From bcb746db7c4264f1b0325b6da012a648fe470c35 Mon Sep 17 00:00:00 2001 From: Vidya Ramakrishnan Date: Thu, 19 Jan 2017 08:46:48 +0530 Subject: [PATCH 1/8] Follow camelcase convention in variables and function names. Use currency formatting for all prices and amounts. --- boxoffice/static/js/dist/bundle.js | 32 +- boxoffice/static/js/models/admin_order.js | 12 +- boxoffice/static/js/models/admin_report.js | 12 +- boxoffice/static/js/models/index.js | 6 +- boxoffice/static/js/models/item_collection.js | 18 +- boxoffice/static/js/models/org.js | 8 +- boxoffice/static/js/models/sidebar.js | 18 +- boxoffice/static/js/models/util.js | 6 +- .../static/js/templates/admin_order.html.js | 20 +- .../static/js/templates/admin_report.html.js | 5 +- boxoffice/static/js/templates/index.html.js | 13 +- .../js/templates/item_collection.html.js | 10 +- boxoffice/static/js/templates/org.html.js | 13 +- boxoffice/static/js/views/admin_order.js | 60 +-- boxoffice/static/js/views/admin_report.js | 16 +- boxoffice/static/js/views/index.js | 4 +- boxoffice/static/js/views/item_collection.js | 46 +-- boxoffice/static/js/views/order.js | 98 ++--- boxoffice/static/js/views/org.js | 8 +- boxoffice/static/js/views/router.js | 4 +- boxoffice/static/js/views/sidebar.js | 16 +- boxoffice/templates/boxoffice.html | 84 ++-- boxoffice/templates/boxoffice.js | 360 ++++++++++-------- boxoffice/templates/order.html | 32 +- boxoffice/views/participant.py | 4 +- 25 files changed, 464 insertions(+), 441 deletions(-) diff --git a/boxoffice/static/js/dist/bundle.js b/boxoffice/static/js/dist/bundle.js index 6853c349..abc778f8 100644 --- a/boxoffice/static/js/dist/bundle.js +++ b/boxoffice/static/js/dist/bundle.js @@ -1,16 +1,16 @@ -!function t(e,n,r){function i(o,s){if(!n[o]){if(!e[o]){var u="function"==typeof require&&require;if(!s&&u)return u(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[o]={exports:{}};e[o][0].call(l.exports,function(t){var n=e[o][1][t];return i(n?n:t)},l,l.exports,t,e,n,r)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o0&&(e=t.substring(t.indexOf("."),t.length)),t=Math.floor(t),t=t.toString();var n=t.substring(t.length-3),r=t.substring(0,t.length-3);""!==r&&(n=","+n);var i="₹"+r.replace(/\B(?=(\d{2})+(?!\d))/g,",")+n+e;return i}};n.Util=r;var i=function(t){return $.ajax({url:t.url,dataType:"json"})};n.fetch=i;var a=function(t){return $.ajax({url:t.url,type:"POST",dataType:"json"})};n.post=a;var o=function(t){var e=void 0===arguments[1]?500:arguments[1];$("html,body").animate({scrollTop:$(t).offset().top},e)};n.scrollToElement=o},{}],9:[function(t,e,n){(function(e){!function(r){var i="object"==typeof self&&self.self===self&&self||"object"==typeof e&&e.global===e&&e;if("function"==typeof define&&define.amd)define(["underscore","jquery","exports"],function(t,e,n){i.Backbone=r(i,n,t,e)});else if("undefined"!=typeof n){var a,o=t("underscore");try{a=t("jquery")}catch(t){}r(i,n,o,a)}else i.Backbone=r(i,{},i._,i.jQuery||i.Zepto||i.ender||i.$)}(function(t,e,n,r){var i=t.Backbone,a=Array.prototype.slice;e.VERSION="1.3.3",e.$=r,e.noConflict=function(){return t.Backbone=i,this},e.emulateHTTP=!1,e.emulateJSON=!1;var o=function(t,e,r){switch(t){case 1:return function(){return n[e](this[r])};case 2:return function(t){return n[e](this[r],t)};case 3:return function(t,i){return n[e](this[r],u(t,this),i)};case 4:return function(t,i,a){return n[e](this[r],u(t,this),i,a)};default:return function(){var t=a.call(arguments);return t.unshift(this[r]),n[e].apply(n,t)}}},s=function(t,e,r){n.each(e,function(e,i){n[i]&&(t.prototype[i]=o(e,i,r))})},u=function(t,e){return n.isFunction(t)?t:n.isObject(t)&&!e._isModel(t)?c(t):n.isString(t)?function(e){return e.get(t)}:t},c=function(t){var e=n.matches(t);return function(t){return e(t.attributes)}},l=e.Events={},h=/\s+/,d=function(t,e,r,i,a){var o,s=0;if(r&&"object"==typeof r){void 0!==i&&"context"in a&&void 0===a.context&&(a.context=i);for(o=n.keys(r);sthis.length&&(i=this.length),i<0&&(i+=this.length+1);var a,o,s=[],u=[],c=[],l=[],h={},d=e.add,f=e.merge,p=e.remove,g=!1,v=this.comparator&&null==i&&e.sort!==!1,y=n.isString(this.comparator)?this.comparator:null;for(o=0;o7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(N,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";return this.location.replace(e+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var r=document.body,i=r.insertBefore(this.iframe,r.firstChild).contentWindow;i.document.open(),i.document.close(),i.location.hash="#"+this.fragment}var a=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState?a("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?a("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};this._usePushState?t("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&t("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),R.started=!1},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();return e===this.fragment&&this.iframe&&(e=this.getHash(this.iframe.contentWindow)),e!==this.fragment&&(this.iframe&&this.navigate(e),void this.loadUrl())},loadUrl:function(t){return!!this.matchRoot()&&(t=this.fragment=this.getFragment(t),n.some(this.handlers,function(e){if(e.route.test(t))return e.callback(t),!0}))},navigate:function(t,e){if(!R.started)return!1;e&&e!==!0||(e={trigger:!!e}),t=this.getFragment(t||"");var n=this.root;""!==t&&"?"!==t.charAt(0)||(n=n.slice(0,-1)||"/");var r=n+t;if(t=this.decodeFragment(t.replace(D,"")),this.fragment!==t){if(this.fragment=t,this._usePushState)this.history[e.replace?"replaceState":"pushState"]({},document.title,r);else{if(!this._wantsHashChange)return this.location.assign(r);if(this._updateHash(this.location,t,e.replace),this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var i=this.iframe.contentWindow;e.replace||(i.document.open(),i.document.close()),this._updateHash(i.location,t,e.replace)}}return e.trigger?this.loadUrl(t):void 0}},_updateHash:function(t,e,n){if(n){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else t.hash="#"+e}}),e.history=new R;var j=function(t,e){var r,i=this;return r=t&&n.has(t,"constructor")?t.constructor:function(){return i.apply(this,arguments)},n.extend(r,i,e),r.prototype=n.create(i.prototype,t),r.prototype.constructor=r,r.__super__=i.prototype,r};x.extend=b.extend=E.extend=C.extend=R.extend=j;var F=function(){throw new Error('A "url" property or function must be specified')},H=function(t,e){var n=e.error;e.error=function(r){n&&n.call(e.context,t,r,e),t.trigger("error",t,r,e)}};return e})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{jquery:12,underscore:13}],10:[function(t,e,n){!function(r){"use strict";function i(t){this.owner=t}function a(t,e){if(Object.create)e.prototype=Object.create(t.prototype);else{var n=function(){};n.prototype=t.prototype,e.prototype=new n}return e.prototype.constructor=e,e}function o(t){var e=this.internal=new s(this);e.loadConfig(t),e.beforeInit(t),e.init(),e.afterInit(t),function t(e,n,r){Object.keys(e).forEach(function(i){n[i]=e[i].bind(r),Object.keys(e[i]).length>0&&t(e[i],n[i],r)})}(l,this,this)}function s(e){var n=this;n.d3=r.d3?r.d3:"undefined"!=typeof t?t("d3"):void 0,n.api=e,n.config=n.getDefaultConfig(),n.data={},n.cache={},n.axes={}}function u(t){i.call(this,t)}function c(t,e){function n(t,e){t.attr("transform",function(t){return"translate("+Math.ceil(e(t)+_)+", 0)"})}function r(t,e){t.attr("transform",function(t){return"translate(0,"+Math.ceil(e(t))+")"})}function i(t){var e=t[0],n=t[t.length-1];return e0&&r[0]>0&&r.unshift(r[0]-(r[1]-r[0])),r}function o(){var t,n=g.copy();return e.isCategory&&(t=g.domain(),n.domain([t[0],t[1]-1])),n}function s(t){var e=d?d(t):t;return"undefined"!=typeof e?e:""}function u(t){if(L)return L;var e={h:11.5,w:5.5};return t.select("text").text(s).each(function(t){var n=this.getBoundingClientRect(),r=s(t),i=n.height,a=r?n.width/r.length:void 0;i&&a&&(e.h=i,e.w=a)}).text(""),L=e,e}function c(n){return e.withoutTransition?n:t.transition(n)}function l(d){d.each(function(){function d(t,n){function r(t,e){a=void 0;for(var s=1;s0?"start":"end":"middle"}function w(t){return t?"rotate("+t+")":""}function T(t){return t?8*Math.sin(Math.PI*(t/180)):0}function A(t){return t?11.5-2.5*(t/15)*(t>0?1:-1):W}var C,P,M,L=l.g=t.select(this),E=this.__chart__||g,k=this.__chart__=o(),V=x?x:a(k),O=L.selectAll(".tick").data(V,k),I=O.enter().insert("g",".domain").attr("class","tick").style("opacity",1e-6),R=O.exit().remove(),G=c(O).style("opacity",1),N=g.rangeExtent?g.rangeExtent():i(g.range()),D=L.selectAll(".domain").data([0]),j=(D.enter().append("path").attr("class","domain"),c(D));I.append("line"),I.append("text");var F=I.select("line"),H=G.select("line"),z=I.select("text"),X=G.select("text");e.isCategory?(_=Math.ceil((k(1)-k(0))/2),P=p?0:_,M=p?_:0):_=P=0;var B,q,Y=u(L.select(".tick")),U=[],W=Math.max(y,0)+m,$="left"===v||"right"===v;B=O.select("text"),q=B.selectAll("tspan").data(function(t,n){var r=e.tickMultiline?d(t,e.tickWidth):[].concat(s(t));return U[n]=r.length,r.map(function(t){return{index:n,splitted:t}})}),q.enter().append("tspan"),q.exit().remove(),q.text(function(t){return t.splitted});var Q=e.tickTextRotate;switch(v){case"bottom":C=n,F.attr("y2",y),z.attr("y",W),H.attr("x1",P).attr("x2",P).attr("y2",b),X.attr("x",0).attr("y",A(Q)).style("text-anchor",S(Q)).attr("transform",w(Q)),q.attr("x",0).attr("dy",f).attr("dx",T(Q)),j.attr("d","M"+N[0]+","+h+"V0H"+N[1]+"V"+h);break;case"top":C=n,F.attr("y2",-y),z.attr("y",-W),H.attr("x2",0).attr("y2",-y),X.attr("x",0).attr("y",-W),B.style("text-anchor","middle"),q.attr("x",0).attr("dy","0em"),j.attr("d","M"+N[0]+","+-h+"V0H"+N[1]+"V"+-h);break;case"left":C=r,F.attr("x2",-y),z.attr("x",-W),H.attr("x2",-y).attr("y1",M).attr("y2",M),X.attr("x",-W).attr("y",_),B.style("text-anchor","end"),q.attr("x",-W).attr("dy",f),j.attr("d","M"+-h+","+N[0]+"H0V"+N[1]+"H"+-h);break;case"right":C=r,F.attr("x2",y),z.attr("x",W),H.attr("x2",y).attr("y2",0),X.attr("x",W).attr("y",0),B.style("text-anchor","start"),q.attr("x",W).attr("dy",f),j.attr("d","M"+h+","+N[0]+"H0V"+N[1]+"H"+h)}if(k.rangeBand){var Z=k,J=Z.rangeBand()/2;E=k=function(t){return Z(t)+J}}else E.rangeBand?E=k:R.call(C,k);I.call(C,E),G.call(C,k)})}var h,d,f,p,g=t.scale.linear(),v="bottom",y=6,m=3,x=null,_=0,b=!0;return e=e||{},h=e.withOuterTick?6:0,l.scale=function(t){return arguments.length?(g=t,l):g},l.orient=function(t){return arguments.length?(v=t in{top:1,right:1,bottom:1,left:1}?t+"":"bottom",l):v},l.tickFormat=function(t){return arguments.length?(d=t,l):d},l.tickCentered=function(t){return arguments.length?(p=t,l):p},l.tickOffset=function(){return _},l.tickInterval=function(){ -var t,n;return e.isCategory?t=2*_:(n=l.g.select("path.domain").node().getTotalLength()-2*h,t=n/l.g.selectAll("line").size()),t===1/0?0:t},l.ticks=function(){return arguments.length?(f=arguments,l):f},l.tickCulling=function(t){return arguments.length?(b=t,l):b},l.tickValues=function(t){if("function"==typeof t)x=function(){return t(g.domain())};else{if(!arguments.length)return x;x=t}return l},l}var l,h,d,f={version:"0.4.11"};f.generate=function(t){return new o(t)},f.chart={fn:o.prototype,internal:{fn:s.prototype,axis:{fn:u.prototype}}},l=f.chart.fn,h=f.chart.internal.fn,d=f.chart.internal.axis.fn,h.beforeInit=function(){},h.afterInit=function(){},h.init=function(){var t=this,e=t.config;if(t.initParams(),e.data_url)t.convertUrlToData(e.data_url,e.data_mimeType,e.data_headers,e.data_keys,t.initWithData);else if(e.data_json)t.initWithData(t.convertJsonToData(e.data_json,e.data_keys));else if(e.data_rows)t.initWithData(t.convertRowsToData(e.data_rows));else{if(!e.data_columns)throw Error("url or json or rows or columns is required.");t.initWithData(t.convertColumnsToData(e.data_columns))}},h.initParams=function(){var t=this,e=t.d3,n=t.config;t.clipId="c3-"+ +new Date+"-clip",t.clipIdForXAxis=t.clipId+"-xaxis",t.clipIdForYAxis=t.clipId+"-yaxis",t.clipIdForGrid=t.clipId+"-grid",t.clipIdForSubchart=t.clipId+"-subchart",t.clipPath=t.getClipPath(t.clipId),t.clipPathForXAxis=t.getClipPath(t.clipIdForXAxis),t.clipPathForYAxis=t.getClipPath(t.clipIdForYAxis),t.clipPathForGrid=t.getClipPath(t.clipIdForGrid),t.clipPathForSubchart=t.getClipPath(t.clipIdForSubchart),t.dragStart=null,t.dragging=!1,t.flowing=!1,t.cancelClick=!1,t.mouseover=!1,t.transiting=!1,t.color=t.generateColor(),t.levelColor=t.generateLevelColor(),t.dataTimeFormat=n.data_xLocaltime?e.time.format:e.time.format.utc,t.axisTimeFormat=n.axis_x_localtime?e.time.format:e.time.format.utc,t.defaultAxisTimeFormat=t.axisTimeFormat.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%-m/%-d",function(t){return t.getDay()&&1!==t.getDate()}],["%-m/%-d",function(t){return 1!==t.getDate()}],["%-m/%-d",function(t){return t.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),t.hiddenTargetIds=[],t.hiddenLegendIds=[],t.focusedTargetIds=[],t.defocusedTargetIds=[],t.xOrient=n.axis_rotated?"left":"bottom",t.yOrient=n.axis_rotated?n.axis_y_inner?"top":"bottom":n.axis_y_inner?"right":"left",t.y2Orient=n.axis_rotated?n.axis_y2_inner?"bottom":"top":n.axis_y2_inner?"left":"right",t.subXOrient=n.axis_rotated?"left":"bottom",t.isLegendRight="right"===n.legend_position,t.isLegendInset="inset"===n.legend_position,t.isLegendTop="top-left"===n.legend_inset_anchor||"top-right"===n.legend_inset_anchor,t.isLegendLeft="top-left"===n.legend_inset_anchor||"bottom-left"===n.legend_inset_anchor,t.legendStep=0,t.legendItemWidth=0,t.legendItemHeight=0,t.currentMaxTickWidths={x:0,y:0,y2:0},t.rotated_padding_left=30,t.rotated_padding_right=n.axis_rotated&&!n.axis_x_show?0:30,t.rotated_padding_top=5,t.withoutFadeIn={},t.intervalForObserveInserted=void 0,t.axes.subx=e.selectAll([])},h.initChartElements=function(){this.initBar&&this.initBar(),this.initLine&&this.initLine(),this.initArc&&this.initArc(),this.initGauge&&this.initGauge(),this.initText&&this.initText()},h.initWithData=function(t){var e,n,r=this,i=r.d3,a=r.config,o=!0;r.axis=new u(r),r.initPie&&r.initPie(),r.initBrush&&r.initBrush(),r.initZoom&&r.initZoom(),a.bindto?"function"==typeof a.bindto.node?r.selectChart=a.bindto:r.selectChart=i.select(a.bindto):r.selectChart=i.selectAll([]),r.selectChart.empty()&&(r.selectChart=i.select(document.createElement("div")).style("opacity",0),r.observeInserted(r.selectChart),o=!1),r.selectChart.html("").classed("c3",!0),r.data.xs={},r.data.targets=r.convertDataToTargets(t),a.data_filter&&(r.data.targets=r.data.targets.filter(a.data_filter)),a.data_hide&&r.addHiddenTargetIds(a.data_hide===!0?r.mapToIds(r.data.targets):a.data_hide),a.legend_hide&&r.addHiddenLegendIds(a.legend_hide===!0?r.mapToIds(r.data.targets):a.legend_hide),r.hasType("gauge")&&(a.legend_show=!1),r.updateSizes(),r.updateScales(),r.x.domain(i.extent(r.getXDomain(r.data.targets))),r.y.domain(r.getYDomain(r.data.targets,"y")),r.y2.domain(r.getYDomain(r.data.targets,"y2")),r.subX.domain(r.x.domain()),r.subY.domain(r.y.domain()),r.subY2.domain(r.y2.domain()),r.orgXDomain=r.x.domain(),r.brush&&r.brush.scale(r.subX),a.zoom_enabled&&r.zoom.scale(r.x),r.svg=r.selectChart.append("svg").style("overflow","hidden").on("mouseenter",function(){return a.onmouseover.call(r)}).on("mouseleave",function(){return a.onmouseout.call(r)}),r.config.svg_classname&&r.svg.attr("class",r.config.svg_classname),e=r.svg.append("defs"),r.clipChart=r.appendClip(e,r.clipId),r.clipXAxis=r.appendClip(e,r.clipIdForXAxis),r.clipYAxis=r.appendClip(e,r.clipIdForYAxis),r.clipGrid=r.appendClip(e,r.clipIdForGrid),r.clipSubchart=r.appendClip(e,r.clipIdForSubchart),r.updateSvgSize(),n=r.main=r.svg.append("g").attr("transform",r.getTranslate("main")),r.initSubchart&&r.initSubchart(),r.initTooltip&&r.initTooltip(),r.initLegend&&r.initLegend(),r.initTitle&&r.initTitle(),n.append("text").attr("class",p.text+" "+p.empty).attr("text-anchor","middle").attr("dominant-baseline","middle"),r.initRegion(),r.initGrid(),n.append("g").attr("clip-path",r.clipPath).attr("class",p.chart),a.grid_lines_front&&r.initGridLines(),r.initEventRect(),r.initChartElements(),n.insert("rect",a.zoom_privileged?null:"g."+p.regions).attr("class",p.zoomRect).attr("width",r.width).attr("height",r.height).style("opacity",0).on("dblclick.zoom",null),a.axis_x_extent&&r.brush.extent(r.getDefaultExtent()),r.axis.init(),r.updateTargets(r.data.targets),o&&(r.updateDimension(),r.config.oninit.call(r),r.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1})),r.bindResize(),r.api.element=r.selectChart.node()},h.smoothLines=function(t,e){var n=this;"grid"===e&&t.each(function(){var t=n.d3.select(this),e=t.attr("x1"),r=t.attr("x2"),i=t.attr("y1"),a=t.attr("y2");t.attr({x1:Math.ceil(e),x2:Math.ceil(r),y1:Math.ceil(i),y2:Math.ceil(a)})})},h.updateSizes=function(){var t=this,e=t.config,n=t.legend?t.getLegendHeight():0,r=t.legend?t.getLegendWidth():0,i=t.isLegendRight||t.isLegendInset?0:n,a=t.hasArcType(),o=e.axis_rotated||a?0:t.getHorizontalAxisHeight("x"),s=e.subchart_show&&!a?e.subchart_size_height+o:0;t.currentWidth=t.getCurrentWidth(),t.currentHeight=t.getCurrentHeight(),t.margin=e.axis_rotated?{top:t.getHorizontalAxisHeight("y2")+t.getCurrentPaddingTop(),right:a?0:t.getCurrentPaddingRight(),bottom:t.getHorizontalAxisHeight("y")+i+t.getCurrentPaddingBottom(),left:s+(a?0:t.getCurrentPaddingLeft())}:{top:4+t.getCurrentPaddingTop(),right:a?0:t.getCurrentPaddingRight(),bottom:o+s+i+t.getCurrentPaddingBottom(),left:a?0:t.getCurrentPaddingLeft()},t.margin2=e.axis_rotated?{top:t.margin.top,right:NaN,bottom:20+i,left:t.rotated_padding_left}:{top:t.currentHeight-s-i,right:NaN,bottom:o+i,left:t.margin.left},t.margin3={top:0,right:NaN,bottom:0,left:0},t.updateSizeForLegend&&t.updateSizeForLegend(n,r),t.width=t.currentWidth-t.margin.left-t.margin.right,t.height=t.currentHeight-t.margin.top-t.margin.bottom,t.width<0&&(t.width=0),t.height<0&&(t.height=0),t.width2=e.axis_rotated?t.margin.left-t.rotated_padding_left-t.rotated_padding_right:t.width,t.height2=e.axis_rotated?t.height:t.currentHeight-t.margin2.top-t.margin2.bottom,t.width2<0&&(t.width2=0),t.height2<0&&(t.height2=0),t.arcWidth=t.width-(t.isLegendRight?r+10:0),t.arcHeight=t.height-(t.isLegendRight?0:10),t.hasType("gauge")&&!e.gauge_fullCircle&&(t.arcHeight+=t.height-t.getGaugeLabelHeight()),t.updateRadius&&t.updateRadius(),t.isLegendRight&&a&&(t.margin3.left=t.arcWidth/2+1.1*t.radiusExpanded)},h.updateTargets=function(t){var e=this;e.updateTargetsForText(t),e.updateTargetsForBar(t),e.updateTargetsForLine(t),e.hasArcType()&&e.updateTargetsForArc&&e.updateTargetsForArc(t),e.updateTargetsForSubchart&&e.updateTargetsForSubchart(t),e.showTargets()},h.showTargets=function(){var t=this;t.svg.selectAll("."+p.target).filter(function(e){return t.isTargetToShow(e.id)}).transition().duration(t.config.transition_duration).style("opacity",1)},h.redraw=function(t,e){var n,r,i,a,o,s,u,c,l,h,d,f,g,v,y,m,x,_,b,S,w,T,C,P,M,L,E,k,V,O=this,I=O.main,R=O.d3,G=O.config,N=O.getShapeIndices(O.isAreaType),D=O.getShapeIndices(O.isBarType),j=O.getShapeIndices(O.isLineType),F=O.hasArcType(),H=O.filterTargetsToShow(O.data.targets),z=O.xv.bind(O);if(t=t||{},n=A(t,"withY",!0),r=A(t,"withSubchart",!0),i=A(t,"withTransition",!0),s=A(t,"withTransform",!1),u=A(t,"withUpdateXDomain",!1),c=A(t,"withUpdateOrgXDomain",!1),l=A(t,"withTrimXDomain",!0),g=A(t,"withUpdateXAxis",u),h=A(t,"withLegend",!1),d=A(t,"withEventRect",!0),f=A(t,"withDimension",!0),a=A(t,"withTransitionForExit",i),o=A(t,"withTransitionForAxis",i),b=i?G.transition_duration:0,S=a?b:0,w=o?b:0,e=e||O.axis.generateTransitions(w),h&&G.legend_show?O.updateLegend(O.mapToIds(O.data.targets),t,e):f&&O.updateDimension(!0),O.isCategorized()&&0===H.length&&O.x.domain([0,O.axes.x.selectAll(".tick").size()]),H.length?(O.updateXDomain(H,u,c,l),G.axis_x_tick_values||(P=O.axis.updateXAxisTickValues(H))):(O.xAxis.tickValues([]),O.subXAxis.tickValues([])),G.zoom_rescale&&!t.flow&&(E=O.x.orgDomain()),O.y.domain(O.getYDomain(H,"y",E)),O.y2.domain(O.getYDomain(H,"y2",E)),!G.axis_y_tick_values&&G.axis_y_tick_count&&O.yAxis.tickValues(O.axis.generateTickValues(O.y.domain(),G.axis_y_tick_count)),!G.axis_y2_tick_values&&G.axis_y2_tick_count&&O.y2Axis.tickValues(O.axis.generateTickValues(O.y2.domain(),G.axis_y2_tick_count)),O.axis.redraw(e,F),O.axis.updateLabels(i),(u||g)&&H.length)if(G.axis_x_tick_culling&&P){for(M=1;M=0&&R.select(this).style("display",e%L?"none":"block")})}else O.svg.selectAll("."+p.axisX+" .tick text").style("display","block");v=O.generateDrawArea?O.generateDrawArea(N,!1):void 0,y=O.generateDrawBar?O.generateDrawBar(D):void 0,m=O.generateDrawLine?O.generateDrawLine(j,!1):void 0,x=O.generateXYForText(N,D,j,!0),_=O.generateXYForText(N,D,j,!1),n&&(O.subY.domain(O.getYDomain(H,"y")),O.subY2.domain(O.getYDomain(H,"y2"))),O.updateXgridFocus(),I.select("text."+p.text+"."+p.empty).attr("x",O.width/2).attr("y",O.height/2).text(G.data_empty_label_text).transition().style("opacity",H.length?0:1),O.updateGrid(b),O.updateRegion(b),O.updateBar(S),O.updateLine(S),O.updateArea(S),O.updateCircle(),O.hasDataLabel()&&O.updateText(S),O.redrawTitle&&O.redrawTitle(),O.redrawArc&&O.redrawArc(b,S,s),O.redrawSubchart&&O.redrawSubchart(r,e,b,S,N,D,j),I.selectAll("."+p.selectedCircles).filter(O.isBarType.bind(O)).selectAll("circle").remove(),G.interaction_enabled&&!t.flow&&d&&(O.redrawEventRect(),O.updateZoom&&O.updateZoom()),O.updateCircleY(),k=(O.config.axis_rotated?O.circleY:O.circleX).bind(O),V=(O.config.axis_rotated?O.circleX:O.circleY).bind(O),t.flow&&(C=O.generateFlow({targets:H,flow:t.flow,duration:t.flow.duration,drawBar:y,drawLine:m,drawArea:v,cx:k,cy:V,xv:z,xForText:x,yForText:_})),(b||C)&&O.isTabVisible()?R.transition().duration(b).each(function(){var e=[];[O.redrawBar(y,!0),O.redrawLine(m,!0),O.redrawArea(v,!0),O.redrawCircle(k,V,!0),O.redrawText(x,_,t.flow,!0),O.redrawRegion(!0),O.redrawGrid(!0)].forEach(function(t){t.forEach(function(t){e.push(t)})}),T=O.generateWait(),e.forEach(function(t){T.add(t)})}).call(T,function(){C&&C(),G.onrendered&&G.onrendered.call(O)}):(O.redrawBar(y),O.redrawLine(m),O.redrawArea(v),O.redrawCircle(k,V),O.redrawText(x,_,t.flow),O.redrawRegion(),O.redrawGrid(),G.onrendered&&G.onrendered.call(O)),O.mapToIds(O.data.targets).forEach(function(t){O.withoutFadeIn[t]=!0})},h.updateAndRedraw=function(t){var e,n=this,r=n.config;t=t||{},t.withTransition=A(t,"withTransition",!0),t.withTransform=A(t,"withTransform",!1),t.withLegend=A(t,"withLegend",!1),t.withUpdateXDomain=!0,t.withUpdateOrgXDomain=!0,t.withTransitionForExit=!1,t.withTransitionForTransform=A(t,"withTransitionForTransform",t.withTransition),n.updateSizes(),t.withLegend&&r.legend_show||(e=n.axis.generateTransitions(t.withTransitionForAxis?r.transition_duration:0),n.updateScales(),n.updateSvgSize(),n.transformAll(t.withTransitionForTransform,e)),n.redraw(t,e)},h.redrawWithoutRescale=function(){this.redraw({withY:!1,withSubchart:!1,withEventRect:!1,withTransitionForAxis:!1})},h.isTimeSeries=function(){return"timeseries"===this.config.axis_x_type},h.isCategorized=function(){return this.config.axis_x_type.indexOf("categor")>=0},h.isCustomX=function(){var t=this,e=t.config;return!t.isTimeSeries()&&(e.data_x||T(e.data_xs))},h.isTimeSeriesY=function(){return"timeseries"===this.config.axis_y_type},h.getTranslate=function(t){var e,n,r=this,i=r.config;return"main"===t?(e=b(r.margin.left),n=b(r.margin.top)):"context"===t?(e=b(r.margin2.left),n=b(r.margin2.top)):"legend"===t?(e=r.margin3.left,n=r.margin3.top):"x"===t?(e=0,n=i.axis_rotated?0:r.height):"y"===t?(e=0,n=i.axis_rotated?r.height:0):"y2"===t?(e=i.axis_rotated?0:r.width,n=i.axis_rotated?1:0):"subx"===t?(e=0,n=i.axis_rotated?0:r.height2):"arc"===t&&(e=r.arcWidth/2,n=r.arcHeight/2),"translate("+e+","+n+")"},h.initialOpacity=function(t){return null!==t.value&&this.withoutFadeIn[t.id]?1:0},h.initialOpacityForCircle=function(t){return null!==t.value&&this.withoutFadeIn[t.id]?this.opacityForCircle(t):0},h.opacityForCircle=function(t){var e=this.config.point_show?1:0;return g(t.value)?this.isScatterType(t)?.5:e:0},h.opacityForText=function(){return this.hasDataLabel()?1:0},h.xx=function(t){return t?this.x(t.x):null},h.xv=function(t){var e=this,n=t.value;return e.isTimeSeries()?n=e.parseDate(t.value):e.isCategorized()&&"string"==typeof t.value&&(n=e.config.axis_x_categories.indexOf(t.value)),Math.ceil(e.x(n))},h.yv=function(t){var e=this,n=t.axis&&"y2"===t.axis?e.y2:e.y;return Math.ceil(n(t.value))},h.subxx=function(t){return t?this.subX(t.x):null},h.transformMain=function(t,e){var n,r,i,a=this;e&&e.axisX?n=e.axisX:(n=a.main.select("."+p.axisX),t&&(n=n.transition())),e&&e.axisY?r=e.axisY:(r=a.main.select("."+p.axisY),t&&(r=r.transition())),e&&e.axisY2?i=e.axisY2:(i=a.main.select("."+p.axisY2),t&&(i=i.transition())),(t?a.main.transition():a.main).attr("transform",a.getTranslate("main")),n.attr("transform",a.getTranslate("x")),r.attr("transform",a.getTranslate("y")),i.attr("transform",a.getTranslate("y2")),a.main.select("."+p.chartArcs).attr("transform",a.getTranslate("arc"))},h.transformAll=function(t,e){var n=this;n.transformMain(t,e),n.config.subchart_show&&n.transformContext(t,e),n.legend&&n.transformLegend(t)},h.updateSvgSize=function(){var t=this,e=t.svg.select(".c3-brush .background");t.svg.attr("width",t.currentWidth).attr("height",t.currentHeight),t.svg.selectAll(["#"+t.clipId,"#"+t.clipIdForGrid]).select("rect").attr("width",t.width).attr("height",t.height),t.svg.select("#"+t.clipIdForXAxis).select("rect").attr("x",t.getXAxisClipX.bind(t)).attr("y",t.getXAxisClipY.bind(t)).attr("width",t.getXAxisClipWidth.bind(t)).attr("height",t.getXAxisClipHeight.bind(t)),t.svg.select("#"+t.clipIdForYAxis).select("rect").attr("x",t.getYAxisClipX.bind(t)).attr("y",t.getYAxisClipY.bind(t)).attr("width",t.getYAxisClipWidth.bind(t)).attr("height",t.getYAxisClipHeight.bind(t)),t.svg.select("#"+t.clipIdForSubchart).select("rect").attr("width",t.width).attr("height",e.size()?e.attr("height"):0),t.svg.select("."+p.zoomRect).attr("width",t.width).attr("height",t.height),t.selectChart.style("max-height",t.currentHeight+"px")},h.updateDimension=function(t){var e=this;t||(e.config.axis_rotated?(e.axes.x.call(e.xAxis),e.axes.subx.call(e.subXAxis)):(e.axes.y.call(e.yAxis),e.axes.y2.call(e.y2Axis))),e.updateSizes(),e.updateScales(),e.updateSvgSize(),e.transformAll(!1)},h.observeInserted=function(t){var e,n=this;return"undefined"==typeof MutationObserver?void r.console.error("MutationObserver not defined."):(e=new MutationObserver(function(i){i.forEach(function(i){"childList"===i.type&&i.previousSibling&&(e.disconnect(),n.intervalForObserveInserted=r.setInterval(function(){t.node().parentNode&&(r.clearInterval(n.intervalForObserveInserted),n.updateDimension(),n.brush&&n.brush.update(),n.config.oninit.call(n),n.redraw({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransition:!1,withTransitionForTransform:!1,withLegend:!0}),t.transition().style("opacity",1))},10))})}),void e.observe(t.node(),{attributes:!0,childList:!0,characterData:!0}))},h.bindResize=function(){var t=this,e=t.config;if(t.resizeFunction=t.generateResize(),t.resizeFunction.add(function(){e.onresize.call(t)}),e.resize_auto&&t.resizeFunction.add(function(){void 0!==t.resizeTimeout&&r.clearTimeout(t.resizeTimeout),t.resizeTimeout=r.setTimeout(function(){delete t.resizeTimeout,t.api.flush()},100)}),t.resizeFunction.add(function(){e.onresized.call(t)}),r.attachEvent)r.attachEvent("onresize",t.resizeFunction);else if(r.addEventListener)r.addEventListener("resize",t.resizeFunction,!1);else{var n=r.onresize;n?n.add&&n.remove||(n=t.generateResize(),n.add(r.onresize)):n=t.generateResize(),n.add(t.resizeFunction),r.onresize=n}},h.generateResize=function(){function t(){e.forEach(function(t){t()})}var e=[];return t.add=function(t){e.push(t)},t.remove=function(t){for(var n=0;n0)for(o=s.hasNegativeValueInTargets(t),e=0;e=0}),0!==i.length)for(r=i[0],o&&l[r]&&l[r].forEach(function(t,e){l[r][e]=t<0?t:0}),n=1;n0||(l[r][e]+=+t)});return s.d3.min(Object.keys(l).map(function(t){return s.d3.min(l[t])}))},h.getYDomainMax=function(t){var e,n,r,i,a,o,s=this,u=s.config,c=s.mapToIds(t),l=s.getValuesAsIdKeyed(t);if(u.data_groups.length>0)for(o=s.hasPositiveValueInTargets(t),e=0;e=0}),0!==i.length)for(r=i[0],o&&l[r]&&l[r].forEach(function(t,e){l[r][e]=t>0?t:0}),n=1;n=0&&w>=0,f=b<=0&&w<=0,(g(x)&&d||g(_)&&f)&&(C=!1),C&&(d&&(b=0),f&&(w=0)),i=Math.abs(w-b),a=o=s=.1*i,"undefined"!=typeof A&&(u=Math.max(Math.abs(b),Math.abs(w)),w=A+u,b=A-u),M?(c=p.getDataLabelLength(b,w,"width"),l=S(p.y.range()),h=[c[0]/l,c[1]/l],o+=i*(h[1]/(1-h[0]-h[1])),s+=i*(h[0]/(1-h[0]-h[1]))):L&&(c=p.getDataLabelLength(b,w,"height"),o+=p.axis.convertPixelsToAxisPadding(c[1],i),s+=p.axis.convertPixelsToAxisPadding(c[0],i)),"y"===e&&T(v.axis_y_padding)&&(o=p.axis.getPadding(v.axis_y_padding,"top",o,i),s=p.axis.getPadding(v.axis_y_padding,"bottom",s,i)),"y2"===e&&T(v.axis_y2_padding)&&(o=p.axis.getPadding(v.axis_y2_padding,"top",o,i),s=p.axis.getPadding(v.axis_y2_padding,"bottom",s,i)),C&&(d&&(s=b),f&&(o=-w)),r=[b-s,w+o],P?r.reverse():r)},h.getXDomainMin=function(t){var e=this,n=e.config;return x(n.axis_x_min)?e.isTimeSeries()?this.parseDate(n.axis_x_min):n.axis_x_min:e.d3.min(t,function(t){return e.d3.min(t.values,function(t){return t.x})})},h.getXDomainMax=function(t){var e=this,n=e.config;return x(n.axis_x_max)?e.isTimeSeries()?this.parseDate(n.axis_x_max):n.axis_x_max:e.d3.max(t,function(t){return e.d3.max(t.values,function(t){return t.x})})},h.getXDomainPadding=function(t){var e,n,r,i,a=this,o=a.config,s=t[1]-t[0];return a.isCategorized()?n=0:a.hasType("bar")?(e=a.getMaxDataCount(),n=e>1?s/(e-1)/2:.5):n=.01*s,"object"==typeof o.axis_x_padding&&T(o.axis_x_padding)?(r=g(o.axis_x_padding.left)?o.axis_x_padding.left:n,i=g(o.axis_x_padding.right)?o.axis_x_padding.right:n):r=i="number"==typeof o.axis_x_padding?o.axis_x_padding:n,{left:r,right:i}},h.getXDomain=function(t){var e=this,n=[e.getXDomainMin(t),e.getXDomainMax(t)],r=n[0],i=n[1],a=e.getXDomainPadding(n),o=0,s=0;return r-i!==0||e.isCategorized()||(e.isTimeSeries()?(r=new Date(.5*r.getTime()),i=new Date(1.5*i.getTime())):(r=0===r?1:.5*r,i=0===i?-1:1.5*i)),(r||0===r)&&(o=e.isTimeSeries()?new Date(r.getTime()-a.left):r-a.left),(i||0===i)&&(s=e.isTimeSeries()?new Date(i.getTime()+a.right):i+a.right),[o,s]},h.updateXDomain=function(t,e,n,r,i){var a=this,o=a.config;return n&&(a.x.domain(i?i:a.d3.extent(a.getXDomain(t))),a.orgXDomain=a.x.domain(),o.zoom_enabled&&a.zoom.scale(a.x).updateScaleExtent(),a.subX.domain(a.x.domain()),a.brush&&a.brush.scale(a.subX)),e&&(a.x.domain(i?i:!a.brush||a.brush.empty()?a.orgXDomain:a.brush.extent()),o.zoom_enabled&&a.zoom.scale(a.x).updateScaleExtent()),r&&a.x.domain(a.trimXDomain(a.x.orgDomain())),a.x.domain()},h.trimXDomain=function(t){var e=this.getZoomDomain(),n=e[0],r=e[1];return t[0]<=n&&(t[1]=+t[1]+(n-t[0]),t[0]=n),r<=t[1]&&(t[0]=+t[0]-(t[1]-r),t[1]=r),t},h.isX=function(t){var e=this,n=e.config;return n.data_x&&t===n.data_x||T(n.data_xs)&&C(n.data_xs,t)},h.isNotX=function(t){return!this.isX(t)},h.getXKey=function(t){var e=this,n=e.config;return n.data_x?n.data_x:T(n.data_xs)?n.data_xs[t]:null},h.getXValuesOfXKey=function(t,e){var n,r=this,i=e&&T(e)?r.mapToIds(e):[];return i.forEach(function(e){r.getXKey(e)===t&&(n=r.data.xs[e])}),n},h.getIndexByX=function(t){var e=this,n=e.filterByX(e.data.targets,t);return n.length?n[0].index:null},h.getXValue=function(t,e){var n=this;return t in n.data.xs&&n.data.xs[t]&&g(n.data.xs[t][e])?n.data.xs[t][e]:e},h.getOtherTargetXs=function(){var t=this,e=Object.keys(t.data.xs);return e.length?t.data.xs[e[0]]:null},h.getOtherTargetX=function(t){var e=this.getOtherTargetXs();return e&&t1},h.isMultipleX=function(){return T(this.config.data_xs)||!this.config.data_xSort||this.hasType("scatter")},h.addName=function(t){var e,n=this;return t&&(e=n.config.data_names[t.id],t.name=void 0!==e?e:t.id),t},h.getValueOnIndex=function(t,e){var n=t.filter(function(t){return t.index===e});return n.length?n[0]:null},h.updateTargetX=function(t,e){var n=this;t.forEach(function(t){t.values.forEach(function(r,i){r.x=n.generateTargetX(e[i],t.id,i)}),n.data.xs[t.id]=e})},h.updateTargetXs=function(t,e){var n=this;t.forEach(function(t){e[t.id]&&n.updateTargetX([t],e[t.id])})},h.generateTargetX=function(t,e,n){var r,i=this;return r=i.isTimeSeries()?t?i.parseDate(t):i.parseDate(i.getXValue(e,n)):i.isCustomX()&&!i.isCategorized()?g(t)?+t:i.getXValue(e,n):n},h.cloneTarget=function(t){return{id:t.id,id_org:t.id_org,values:t.values.map(function(t){return{x:t.x,value:t.value,id:t.id}})}},h.updateXs=function(){var t=this;t.data.targets.length&&(t.xs=[],t.data.targets[0].values.forEach(function(e){t.xs[e.index]=e.x}))},h.getPrevX=function(t){var e=this.xs[t-1];return"undefined"!=typeof e?e:null},h.getNextX=function(t){var e=this.xs[t+1];return"undefined"!=typeof e?e:null},h.getMaxDataCount=function(){var t=this;return t.d3.max(t.data.targets,function(t){return t.values.length})},h.getMaxDataCountTarget=function(t){var e,n=t.length,r=0; -return n>1?t.forEach(function(t){t.values.length>r&&(e=t,r=t.values.length)}):e=n?t[0]:null,e},h.getEdgeX=function(t){var e=this;return t.length?[e.d3.min(t,function(t){return t.values[0].x}),e.d3.max(t,function(t){return t.values[t.values.length-1].x})]:[0,0]},h.mapToIds=function(t){return t.map(function(t){return t.id})},h.mapToTargetIds=function(t){var e=this;return t?[].concat(t):e.mapToIds(e.data.targets)},h.hasTarget=function(t,e){var n,r=this.mapToIds(t);for(n=0;ne?1:t>=e?0:NaN})},h.addHiddenTargetIds=function(t){this.hiddenTargetIds=this.hiddenTargetIds.concat(t)},h.removeHiddenTargetIds=function(t){this.hiddenTargetIds=this.hiddenTargetIds.filter(function(e){return t.indexOf(e)<0})},h.addHiddenLegendIds=function(t){this.hiddenLegendIds=this.hiddenLegendIds.concat(t)},h.removeHiddenLegendIds=function(t){this.hiddenLegendIds=this.hiddenLegendIds.filter(function(e){return t.indexOf(e)<0})},h.getValuesAsIdKeyed=function(t){var e={};return t.forEach(function(t){e[t.id]=[],t.values.forEach(function(n){e[t.id].push(n.value)})}),e},h.checkValueInTargets=function(t,e){var n,r,i,a=Object.keys(t);for(n=0;n0})},h.isOrderDesc=function(){var t=this.config;return"string"==typeof t.data_order&&"desc"===t.data_order.toLowerCase()},h.isOrderAsc=function(){var t=this.config;return"string"==typeof t.data_order&&"asc"===t.data_order.toLowerCase()},h.orderTargets=function(t){var e=this,n=e.config,r=e.isOrderAsc(),i=e.isOrderDesc();return r||i?t.sort(function(t,e){var n=function(t,e){return t+Math.abs(e.value)},i=t.values.reduce(n,0),a=e.values.reduce(n,0);return r?a-i:i-a}):v(n.data_order)&&t.sort(n.data_order),t},h.filterByX=function(t,e){return this.d3.merge(t.map(function(t){return t.values})).filter(function(t){return t.x-e===0})},h.filterRemoveNull=function(t){return t.filter(function(t){return g(t.value)})},h.filterByXDomain=function(t,e){return t.map(function(t){return{id:t.id,id_org:t.id_org,values:t.values.filter(function(t){return e[0]<=t.x&&t.x<=e[1]})}})},h.hasDataLabel=function(){var t=this.config;return!("boolean"!=typeof t.data_labels||!t.data_labels)||!("object"!=typeof t.data_labels||!T(t.data_labels))},h.getDataLabelLength=function(t,e,n){var r=this,i=[0,0],a=1.3;return r.selectChart.select("svg").selectAll(".dummy").data([t,e]).enter().append("text").text(function(t){return r.dataLabelFormat(t.id)(t)}).each(function(t,e){i[e]=this.getBoundingClientRect()[n]*a}).remove(),i},h.isNoneArc=function(t){return this.hasTarget(this.data.targets,t.id)},h.isArc=function(t){return"data"in t&&this.hasTarget(this.data.targets,t.data.id)},h.findSameXOfValues=function(t,e){var n,r=t[e].x,i=[];for(n=e-1;n>=0&&r===t[n].x;n--)i.push(t[n]);for(n=e;n=0?r.data.xs[n]=(e&&r.data.xs[n]?r.data.xs[n]:[]).concat(t.map(function(t){return t[a]}).filter(g).map(function(t,e){return r.generateTargetX(t,n,e)})):i.data_x?r.data.xs[n]=r.getOtherTargetXs():T(i.data_xs)&&(r.data.xs[n]=r.getXValuesOfXKey(a,r.data.targets)):r.data.xs[n]=t.map(function(t,e){return e})}),a.forEach(function(t){if(!r.data.xs[t])throw new Error('x is not defined for id = "'+t+'".')}),n=a.map(function(e,n){var a=i.data_idConverter(e);return{id:a,id_org:e,values:t.map(function(t,o){var s,u=r.getXKey(e),c=t[u],l=null===t[e]||isNaN(t[e])?null:+t[e];return r.isCustomX()&&r.isCategorized()&&0===n&&!m(c)?(0===n&&0===o&&(i.axis_x_categories=[]),s=i.axis_x_categories.indexOf(c),s===-1&&(s=i.axis_x_categories.length,i.axis_x_categories.push(c))):s=r.generateTargetX(c,e,o),(m(t[e])||r.data.xs[e].length<=o)&&(s=void 0),{x:s,value:l,id:a}}).filter(function(t){return x(t.x)})}}),n.forEach(function(t){var e;i.data_xSort&&(t.values=t.values.sort(function(t,e){var n=t.x||0===t.x?t.x:1/0,r=e.x||0===e.x?e.x:1/0;return n-r})),e=0,t.values.forEach(function(t){t.index=e++}),r.data.xs[t.id].sort(function(t,e){return t-e})}),r.hasNegativeValue=r.hasNegativeValueInTargets(n),r.hasPositiveValue=r.hasPositiveValueInTargets(n),i.data_type&&r.setTargetType(r.mapToIds(n).filter(function(t){return!(t in i.data_types)}),i.data_type),n.forEach(function(t){r.addCache(t.id_org,t)}),n},h.load=function(t,e){var n=this;t&&(e.filter&&(t=t.filter(e.filter)),(e.type||e.types)&&t.forEach(function(t){var r=e.types&&e.types[t.id]?e.types[t.id]:e.type;n.setTargetType(t.id,r)}),n.data.targets.forEach(function(e){for(var n=0;n0?n:320/(t.hasType("gauge")&&!e.gauge_fullCircle?2:1)},h.getCurrentPaddingTop=function(){var t=this,e=t.config,n=g(e.padding_top)?e.padding_top:0;return t.title&&t.title.node()&&(n+=t.getTitlePadding()),n},h.getCurrentPaddingBottom=function(){var t=this.config;return g(t.padding_bottom)?t.padding_bottom:0},h.getCurrentPaddingLeft=function(t){var e=this,n=e.config;return g(n.padding_left)?n.padding_left:n.axis_rotated?n.axis_x_show?Math.max(_(e.getAxisWidthByAxisId("x",t)),40):1:!n.axis_y_show||n.axis_y_inner?e.axis.getYAxisLabelPosition().isOuter?30:1:_(e.getAxisWidthByAxisId("y",t))},h.getCurrentPaddingRight=function(){var t=this,e=t.config,n=10,r=t.isLegendRight?t.getLegendWidth()+20:0;return g(e.padding_right)?e.padding_right+1:e.axis_rotated?n+r:!e.axis_y2_show||e.axis_y2_inner?2+r+(t.axis.getY2AxisLabelPosition().isOuter?20:0):_(t.getAxisWidthByAxisId("y2"))+r},h.getParentRectValue=function(t){for(var e,n=this.selectChart.node();n&&"BODY"!==n.tagName;){try{e=n.getBoundingClientRect()[t]}catch(r){"width"===t&&(e=n.offsetWidth)}if(e)break;n=n.parentNode}return e},h.getParentWidth=function(){return this.getParentRectValue("width")},h.getParentHeight=function(){var t=this.selectChart.style("height");return t.indexOf("px")>0?+t.replace("px",""):0},h.getSvgLeft=function(t){var e=this,n=e.config,r=n.axis_rotated||!n.axis_rotated&&!n.axis_y_inner,i=n.axis_rotated?p.axisX:p.axisY,a=e.main.select("."+i).node(),o=a&&r?a.getBoundingClientRect():{right:0},s=e.selectChart.node().getBoundingClientRect(),u=e.hasArcType(),c=o.right-s.left-(u?0:e.getCurrentPaddingLeft(t));return c>0?c:0},h.getAxisWidthByAxisId=function(t,e){var n=this,r=n.axis.getLabelPositionById(t);return n.axis.getMaxTickWidth(t,e)+(r.isInner?20:40)},h.getHorizontalAxisHeight=function(t){var e=this,n=e.config,r=30;return"x"!==t||n.axis_x_show?"x"===t&&n.axis_x_height?n.axis_x_height:"y"!==t||n.axis_y_show?"y2"!==t||n.axis_y2_show?("x"===t&&!n.axis_rotated&&n.axis_x_tick_rotate&&(r=30+e.axis.getMaxTickWidth(t)*Math.cos(Math.PI*(90-n.axis_x_tick_rotate)/180)),"y"===t&&n.axis_rotated&&n.axis_y_tick_rotate&&(r=30+e.axis.getMaxTickWidth(t)*Math.cos(Math.PI*(90-n.axis_y_tick_rotate)/180)),r+(e.axis.getLabelPositionById(t).isInner?0:10)+("y2"===t?-10:0)):e.rotated_padding_top:!n.legend_show||e.isLegendRight||e.isLegendInset?1:10:8},h.getEventRectWidth=function(){return Math.max(0,this.xAxis.tickInterval())},h.getShapeIndices=function(t){var e,n,r=this,i=r.config,a={},o=0;return r.filterTargetsToShow(r.data.targets.filter(t,r)).forEach(function(t){for(e=0;e=0&&(c+=s(i[o].value)-u))}),c}},h.isWithinShape=function(t,e){var n,r=this,i=r.d3.select(t);return r.isTargetToShow(e.id)?"circle"===t.nodeName?n=r.isStepType(e)?r.isWithinStep(t,r.getYScale(e.id)(e.value)):r.isWithinCircle(t,1.5*r.pointSelectR(e)):"path"===t.nodeName&&(n=!i.classed(p.bar)||r.isWithinBar(t)):n=!1,n},h.getInterpolate=function(t){var e=this,n=e.isInterpolationType(e.config.spline_interpolation_type)?e.config.spline_interpolation_type:"cardinal";return e.isSplineType(t)?n:e.isStepType(t)?e.config.line_step_type:"linear"},h.initLine=function(){var t=this;t.main.select("."+p.chart).append("g").attr("class",p.chartLines)},h.updateTargetsForLine=function(t){var e,n,r=this,i=r.config,a=r.classChartLine.bind(r),o=r.classLines.bind(r),s=r.classAreas.bind(r),u=r.classCircles.bind(r),c=r.classFocus.bind(r);e=r.main.select("."+p.chartLines).selectAll("."+p.chartLine).data(t).attr("class",function(t){return a(t)+c(t)}),n=e.enter().append("g").attr("class",a).style("opacity",0).style("pointer-events","none"),n.append("g").attr("class",o),n.append("g").attr("class",s),n.append("g").attr("class",function(t){return r.generateClass(p.selectedCircles,t.id)}),n.append("g").attr("class",u).style("cursor",function(t){return i.data_selection_isselectable(t)?"pointer":null}),t.forEach(function(t){r.main.selectAll("."+p.selectedCircles+r.getTargetSelectorSuffix(t.id)).selectAll("."+p.selectedCircle).each(function(e){e.value=t.values[e.index].value})})},h.updateLine=function(t){var e=this;e.mainLine=e.main.selectAll("."+p.lines).selectAll("."+p.line).data(e.lineData.bind(e)),e.mainLine.enter().append("path").attr("class",e.classLine.bind(e)).style("stroke",e.color),e.mainLine.style("opacity",e.initialOpacity.bind(e)).style("shape-rendering",function(t){return e.isStepType(t)?"crispEdges":""}).attr("transform",null),e.mainLine.exit().transition().duration(t).style("opacity",0).remove()},h.redrawLine=function(t,e){return[(e?this.mainLine.transition(Math.random().toString()):this.mainLine).attr("d",t).style("stroke",this.color).style("opacity",1)]},h.generateDrawLine=function(t,e){var n=this,r=n.config,i=n.d3.svg.line(),a=n.generateGetLinePoints(t,e),o=e?n.getSubYScale:n.getYScale,s=function(t){return(e?n.subxx:n.xx).call(n,t)},u=function(t,e){return r.data_groups.length>0?a(t,e)[0][1]:o.call(n,t.id)(t.value)};return i=r.axis_rotated?i.x(u).y(s):i.x(s).y(u),r.line_connectNull||(i=i.defined(function(t){return null!=t.value})),function(t){var a,s=r.line_connectNull?n.filterRemoveNull(t.values):t.values,u=e?n.x:n.subX,c=o.call(n,t.id),l=0,h=0;return n.isLineType(t)?r.data_regions[t.id]?a=n.lineWithRegions(s,u,c,r.data_regions[t.id]):(n.isStepType(t)&&(s=n.convertValuesToStep(s)),a=i.interpolate(n.getInterpolate(t))(s)):(s[0]&&(l=u(s[0].x),h=c(s[0].value)),a=r.axis_rotated?"M "+h+" "+l:"M "+l+" "+h),a?a:"M 0 0"}},h.generateGetLinePoints=function(t,e){var n=this,r=n.config,i=t.__max__+1,a=n.getShapeX(0,i,t,!!e),o=n.getShapeY(!!e),s=n.getShapeOffset(n.isLineType,t,!!e),u=e?n.getSubYScale:n.getYScale;return function(t,e){var i=u.call(n,t.id)(0),c=s(t,e)||i,l=a(t),h=o(t);return r.axis_rotated&&(00?a(t,e)[0][1]:o.call(n,t.id)(n.getAreaBaseValue(t.id))},c=function(t,e){return r.data_groups.length>0?a(t,e)[1][1]:o.call(n,t.id)(t.value)};return i=r.axis_rotated?i.x0(u).x1(c).y(s):i.x(s).y0(r.area_above?0:u).y1(c),r.line_connectNull||(i=i.defined(function(t){return null!==t.value})),function(t){var e,a=r.line_connectNull?n.filterRemoveNull(t.values):t.values,o=0,s=0;return n.isAreaType(t)?(n.isStepType(t)&&(a=n.convertValuesToStep(a)),e=i.interpolate(n.getInterpolate(t))(a)):(a[0]&&(o=n.x(a[0].x),s=n.getYScale(t.id)(a[0].value)),e=r.axis_rotated?"M "+s+" "+o:"M "+o+" "+s),e?e:"M 0 0"}},h.getAreaBaseValue=function(){return 0},h.generateGetAreaPoints=function(t,e){var n=this,r=n.config,i=t.__max__+1,a=n.getShapeX(0,i,t,!!e),o=n.getShapeY(!!e),s=n.getShapeOffset(n.isAreaType,t,!!e),u=e?n.getSubYScale:n.getYScale;return function(t,e){var i=u.call(n,t.id)(0),c=s(t,e)||i,l=a(t),h=o(t);return r.axis_rotated&&(00?(t=n.getShapeIndices(n.isLineType),e=n.generateGetLinePoints(t),n.circleY=function(t,n){return e(t,n)[0][1]}):n.circleY=function(t){return n.getYScale(t.id)(t.value)}},h.getCircles=function(t,e){var n=this;return(e?n.main.selectAll("."+p.circles+n.getTargetSelectorSuffix(e)):n.main).selectAll("."+p.circle+(g(t)?"-"+t:""))},h.expandCircles=function(t,e,n){var r=this,i=r.pointExpandedR.bind(r);n&&r.unexpandCircles(),r.getCircles(t,e).classed(p.EXPANDED,!0).attr("r",i)},h.unexpandCircles=function(t){var e=this,n=e.pointR.bind(e);e.getCircles(t).filter(function(){return e.d3.select(this).classed(p.EXPANDED)}).classed(p.EXPANDED,!1).attr("r",n)},h.pointR=function(t){var e=this,n=e.config;return e.isStepType(t)?0:v(n.point_r)?n.point_r(t):n.point_r},h.pointExpandedR=function(t){var e=this,n=e.config;return n.point_focus_expand_enabled?n.point_focus_expand_r?n.point_focus_expand_r:1.75*e.pointR(t):e.pointR(t)},h.pointSelectR=function(t){var e=this,n=e.config;return v(n.point_select_r)?n.point_select_r(t):n.point_select_r?n.point_select_r:4*e.pointR(t)},h.isWithinCircle=function(t,e){var n=this.d3,r=n.mouse(t),i=n.select(t),a=+i.attr("cx"),o=+i.attr("cy");return Math.sqrt(Math.pow(a-r[0],2)+Math.pow(o-r[1],2))r.bar_width_max?r.bar_width_max:i},h.getBars=function(t,e){var n=this;return(e?n.main.selectAll("."+p.bars+n.getTargetSelectorSuffix(e)):n.main).selectAll("."+p.bar+(g(t)?"-"+t:""))},h.expandBars=function(t,e,n){var r=this;n&&r.unexpandBars(),r.getBars(t,e).classed(p.EXPANDED,!0)},h.unexpandBars=function(t){var e=this;e.getBars(t).classed(p.EXPANDED,!1)},h.generateDrawBar=function(t,e){var n=this,r=n.config,i=n.generateGetBarPoints(t,e);return function(t,e){var n=i(t,e),a=r.axis_rotated?1:0,o=r.axis_rotated?0:1,s="M "+n[0][a]+","+n[0][o]+" L"+n[1][a]+","+n[1][o]+" L"+n[2][a]+","+n[2][o]+" L"+n[3][a]+","+n[3][o]+" z";return s}},h.generateGetBarPoints=function(t,e){var n=this,r=e?n.subXAxis:n.xAxis,i=t.__max__+1,a=n.getBarW(r,i),o=n.getShapeX(a,i,t,!!e),s=n.getShapeY(!!e),u=n.getShapeOffset(n.isBarType,t,!!e),c=e?n.getSubYScale:n.getYScale;return function(t,e){var r=c.call(n,t.id)(0),i=u(t,e)||r,l=o(t),h=s(t);return n.config.axis_rotated&&(0a.width?r=a.width-o.width:r<0&&(r=4)),r},h.getYForText=function(t,e,n){var r,i=this,a=n.getBoundingClientRect();return i.config.axis_rotated?r=(t[0][0]+t[2][0]+.6*a.height)/2:(r=t[2][1],e.value<0||0===e.value&&!i.hasPositiveValue?(r+=a.height,i.isBarType(e)&&i.isSafari()?r-=3:!i.isBarType(e)&&i.isChrome()&&(r+=3)):r+=i.isBarType(e)?-3:-6),null!==e.value||i.config.axis_rotated||(rthis.height&&(r=this.height-4)),r},h.setTargetType=function(t,e){var n=this,r=n.config;n.mapToTargetIds(t).forEach(function(t){n.withoutFadeIn[t]=e===r.data_types[t],r.data_types[t]=e}),t||(r.data_type=e)},h.hasType=function(t,e){var n=this,r=n.config.data_types,i=!1;return e=e||n.data.targets,e&&e.length?e.forEach(function(e){var n=r[e.id];(n&&n.indexOf(t)>=0||!n&&"line"===t)&&(i=!0)}):Object.keys(r).length?Object.keys(r).forEach(function(e){r[e]===t&&(i=!0)}):i=n.config.data_type===t,i},h.hasArcType=function(t){return this.hasType("pie",t)||this.hasType("donut",t)||this.hasType("gauge",t)},h.isLineType=function(t){var e=this.config,n=y(t)?t:t.id;return!e.data_types[n]||["line","spline","area","area-spline","step","area-step"].indexOf(e.data_types[n])>=0},h.isStepType=function(t){var e=y(t)?t:t.id;return["step","area-step"].indexOf(this.config.data_types[e])>=0},h.isSplineType=function(t){var e=y(t)?t:t.id;return["spline","area-spline"].indexOf(this.config.data_types[e])>=0},h.isAreaType=function(t){var e=y(t)?t:t.id;return["area","area-spline","area-step"].indexOf(this.config.data_types[e])>=0},h.isBarType=function(t){var e=y(t)?t:t.id;return"bar"===this.config.data_types[e]},h.isScatterType=function(t){var e=y(t)?t:t.id;return"scatter"===this.config.data_types[e]},h.isPieType=function(t){var e=y(t)?t:t.id;return"pie"===this.config.data_types[e]},h.isGaugeType=function(t){var e=y(t)?t:t.id;return"gauge"===this.config.data_types[e]},h.isDonutType=function(t){var e=y(t)?t:t.id;return"donut"===this.config.data_types[e]},h.isArcType=function(t){return this.isPieType(t)||this.isDonutType(t)||this.isGaugeType(t)},h.lineData=function(t){return this.isLineType(t)?[t]:[]},h.arcData=function(t){return this.isArcType(t.data)?[t]:[]},h.barData=function(t){return this.isBarType(t)?t.values:[]},h.lineOrScatterData=function(t){return this.isLineType(t)||this.isScatterType(t)?t.values:[]},h.barOrLineData=function(t){return this.isBarType(t)||this.isLineType(t)?t.values:[]},h.isInterpolationType=function(t){return["linear","linear-closed","basis","basis-open","basis-closed","bundle","cardinal","cardinal-open","cardinal-closed","monotone"].indexOf(t)>=0},h.initGrid=function(){var t=this,e=t.config,n=t.d3;t.grid=t.main.append("g").attr("clip-path",t.clipPathForGrid).attr("class",p.grid),e.grid_x_show&&t.grid.append("g").attr("class",p.xgrids),e.grid_y_show&&t.grid.append("g").attr("class",p.ygrids),e.grid_focus_show&&t.grid.append("g").attr("class",p.xgridFocus).append("line").attr("class",p.xgridFocus),t.xgrid=n.selectAll([]),e.grid_lines_front||t.initGridLines()},h.initGridLines=function(){var t=this,e=t.d3;t.gridLines=t.main.append("g").attr("clip-path",t.clipPathForGrid).attr("class",p.grid+" "+p.gridLines),t.gridLines.append("g").attr("class",p.xgridLines),t.gridLines.append("g").attr("class",p.ygridLines),t.xgridLines=e.selectAll([])},h.updateXGrid=function(t){var e=this,n=e.config,r=e.d3,i=e.generateGridData(n.grid_x_type,e.x),a=e.isCategorized()?e.xAxis.tickOffset():0;e.xgridAttr=n.axis_rotated?{x1:0,x2:e.width,y1:function(t){return e.x(t)-a},y2:function(t){return e.x(t)-a}}:{x1:function(t){return e.x(t)+a},x2:function(t){return e.x(t)+a},y1:0,y2:e.height},e.xgrid=e.main.select("."+p.xgrids).selectAll("."+p.xgrid).data(i),e.xgrid.enter().append("line").attr("class",p.xgrid),t||e.xgrid.attr(e.xgridAttr).style("opacity",function(){return+r.select(this).attr(n.axis_rotated?"y1":"x1")===(n.axis_rotated?e.height:0)?0:1}),e.xgrid.exit().remove()},h.updateYGrid=function(){var t=this,e=t.config,n=t.yAxis.tickValues()||t.y.ticks(e.grid_y_ticks);t.ygrid=t.main.select("."+p.ygrids).selectAll("."+p.ygrid).data(n),t.ygrid.enter().append("line").attr("class",p.ygrid),t.ygrid.attr("x1",e.axis_rotated?t.y:0).attr("x2",e.axis_rotated?t.y:t.width).attr("y1",e.axis_rotated?0:t.y).attr("y2",e.axis_rotated?t.height:t.y),t.ygrid.exit().remove(),t.smoothLines(t.ygrid,"grid")},h.gridTextAnchor=function(t){return t.position?t.position:"end"},h.gridTextDx=function(t){return"start"===t.position?4:"middle"===t.position?0:-4},h.xGridTextX=function(t){return"start"===t.position?-this.height:"middle"===t.position?-this.height/2:0},h.yGridTextX=function(t){return"start"===t.position?0:"middle"===t.position?this.width/2:this.width},h.updateGrid=function(t){var e,n,r,i=this,a=i.main,o=i.config;i.grid.style("visibility",i.hasArcType()?"hidden":"visible"),a.select("line."+p.xgridFocus).style("visibility","hidden"),o.grid_x_show&&i.updateXGrid(),i.xgridLines=a.select("."+p.xgridLines).selectAll("."+p.xgridLine).data(o.grid_x_lines),e=i.xgridLines.enter().append("g").attr("class",function(t){return p.xgridLine+(t.class?" "+t.class:"")}),e.append("line").style("opacity",0),e.append("text").attr("text-anchor",i.gridTextAnchor).attr("transform",o.axis_rotated?"":"rotate(-90)").attr("dx",i.gridTextDx).attr("dy",-5).style("opacity",0),i.xgridLines.exit().transition().duration(t).style("opacity",0).remove(),o.grid_y_show&&i.updateYGrid(),i.ygridLines=a.select("."+p.ygridLines).selectAll("."+p.ygridLine).data(o.grid_y_lines),n=i.ygridLines.enter().append("g").attr("class",function(t){return p.ygridLine+(t.class?" "+t.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor",i.gridTextAnchor).attr("transform",o.axis_rotated?"rotate(-90)":"").attr("dx",i.gridTextDx).attr("dy",-5).style("opacity",0),r=i.yv.bind(i),i.ygridLines.select("line").transition().duration(t).attr("x1",o.axis_rotated?r:0).attr("x2",o.axis_rotated?r:i.width).attr("y1",o.axis_rotated?0:r).attr("y2",o.axis_rotated?i.height:r).style("opacity",1),i.ygridLines.select("text").transition().duration(t).attr("x",o.axis_rotated?i.xGridTextX.bind(i):i.yGridTextX.bind(i)).attr("y",r).text(function(t){return t.text}).style("opacity",1),i.ygridLines.exit().transition().duration(t).style("opacity",0).remove()},h.redrawGrid=function(t){var e=this,n=e.config,r=e.xv.bind(e),i=e.xgridLines.select("line"),a=e.xgridLines.select("text");return[(t?i.transition():i).attr("x1",n.axis_rotated?0:r).attr("x2",n.axis_rotated?e.width:r).attr("y1",n.axis_rotated?r:0).attr("y2",n.axis_rotated?r:e.height).style("opacity",1),(t?a.transition():a).attr("x",n.axis_rotated?e.yGridTextX.bind(e):e.xGridTextX.bind(e)).attr("y",r).text(function(t){return t.text}).style("opacity",1)]},h.showXGridFocus=function(t){var e=this,n=e.config,r=t.filter(function(t){return t&&g(t.value)}),i=e.main.selectAll("line."+p.xgridFocus),a=e.xx.bind(e);n.tooltip_show&&(e.hasType("scatter")||e.hasArcType()||(i.style("visibility","visible").data([r[0]]).attr(n.axis_rotated?"y1":"x1",a).attr(n.axis_rotated?"y2":"x2",a),e.smoothLines(i,"grid")))},h.hideXGridFocus=function(){this.main.select("line."+p.xgridFocus).style("visibility","hidden")},h.updateXgridFocus=function(){var t=this,e=t.config;t.main.select("line."+p.xgridFocus).attr("x1",e.axis_rotated?0:-10).attr("x2",e.axis_rotated?t.width:-10).attr("y1",e.axis_rotated?-10:0).attr("y2",e.axis_rotated?-10:t.height)},h.generateGridData=function(t,e){var n,r,i,a,o=this,s=[],u=o.main.select("."+p.axisX).selectAll(".tick").size();if("year"===t)for(n=o.getXDomain(),r=n[0].getFullYear(),i=n[1].getFullYear(),a=r;a<=i;a++)s.push(new Date(a+"-01-01 00:00:00"));else s=e.ticks(10),s.length>u&&(s=s.filter(function(t){return(""+t).indexOf(".")<0}));return s},h.getGridFilterToRemove=function(t){return t?function(e){var n=!1;return[].concat(t).forEach(function(t){("value"in t&&e.value===t.value||"class"in t&&e.class===t.class)&&(n=!0)}),n}:function(){return!0}},h.removeGridLines=function(t,e){var n=this,r=n.config,i=n.getGridFilterToRemove(t),a=function(t){return!i(t)},o=e?p.xgridLines:p.ygridLines,s=e?p.xgridLine:p.ygridLine;n.main.select("."+o).selectAll("."+s).filter(i).transition().duration(r.transition_duration).style("opacity",0).remove(),e?r.grid_x_lines=r.grid_x_lines.filter(a):r.grid_y_lines=r.grid_y_lines.filter(a)},h.initTooltip=function(){var t,e=this,n=e.config;if(e.tooltip=e.selectChart.style("position","relative").append("div").attr("class",p.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none"),n.tooltip_init_show){if(e.isTimeSeries()&&y(n.tooltip_init_x)){for(n.tooltip_init_x=e.parseDate(n.tooltip_init_x),t=0;t0&&r>0&&(n=t?v.indexOf(t.id):null,r=e?v.indexOf(e.id):null),g?n-r:r-n})}for(a=0;a"+(o||0===o?""+o+"":"")),s=P(p(t[a].value,t[a].ratio,t[a].id,t[a].index,t)),void 0!==s)){if(null===t[a].name)continue;u=P(f(t[a].name,t[a].ratio,t[a].id,t[a].index)),c=l.levelColor?l.levelColor(t[a].value):r(t[a].id),i+="",i+=""+u+"",i+=""+s+"",i+=""}return i+""},h.tooltipPosition=function(t,e,n,r){var i,a,o,s,u,c=this,l=c.config,h=c.d3,d=c.hasArcType(),f=h.mouse(r);return d?(a=(c.width-(c.isLegendRight?c.getLegendWidth():0))/2+f[0],s=c.height/2+f[1]+20):(i=c.getSvgLeft(!0),l.axis_rotated?(a=i+f[0]+100,o=a+e,u=c.currentWidth-c.getCurrentPaddingRight(),s=c.x(t[0].x)+20):(a=i+c.getCurrentPaddingLeft(!0)+c.x(t[0].x)+20,o=a+e,u=i+c.currentWidth-c.getCurrentPaddingRight(),s=f[1]+15),o>u&&(a-=o-u+20),s+n>c.currentHeight&&(s-=n+30)),s<0&&(s=0),{top:s,left:a}},h.showTooltip=function(t,e){var n,r,i,a=this,o=a.config,s=a.hasArcType(),u=t.filter(function(t){return t&&g(t.value)}),c=o.tooltip_position||h.tooltipPosition;0!==u.length&&o.tooltip_show&&(a.tooltip.html(o.tooltip_contents.call(a,t,a.axis.getXAxisTickFormat(),a.getYFormat(s),a.color)).style("display","block"),n=a.tooltip.property("offsetWidth"),r=a.tooltip.property("offsetHeight"),i=c.call(this,u,n,r,e),a.tooltip.style("top",i.top+"px").style("left",i.left+"px"))},h.hideTooltip=function(){this.tooltip.style("display","none")},h.initLegend=function(){var t=this;return t.legendItemTextBox={},t.legendHasRendered=!1,t.legend=t.svg.append("g").attr("transform",t.getTranslate("legend")),t.config.legend_show?void t.updateLegendWithDefaults():(t.legend.style("visibility","hidden"),void(t.hiddenLegendIds=t.mapToIds(t.data.targets)))},h.updateLegendWithDefaults=function(){var t=this;t.updateLegend(t.mapToIds(t.data.targets),{withTransform:!1,withTransitionForTransform:!1,withTransition:!1})},h.updateSizeForLegend=function(t,e){var n=this,r=n.config,i={top:n.isLegendTop?n.getCurrentPaddingTop()+r.legend_inset_y+5.5:n.currentHeight-t-n.getCurrentPaddingBottom()-r.legend_inset_y,left:n.isLegendLeft?n.getCurrentPaddingLeft()+r.legend_inset_x+.5:n.currentWidth-e-n.getCurrentPaddingRight()-r.legend_inset_x+.5};n.margin3={top:n.isLegendRight?0:n.isLegendInset?i.top:n.currentHeight-t,right:NaN,bottom:0,left:n.isLegendRight?n.currentWidth-e:n.isLegendInset?i.left:0}},h.transformLegend=function(t){var e=this;(t?e.legend.transition():e.legend).attr("transform",e.getTranslate("legend"))},h.updateLegendStep=function(t){this.legendStep=t},h.updateLegendItemWidth=function(t){this.legendItemWidth=t},h.updateLegendItemHeight=function(t){this.legendItemHeight=t},h.getLegendWidth=function(){var t=this;return t.config.legend_show?t.isLegendRight||t.isLegendInset?t.legendItemWidth*(t.legendStep+1):t.currentWidth:0},h.getLegendHeight=function(){var t=this,e=0;return t.config.legend_show&&(e=t.isLegendRight?t.currentHeight:Math.max(20,t.legendItemHeight)*(t.legendStep+1)),e},h.opacityForLegend=function(t){return t.classed(p.legendItemHidden)?null:1},h.opacityForUnfocusedLegend=function(t){return t.classed(p.legendItemHidden)?null:.3},h.toggleFocusLegend=function(t,e){var n=this;t=n.mapToTargetIds(t),n.legend.selectAll("."+p.legendItem).filter(function(e){return t.indexOf(e)>=0}).classed(p.legendItemFocused,e).transition().duration(100).style("opacity",function(){var t=e?n.opacityForLegend:n.opacityForUnfocusedLegend;return t.call(n,n.d3.select(this))})},h.revertLegend=function(){var t=this,e=t.d3;t.legend.selectAll("."+p.legendItem).classed(p.legendItemFocused,!1).transition().duration(100).style("opacity",function(){return t.opacityForLegend(e.select(this))})},h.showLegend=function(t){var e=this,n=e.config;n.legend_show||(n.legend_show=!0,e.legend.style("visibility","visible"),e.legendHasRendered||e.updateLegendWithDefaults()),e.removeHiddenLegendIds(t),e.legend.selectAll(e.selectorLegends(t)).style("visibility","visible").transition().style("opacity",function(){return e.opacityForLegend(e.d3.select(this))})},h.hideLegend=function(t){var e=this,n=e.config;n.legend_show&&w(t)&&(n.legend_show=!1,e.legend.style("visibility","hidden")),e.addHiddenLegendIds(t),e.legend.selectAll(e.selectorLegends(t)).style("opacity",0).style("visibility","hidden")},h.clearLegendItemTextBoxCache=function(){this.legendItemTextBox={}},h.updateLegend=function(t,e,n){function r(t,e){return w.legendItemTextBox[e]||(w.legendItemTextBox[e]=w.getTextRect(t.textContent,p.legendItem,t)),w.legendItemTextBox[e]}function i(e,n,i){function a(t,e){e||(o=(p-V-f)/2,o=M)&&(M=h),(!L||d>=L)&&(L=d),s=w.isLegendRight||w.isLegendInset?L:M,void(T.legend_equally?(Object.keys(I).forEach(function(t){I[t]=M}),Object.keys(R).forEach(function(t){R[t]=L}),o=(p-s*t.length)/2,o0&&0===S.size()&&(S=w.legend.insert("g","."+p.legendItem).attr("class",p.legendBackground).append("rect")),m=w.legend.selectAll("text").data(t).text(function(t){return x(T.data_names[t])?T.data_names[t]:t}).each(function(t,e){i(this,t,e)}),(v?m.transition():m).attr("x",o).attr("y",c),_=w.legend.selectAll("rect."+p.legendItemEvent).data(t),(v?_.transition():_).attr("width",function(t){return I[t]}).attr("height",function(t){return R[t]}).attr("x",s).attr("y",l),b=w.legend.selectAll("line."+p.legendItemTile).data(t),(v?b.transition():b).style("stroke",w.color).attr("x1",h).attr("y1",f).attr("x2",d).attr("y2",f),S&&(v?S.transition():S).attr("height",w.getLegendHeight()-12).attr("width",M*(D+1)+10),w.legend.selectAll("."+p.legendItem).classed(p.legendItemHidden,function(t){return!w.isTargetToShow(t)}),w.updateLegendItemWidth(M),w.updateLegendItemHeight(L),w.updateLegendStep(D),w.updateSizes(),w.updateScales(),w.updateSvgSize(),w.transformAll(y,n),w.legendHasRendered=!0},h.initTitle=function(){var t=this;t.title=t.svg.append("text").text(t.config.title_text).attr("class",t.CLASS.title)},h.redrawTitle=function(){var t=this;t.title.attr("x",t.xForTitle.bind(t)).attr("y",t.yForTitle.bind(t))},h.xForTitle=function(){var t,e=this,n=e.config,r=n.title_position||"left";return t=r.indexOf("right")>=0?e.currentWidth-e.getTextRect(e.title.node().textContent,e.CLASS.title,e.title.node()).width-n.title_padding.right:r.indexOf("center")>=0?(e.currentWidth-e.getTextRect(e.title.node().textContent,e.CLASS.title,e.title.node()).width)/2:n.title_padding.left},h.yForTitle=function(){var t=this;return t.config.title_padding.top+t.getTextRect(t.title.node().textContent,t.CLASS.title,t.title.node()).height},h.getTitlePadding=function(){var t=this;return t.yForTitle()+t.config.title_padding.bottom},a(i,u),u.prototype.init=function(){var t=this.owner,e=t.config,n=t.main;t.axes.x=n.append("g").attr("class",p.axis+" "+p.axisX).attr("clip-path",t.clipPathForXAxis).attr("transform",t.getTranslate("x")).style("visibility",e.axis_x_show?"visible":"hidden"),t.axes.x.append("text").attr("class",p.axisXLabel).attr("transform",e.axis_rotated?"rotate(-90)":"").style("text-anchor",this.textAnchorForXAxisLabel.bind(this)),t.axes.y=n.append("g").attr("class",p.axis+" "+p.axisY).attr("clip-path",e.axis_y_inner?"":t.clipPathForYAxis).attr("transform",t.getTranslate("y")).style("visibility",e.axis_y_show?"visible":"hidden"),t.axes.y.append("text").attr("class",p.axisYLabel).attr("transform",e.axis_rotated?"":"rotate(-90)").style("text-anchor",this.textAnchorForYAxisLabel.bind(this)),t.axes.y2=n.append("g").attr("class",p.axis+" "+p.axisY2).attr("transform",t.getTranslate("y2")).style("visibility",e.axis_y2_show?"visible":"hidden"),t.axes.y2.append("text").attr("class",p.axisY2Label).attr("transform",e.axis_rotated?"":"rotate(-90)").style("text-anchor",this.textAnchorForY2AxisLabel.bind(this))},u.prototype.getXAxis=function(t,e,n,r,i,a,o){var s=this.owner,u=s.config,l={isCategory:s.isCategorized(),withOuterTick:i,tickMultiline:u.axis_x_tick_multiline,tickWidth:u.axis_x_tick_width,tickTextRotate:o?0:u.axis_x_tick_rotate,withoutTransition:a},h=c(s.d3,l).scale(t).orient(e);return s.isTimeSeries()&&r&&"function"!=typeof r&&(r=r.map(function(t){return s.parseDate(t)})),h.tickFormat(n).tickValues(r),s.isCategorized()&&(h.tickCentered(u.axis_x_tick_centered),w(u.axis_x_tick_culling)&&(u.axis_x_tick_culling=!1)),h},u.prototype.updateXAxisTickValues=function(t,e){var n,r=this.owner,i=r.config;return(i.axis_x_tick_fit||i.axis_x_tick_count)&&(n=this.generateTickValues(r.mapTargetsToUniqueXs(t),i.axis_x_tick_count,r.isTimeSeries())),e?e.tickValues(n):(r.xAxis.tickValues(n),r.subXAxis.tickValues(n)),n},u.prototype.getYAxis=function(t,e,n,r,i,a,o){var s=this.owner,u=s.config,l={withOuterTick:i,withoutTransition:a,tickTextRotate:o?0:u.axis_y_tick_rotate},h=c(s.d3,l).scale(t).orient(e).tickFormat(n);return s.isTimeSeriesY()?h.ticks(s.d3.time[u.axis_y_tick_time_value],u.axis_y_tick_time_interval):h.tickValues(r),h},u.prototype.getId=function(t){var e=this.owner.config;return t in e.data_axes?e.data_axes[t]:"y"},u.prototype.getXAxisTickFormat=function(){var t=this.owner,e=t.config,n=t.isTimeSeries()?t.defaultAxisTimeFormat:t.isCategorized()?t.categoryName:function(t){return t<0?t.toFixed(0):t};return e.axis_x_tick_format&&(v(e.axis_x_tick_format)?n=e.axis_x_tick_format:t.isTimeSeries()&&(n=function(n){return n?t.axisTimeFormat(e.axis_x_tick_format)(n):""})),v(n)?function(e){return n.call(t,e)}:n},u.prototype.getTickValues=function(t,e){return t?t:e?e.tickValues():void 0},u.prototype.getXAxisTickValues=function(){return this.getTickValues(this.owner.config.axis_x_tick_values,this.owner.xAxis)},u.prototype.getYAxisTickValues=function(){return this.getTickValues(this.owner.config.axis_y_tick_values,this.owner.yAxis)},u.prototype.getY2AxisTickValues=function(){return this.getTickValues(this.owner.config.axis_y2_tick_values,this.owner.y2Axis)},u.prototype.getLabelOptionByAxisId=function(t){var e,n=this.owner,r=n.config;return"y"===t?e=r.axis_y_label:"y2"===t?e=r.axis_y2_label:"x"===t&&(e=r.axis_x_label),e},u.prototype.getLabelText=function(t){var e=this.getLabelOptionByAxisId(t);return y(e)?e:e?e.text:null},u.prototype.setLabelText=function(t,e){var n=this.owner,r=n.config,i=this.getLabelOptionByAxisId(t);y(i)?"y"===t?r.axis_y_label=e:"y2"===t?r.axis_y2_label=e:"x"===t&&(r.axis_x_label=e):i&&(i.text=e)},u.prototype.getLabelPosition=function(t,e){var n=this.getLabelOptionByAxisId(t),r=n&&"object"==typeof n&&n.position?n.position:e;return{isInner:r.indexOf("inner")>=0,isOuter:r.indexOf("outer")>=0,isLeft:r.indexOf("left")>=0,isCenter:r.indexOf("center")>=0,isRight:r.indexOf("right")>=0,isTop:r.indexOf("top")>=0,isMiddle:r.indexOf("middle")>=0,isBottom:r.indexOf("bottom")>=0}},u.prototype.getXAxisLabelPosition=function(){return this.getLabelPosition("x",this.owner.config.axis_rotated?"inner-top":"inner-right")},u.prototype.getYAxisLabelPosition=function(){return this.getLabelPosition("y",this.owner.config.axis_rotated?"inner-right":"inner-top")},u.prototype.getY2AxisLabelPosition=function(){return this.getLabelPosition("y2",this.owner.config.axis_rotated?"inner-right":"inner-top")},u.prototype.getLabelPositionById=function(t){return"y2"===t?this.getY2AxisLabelPosition():"y"===t?this.getYAxisLabelPosition():this.getXAxisLabelPosition()},u.prototype.textForXAxisLabel=function(){return this.getLabelText("x")},u.prototype.textForYAxisLabel=function(){return this.getLabelText("y")},u.prototype.textForY2AxisLabel=function(){return this.getLabelText("y2")},u.prototype.xForAxisLabel=function(t,e){var n=this.owner;return t?e.isLeft?0:e.isCenter?n.width/2:n.width:e.isBottom?-n.height:e.isMiddle?-n.height/2:0},u.prototype.dxForAxisLabel=function(t,e){return t?e.isLeft?"0.5em":e.isRight?"-0.5em":"0":e.isTop?"-0.5em":e.isBottom?"0.5em":"0"},u.prototype.textAnchorForAxisLabel=function(t,e){return t?e.isLeft?"start":e.isCenter?"middle":"end":e.isBottom?"start":e.isMiddle?"middle":"end"},u.prototype.xForXAxisLabel=function(){return this.xForAxisLabel(!this.owner.config.axis_rotated,this.getXAxisLabelPosition())},u.prototype.xForYAxisLabel=function(){return this.xForAxisLabel(this.owner.config.axis_rotated,this.getYAxisLabelPosition())},u.prototype.xForY2AxisLabel=function(){return this.xForAxisLabel(this.owner.config.axis_rotated,this.getY2AxisLabelPosition())},u.prototype.dxForXAxisLabel=function(){return this.dxForAxisLabel(!this.owner.config.axis_rotated,this.getXAxisLabelPosition())},u.prototype.dxForYAxisLabel=function(){return this.dxForAxisLabel(this.owner.config.axis_rotated,this.getYAxisLabelPosition())},u.prototype.dxForY2AxisLabel=function(){return this.dxForAxisLabel(this.owner.config.axis_rotated,this.getY2AxisLabelPosition())},u.prototype.dyForXAxisLabel=function(){var t=this.owner,e=t.config,n=this.getXAxisLabelPosition();return e.axis_rotated?n.isInner?"1.2em":-25-this.getMaxTickWidth("x"):n.isInner?"-0.5em":e.axis_x_height?e.axis_x_height-10:"3em"},u.prototype.dyForYAxisLabel=function(){var t=this.owner,e=this.getYAxisLabelPosition();return t.config.axis_rotated?e.isInner?"-0.5em":"3em":e.isInner?"1.2em":-10-(t.config.axis_y_inner?0:this.getMaxTickWidth("y")+10)},u.prototype.dyForY2AxisLabel=function(){var t=this.owner,e=this.getY2AxisLabelPosition();return t.config.axis_rotated?e.isInner?"1.2em":"-2.2em":e.isInner?"-0.5em":15+(t.config.axis_y2_inner?0:this.getMaxTickWidth("y2")+15)},u.prototype.textAnchorForXAxisLabel=function(){var t=this.owner;return this.textAnchorForAxisLabel(!t.config.axis_rotated,this.getXAxisLabelPosition())},u.prototype.textAnchorForYAxisLabel=function(){var t=this.owner;return this.textAnchorForAxisLabel(t.config.axis_rotated,this.getYAxisLabelPosition())},u.prototype.textAnchorForY2AxisLabel=function(){var t=this.owner;return this.textAnchorForAxisLabel(t.config.axis_rotated,this.getY2AxisLabelPosition())},u.prototype.getMaxTickWidth=function(t,e){var n,r,i,a,o,s=this.owner,u=s.config,c=0;return e&&s.currentMaxTickWidths[t]?s.currentMaxTickWidths[t]:(s.svg&&(n=s.filterTargetsToShow(s.data.targets),"y"===t?(r=s.y.copy().domain(s.getYDomain(n,"y")),i=this.getYAxis(r,s.yOrient,u.axis_y_tick_format,s.yAxisTickValues,!1,!0,!0)):"y2"===t?(r=s.y2.copy().domain(s.getYDomain(n,"y2")),i=this.getYAxis(r,s.y2Orient,u.axis_y2_tick_format,s.y2AxisTickValues,!1,!0,!0)):(r=s.x.copy().domain(s.getXDomain(n)),i=this.getXAxis(r,s.xOrient,s.xAxisTickFormat,s.xAxisTickValues,!1,!0,!0),this.updateXAxisTickValues(n,i)),a=s.d3.select("body").append("div").classed("c3",!0),o=a.append("svg").style("visibility","hidden").style("position","fixed").style("top",0).style("left",0),o.append("g").call(i).each(function(){s.d3.select(this).selectAll("text").each(function(){var t=this.getBoundingClientRect();c2){for(o=r-2,i=t[0],a=t[t.length-1],s=(a-i)/(o+1),l=[i],u=0;u=0;return"url("+(e?"":document.URL.split("#")[0])+"#"+t+")"},h.appendClip=function(t,e){return t.append("clipPath").attr("id",e).append("rect")},h.getAxisClipX=function(t){var e=Math.max(30,this.margin.left);return t?-(1+e):-(e-1)},h.getAxisClipY=function(t){return t?-20:-this.margin.top},h.getXAxisClipX=function(){var t=this;return t.getAxisClipX(!t.config.axis_rotated)},h.getXAxisClipY=function(){var t=this;return t.getAxisClipY(!t.config.axis_rotated)},h.getYAxisClipX=function(){var t=this;return t.config.axis_y_inner?-1:t.getAxisClipX(t.config.axis_rotated)},h.getYAxisClipY=function(){var t=this;return t.getAxisClipY(t.config.axis_rotated)},h.getAxisClipWidth=function(t){var e=this,n=Math.max(30,e.margin.left),r=Math.max(30,e.margin.right);return t?e.width+2+n+r:e.margin.left+20},h.getAxisClipHeight=function(t){return(t?this.margin.bottom:this.margin.top+this.height)+20},h.getXAxisClipWidth=function(){var t=this;return t.getAxisClipWidth(!t.config.axis_rotated)},h.getXAxisClipHeight=function(){var t=this;return t.getAxisClipHeight(!t.config.axis_rotated)},h.getYAxisClipWidth=function(){var t=this;return t.getAxisClipWidth(t.config.axis_rotated)+(t.config.axis_y_inner?20:0)},h.getYAxisClipHeight=function(){var t=this;return t.getAxisClipHeight(t.config.axis_rotated)},h.initPie=function(){var t=this,e=t.d3,n=t.config;t.pie=e.layout.pie().value(function(t){return t.values.reduce(function(t,e){return t+e.value},0)}),n.data_order||t.pie.sort(null)},h.updateRadius=function(){var t=this,e=t.config,n=e.gauge_width||e.donut_width;t.radiusExpanded=Math.min(t.arcWidth,t.arcHeight)/2,t.radius=.95*t.radiusExpanded,t.innerRadiusRatio=n?(t.radius-n)/t.radius:.6,t.innerRadius=t.hasType("donut")||t.hasType("gauge")?t.radius*t.innerRadiusRatio:0},h.updateArc=function(){var t=this;t.svgArc=t.getSvgArc(),t.svgArcExpanded=t.getSvgArcExpanded(),t.svgArcExpandedSub=t.getSvgArcExpanded(.98)},h.updateAngle=function(t){var e,n,r,i,a=this,o=a.config,s=!1,u=0;return o?(a.pie(a.filterTargetsToShow(a.data.targets)).forEach(function(e){ -s||e.data.id!==t.data.id||(s=!0,t=e,t.index=u),u++}),isNaN(t.startAngle)&&(t.startAngle=0),isNaN(t.endAngle)&&(t.endAngle=t.startAngle),a.isGaugeType(t.data)&&(e=o.gauge_min,n=o.gauge_max,r=Math.PI*(o.gauge_fullCircle?2:1)/(n-e),i=t.value.375?1.175-36/o.radius:.8)*o.radius/i:0,c="translate("+n*a+","+r*a+")"),c},h.getArcRatio=function(t){var e=this,n=e.config,r=Math.PI*(e.hasType("gauge")&&!n.gauge_fullCircle?1:2);return t?(t.endAngle-t.startAngle)/r:null},h.convertToArcData=function(t){return this.addName({id:t.data.id,value:t.value,ratio:this.getArcRatio(t),index:t.index})},h.textForArcLabel=function(t){var e,n,r,i,a,o=this;return o.shouldShowArcLabel()?(e=o.updateAngle(t),n=e?e.value:null,r=o.getArcRatio(e),i=t.data.id,o.hasType("gauge")||o.meetsArcLabelThreshold(r)?(a=o.getArcLabelFormat(),a?a(n,r,i):o.defaultArcValueFormat(n,r)):""):""},h.expandArc=function(t){var e,n=this;return n.transiting?void(e=r.setInterval(function(){n.transiting||(r.clearInterval(e),n.legend.selectAll(".c3-legend-item-focused").size()>0&&n.expandArc(t))},10)):(t=n.mapToTargetIds(t),void n.svg.selectAll(n.selectorTargets(t,"."+p.chartArc)).each(function(t){n.shouldExpand(t.data.id)&&n.d3.select(this).selectAll("path").transition().duration(n.expandDuration(t.data.id)).attr("d",n.svgArcExpanded).transition().duration(2*n.expandDuration(t.data.id)).attr("d",n.svgArcExpandedSub).each(function(t){n.isDonutType(t.data)})}))},h.unexpandArc=function(t){var e=this;e.transiting||(t=e.mapToTargetIds(t),e.svg.selectAll(e.selectorTargets(t,"."+p.chartArc)).selectAll("path").transition().duration(function(t){return e.expandDuration(t.data.id)}).attr("d",e.svgArc),e.svg.selectAll("."+p.arc).style("opacity",1))},h.expandDuration=function(t){var e=this,n=e.config;return e.isDonutType(t)?n.donut_expand_duration:e.isGaugeType(t)?n.gauge_expand_duration:e.isPieType(t)?n.pie_expand_duration:50},h.shouldExpand=function(t){var e=this,n=e.config;return e.isDonutType(t)&&n.donut_expand||e.isGaugeType(t)&&n.gauge_expand||e.isPieType(t)&&n.pie_expand},h.shouldShowArcLabel=function(){var t=this,e=t.config,n=!0;return t.hasType("donut")?n=e.donut_label_show:t.hasType("pie")&&(n=e.pie_label_show),n},h.meetsArcLabelThreshold=function(t){var e=this,n=e.config,r=e.hasType("donut")?n.donut_label_threshold:n.pie_label_threshold;return t>=r},h.getArcLabelFormat=function(){var t=this,e=t.config,n=e.pie_label_format;return t.hasType("gauge")?n=e.gauge_label_format:t.hasType("donut")&&(n=e.donut_label_format),n},h.getArcTitle=function(){var t=this;return t.hasType("donut")?t.config.donut_title:""},h.updateTargetsForArc=function(t){var e,n,r=this,i=r.main,a=r.classChartArc.bind(r),o=r.classArcs.bind(r),s=r.classFocus.bind(r);e=i.select("."+p.chartArcs).selectAll("."+p.chartArc).data(r.pie(t)).attr("class",function(t){return a(t)+s(t.data)}),n=e.enter().append("g").attr("class",a),n.append("g").attr("class",o),n.append("text").attr("dy",r.hasType("gauge")?"-.1em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none")},h.initArc=function(){var t=this;t.arcs=t.main.select("."+p.chart).append("g").attr("class",p.chartArcs).attr("transform",t.getTranslate("arc")),t.arcs.append("text").attr("class",p.chartArcsTitle).style("text-anchor","middle").text(t.getArcTitle())},h.redrawArc=function(t,e,n){var r,i=this,a=i.d3,o=i.config,s=i.main;r=s.selectAll("."+p.arcs).selectAll("."+p.arc).data(i.arcData.bind(i)),r.enter().append("path").attr("class",i.classArc.bind(i)).style("fill",function(t){return i.color(t.data)}).style("cursor",function(t){return o.interaction_enabled&&o.data_selection_isselectable(t)?"pointer":null}).style("opacity",0).each(function(t){i.isGaugeType(t.data)&&(t.startAngle=t.endAngle=o.gauge_startingAngle),this._current=t}),r.attr("transform",function(t){return!i.isGaugeType(t.data)&&n?"scale(0)":""}).style("opacity",function(t){return t===this._current?0:1}).on("mouseover",o.interaction_enabled?function(t){var e,n;i.transiting||(e=i.updateAngle(t),e&&(n=i.convertToArcData(e),i.expandArc(e.data.id),i.api.focus(e.data.id),i.toggleFocusLegend(e.data.id,!0),i.config.data_onmouseover(n,this)))}:null).on("mousemove",o.interaction_enabled?function(t){var e,n,r=i.updateAngle(t);r&&(e=i.convertToArcData(r),n=[e],i.showTooltip(n,this))}:null).on("mouseout",o.interaction_enabled?function(t){var e,n;i.transiting||(e=i.updateAngle(t),e&&(n=i.convertToArcData(e),i.unexpandArc(e.data.id),i.api.revert(),i.revertLegend(),i.hideTooltip(),i.config.data_onmouseout(n,this)))}:null).on("click",o.interaction_enabled?function(t,e){var n,r=i.updateAngle(t);r&&(n=i.convertToArcData(r),i.toggleShape&&i.toggleShape(this,n,e),i.config.data_onclick.call(i.api,n,this))}:null).each(function(){i.transiting=!0}).transition().duration(t).attrTween("d",function(t){var e,n=i.updateAngle(t);return n?(isNaN(this._current.startAngle)&&(this._current.startAngle=0),isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle),e=a.interpolate(this._current,n),this._current=e(0),function(n){var r=e(n);return r.data=t.data,i.getArc(r,!0)}):function(){return"M 0 0"}}).attr("transform",n?"scale(1)":"").style("fill",function(t){return i.levelColor?i.levelColor(t.data.values[0].value):i.color(t.data.id)}).style("opacity",1).call(i.endall,function(){i.transiting=!1}),r.exit().transition().duration(e).style("opacity",0).remove(),s.selectAll("."+p.chartArc).select("text").style("opacity",0).attr("class",function(t){return i.isGaugeType(t.data)?p.gaugeValue:""}).text(i.textForArcLabel.bind(i)).attr("transform",i.transformForArcLabel.bind(i)).style("font-size",function(t){return i.isGaugeType(t.data)?Math.round(i.radius/5)+"px":""}).transition().duration(t).style("opacity",function(t){return i.isTargetToShow(t.data.id)&&i.isArcType(t.data)?1:0}),s.select("."+p.chartArcsTitle).style("opacity",i.hasType("donut")||i.hasType("gauge")?1:0),i.hasType("gauge")&&(i.arcs.select("."+p.chartArcsBackground).attr("d",function(){var t={data:[{value:o.gauge_max}],startAngle:o.gauge_startingAngle,endAngle:-1*o.gauge_startingAngle};return i.getArc(t,!0,!0)}),i.arcs.select("."+p.chartArcsGaugeUnit).attr("dy",".75em").text(o.gauge_label_show?o.gauge_units:""),i.arcs.select("."+p.chartArcsGaugeMin).attr("dx",-1*(i.innerRadius+(i.radius-i.innerRadius)/(o.gauge_fullCircle?1:2))+"px").attr("dy","1.2em").text(o.gauge_label_show?o.gauge_min:""),i.arcs.select("."+p.chartArcsGaugeMax).attr("dx",i.innerRadius+(i.radius-i.innerRadius)/(o.gauge_fullCircle?1:2)+"px").attr("dy","1.2em").text(o.gauge_label_show?o.gauge_max:""))},h.initGauge=function(){var t=this.arcs;this.hasType("gauge")&&(t.append("path").attr("class",p.chartArcsBackground),t.append("text").attr("class",p.chartArcsGaugeUnit).style("text-anchor","middle").style("pointer-events","none"),t.append("text").attr("class",p.chartArcsGaugeMin).style("text-anchor","middle").style("pointer-events","none"),t.append("text").attr("class",p.chartArcsGaugeMax).style("text-anchor","middle").style("pointer-events","none"))},h.getGaugeLabelHeight=function(){return this.config.gauge_label_show?20:0},h.initRegion=function(){var t=this;t.region=t.main.append("g").attr("clip-path",t.clipPath).attr("class",p.regions)},h.updateRegion=function(t){var e=this,n=e.config;e.region.style("visibility",e.hasArcType()?"hidden":"visible"),e.mainRegion=e.main.select("."+p.regions).selectAll("."+p.region).data(n.regions),e.mainRegion.enter().append("g").append("rect").style("fill-opacity",0),e.mainRegion.attr("class",e.classRegion.bind(e)),e.mainRegion.exit().transition().duration(t).style("opacity",0).remove()},h.redrawRegion=function(t){var e=this,n=e.mainRegion.selectAll("rect").each(function(){var t=e.d3.select(this.parentNode).datum();e.d3.select(this).datum(t)}),r=e.regionX.bind(e),i=e.regionY.bind(e),a=e.regionWidth.bind(e),o=e.regionHeight.bind(e);return[(t?n.transition():n).attr("x",r).attr("y",i).attr("width",a).attr("height",o).style("fill-opacity",function(t){return g(t.opacity)?t.opacity:.1})]},h.regionX=function(t){var e,n=this,r=n.config,i="y"===t.axis?n.y:n.y2;return e="y"===t.axis||"y2"===t.axis?r.axis_rotated&&"start"in t?i(t.start):0:r.axis_rotated?0:"start"in t?n.x(n.isTimeSeries()?n.parseDate(t.start):t.start):0},h.regionY=function(t){var e,n=this,r=n.config,i="y"===t.axis?n.y:n.y2;return e="y"===t.axis||"y2"===t.axis?r.axis_rotated?0:"end"in t?i(t.end):0:r.axis_rotated&&"start"in t?n.x(n.isTimeSeries()?n.parseDate(t.start):t.start):0},h.regionWidth=function(t){var e,n=this,r=n.config,i=n.regionX(t),a="y"===t.axis?n.y:n.y2;return e="y"===t.axis||"y2"===t.axis?r.axis_rotated&&"end"in t?a(t.end):n.width:r.axis_rotated?n.width:"end"in t?n.x(n.isTimeSeries()?n.parseDate(t.end):t.end):n.width,e=0?p.focused:"")},h.classDefocused=function(t){return" "+(this.defocusedTargetIds.indexOf(t.id)>=0?p.defocused:"")},h.classChartText=function(t){return p.chartText+this.classTarget(t.id)},h.classChartLine=function(t){return p.chartLine+this.classTarget(t.id)},h.classChartBar=function(t){return p.chartBar+this.classTarget(t.id)},h.classChartArc=function(t){return p.chartArc+this.classTarget(t.data.id)},h.getTargetSelectorSuffix=function(t){return t||0===t?("-"+t).replace(/[\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g,"-"):""},h.selectorTarget=function(t,e){return(e||"")+"."+p.target+this.getTargetSelectorSuffix(t)},h.selectorTargets=function(t,e){var n=this;return t=t||[],t.length?t.map(function(t){return n.selectorTarget(t,e)}):null},h.selectorLegend=function(t){return"."+p.legendItem+this.getTargetSelectorSuffix(t)},h.selectorLegends=function(t){var e=this;return t&&t.length?t.map(function(t){return e.selectorLegend(t)}):null};var g=h.isValue=function(t){return t||0===t},v=h.isFunction=function(t){return"function"==typeof t},y=h.isString=function(t){return"string"==typeof t},m=h.isUndefined=function(t){return"undefined"==typeof t},x=h.isDefined=function(t){return"undefined"!=typeof t},_=h.ceil10=function(t){return 10*Math.ceil(t/10)},b=h.asHalfPixel=function(t){return Math.ceil(t)+.5},S=h.diffDomain=function(t){return t[1]-t[0]},w=h.isEmpty=function(t){return"undefined"==typeof t||null===t||y(t)&&0===t.length||"object"==typeof t&&0===Object.keys(t).length},T=h.notEmpty=function(t){return!h.isEmpty(t)},A=h.getOption=function(t,e,n){return x(t[e])?t[e]:n},C=h.hasValue=function(t,e){var n=!1;return Object.keys(t).forEach(function(r){t[r]===e&&(n=!0)}),n},P=h.sanitise=function(t){return"string"==typeof t?t.replace(//g,">"):t},M=h.getPathBox=function(t){var e=t.getBoundingClientRect(),n=[t.pathSegList.getItem(0),t.pathSegList.getItem(1)],r=n[0].x,i=Math.min(n[0].y,n[1].y);return{x:r,y:i,width:e.width,height:e.height}};l.focus=function(t){var e,n=this.internal;t=n.mapToTargetIds(t),e=n.svg.selectAll(n.selectorTargets(t.filter(n.isTargetToShow,n))),this.revert(),this.defocus(),e.classed(p.focused,!0).classed(p.defocused,!1),n.hasArcType()&&n.expandArc(t),n.toggleFocusLegend(t,!0),n.focusedTargetIds=t,n.defocusedTargetIds=n.defocusedTargetIds.filter(function(e){return t.indexOf(e)<0})},l.defocus=function(t){var e,n=this.internal;t=n.mapToTargetIds(t),e=n.svg.selectAll(n.selectorTargets(t.filter(n.isTargetToShow,n))),e.classed(p.focused,!1).classed(p.defocused,!0),n.hasArcType()&&n.unexpandArc(t),n.toggleFocusLegend(t,!1),n.focusedTargetIds=n.focusedTargetIds.filter(function(e){return t.indexOf(e)<0}),n.defocusedTargetIds=t},l.revert=function(t){var e,n=this.internal;t=n.mapToTargetIds(t),e=n.svg.selectAll(n.selectorTargets(t)),e.classed(p.focused,!1).classed(p.defocused,!1),n.hasArcType()&&n.unexpandArc(t),n.config.legend_show&&(n.showLegend(t.filter(n.isLegendToShow.bind(n))),n.legend.selectAll(n.selectorLegends(t)).filter(function(){return n.d3.select(this).classed(p.legendItemFocused)}).classed(p.legendItemFocused,!1)),n.focusedTargetIds=[],n.defocusedTargetIds=[]},l.show=function(t,e){var n,r=this.internal;t=r.mapToTargetIds(t),e=e||{},r.removeHiddenTargetIds(t),n=r.svg.selectAll(r.selectorTargets(t)),n.transition().style("opacity",1,"important").call(r.endall,function(){n.style("opacity",null).style("opacity",1)}),e.withLegend&&r.showLegend(t),r.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},l.hide=function(t,e){var n,r=this.internal;t=r.mapToTargetIds(t),e=e||{},r.addHiddenTargetIds(t),n=r.svg.selectAll(r.selectorTargets(t)),n.transition().style("opacity",0,"important").call(r.endall,function(){n.style("opacity",null).style("opacity",0)}),e.withLegend&&r.hideLegend(t),r.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},l.toggle=function(t,e){var n=this,r=this.internal;r.mapToTargetIds(t).forEach(function(t){r.isTargetToShow(t)?n.hide(t,e):n.show(t,e)})},l.zoom=function(t){var e=this.internal;return t&&(e.isTimeSeries()&&(t=t.map(function(t){return e.parseDate(t)})),e.brush.extent(t),e.redraw({withUpdateXDomain:!0,withY:e.config.zoom_rescale}),e.config.zoom_onzoom.call(this,e.x.orgDomain())),e.brush.extent()},l.zoom.enable=function(t){var e=this.internal;e.config.zoom_enabled=t,e.updateAndRedraw()},l.unzoom=function(){var t=this.internal;t.brush.clear().update(),t.redraw({withUpdateXDomain:!0})},l.zoom.max=function(t){var e=this.internal,n=e.config,r=e.d3;return 0===t||t?void(n.zoom_x_max=r.max([e.orgXDomain[1],t])):n.zoom_x_max},l.zoom.min=function(t){var e=this.internal,n=e.config,r=e.d3;return 0===t||t?void(n.zoom_x_min=r.min([e.orgXDomain[0],t])):n.zoom_x_min},l.zoom.range=function(t){return arguments.length?(x(t.max)&&this.domain.max(t.max),void(x(t.min)&&this.domain.min(t.min))):{max:this.domain.max(),min:this.domain.min()}},l.load=function(t){var e=this.internal,n=e.config;return t.xs&&e.addXs(t.xs),"names"in t&&l.data.names.bind(this)(t.names),"classes"in t&&Object.keys(t.classes).forEach(function(e){n.data_classes[e]=t.classes[e]}),"categories"in t&&e.isCategorized()&&(n.axis_x_categories=t.categories),"axes"in t&&Object.keys(t.axes).forEach(function(e){n.data_axes[e]=t.axes[e]}),"colors"in t&&Object.keys(t.colors).forEach(function(e){n.data_colors[e]=t.colors[e]}),"cacheIds"in t&&e.hasCaches(t.cacheIds)?void e.load(e.getCaches(t.cacheIds),t.done):void("unload"in t?e.unload(e.mapToTargetIds("boolean"==typeof t.unload&&t.unload?null:t.unload),function(){e.loadFromArgs(t)}):e.loadFromArgs(t))},l.unload=function(t){var e=this.internal;t=t||{},t instanceof Array?t={ids:t}:"string"==typeof t&&(t={ids:[t]}),e.unload(e.mapToTargetIds(t.ids),function(){e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),t.done&&t.done()})},l.flow=function(t){var e,n,r,i,a,o,s,u,c=this.internal,l=[],h=c.getMaxDataCount(),d=0,f=0;if(t.json)n=c.convertJsonToData(t.json,t.keys);else if(t.rows)n=c.convertRowsToData(t.rows);else{if(!t.columns)return;n=c.convertColumnsToData(t.columns)}e=c.convertDataToTargets(n,!0),c.data.targets.forEach(function(t){var n,r,i=!1;for(n=0;n1?a.values[a.values.length-1].x-o.x:o.x-c.getXDomain(c.data.targets)[0]:1,i=[o.x-s,o.x],c.updateXDomain(null,!0,!0,!1,i)),c.updateTargets(c.data.targets),c.redraw({flow:{index:o.index,length:d,duration:g(t.duration)?t.duration:c.config.transition_duration,done:t.done,orgDataCount:h},withLegend:!0,withTransition:h>1,withTrimXDomain:!1,withUpdateXAxis:!0})},h.generateFlow=function(t){var e=this,n=e.config,r=e.d3;return function(){var i,a,o,s=t.targets,u=t.flow,c=t.drawBar,l=t.drawLine,h=t.drawArea,d=t.cx,f=t.cy,g=t.xv,v=t.xForText,y=t.yForText,m=t.duration,x=1,_=u.index,b=u.length,w=e.getValueOnIndex(e.data.targets[0].values,_),T=e.getValueOnIndex(e.data.targets[0].values,_+b),A=e.x.domain(),C=u.duration||m,P=u.done||function(){},M=e.generateWait(),L=e.xgrid||r.selectAll([]),E=e.xgridLines||r.selectAll([]),k=e.mainRegion||r.selectAll([]),V=e.mainText||r.selectAll([]),O=e.mainBar||r.selectAll([]),I=e.mainLine||r.selectAll([]),R=e.mainArea||r.selectAll([]),G=e.mainCircle||r.selectAll([]);e.flowing=!0,e.data.targets.forEach(function(t){t.values.splice(0,b)}),o=e.updateXDomain(s,!0,!0),e.updateXGrid&&e.updateXGrid(!0),u.orgDataCount?i=1===u.orgDataCount||(w&&w.x)===(T&&T.x)?e.x(A[0])-e.x(o[0]):e.isTimeSeries()?e.x(A[0])-e.x(o[0]):e.x(w.x)-e.x(T.x):1!==e.data.targets[0].values.length?i=e.x(A[0])-e.x(o[0]):e.isTimeSeries()?(w=e.getValueOnIndex(e.data.targets[0].values,0),T=e.getValueOnIndex(e.data.targets[0].values,e.data.targets[0].values.length-1),i=e.x(w.x)-e.x(T.x)):i=S(o)/2,x=S(A)/S(o),a="translate("+i+",0) scale("+x+",1)",e.hideXGridFocus(),r.transition().ease("linear").duration(C).each(function(){M.add(e.axes.x.transition().call(e.xAxis)),M.add(O.transition().attr("transform",a)),M.add(I.transition().attr("transform",a)),M.add(R.transition().attr("transform",a)),M.add(G.transition().attr("transform",a)),M.add(V.transition().attr("transform",a)),M.add(k.filter(e.isRegionOnX).transition().attr("transform",a)),M.add(L.transition().attr("transform",a)),M.add(E.transition().attr("transform",a))}).call(M,function(){var t,r=[],i=[],a=[];if(b){for(t=0;t=0,d=!e||e.indexOf(s)>=0,f=u.classed(p.SELECTED);u.classed(p.line)||u.classed(p.area)||(h&&d?a.data_selection_isselectable(o)&&!f&&l(!0,u.classed(p.SELECTED,!0),o,s):x(n)&&n&&f&&l(!1,u.classed(p.SELECTED,!1),o,s))})},l.unselect=function(t,e){var n=this.internal,r=n.d3,i=n.config;i.data_selection_enabled&&n.main.selectAll("."+p.shapes).selectAll("."+p.shape).each(function(a,o){var s=r.select(this),u=a.data?a.data.id:a.id,c=n.getToggle(this,a).bind(n),l=i.data_selection_grouped||!t||t.indexOf(u)>=0,h=!e||e.indexOf(o)>=0,d=s.classed(p.SELECTED);s.classed(p.line)||s.classed(p.area)||l&&h&&i.data_selection_isselectable(a)&&d&&c(!1,s.classed(p.SELECTED,!1),a,o)})},l.transform=function(t,e){var n=this.internal,r=["pie","donut"].indexOf(t)>=0?{withTransform:!0}:null;n.transformTo(e,t,r)},h.transformTo=function(t,e,n){var r=this,i=!r.hasArcType(),a=n||{withTransitionForAxis:i};a.withTransitionForTransform=!1,r.transiting=!1,r.setTargetType(t,e),r.updateTargets(r.data.targets),r.updateAndRedraw(a)},l.groups=function(t){var e=this.internal,n=e.config;return m(t)?n.data_groups:(n.data_groups=t,e.redraw(),n.data_groups)},l.xgrids=function(t){var e=this.internal,n=e.config;return t?(n.grid_x_lines=t,e.redrawWithoutRescale(),n.grid_x_lines):n.grid_x_lines},l.xgrids.add=function(t){var e=this.internal;return this.xgrids(e.config.grid_x_lines.concat(t?t:[]))},l.xgrids.remove=function(t){var e=this.internal;e.removeGridLines(t,!0)},l.ygrids=function(t){var e=this.internal,n=e.config;return t?(n.grid_y_lines=t,e.redrawWithoutRescale(),n.grid_y_lines):n.grid_y_lines},l.ygrids.add=function(t){var e=this.internal;return this.ygrids(e.config.grid_y_lines.concat(t?t:[]))},l.ygrids.remove=function(t){var e=this.internal;e.removeGridLines(t,!1)},l.regions=function(t){var e=this.internal,n=e.config;return t?(n.regions=t,e.redrawWithoutRescale(),n.regions):n.regions},l.regions.add=function(t){var e=this.internal,n=e.config;return t?(n.regions=n.regions.concat(t),e.redrawWithoutRescale(),n.regions):n.regions},l.regions.remove=function(t){var e,n,r,i=this.internal,a=i.config;return t=t||{},e=i.getOption(t,"duration",a.transition_duration),n=i.getOption(t,"classes",[p.region]),r=i.main.select("."+p.regions).selectAll(n.map(function(t){return"."+t})),(e?r.transition().duration(e):r).style("opacity",0).remove(),a.regions=a.regions.filter(function(t){var e=!1;return!t.class||(t.class.split(" ").forEach(function(t){n.indexOf(t)>=0&&(e=!0)}),!e)}),a.regions},l.data=function(t){var e=this.internal.data.targets;return"undefined"==typeof t?e:e.filter(function(e){return[].concat(t).indexOf(e.id)>=0})},l.data.shown=function(t){return this.internal.filterTargetsToShow(this.data(t))},l.data.values=function(t){var e,n=null;return t&&(e=this.data(t),n=e[0]?e[0].values.map(function(t){return t.value}):null),n},l.data.names=function(t){return this.internal.clearLegendItemTextBoxCache(),this.internal.updateDataAttributes("names",t)},l.data.colors=function(t){return this.internal.updateDataAttributes("colors",t)},l.data.axes=function(t){return this.internal.updateDataAttributes("axes",t)},l.category=function(t,e){var n=this.internal,r=n.config;return arguments.length>1&&(r.axis_x_categories[t]=e,n.redraw()),r.axis_x_categories[t]},l.categories=function(t){var e=this.internal,n=e.config;return arguments.length?(n.axis_x_categories=t,e.redraw(),n.axis_x_categories):n.axis_x_categories},l.color=function(t){var e=this.internal;return e.color(t)},l.x=function(t){var e=this.internal;return arguments.length&&(e.updateTargetX(e.data.targets,t),e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),e.data.xs},l.xs=function(t){var e=this.internal;return arguments.length&&(e.updateTargetXs(e.data.targets,t),e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),e.data.xs},l.axis=function(){},l.axis.labels=function(t){var e=this.internal;arguments.length&&(Object.keys(t).forEach(function(n){e.axis.setLabelText(n,t[n])}),e.axis.updateLabels())},l.axis.max=function(t){var e=this.internal,n=e.config;return arguments.length?("object"==typeof t?(g(t.x)&&(n.axis_x_max=t.x),g(t.y)&&(n.axis_y_max=t.y),g(t.y2)&&(n.axis_y2_max=t.y2)):n.axis_y_max=n.axis_y2_max=t,void e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})):{x:n.axis_x_max,y:n.axis_y_max,y2:n.axis_y2_max}},l.axis.min=function(t){var e=this.internal,n=e.config;return arguments.length?("object"==typeof t?(g(t.x)&&(n.axis_x_min=t.x),g(t.y)&&(n.axis_y_min=t.y),g(t.y2)&&(n.axis_y2_min=t.y2)):n.axis_y_min=n.axis_y2_min=t,void e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})):{x:n.axis_x_min,y:n.axis_y_min,y2:n.axis_y2_min}},l.axis.range=function(t){return arguments.length?(x(t.max)&&this.axis.max(t.max),void(x(t.min)&&this.axis.min(t.min))):{max:this.axis.max(),min:this.axis.min()}},l.legend=function(){},l.legend.show=function(t){var e=this.internal;e.showLegend(e.mapToTargetIds(t)),e.updateAndRedraw({withLegend:!0})},l.legend.hide=function(t){var e=this.internal;e.hideLegend(e.mapToTargetIds(t)),e.updateAndRedraw({withLegend:!0})},l.resize=function(t){var e=this.internal,n=e.config;n.size_width=t?t.width:null,n.size_height=t?t.height:null,this.flush()},l.flush=function(){var t=this.internal;t.updateAndRedraw({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},l.destroy=function(){var t=this.internal;if(r.clearInterval(t.intervalForObserveInserted),void 0!==t.resizeTimeout&&r.clearTimeout(t.resizeTimeout),r.detachEvent)r.detachEvent("onresize",t.resizeFunction);else if(r.removeEventListener)r.removeEventListener("resize",t.resizeFunction);else{var e=r.onresize;e&&e.add&&e.remove&&e.remove(t.resizeFunction)}return t.selectChart.classed("c3",!1).html(""),Object.keys(t).forEach(function(e){t[e]=null}),null},l.tooltip=function(){},l.tooltip.show=function(t){var e,n,r=this.internal;t.mouse&&(n=t.mouse),t.data?r.isMultipleX()?(n=[r.x(t.data.x),r.getYScale(t.data.id)(t.data.value)],e=null):e=g(t.data.index)?t.data.index:r.getIndexByX(t.data.x):"undefined"!=typeof t.x?e=r.getIndexByX(t.x):"undefined"!=typeof t.index&&(e=t.index),r.dispatchEvent("mouseover",e,n),r.dispatchEvent("mousemove",e,n),r.config.tooltip_onshow.call(r,t.data)},l.tooltip.hide=function(){this.internal.dispatchEvent("mouseout",0),this.internal.config.tooltip_onhide.call(this)};var L;h.isSafari=function(){var t=r.navigator.userAgent;return t.indexOf("Safari")>=0&&t.indexOf("Chrome")<0},h.isChrome=function(){var t=r.navigator.userAgent;return t.indexOf("Chrome")>=0},Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=Array.prototype.slice.call(arguments,1),n=this,r=function(){},i=function(){return n.apply(this instanceof r?this:t,e.concat(Array.prototype.slice.call(arguments)))};return r.prototype=this.prototype,i.prototype=new r,i}),function(){"SVGPathSeg"in r||(r.SVGPathSeg=function(t,e,n){this.pathSegType=t,this.pathSegTypeAsLetter=e,this._owningPathSegList=n},SVGPathSeg.PATHSEG_UNKNOWN=0,SVGPathSeg.PATHSEG_CLOSEPATH=1,SVGPathSeg.PATHSEG_MOVETO_ABS=2,SVGPathSeg.PATHSEG_MOVETO_REL=3,SVGPathSeg.PATHSEG_LINETO_ABS=4,SVGPathSeg.PATHSEG_LINETO_REL=5,SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS=6,SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL=7,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS=8,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL=9,SVGPathSeg.PATHSEG_ARC_ABS=10,SVGPathSeg.PATHSEG_ARC_REL=11,SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS=12,SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL=13,SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS=14,SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL=15,SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS=16,SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL=17,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS=18,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL=19,SVGPathSeg.prototype._segmentChanged=function(){this._owningPathSegList&&this._owningPathSegList.segmentChanged(this)},r.SVGPathSegClosePath=function(t){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CLOSEPATH,"z",t)},SVGPathSegClosePath.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegClosePath.prototype.toString=function(){return"[object SVGPathSegClosePath]"},SVGPathSegClosePath.prototype._asPathString=function(){return this.pathSegTypeAsLetter},SVGPathSegClosePath.prototype.clone=function(){return new SVGPathSegClosePath((void 0))},r.SVGPathSegMovetoAbs=function(t,e,n){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_MOVETO_ABS,"M",t),this._x=e,this._y=n},SVGPathSegMovetoAbs.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegMovetoAbs.prototype.toString=function(){return"[object SVGPathSegMovetoAbs]"},SVGPathSegMovetoAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},SVGPathSegMovetoAbs.prototype.clone=function(){return new SVGPathSegMovetoAbs((void 0),this._x,this._y)},Object.defineProperty(SVGPathSegMovetoAbs.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegMovetoAbs.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._segmentChanged()},enumerable:!0}),r.SVGPathSegMovetoRel=function(t,e,n){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_MOVETO_REL,"m",t),this._x=e,this._y=n},SVGPathSegMovetoRel.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegMovetoRel.prototype.toString=function(){return"[object SVGPathSegMovetoRel]"},SVGPathSegMovetoRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},SVGPathSegMovetoRel.prototype.clone=function(){return new SVGPathSegMovetoRel((void 0),this._x,this._y)},Object.defineProperty(SVGPathSegMovetoRel.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegMovetoRel.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._segmentChanged()},enumerable:!0}),r.SVGPathSegLinetoAbs=function(t,e,n){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_ABS,"L",t),this._x=e,this._y=n},SVGPathSegLinetoAbs.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegLinetoAbs.prototype.toString=function(){return"[object SVGPathSegLinetoAbs]"},SVGPathSegLinetoAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},SVGPathSegLinetoAbs.prototype.clone=function(){return new SVGPathSegLinetoAbs((void 0),this._x,this._y)},Object.defineProperty(SVGPathSegLinetoAbs.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegLinetoAbs.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._segmentChanged()},enumerable:!0}),r.SVGPathSegLinetoRel=function(t,e,n){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_REL,"l",t),this._x=e,this._y=n},SVGPathSegLinetoRel.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegLinetoRel.prototype.toString=function(){return"[object SVGPathSegLinetoRel]"},SVGPathSegLinetoRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},SVGPathSegLinetoRel.prototype.clone=function(){return new SVGPathSegLinetoRel((void 0),this._x,this._y)},Object.defineProperty(SVGPathSegLinetoRel.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegLinetoRel.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._segmentChanged()},enumerable:!0}),r.SVGPathSegCurvetoCubicAbs=function(t,e,n,r,i,a,o){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS,"C",t),this._x=e,this._y=n,this._x1=r,this._y1=i,this._x2=a,this._y2=o},SVGPathSegCurvetoCubicAbs.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegCurvetoCubicAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicAbs]"},SVGPathSegCurvetoCubicAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y},SVGPathSegCurvetoCubicAbs.prototype.clone=function(){return new SVGPathSegCurvetoCubicAbs((void 0),this._x,this._y,this._x1,this._y1,this._x2,this._y2)},Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"x1",{get:function(){return this._x1},set:function(t){this._x1=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"y1",{get:function(){return this._y1},set:function(t){this._y1=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"x2",{get:function(){return this._x2},set:function(t){this._x2=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"y2",{get:function(){return this._y2},set:function(t){this._y2=t,this._segmentChanged()},enumerable:!0}),r.SVGPathSegCurvetoCubicRel=function(t,e,n,r,i,a,o){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL,"c",t),this._x=e,this._y=n,this._x1=r,this._y1=i,this._x2=a,this._y2=o},SVGPathSegCurvetoCubicRel.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegCurvetoCubicRel.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicRel]"},SVGPathSegCurvetoCubicRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y},SVGPathSegCurvetoCubicRel.prototype.clone=function(){return new SVGPathSegCurvetoCubicRel((void 0),this._x,this._y,this._x1,this._y1,this._x2,this._y2)},Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"x1",{get:function(){return this._x1},set:function(t){this._x1=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"y1",{get:function(){return this._y1},set:function(t){this._y1=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"x2",{get:function(){return this._x2},set:function(t){this._x2=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"y2",{get:function(){return this._y2},set:function(t){this._y2=t,this._segmentChanged()},enumerable:!0}),r.SVGPathSegCurvetoQuadraticAbs=function(t,e,n,r,i){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS,"Q",t),this._x=e,this._y=n,this._x1=r,this._y1=i},SVGPathSegCurvetoQuadraticAbs.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegCurvetoQuadraticAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticAbs]"},SVGPathSegCurvetoQuadraticAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y},SVGPathSegCurvetoQuadraticAbs.prototype.clone=function(){return new SVGPathSegCurvetoQuadraticAbs((void 0),this._x,this._y,this._x1,this._y1)},Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype,"x1",{get:function(){return this._x1},set:function(t){this._x1=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype,"y1",{get:function(){return this._y1},set:function(t){this._y1=t,this._segmentChanged()},enumerable:!0}),r.SVGPathSegCurvetoQuadraticRel=function(t,e,n,r,i){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL,"q",t),this._x=e,this._y=n,this._x1=r,this._y1=i},SVGPathSegCurvetoQuadraticRel.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegCurvetoQuadraticRel.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticRel]"},SVGPathSegCurvetoQuadraticRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y},SVGPathSegCurvetoQuadraticRel.prototype.clone=function(){return new SVGPathSegCurvetoQuadraticRel((void 0),this._x,this._y,this._x1,this._y1)},Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype,"x1",{get:function(){return this._x1},set:function(t){this._x1=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype,"y1",{get:function(){return this._y1},set:function(t){this._y1=t,this._segmentChanged()},enumerable:!0}),r.SVGPathSegArcAbs=function(t,e,n,r,i,a,o,s){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_ARC_ABS,"A",t),this._x=e,this._y=n,this._r1=r,this._r2=i,this._angle=a,this._largeArcFlag=o,this._sweepFlag=s},SVGPathSegArcAbs.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegArcAbs.prototype.toString=function(){return"[object SVGPathSegArcAbs]"},SVGPathSegArcAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y},SVGPathSegArcAbs.prototype.clone=function(){return new SVGPathSegArcAbs((void 0),this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)},Object.defineProperty(SVGPathSegArcAbs.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegArcAbs.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegArcAbs.prototype,"r1",{get:function(){return this._r1},set:function(t){this._r1=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegArcAbs.prototype,"r2",{get:function(){return this._r2},set:function(t){this._r2=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegArcAbs.prototype,"angle",{get:function(){return this._angle},set:function(t){this._angle=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegArcAbs.prototype,"largeArcFlag",{get:function(){return this._largeArcFlag},set:function(t){this._largeArcFlag=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegArcAbs.prototype,"sweepFlag",{get:function(){return this._sweepFlag},set:function(t){this._sweepFlag=t,this._segmentChanged()},enumerable:!0}),r.SVGPathSegArcRel=function(t,e,n,r,i,a,o,s){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_ARC_REL,"a",t),this._x=e,this._y=n,this._r1=r,this._r2=i,this._angle=a,this._largeArcFlag=o,this._sweepFlag=s},SVGPathSegArcRel.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegArcRel.prototype.toString=function(){return"[object SVGPathSegArcRel]"},SVGPathSegArcRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y},SVGPathSegArcRel.prototype.clone=function(){return new SVGPathSegArcRel((void 0),this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)},Object.defineProperty(SVGPathSegArcRel.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegArcRel.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegArcRel.prototype,"r1",{get:function(){return this._r1},set:function(t){this._r1=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegArcRel.prototype,"r2",{get:function(){return this._r2},set:function(t){this._r2=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegArcRel.prototype,"angle",{get:function(){return this._angle},set:function(t){this._angle=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegArcRel.prototype,"largeArcFlag",{get:function(){return this._largeArcFlag},set:function(t){this._largeArcFlag=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegArcRel.prototype,"sweepFlag",{get:function(){return this._sweepFlag},set:function(t){this._sweepFlag=t,this._segmentChanged()},enumerable:!0}),r.SVGPathSegLinetoHorizontalAbs=function(t,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS,"H",t),this._x=e},SVGPathSegLinetoHorizontalAbs.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegLinetoHorizontalAbs.prototype.toString=function(){return"[object SVGPathSegLinetoHorizontalAbs]"},SVGPathSegLinetoHorizontalAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x},SVGPathSegLinetoHorizontalAbs.prototype.clone=function(){return new SVGPathSegLinetoHorizontalAbs((void 0),this._x)},Object.defineProperty(SVGPathSegLinetoHorizontalAbs.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._segmentChanged()},enumerable:!0}),r.SVGPathSegLinetoHorizontalRel=function(t,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL,"h",t),this._x=e},SVGPathSegLinetoHorizontalRel.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegLinetoHorizontalRel.prototype.toString=function(){return"[object SVGPathSegLinetoHorizontalRel]"},SVGPathSegLinetoHorizontalRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x},SVGPathSegLinetoHorizontalRel.prototype.clone=function(){return new SVGPathSegLinetoHorizontalRel((void 0),this._x)},Object.defineProperty(SVGPathSegLinetoHorizontalRel.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._segmentChanged()},enumerable:!0}),r.SVGPathSegLinetoVerticalAbs=function(t,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS,"V",t),this._y=e},SVGPathSegLinetoVerticalAbs.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegLinetoVerticalAbs.prototype.toString=function(){return"[object SVGPathSegLinetoVerticalAbs]"},SVGPathSegLinetoVerticalAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._y},SVGPathSegLinetoVerticalAbs.prototype.clone=function(){return new SVGPathSegLinetoVerticalAbs((void 0),this._y)},Object.defineProperty(SVGPathSegLinetoVerticalAbs.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._segmentChanged()},enumerable:!0}),r.SVGPathSegLinetoVerticalRel=function(t,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL,"v",t),this._y=e},SVGPathSegLinetoVerticalRel.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegLinetoVerticalRel.prototype.toString=function(){return"[object SVGPathSegLinetoVerticalRel]"},SVGPathSegLinetoVerticalRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._y},SVGPathSegLinetoVerticalRel.prototype.clone=function(){return new SVGPathSegLinetoVerticalRel((void 0),this._y)},Object.defineProperty(SVGPathSegLinetoVerticalRel.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._segmentChanged()},enumerable:!0}),r.SVGPathSegCurvetoCubicSmoothAbs=function(t,e,n,r,i){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,"S",t),this._x=e,this._y=n,this._x2=r,this._y2=i},SVGPathSegCurvetoCubicSmoothAbs.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegCurvetoCubicSmoothAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicSmoothAbs]"},SVGPathSegCurvetoCubicSmoothAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y},SVGPathSegCurvetoCubicSmoothAbs.prototype.clone=function(){return new SVGPathSegCurvetoCubicSmoothAbs((void 0),this._x,this._y,this._x2,this._y2)},Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype,"x2",{get:function(){return this._x2},set:function(t){this._x2=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype,"y2",{get:function(){return this._y2},set:function(t){this._y2=t,this._segmentChanged()},enumerable:!0}),r.SVGPathSegCurvetoCubicSmoothRel=function(t,e,n,r,i){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,"s",t),this._x=e,this._y=n,this._x2=r,this._y2=i},SVGPathSegCurvetoCubicSmoothRel.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegCurvetoCubicSmoothRel.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicSmoothRel]"},SVGPathSegCurvetoCubicSmoothRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y},SVGPathSegCurvetoCubicSmoothRel.prototype.clone=function(){return new SVGPathSegCurvetoCubicSmoothRel((void 0),this._x,this._y,this._x2,this._y2)},Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype,"x2",{get:function(){return this._x2},set:function(t){this._x2=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype,"y2",{get:function(){return this._y2},set:function(t){this._y2=t,this._segmentChanged()},enumerable:!0}),r.SVGPathSegCurvetoQuadraticSmoothAbs=function(t,e,n){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,"T",t),this._x=e,this._y=n},SVGPathSegCurvetoQuadraticSmoothAbs.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegCurvetoQuadraticSmoothAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticSmoothAbs]"},SVGPathSegCurvetoQuadraticSmoothAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},SVGPathSegCurvetoQuadraticSmoothAbs.prototype.clone=function(){return new SVGPathSegCurvetoQuadraticSmoothAbs((void 0),this._x,this._y)},Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothAbs.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothAbs.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._segmentChanged()},enumerable:!0}),r.SVGPathSegCurvetoQuadraticSmoothRel=function(t,e,n){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,"t",t),this._x=e,this._y=n},SVGPathSegCurvetoQuadraticSmoothRel.prototype=Object.create(SVGPathSeg.prototype),SVGPathSegCurvetoQuadraticSmoothRel.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticSmoothRel]"},SVGPathSegCurvetoQuadraticSmoothRel.prototype._asPathString=function(){ -return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},SVGPathSegCurvetoQuadraticSmoothRel.prototype.clone=function(){return new SVGPathSegCurvetoQuadraticSmoothRel((void 0),this._x,this._y)},Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothRel.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._segmentChanged()},enumerable:!0}),Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothRel.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._segmentChanged()},enumerable:!0}),SVGPathElement.prototype.createSVGPathSegClosePath=function(){return new SVGPathSegClosePath((void 0))},SVGPathElement.prototype.createSVGPathSegMovetoAbs=function(t,e){return new SVGPathSegMovetoAbs((void 0),t,e)},SVGPathElement.prototype.createSVGPathSegMovetoRel=function(t,e){return new SVGPathSegMovetoRel((void 0),t,e)},SVGPathElement.prototype.createSVGPathSegLinetoAbs=function(t,e){return new SVGPathSegLinetoAbs((void 0),t,e)},SVGPathElement.prototype.createSVGPathSegLinetoRel=function(t,e){return new SVGPathSegLinetoRel((void 0),t,e)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs=function(t,e,n,r,i,a){return new SVGPathSegCurvetoCubicAbs((void 0),t,e,n,r,i,a)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel=function(t,e,n,r,i,a){return new SVGPathSegCurvetoCubicRel((void 0),t,e,n,r,i,a)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs=function(t,e,n,r){return new SVGPathSegCurvetoQuadraticAbs((void 0),t,e,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel=function(t,e,n,r){return new SVGPathSegCurvetoQuadraticRel((void 0),t,e,n,r)},SVGPathElement.prototype.createSVGPathSegArcAbs=function(t,e,n,r,i,a,o){return new SVGPathSegArcAbs((void 0),t,e,n,r,i,a,o)},SVGPathElement.prototype.createSVGPathSegArcRel=function(t,e,n,r,i,a,o){return new SVGPathSegArcRel((void 0),t,e,n,r,i,a,o)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs=function(t){return new SVGPathSegLinetoHorizontalAbs((void 0),t)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel=function(t){return new SVGPathSegLinetoHorizontalRel((void 0),t)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs=function(t){return new SVGPathSegLinetoVerticalAbs((void 0),t)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel=function(t){return new SVGPathSegLinetoVerticalRel((void 0),t)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs=function(t,e,n,r){return new SVGPathSegCurvetoCubicSmoothAbs((void 0),t,e,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel=function(t,e,n,r){return new SVGPathSegCurvetoCubicSmoothRel((void 0),t,e,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs=function(t,e){return new SVGPathSegCurvetoQuadraticSmoothAbs((void 0),t,e)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel=function(t,e){return new SVGPathSegCurvetoQuadraticSmoothRel((void 0),t,e)}),"SVGPathSegList"in r||(r.SVGPathSegList=function(t){this._pathElement=t,this._list=this._parsePath(this._pathElement.getAttribute("d")),this._mutationObserverConfig={attributes:!0,attributeFilter:["d"]},this._pathElementMutationObserver=new MutationObserver(this._updateListFromPathMutations.bind(this)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)},Object.defineProperty(SVGPathSegList.prototype,"numberOfItems",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),Object.defineProperty(SVGPathElement.prototype,"pathSegList",{get:function(){return this._pathSegList||(this._pathSegList=new SVGPathSegList(this)),this._pathSegList},enumerable:!0}),Object.defineProperty(SVGPathElement.prototype,"normalizedPathSegList",{get:function(){return this.pathSegList},enumerable:!0}),Object.defineProperty(SVGPathElement.prototype,"animatedPathSegList",{get:function(){return this.pathSegList},enumerable:!0}),Object.defineProperty(SVGPathElement.prototype,"animatedNormalizedPathSegList",{get:function(){return this.pathSegList},enumerable:!0}),SVGPathSegList.prototype._checkPathSynchronizedToList=function(){this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords())},SVGPathSegList.prototype._updateListFromPathMutations=function(t){if(this._pathElement){var e=!1;t.forEach(function(t){"d"==t.attributeName&&(e=!0)}),e&&(this._list=this._parsePath(this._pathElement.getAttribute("d")))}},SVGPathSegList.prototype._writeListToPath=function(){this._pathElementMutationObserver.disconnect(),this._pathElement.setAttribute("d",SVGPathSegList._pathSegArrayAsString(this._list)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)},SVGPathSegList.prototype.segmentChanged=function(t){this._writeListToPath()},SVGPathSegList.prototype.clear=function(){this._checkPathSynchronizedToList(),this._list.forEach(function(t){t._owningPathSegList=null}),this._list=[],this._writeListToPath()},SVGPathSegList.prototype.initialize=function(t){return this._checkPathSynchronizedToList(),this._list=[t],t._owningPathSegList=this,this._writeListToPath(),t},SVGPathSegList.prototype._checkValidIndex=function(t){if(isNaN(t)||t<0||t>=this.numberOfItems)throw"INDEX_SIZE_ERR"},SVGPathSegList.prototype.getItem=function(t){return this._checkPathSynchronizedToList(),this._checkValidIndex(t),this._list[t]},SVGPathSegList.prototype.insertItemBefore=function(t,e){return this._checkPathSynchronizedToList(),e>this.numberOfItems&&(e=this.numberOfItems),t._owningPathSegList&&(t=t.clone()),this._list.splice(e,0,t),t._owningPathSegList=this,this._writeListToPath(),t},SVGPathSegList.prototype.replaceItem=function(t,e){return this._checkPathSynchronizedToList(),t._owningPathSegList&&(t=t.clone()),this._checkValidIndex(e),this._list[e]=t,t._owningPathSegList=this,this._writeListToPath(),t},SVGPathSegList.prototype.removeItem=function(t){this._checkPathSynchronizedToList(),this._checkValidIndex(t);var e=this._list[t];return this._list.splice(t,1),this._writeListToPath(),e},SVGPathSegList.prototype.appendItem=function(t){return this._checkPathSynchronizedToList(),t._owningPathSegList&&(t=t.clone()),this._list.push(t),t._owningPathSegList=this,this._writeListToPath(),t},SVGPathSegList._pathSegArrayAsString=function(t){var e="",n=!0;return t.forEach(function(t){n?(n=!1,e+=t._asPathString()):e+=" "+t._asPathString()}),e},SVGPathSegList.prototype._parsePath=function(t){if(!t||0==t.length)return[];var e=this,n=function(){this.pathSegList=[]};n.prototype.appendSegment=function(t){this.pathSegList.push(t)};var r=function(t){this._string=t,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()};r.prototype._isCurrentSpace=function(){var t=this._string[this._currentIndex];return t<=" "&&(" "==t||"\n"==t||"\t"==t||"\r"==t||"\f"==t)},r.prototype._skipOptionalSpaces=function(){for(;this._currentIndex="0"&&t<="9")&&e!=SVGPathSeg.PATHSEG_CLOSEPATH?e==SVGPathSeg.PATHSEG_MOVETO_ABS?SVGPathSeg.PATHSEG_LINETO_ABS:e==SVGPathSeg.PATHSEG_MOVETO_REL?SVGPathSeg.PATHSEG_LINETO_REL:e:SVGPathSeg.PATHSEG_UNKNOWN},r.prototype.initialCommandIsMoveTo=function(){if(!this.hasMoreData())return!0;var t=this.peekSegmentType();return t==SVGPathSeg.PATHSEG_MOVETO_ABS||t==SVGPathSeg.PATHSEG_MOVETO_REL},r.prototype._parseNumber=function(){var t=0,e=0,n=1,r=0,i=1,a=1,o=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex"9")&&"."!=this._string.charAt(this._currentIndex))){for(var s=this._currentIndex;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!=s)for(var u=this._currentIndex-1,c=1;u>=s;)e+=c*(this._string.charAt(u--)-"0"),c*=10;if(this._currentIndex=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)r+=(this._string.charAt(this._currentIndex++)-"0")*(n*=.1)}if(this._currentIndex!=o&&this._currentIndex+1=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)t*=10,t+=this._string.charAt(this._currentIndex)-"0",this._currentIndex++}var l=e+r;if(l*=i,t&&(l*=Math.pow(10,a*t)),o!=this._currentIndex)return this._skipOptionalSpacesOrDelimiter(),l}},r.prototype._parseArcFlag=function(){if(!(this._currentIndex>=this._endIndex)){var t=!1,e=this._string.charAt(this._currentIndex++);if("0"==e)t=!1;else{if("1"!=e)return;t=!0}return this._skipOptionalSpacesOrDelimiter(),t}},r.prototype.parseSegment=function(){var t=this._string[this._currentIndex],n=this._pathSegTypeFromChar(t);if(n==SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand==SVGPathSeg.PATHSEG_UNKNOWN)return null;if(n=this._nextCommandHelper(t,this._previousCommand),n==SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;switch(this._previousCommand=n,n){case SVGPathSeg.PATHSEG_MOVETO_REL:return new SVGPathSegMovetoRel(e,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_MOVETO_ABS:return new SVGPathSegMovetoAbs(e,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_REL:return new SVGPathSegLinetoRel(e,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_ABS:return new SVGPathSegLinetoAbs(e,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new SVGPathSegLinetoHorizontalRel(e,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new SVGPathSegLinetoHorizontalAbs(e,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new SVGPathSegLinetoVerticalRel(e,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new SVGPathSegLinetoVerticalAbs(e,this._parseNumber());case SVGPathSeg.PATHSEG_CLOSEPATH:return this._skipOptionalSpaces(),new SVGPathSegClosePath(e);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:var r={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicRel(e,r.x,r.y,r.x1,r.y1,r.x2,r.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:var r={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicAbs(e,r.x,r.y,r.x1,r.y1,r.x2,r.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:var r={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothRel(e,r.x,r.y,r.x2,r.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:var r={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothAbs(e,r.x,r.y,r.x2,r.y2);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:var r={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticRel(e,r.x,r.y,r.x1,r.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:var r={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticAbs(e,r.x,r.y,r.x1,r.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:return new SVGPathSegCurvetoQuadraticSmoothRel(e,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:return new SVGPathSegCurvetoQuadraticSmoothAbs(e,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_ARC_REL:var r={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcRel(e,r.x,r.y,r.x1,r.y1,r.arcAngle,r.arcLarge,r.arcSweep);case SVGPathSeg.PATHSEG_ARC_ABS:var r={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcAbs(e,r.x,r.y,r.x1,r.y1,r.arcAngle,r.arcLarge,r.arcSweep);default:throw"Unknown path seg type."}};var i=new n,a=new r(t);if(!a.initialCommandIsMoveTo())return[];for(;a.hasMoreData();){var o=a.parseSegment();if(!o)return[];i.appendSegment(o)}return i.pathSegList})}(),"function"==typeof define&&define.amd?define("c3",["d3"],function(){return f}):"undefined"!=typeof n&&"undefined"!=typeof e?e.exports=f:r.c3=f}(window)},{d3:11}],11:[function(t,e,n){!function(){function t(t){return t&&(t.ownerDocument||t.document||t).documentElement}function n(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function r(t,e){return te?1:t>=e?0:NaN}function i(t){return null===t?NaN:+t}function a(t){return!isNaN(t)}function o(t){return{left:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);r>>1;t(e[a],n)<0?r=a+1:i=a}return r},right:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);r>>1;t(e[a],n)>0?i=a:r=a+1}return r}}}function s(t){return t.length}function u(t){for(var e=1;t*e%1;)e*=10;return e}function c(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function l(){this._=Object.create(null)}function h(t){return(t+="")===_o||t[0]===bo?bo+t:t}function d(t){return(t+="")[0]===bo?t.slice(1):t}function f(t){return h(t)in this._}function p(t){return(t=h(t))in this._&&delete this._[t]}function g(){var t=[];for(var e in this._)t.push(d(e));return t}function v(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function m(){this._=Object.create(null)}function x(t){return t}function _(t,e,n){return function(){var r=n.apply(e,arguments);return r===e?t:r}}function b(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var n=0,r=So.length;n=e&&(e=i+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var c=Vo.get(t);return c&&(t=c,u=$),s?e?i:r:e?S:a}function W(t,e){return function(n){var r=uo.event;uo.event=n,e[0]=this.__data__;try{t.apply(this,e)}finally{uo.event=r}}}function $(t,e){var n=W(t,e);return function(t){var e=this,r=t.relatedTarget;r&&(r===e||8&r.compareDocumentPosition(e))||n.call(e,t)}}function Q(e){var r=".dragsuppress-"+ ++Io,i="click"+r,a=uo.select(n(e)).on("touchmove"+r,A).on("dragstart"+r,A).on("selectstart"+r,A);if(null==Oo&&(Oo=!("onselectstart"in e)&&b(e.style,"userSelect")),Oo){var o=t(e).style,s=o[Oo];o[Oo]="none"}return function(t){if(a.on(r,null),Oo&&(o[Oo]=s),t){var e=function(){a.on(i,null)};a.on(i,function(){A(),e()},!0),setTimeout(e,0)}}}function Z(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(Ro<0){var a=n(t);if(a.scrollX||a.scrollY){r=uo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();Ro=!(o.f||o.e),r.remove()}}return Ro?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function J(){return uo.event.changedTouches[0].identifier}function K(t){return t>0?1:t<0?-1:0}function tt(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function et(t){return t>1?0:t<-1?Do:Math.acos(t)}function nt(t){return t>1?Ho:t<-1?-Ho:Math.asin(t)}function rt(t){return((t=Math.exp(t))-1/t)/2}function it(t){return((t=Math.exp(t))+1/t)/2}function at(t){return((t=Math.exp(2*t))-1)/(t+1)}function ot(t){return(t=Math.sin(t/2))*t}function st(){}function ut(t,e,n){return this instanceof ut?(this.h=+t,this.s=+e,void(this.l=+n)):arguments.length<2?t instanceof ut?new ut(t.h,t.s,t.l):St(""+t,wt,ut):new ut(t,e,n)}function ct(t,e,n){function r(t){return t>360?t-=360:t<0&&(t+=360),t<60?a+(o-a)*t/60:t<180?o:t<240?a+(o-a)*(240-t)/60:a}function i(t){return Math.round(255*r(t))}var a,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,n=n<0?0:n>1?1:n,o=n<=.5?n*(1+e):n+e-n*e,a=2*n-o,new mt(i(t+120),i(t),i(t-120))}function lt(t,e,n){return this instanceof lt?(this.h=+t,this.c=+e,void(this.l=+n)):arguments.length<2?t instanceof lt?new lt(t.h,t.c,t.l):t instanceof dt?pt(t.l,t.a,t.b):pt((t=Tt((t=uo.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new lt(t,e,n)}function ht(t,e,n){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(n,Math.cos(t*=zo)*e,Math.sin(t)*e)}function dt(t,e,n){return this instanceof dt?(this.l=+t,this.a=+e,void(this.b=+n)):arguments.length<2?t instanceof dt?new dt(t.l,t.a,t.b):t instanceof lt?ht(t.h,t.c,t.l):Tt((t=mt(t)).r,t.g,t.b):new dt(t,e,n)}function ft(t,e,n){var r=(t+16)/116,i=r+e/500,a=r-n/200;return i=gt(i)*Ko,r=gt(r)*ts,a=gt(a)*es,new mt(yt(3.2404542*i-1.5371385*r-.4985314*a),yt(-.969266*i+1.8760108*r+.041556*a),yt(.0556434*i-.2040259*r+1.0572252*a))}function pt(t,e,n){return t>0?new lt(Math.atan2(n,e)*Xo,Math.sqrt(e*e+n*n),t):new lt(NaN,NaN,t)}function gt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function vt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function mt(t,e,n){return this instanceof mt?(this.r=~~t,this.g=~~e,void(this.b=~~n)):arguments.length<2?t instanceof mt?new mt(t.r,t.g,t.b):St(""+t,mt,ct):new mt(t,e,n)}function xt(t){return new mt(t>>16,t>>8&255,255&t)}function _t(t){return xt(t)+""}function bt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function St(t,e,n){var r,i,a,o=0,s=0,u=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return n(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(Ct(i[0]),Ct(i[1]),Ct(i[2]))}return(a=is.get(t))?e(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&a)>>4,o=o>>4|o,s=240&a,s=s>>4|s,u=15&a,u=u<<4|u):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,u=255&a)),e(o,s,u))}function wt(t,e,n){var r,i,a=Math.min(t/=255,e/=255,n/=255),o=Math.max(t,e,n),s=o-a,u=(o+a)/2;return s?(i=u<.5?s/(o+a):s/(2-o-a),r=t==o?(e-n)/s+(e0&&u<1?0:r),new ut(r,i,u)}function Tt(t,e,n){t=At(t),e=At(e),n=At(n);var r=vt((.4124564*t+.3575761*e+.1804375*n)/Ko),i=vt((.2126729*t+.7151522*e+.072175*n)/ts),a=vt((.0193339*t+.119192*e+.9503041*n)/es);return dt(116*i-16,500*(r-i),200*(i-a))}function At(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ct(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Pt(t){return"function"==typeof t?t:function(){return t}}function Mt(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),Lt(e,n,t,r)}}function Lt(t,e,n,r){function i(){var t,e=u.status;if(!e&&kt(u)||e>=200&&e<300||304===e){try{t=n.call(a,u)}catch(t){return void o.error.call(a,t)}o.load.call(a,t)}else o.error.call(a,u)}var a={},o=uo.dispatch("beforesend","progress","load","error"),s={},u=new XMLHttpRequest,c=null;return!this.XDomainRequest||"withCredentials"in u||!/^(http(s)?:)?\/\//.test(t)||(u=new XDomainRequest),"onload"in u?u.onload=u.onerror=i:u.onreadystatechange=function(){u.readyState>3&&i()},u.onprogress=function(t){var e=uo.event;uo.event=t;try{o.progress.call(a,u)}finally{uo.event=e}},a.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",a)},a.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",a):e},a.responseType=function(t){return arguments.length?(c=t,a):c},a.response=function(t){return n=t,a},["get","post"].forEach(function(t){a[t]=function(){return a.send.apply(a,[t].concat(lo(arguments)))}}),a.send=function(n,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),u.open(n,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),u.setRequestHeader)for(var l in s)u.setRequestHeader(l,s[l]);return null!=e&&u.overrideMimeType&&u.overrideMimeType(e),null!=c&&(u.responseType=c),null!=i&&a.on("error",i).on("load",function(t){i(null,t)}),o.beforesend.call(a,u),u.send(null==r?null:r),a},a.abort=function(){return u.abort(),a},uo.rebind(a,o,"on"),null==r?a:a.get(Et(r))}function Et(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}function kt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Vt(t,e,n){var r=arguments.length;r<2&&(e=0),r<3&&(n=Date.now());var i=n+e,a={c:t,t:i,n:null};return os?os.n=a:as=a,os=a,ss||(us=clearTimeout(us),ss=1,cs(Ot)),a}function Ot(){var t=It(),e=Rt()-t;e>24?(isFinite(e)&&(clearTimeout(us),us=setTimeout(Ot,e)),ss=0):(ss=1,cs(Ot))}function It(){for(var t=Date.now(),e=as;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Rt(){for(var t,e=as,n=1/0;e;)e.c?(e.t8?function(t){return t/n}:function(t){return t*n},symbol:t}}function Dt(t){var e=t.decimal,n=t.thousands,r=t.grouping,i=t.currency,a=r&&n?function(t,e){for(var i=t.length,a=[],o=0,s=r[0],u=0;i>0&&s>0&&(u+s+1>e&&(s=Math.max(1,e-u)),a.push(t.substring(i-=s,i+s)),!((u+=s+1)>e));)s=r[o=(o+1)%r.length];return a.reverse().join(n)}:x;return function(t){var n=hs.exec(t),r=n[1]||" ",o=n[2]||">",s=n[3]||"-",u=n[4]||"",c=n[5],l=+n[6],h=n[7],d=n[8],f=n[9],p=1,g="",v="",y=!1,m=!0;switch(d&&(d=+d.substring(1)),(c||"0"===r&&"="===o)&&(c=r="0",o="="),f){case"n":h=!0,f="g";break;case"%":p=100,v="%",f="f";break;case"p":p=100,v="%",f="r";break;case"b":case"o":case"x":case"X":"#"===u&&(g="0"+f.toLowerCase());case"c":m=!1;case"d":y=!0,d=0;break;case"s":p=-1,f="r"}"$"===u&&(g=i[0],v=i[1]),"r"!=f||d||(f="g"),null!=d&&("g"==f?d=Math.max(1,Math.min(21,d)):"e"!=f&&"f"!=f||(d=Math.max(0,Math.min(20,d)))),f=ds.get(f)||jt;var x=c&&h;return function(t){var n=v;if(y&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(p<0){var u=uo.formatPrefix(t,d);t=u.scale(t),n=u.symbol+v}else t*=p;t=f(t,d);var _,b,S=t.lastIndexOf(".");if(S<0){var w=m?t.lastIndexOf("e"):-1;w<0?(_=t,b=""):(_=t.substring(0,w),b=t.substring(w))}else _=t.substring(0,S),b=e+t.substring(S+1);!c&&h&&(_=a(_,1/0));var T=g.length+_.length+b.length+(x?0:i.length),A=T"===o?A+i+t:"^"===o?A.substring(0,T>>=1)+i+t+A.substring(T):i+(x?t:A+t))+n}}}function jt(t){return t+""}function Ft(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ht(t,e,n){function r(e){var n=t(e),r=a(n,1);return e-n1)for(;o=c)return-1;if(i=e.charCodeAt(s++),37===i){if(o=e.charAt(s++),a=L[o in vs?e.charAt(s++):o],!a||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function r(t,e,n){S.lastIndex=0;var r=S.exec(e.slice(n));return r?(t.w=w.get(r[0].toLowerCase()),n+r[0].length):-1}function i(t,e,n){_.lastIndex=0;var r=_.exec(e.slice(n));return r?(t.w=b.get(r[0].toLowerCase()),n+r[0].length):-1}function a(t,e,n){C.lastIndex=0;var r=C.exec(e.slice(n));return r?(t.m=P.get(r[0].toLowerCase()),n+r[0].length):-1}function o(t,e,n){T.lastIndex=0;var r=T.exec(e.slice(n));return r?(t.m=A.get(r[0].toLowerCase()),n+r[0].length):-1}function s(t,e,r){return n(t,M.c.toString(),e,r)}function u(t,e,r){return n(t,M.x.toString(),e,r)}function c(t,e,r){return n(t,M.X.toString(),e,r)}function l(t,e,n){var r=x.get(e.slice(n,n+=2).toLowerCase());return null==r?-1:(t.p=r,n)}var h=t.dateTime,d=t.date,f=t.time,p=t.periods,g=t.days,v=t.shortDays,y=t.months,m=t.shortMonths;e.utc=function(t){function n(t){try{ps=Ft;var e=new ps;return e._=t,r(e)}finally{ps=Date}}var r=e(t);return n.parse=function(t){try{ps=Ft;var e=r.parse(t);return e&&e._}finally{ps=Date}},n.toString=r.toString,n},e.multi=e.utc.multi=ce;var x=uo.map(),_=qt(g),b=Yt(g),S=qt(v),w=Yt(v),T=qt(y),A=Yt(y),C=qt(m),P=Yt(m);p.forEach(function(t,e){ -x.set(t.toLowerCase(),e)});var M={a:function(t){return v[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return m[t.getMonth()]},B:function(t){return y[t.getMonth()]},c:e(h),d:function(t,e){return Bt(t.getDate(),e,2)},e:function(t,e){return Bt(t.getDate(),e,2)},H:function(t,e){return Bt(t.getHours(),e,2)},I:function(t,e){return Bt(t.getHours()%12||12,e,2)},j:function(t,e){return Bt(1+fs.dayOfYear(t),e,3)},L:function(t,e){return Bt(t.getMilliseconds(),e,3)},m:function(t,e){return Bt(t.getMonth()+1,e,2)},M:function(t,e){return Bt(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Bt(t.getSeconds(),e,2)},U:function(t,e){return Bt(fs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Bt(fs.mondayOfYear(t),e,2)},x:e(d),X:e(f),y:function(t,e){return Bt(t.getFullYear()%100,e,2)},Y:function(t,e){return Bt(t.getFullYear()%1e4,e,4)},Z:se,"%":function(){return"%"}},L={a:r,A:i,b:a,B:o,c:s,d:ee,e:ee,H:re,I:re,j:ne,L:oe,m:te,M:ie,p:l,S:ae,U:Wt,w:Ut,W:$t,x:u,X:c,y:Zt,Y:Qt,Z:Jt,"%":ue};return e}function Bt(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a68?1900:2e3)}function te(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ee(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function ne(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function re(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function ie(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function ae(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function oe(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function se(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",r=xo(e)/60|0,i=xo(e)%60;return n+Bt(r,"0",2)+Bt(i,"0",2)}function ue(t,e,n){ms.lastIndex=0;var r=ms.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function ce(t){for(var e=t.length,n=-1;++n=0?1:-1,s=o*n,u=Math.cos(e),c=Math.sin(e),l=a*c,h=i*u+l*Math.cos(s),d=l*o*Math.sin(s);Ts.add(Math.atan2(d,h)),r=t,i=u,a=c}var e,n,r,i,a;As.point=function(o,s){As.point=t,r=(e=o)*zo,i=Math.cos(s=(n=s)*zo/2+Do/4),a=Math.sin(s)},As.lineEnd=function(){t(e,n)}}function ve(t){var e=t[0],n=t[1],r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function me(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function xe(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function be(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Se(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function we(t,e){return xo(t[0]-e[0])=0;--s)i.point((h=l[s])[0],h[1])}else r(f.x,f.p.x,-1,i);f=f.p}f=f.o,l=f.z,p=!p}while(!f.v);i.lineEnd()}}}function Ve(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r0){for(b||(a.polygonStart(),b=!0),a.lineStart();++o1&&2&e&&n.push(n.pop().concat(n.shift())),f.push(n.filter(Re))}var f,p,g,v=e(a),y=i.invert(r[0],r[1]),m={point:o,lineStart:u,lineEnd:c,polygonStart:function(){m.point=l,m.lineStart=h,m.lineEnd=d,f=[],p=[]},polygonEnd:function(){m.point=o,m.lineStart=u,m.lineEnd=c,f=uo.merge(f);var t=He(y,p);f.length?(b||(a.polygonStart(),b=!0),ke(f,Ne,t,n,a)):t&&(b||(a.polygonStart(),b=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),b&&(a.polygonEnd(),b=!1),f=p=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}},x=Ge(),_=e(x),b=!1;return m}}function Re(t){return t.length>1}function Ge(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:S,buffer:function(){var n=e;return e=[],t=null,n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function Ne(t,e){return((t=t.x)[0]<0?t[1]-Ho-Go:Ho-t[1])-((e=e.x)[0]<0?e[1]-Ho-Go:Ho-e[1])}function De(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?Do:-Do,u=xo(a-n);xo(u-Do)0?Ho:-Ho),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(a,r),e=0):i!==s&&u>=Do&&(xo(n-i)Go?Math.atan((Math.sin(e)*(a=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(e))*Math.sin(t))/(i*a*o)):(e+r)/2}function Fe(t,e,n,r){var i;if(null==t)i=n*Ho,r.point(-Do,i),r.point(0,i),r.point(Do,i),r.point(Do,0),r.point(Do,-i),r.point(0,-i),r.point(-Do,-i),r.point(-Do,0),r.point(-Do,i);else if(xo(t[0]-e[0])>Go){var a=t[0]=0?1:-1,w=S*b,T=w>Do,A=p*x;if(Ts.add(Math.atan2(A*S*Math.sin(w),g*_+A*Math.cos(w))),a+=T?b+S*jo:b,T^d>=n^y>=n){var C=me(ve(h),ve(t));be(C);var P=me(i,C);be(P);var M=(T^b>=0?-1:1)*nt(P[2]);(r>M||r===M&&(C[0]||C[1]))&&(o+=T^b>=0?1:-1)}if(!v++)break;d=y,p=x,g=_,h=t}}return(a<-Go||aa}function n(t){var n,a,u,c,l;return{lineStart:function(){c=u=!1,l=1},point:function(h,d){var f,p=[h,d],g=e(h,d),v=o?g?0:i(h,d):g?i(h+(h<0?Do:-Do),d):0;if(!n&&(c=u=g)&&t.lineStart(),g!==u&&(f=r(n,p),(we(n,f)||we(p,f))&&(p[0]+=Go,p[1]+=Go,g=e(p[0],p[1]))),g!==u)l=0,g?(t.lineStart(),f=r(p,n),t.point(f[0],f[1])):(f=r(n,p),t.point(f[0],f[1]),t.lineEnd()),n=f;else if(s&&n&&o^g){var y;v&a||!(y=r(p,n,!0))||(l=0,o?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!g||n&&we(n,p)||t.point(p[0],p[1]),n=p,u=g,a=v},lineEnd:function(){u&&t.lineEnd(),n=null},clean:function(){return l|(c&&u)<<1}}}function r(t,e,n){var r=ve(t),i=ve(e),o=[1,0,0],s=me(r,i),u=ye(s,s),c=s[0],l=u-c*c;if(!l)return!n&&t;var h=a*u/l,d=-a*c/l,f=me(o,s),p=_e(o,h),g=_e(s,d);xe(p,g);var v=f,y=ye(p,v),m=ye(v,v),x=y*y-m*(ye(p,p)-1);if(!(x<0)){var _=Math.sqrt(x),b=_e(v,(-y-_)/m);if(xe(b,p),b=Se(b),!n)return b;var S,w=t[0],T=e[0],A=t[1],C=e[1];T0^b[1]<(xo(b[0]-w)Do^(w<=b[0]&&b[0]<=T)){var E=_e(v,(-y+_)/m);return xe(E,p),[b,Se(E)]}}}function i(e,n){var r=o?t:Do-t,i=0;return e<-r?i|=1:e>r&&(i|=2),n<-r?i|=4:n>r&&(i|=8),i}var a=Math.cos(t),o=a>0,s=xo(a)>Go,u=vn(t,6*zo);return Ie(e,n,u,o?[0,-t]:[-Do,t-Do])}function Xe(t,e,n,r){return function(i){var a,o=i.a,s=i.b,u=o.x,c=o.y,l=s.x,h=s.y,d=0,f=1,p=l-u,g=h-c;if(a=t-u,p||!(a>0)){if(a/=p,p<0){if(a0){if(a>f)return;a>d&&(d=a)}if(a=n-u,p||!(a<0)){if(a/=p,p<0){if(a>f)return;a>d&&(d=a)}else if(p>0){if(a0)){if(a/=g,g<0){if(a0){if(a>f)return;a>d&&(d=a)}if(a=r-c,g||!(a<0)){if(a/=g,g<0){if(a>f)return;a>d&&(d=a)}else if(g>0){if(a0&&(i.a={x:u+d*p,y:c+d*g}),f<1&&(i.b={x:u+f*p,y:c+f*g}),i}}}}}}function Be(t,e,n,r){function i(r,i){return xo(r[0]-t)0?0:3:xo(r[0]-n)0?2:1:xo(r[1]-e)0?1:0:i>0?3:2}function a(t,e){return o(t.x,e.x)}function o(t,e){var n=i(t,1),r=i(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){function u(t){for(var e=0,n=v.length,r=t[1],i=0;ir&&tt(c,a,t)>0&&++e:a[1]<=r&&tt(c,a,t)<0&&--e,c=a;return 0!==e}function c(a,s,u,c){var l=0,h=0;if(null==a||(l=i(a,u))!==(h=i(s,u))||o(a,s)<0^u>0){do c.point(0===l||3===l?t:n,l>1?r:e);while((l=(l+u+4)%4)!==h)}else c.point(s[0],s[1])}function l(i,a){return t<=i&&i<=n&&e<=a&&a<=r}function h(t,e){l(t,e)&&s.point(t,e)}function d(){L.point=p,v&&v.push(y=[]),T=!0,w=!1,b=S=NaN}function f(){g&&(p(m,x),_&&w&&P.rejoin(),g.push(P.buffer())),L.point=h,w&&s.lineEnd()}function p(t,e){t=Math.max(-js,Math.min(js,t)),e=Math.max(-js,Math.min(js,e));var n=l(t,e);if(v&&y.push([t,e]),T)m=t,x=e,_=n,T=!1,n&&(s.lineStart(),s.point(t,e));else if(n&&w)s.point(t,e);else{var r={a:{x:b,y:S},b:{x:t,y:e}};M(r)?(w||(s.lineStart(),s.point(r.a.x,r.a.y)),s.point(r.b.x,r.b.y),n||s.lineEnd(),A=!1):n&&(s.lineStart(),s.point(t,e),A=!1)}b=t,S=e,w=n}var g,v,y,m,x,_,b,S,w,T,A,C=s,P=Ge(),M=Xe(t,e,n,r),L={point:h,lineStart:d,lineEnd:f,polygonStart:function(){s=P,g=[],v=[],A=!0},polygonEnd:function(){s=C,g=uo.merge(g);var e=u([t,r]),n=A&&e,i=g.length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),c(null,null,1,s),s.lineEnd()),i&&ke(g,a,e,c,s),s.polygonEnd()),g=v=y=null}};return L}}function qe(t){var e=0,n=Do/3,r=un(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*Do/180,n=t[1]*Do/180):[e/Do*180,n/Do*180]},i}function Ye(t,e){function n(t,e){var n=Math.sqrt(a-2*i*Math.sin(e))/i;return[n*Math.sin(t*=i),o-n*Math.cos(t)]}var r=Math.sin(t),i=(r+Math.sin(e))/2,a=1+r*(2*i-r),o=Math.sqrt(a)/i;return n.invert=function(t,e){var n=o-e;return[Math.atan2(t,n)/i,nt((a-(t*t+n*n)*i*i)/(2*i))]},n}function Ue(){function t(t,e){Hs+=i*t-r*e,r=t,i=e}var e,n,r,i;Ys.point=function(a,o){Ys.point=t,e=r=a,n=i=o},Ys.lineEnd=function(){t(e,n)}}function We(t,e){tBs&&(Bs=t),eqs&&(qs=e)}function $e(){function t(t,e){o.push("M",t,",",e,a)}function e(t,e){o.push("M",t,",",e),s.point=n}function n(t,e){o.push("L",t,",",e)}function r(){s.point=t}function i(){o.push("Z")}var a=Qe(4.5),o=[],s={point:t,lineStart:function(){s.point=e},lineEnd:r,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=r,s.point=t},pointRadius:function(t){return a=Qe(t),s},result:function(){if(o.length){var t=o.join("");return o=[],t}}};return s}function Qe(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ze(t,e){Ms+=t,Ls+=e,++Es}function Je(){function t(t,r){var i=t-e,a=r-n,o=Math.sqrt(i*i+a*a);ks+=o*(e+t)/2,Vs+=o*(n+r)/2,Os+=o,Ze(e=t,n=r)}var e,n;Ws.point=function(r,i){Ws.point=t,Ze(e=r,n=i)}}function Ke(){Ws.point=Ze}function tn(){function t(t,e){var n=t-r,a=e-i,o=Math.sqrt(n*n+a*a);ks+=o*(r+t)/2,Vs+=o*(i+e)/2,Os+=o,o=i*t-r*e,Is+=o*(r+t),Rs+=o*(i+e),Gs+=3*o,Ze(r=t,i=e)}var e,n,r,i;Ws.point=function(a,o){Ws.point=t,Ze(e=r=a,n=i=o)},Ws.lineEnd=function(){t(e,n)}}function en(t){function e(e,n){t.moveTo(e+o,n),t.arc(e,n,o,0,jo)}function n(e,n){t.moveTo(e,n),s.point=r}function r(e,n){t.lineTo(e,n)}function i(){s.point=e}function a(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=n},lineEnd:i,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return o=t,s},result:S};return s}function nn(t){function e(t){return(s?r:n)(t)}function n(e){return on(e,function(n,r){n=t(n,r),e.point(n[0],n[1])})}function r(e){function n(n,r){n=t(n,r),e.point(n[0],n[1])}function r(){x=NaN,T.point=a,e.lineStart()}function a(n,r){var a=ve([n,r]),o=t(n,r);i(x,_,m,b,S,w,x=o[0],_=o[1],m=n,b=a[0],S=a[1],w=a[2],s,e),e.point(x,_)}function o(){T.point=n,e.lineEnd()}function u(){r(),T.point=c,T.lineEnd=l}function c(t,e){a(h=t,d=e),f=x,p=_,g=b,v=S,y=w,T.point=a}function l(){i(x,_,m,b,S,w,f,p,h,g,v,y,s,e),T.lineEnd=o,o()}var h,d,f,p,g,v,y,m,x,_,b,S,w,T={point:n,lineStart:r,lineEnd:o,polygonStart:function(){e.polygonStart(),T.lineStart=u},polygonEnd:function(){e.polygonEnd(),T.lineStart=r}};return T}function i(e,n,r,s,u,c,l,h,d,f,p,g,v,y){var m=l-e,x=h-n,_=m*m+x*x;if(_>4*a&&v--){var b=s+f,S=u+p,w=c+g,T=Math.sqrt(b*b+S*S+w*w),A=Math.asin(w/=T),C=xo(xo(w)-1)a||xo((m*E+x*k)/_-.5)>.3||s*f+u*p+c*g0&&16,e):Math.sqrt(a)},e}function rn(t){var e=nn(function(e,n){return t([e*Xo,n*Xo])});return function(t){return cn(e(t))}}function an(t){this.stream=t}function on(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function sn(t){return un(function(){return t})()}function un(t){function e(t){return t=s(t[0]*zo,t[1]*zo),[t[0]*d+u,c-t[1]*d]}function n(t){return t=s.invert((t[0]-u)/d,(c-t[1])/d),t&&[t[0]*Xo,t[1]*Xo]}function r(){s=Le(o=dn(y,m,_),a);var t=a(g,v);return u=f-t[0]*d,c=p+t[1]*d,i()}function i(){return l&&(l.valid=!1,l=null),e}var a,o,s,u,c,l,h=nn(function(t,e){return t=a(t,e),[t[0]*d+u,c-t[1]*d]}),d=150,f=480,p=250,g=0,v=0,y=0,m=0,_=0,b=Ds,S=x,w=null,T=null;return e.stream=function(t){return l&&(l.valid=!1),l=cn(b(o,h(S(t)))),l.valid=!0,l},e.clipAngle=function(t){return arguments.length?(b=null==t?(w=t,Ds):ze((w=+t)*zo),i()):w},e.clipExtent=function(t){return arguments.length?(T=t,S=t?Be(t[0][0],t[0][1],t[1][0],t[1][1]):x,i()):T},e.scale=function(t){return arguments.length?(d=+t,r()):d},e.translate=function(t){return arguments.length?(f=+t[0],p=+t[1],r()):[f,p]},e.center=function(t){return arguments.length?(g=t[0]%360*zo,v=t[1]%360*zo,r()):[g*Xo,v*Xo]},e.rotate=function(t){return arguments.length?(y=t[0]%360*zo,m=t[1]%360*zo,_=t.length>2?t[2]%360*zo:0,r()):[y*Xo,m*Xo,_*Xo]},uo.rebind(e,h,"precision"),function(){return a=t.apply(this,arguments),e.invert=a.invert&&n,r()}}function cn(t){return on(t,function(e,n){t.point(e*zo,n*zo)})}function ln(t,e){return[t,e]}function hn(t,e){return[t>Do?t-jo:t<-Do?t+jo:t,e]}function dn(t,e,n){return t?e||n?Le(pn(t),gn(e,n)):pn(t):e||n?gn(e,n):hn}function fn(t){return function(e,n){return e+=t,[e>Do?e-jo:e<-Do?e+jo:e,n]}}function pn(t){var e=fn(t);return e.invert=fn(-t),e}function gn(t,e){function n(t,e){var n=Math.cos(e),s=Math.cos(t)*n,u=Math.sin(t)*n,c=Math.sin(e),l=c*r+s*i;return[Math.atan2(u*a-l*o,s*r-c*i),nt(l*a+u*o)]}var r=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=Math.sin(e);return n.invert=function(t,e){var n=Math.cos(e),s=Math.cos(t)*n,u=Math.sin(t)*n,c=Math.sin(e),l=c*a-u*o;return[Math.atan2(u*a+c*o,s*r+l*i),nt(l*r-s*i)]},n}function vn(t,e){var n=Math.cos(t),r=Math.sin(t);return function(i,a,o,s){var u=o*e;null!=i?(i=yn(n,i),a=yn(n,a),(o>0?ia)&&(i+=o*jo)):(i=t+o*jo,a=t-.5*u);for(var c,l=i;o>0?l>a:l0?e<-Ho+Go&&(e=-Ho+Go):e>Ho-Go&&(e=Ho-Go);var n=o/Math.pow(i(e),a);return[n*Math.sin(a*t),o-n*Math.cos(a*t)]}var r=Math.cos(t),i=function(t){return Math.tan(Do/4+t/2)},a=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(i(e)/i(t)),o=r*Math.pow(i(t),a)/a;return a?(n.invert=function(t,e){var n=o-e,r=K(a)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/a,2*Math.atan(Math.pow(o/r,1/a))-Ho]},n):Pn}function Cn(t,e){function n(t,e){var n=a-e;return[n*Math.sin(i*t),a-n*Math.cos(i*t)]}var r=Math.cos(t),i=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),a=r/i+t;return xo(i)1&&tt(t[n[r-2]],t[n[r-1]],t[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}function On(t,e){return t[0]-e[0]||t[1]-e[1]}function In(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function Rn(t,e,n,r){var i=t[0],a=n[0],o=e[0]-i,s=r[0]-a,u=t[1],c=n[1],l=e[1]-u,h=r[1]-c,d=(s*(u-c)-h*(i-a))/(h*o-s*l);return[i+d*o,u+d*l]}function Gn(t){var e=t[0],n=t[t.length-1];return!(e[0]-n[0]||e[1]-n[1])}function Nn(){ir(this),this.edge=this.site=this.circle=null}function Dn(t){var e=uu.pop()||new Nn;return e.site=t,e}function jn(t){$n(t),au.remove(t),uu.push(t),ir(t)}function Fn(t){var e=t.circle,n=e.x,r=e.cy,i={x:n,y:r},a=t.P,o=t.N,s=[t];jn(t);for(var u=a;u.circle&&xo(n-u.circle.x)Go)s=s.L;else{if(i=a-Xn(s,o),!(i>Go)){r>-Go?(e=s.P,n=s):i>-Go?(e=s,n=s.N):e=n=s;break}if(!s.R){e=s;break}s=s.R}var u=Dn(t);if(au.insert(e,u),e||n){if(e===n)return $n(e),n=Dn(e.site),au.insert(u,n),u.edge=n.edge=Kn(e.site,u.site),Wn(e),void Wn(n);if(!n)return void(u.edge=Kn(e.site,u.site));$n(e),$n(n);var c=e.site,l=c.x,h=c.y,d=t.x-l,f=t.y-h,p=n.site,g=p.x-l,v=p.y-h,y=2*(d*v-f*g),m=d*d+f*f,x=g*g+v*v,_={x:(v*m-f*x)/y+l,y:(d*x-g*m)/y+h};er(n.edge,c,p,_),u.edge=Kn(c,t,null,_),n.edge=Kn(t,p,null,_),Wn(e),Wn(n)}}function zn(t,e){var n=t.site,r=n.x,i=n.y,a=i-e;if(!a)return r;var o=t.P;if(!o)return-(1/0);n=o.site;var s=n.x,u=n.y,c=u-e;if(!c)return s;var l=s-r,h=1/a-1/c,d=l/c;return h?(-d+Math.sqrt(d*d-2*h*(l*l/(-2*c)-u+c/2+i-a/2)))/h+r:(r+s)/2}function Xn(t,e){var n=t.N;if(n)return zn(n,e);var r=t.site;return r.y===e?r.x:1/0}function Bn(t){this.site=t,this.edges=[]}function qn(t){for(var e,n,r,i,a,o,s,u,c,l,h=t[0][0],d=t[1][0],f=t[0][1],p=t[1][1],g=iu,v=g.length;v--;)if(a=g[v],a&&a.prepare())for(s=a.edges,u=s.length,o=0;oGo||xo(i-n)>Go)&&(s.splice(o,0,new nr(tr(a.site,l,xo(r-h)Go?{x:h,y:xo(e-h)Go?{x:xo(n-p)Go?{x:d,y:xo(e-d)Go?{x:xo(n-f)=-No)){var f=u*u+c*c,p=l*l+h*h,g=(h*f-c*p)/d,v=(u*p-l*f)/d,h=v+s,y=cu.pop()||new Un;y.arc=t,y.site=i,y.x=g+o,y.y=h+Math.sqrt(g*g+v*v),y.cy=h,t.circle=y;for(var m=null,x=su._;x;)if(y.y=s)return;if(d>p){if(a){if(a.y>=c)return}else a={x:v,y:u};n={x:v,y:c}}else{if(a){if(a.y1)if(d>p){if(a){if(a.y>=c)return}else a={x:(u-i)/r,y:u};n={x:(c-i)/r,y:c}}else{if(a){if(a.y=s)return}else a={x:o,y:r*o+i};n={x:s,y:r*s+i}}else{if(a){if(a.xa||h>o||d=_,w=n>=b,T=w<<1|S,A=T+4;Ta&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,u.push({i:o,x:mr(n,r)})),a=du.lastIndex;return a=0&&!(n=uo.interpolators[r](t,e)););return n}function br(t,e){var n,r=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(n=0;n=1?1:t(e)}}function wr(t){return function(e){return 1-t(1-e)}}function Tr(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Ar(t){return t*t}function Cr(t){return t*t*t}function Pr(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}function Mr(t){return function(e){return Math.pow(e,t)}}function Lr(t){return 1-Math.cos(t*Ho)}function Er(t){return Math.pow(2,10*(t-1))}function kr(t){return 1-Math.sqrt(1-t*t)}function Vr(t,e){var n;return arguments.length<2&&(e=.45),arguments.length?n=e/jo*Math.asin(1/t):(t=1,n=e/4),function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-n)*jo/e)}}function Or(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Ir(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function Rr(t,e){t=uo.hcl(t),e=uo.hcl(e);var n=t.h,r=t.c,i=t.l,a=e.h-n,o=e.c-r,s=e.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?e.c:r),isNaN(a)?(a=0,n=isNaN(n)?e.h:n):a>180?a-=360:a<-180&&(a+=360),function(t){return ht(n+a*t,r+o*t,i+s*t)+""}}function Gr(t,e){t=uo.hsl(t),e=uo.hsl(e);var n=t.h,r=t.s,i=t.l,a=e.h-n,o=e.s-r,s=e.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?e.s:r),isNaN(a)?(a=0,n=isNaN(n)?e.h:n):a>180?a-=360:a<-180&&(a+=360),function(t){return ct(n+a*t,r+o*t,i+s*t)+""}}function Nr(t,e){t=uo.lab(t),e=uo.lab(e);var n=t.l,r=t.a,i=t.b,a=e.l-n,o=e.a-r,s=e.b-i;return function(t){return ft(n+a*t,r+o*t,i+s*t)+""}}function Dr(t,e){return e-=t,function(n){return Math.round(t+e*n)}}function jr(t){var e=[t.a,t.b],n=[t.c,t.d],r=Hr(e),i=Fr(e,n),a=Hr(zr(n,e,-i))||0;e[0]*n[1]180?e+=360:e-t>180&&(t+=360),r.push({i:n.push(Xr(n)+"rotate(",null,")")-2,x:mr(t,e)})):e&&n.push(Xr(n)+"rotate("+e+")")}function Yr(t,e,n,r){t!==e?r.push({i:n.push(Xr(n)+"skewX(",null,")")-2,x:mr(t,e)}):e&&n.push(Xr(n)+"skewX("+e+")")}function Ur(t,e,n,r){if(t[0]!==e[0]||t[1]!==e[1]){var i=n.push(Xr(n)+"scale(",null,",",null,")");r.push({i:i-4,x:mr(t[0],e[0])},{i:i-2,x:mr(t[1],e[1])})}else 1===e[0]&&1===e[1]||n.push(Xr(n)+"scale("+e+")")}function Wr(t,e){var n=[],r=[];return t=uo.transform(t),e=uo.transform(e),Br(t.translate,e.translate,n,r),qr(t.rotate,e.rotate,n,r),Yr(t.skew,e.skew,n,r),Ur(t.scale,e.scale,n,r),t=e=null,function(t){for(var e,i=-1,a=r.length;++i=0;)n.push(i[r])}function si(t,e){for(var n=[t],r=[];null!=(t=n.pop());)if(r.push(t),(a=t.children)&&(i=a.length))for(var i,a,o=-1;++oi&&(r=n,i=e);return r}function mi(t){return t.reduce(xi,0)}function xi(t,e){return t+e[1]}function _i(t,e){return bi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function bi(t,e){for(var n=-1,r=+t[0],i=(t[1]-r)/e,a=[];++n<=e;)a[n]=i*n+r;return a}function Si(t){return[uo.min(t),uo.max(t)]}function wi(t,e){return t.value-e.value}function Ti(t,e){var n=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=n,n._pack_prev=e}function Ai(t,e){t._pack_next=e,e._pack_prev=t}function Ci(t,e){var n=e.x-t.x,r=e.y-t.y,i=t.r+e.r;return.999*i*i>n*n+r*r}function Pi(t){function e(t){l=Math.min(t.x-t.r,l),h=Math.max(t.x+t.r,h),d=Math.min(t.y-t.r,d),f=Math.max(t.y+t.r,f)}if((n=t.children)&&(c=n.length)){var n,r,i,a,o,s,u,c,l=1/0,h=-(1/0),d=1/0,f=-(1/0);if(n.forEach(Mi),r=n[0],r.x=-r.r,r.y=0,e(r),c>1&&(i=n[1],i.x=i.r,i.y=0,e(i),c>2))for(a=n[2],ki(r,i,a),e(a),Ti(r,a),r._pack_prev=a,Ti(a,i),i=r._pack_next,o=3;o=0;)e=i[a],e.z+=n,e.m+=n,n+=e.s+(r+=e.c)}function Ni(t,e,n){return t.a.parent===e.parent?t.a:n}function Di(t){return 1+uo.max(t,function(t){return t.y})}function ji(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Fi(t){var e=t.children;return e&&e.length?Fi(e[0]):t}function Hi(t){var e,n=t.children;return n&&(e=n.length)?Hi(n[e-1]):t}function zi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Xi(t,e){var n=t.x+e[3],r=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return i<0&&(n+=i/2,i=0),a<0&&(r+=a/2,a=0),{x:n,y:r,dx:i,dy:a}}function Bi(t){var e=t[0],n=t[t.length-1];return e2?$i:Yi,u=r?Qr:$r;return o=i(t,e,u,n),s=i(e,t,u,_r),a}function a(t){return o(t)}var o,s;return a.invert=function(t){return s(t)},a.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},a.range=function(t){return arguments.length?(e=t,i()):e},a.rangeRound=function(t){return a.range(t).interpolate(Dr)},a.clamp=function(t){return arguments.length?(r=t,i()):r},a.interpolate=function(t){return arguments.length?(n=t,i()):n},a.ticks=function(e){return ta(t,e)},a.tickFormat=function(e,n){return ea(t,e,n)},a.nice=function(e){return Ji(t,e),i()},a.copy=function(){return Qi(t,e,n,r)},i()}function Zi(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ji(t,e){return Ui(t,Wi(Ki(t,e)[2])),Ui(t,Wi(Ki(t,e)[2])),t}function Ki(t,e){null==e&&(e=10);var n=Bi(t),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/e)/Math.LN10)),a=e/r*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+.5*i,n[2]=i,n}function ta(t,e){return uo.range.apply(uo,Ki(t,e))}function ea(t,e,n){var r=Ki(t,e);if(n){var i=hs.exec(n);if(i.shift(),"s"===i[8]){var a=uo.formatPrefix(Math.max(xo(r[0]),xo(r[1])));return i[7]||(i[7]="."+na(a.scale(r[2]))),i[8]="f",n=uo.format(i.join("")),function(t){return n(a.scale(t))+a.symbol}}i[7]||(i[7]="."+ra(i[8],r)),n=i.join("")}else n=",."+na(r[2])+"f";return uo.format(n)}function na(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ra(t,e){var n=na(e[2]);return t in Tu?Math.abs(n-na(Math.max(xo(e[0]),xo(e[1]))))+ +("e"!==t):n-2*("%"===t)}function ia(t,e,n,r){function i(t){return(n?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function a(t){return n?Math.pow(e,t):-Math.pow(e,-t)}function o(e){return t(i(e))}return o.invert=function(e){return a(t.invert(e))},o.domain=function(e){return arguments.length?(n=e[0]>=0,t.domain((r=e.map(Number)).map(i)),o):r},o.base=function(n){return arguments.length?(e=+n,t.domain(r.map(i)),o):e},o.nice=function(){var e=Ui(r.map(i),n?Math:Cu);return t.domain(e),r=e.map(a),o},o.ticks=function(){var t=Bi(r),o=[],s=t[0],u=t[1],c=Math.floor(i(s)),l=Math.ceil(i(u)),h=e%1?2:e;if(isFinite(l-c)){if(n){for(;c0;d--)o.push(a(c)*d);for(c=0;o[c]u;l--);o=o.slice(c,l)}return o},o.tickFormat=function(t,n){if(!arguments.length)return Au;arguments.length<2?n=Au:"function"!=typeof n&&(n=uo.format(n));var r=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/a(Math.round(i(t)));return o*e0?s[n-1]:t[0],n0?0:1}function xa(t,e,n,r,i){var a=t[0]-e[0],o=t[1]-e[1],s=(i?r:-r)/Math.sqrt(a*a+o*o),u=s*o,c=-s*a,l=t[0]+u,h=t[1]+c,d=e[0]+u,f=e[1]+c,p=(l+d)/2,g=(h+f)/2,v=d-l,y=f-h,m=v*v+y*y,x=n-r,_=l*f-d*h,b=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*m-_*_)),S=(_*y-v*b)/m,w=(-_*v-y*b)/m,T=(_*y+v*b)/m,A=(-_*v+y*b)/m,C=S-p,P=w-g,M=T-p,L=A-g;return C*C+P*P>M*M+L*L&&(S=T,w=A),[[S-u,w-c],[S*n/x,w*n/x]]}function _a(t){function e(e){function o(){c.push("M",a(t(l),s))}for(var u,c=[],l=[],h=-1,d=e.length,f=Pt(n),p=Pt(r);++h1?t.join("L"):t+"Z"}function Sa(t){return t.join("L")+"Z"}function wa(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e1&&i.push("H",r[0]),i.join("")}function Ta(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e1){s=e[1],a=t[u],u++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var c=2;c9&&(i=3*e/Math.sqrt(i),o[s]=i*n,o[s+1]=i*r));for(s=-1;++s<=u;)i=(t[Math.min(u,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}function Fa(t){return t.length<3?ba(t):t[0]+La(t,ja(t))}function Ha(t){for(var e,n,r,i=-1,a=t.length;++i0;)f[--s].call(t,o);if(a>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[r]:delete t[n],1}var u,c,h,d,f,p=t[n]||(t[n]={active:0,count:0}),g=p[r];g||(u=i.time,c=Vt(a,0,u),g=p[r]={tween:new l,time:u,timer:c,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function eo(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate("+(isFinite(r)?r:n(t))+",0)"})}function no(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate(0,"+(isFinite(r)?r:n(t))+")"})}function ro(t){return t.toISOString()}function io(t,e,n){function r(e){return t(e)}function i(t,n){var r=t[1]-t[0],i=r/n,a=uo.bisect(Zu,i);return a==Zu.length?[e.year,Ki(t.map(function(t){return t/31536e6}),n)[2]]:a?e[i/Zu[a-1]1?{floor:function(e){for(;n(e=t.floor(e));)e=ao(e-1);return e},ceil:function(e){for(;n(e=t.ceil(e));)e=ao(+e+1);return e}}:t))},r.ticks=function(t,e){var n=Bi(r.domain()),a=null==t?i(n,10):"number"==typeof t?i(n,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(n[0],ao(+n[1]+1),e<1?1:e)},r.tickFormat=function(){return n},r.copy=function(){return io(t.copy(),e,n)},Zi(r,t)}function ao(t){return new Date(t)}function oo(t){return JSON.parse(t.responseText)}function so(t){var e=ho.createRange();return e.selectNode(ho.body),e.createContextualFragment(t.responseText)}var uo={version:"3.5.17"},co=[].slice,lo=function(t){return co.call(t)},ho=this.document;if(ho)try{lo(ho.documentElement.childNodes)[0].nodeType}catch(t){lo=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}if(Date.now||(Date.now=function(){return+new Date}),ho)try{ho.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var fo=this.Element.prototype,po=fo.setAttribute,go=fo.setAttributeNS,vo=this.CSSStyleDeclaration.prototype,yo=vo.setProperty;fo.setAttribute=function(t,e){po.call(this,t,e+"")},fo.setAttributeNS=function(t,e,n){go.call(this,t,e,n+"")},vo.setProperty=function(t,e,n){yo.call(this,t,e+"",n)}}uo.ascending=r,uo.descending=function(t,e){return et?1:e>=t?0:NaN},uo.min=function(t,e){var n,r,i=-1,a=t.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++ir&&(n=r)}else{for(;++i=r){n=r;break}for(;++ir&&(n=r)}return n},uo.max=function(t,e){var n,r,i=-1,a=t.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++in&&(n=r)}else{for(;++i=r){n=r;break}for(;++in&&(n=r)}return n},uo.extent=function(t,e){var n,r,i,a=-1,o=t.length;if(1===arguments.length){for(;++a=r){n=i=r;break}for(;++ar&&(n=r),i=r){n=i=r;break}for(;++ar&&(n=r),i1)return u/(l-1)},uo.deviation=function(){var t=uo.variance.apply(this,arguments);return t?Math.sqrt(t):t};var mo=o(r);uo.bisectLeft=mo.left,uo.bisect=uo.bisectRight=mo.right,uo.bisector=function(t){return o(1===t.length?function(e,n){return r(t(e),n)}:t)},uo.shuffle=function(t,e,n){(a=arguments.length)<3&&(n=t.length,a<2&&(e=0));for(var r,i,a=n-e;a;)i=Math.random()*a--|0,r=t[a+e],t[a+e]=t[i+e],t[i+e]=r;return t},uo.permute=function(t,e){for(var n=e.length,r=new Array(n);n--;)r[n]=t[e[n]];return r},uo.pairs=function(t){for(var e,n=0,r=t.length-1,i=t[0],a=new Array(r<0?0:r);n=0;)for(r=t[i],e=r.length;--e>=0;)n[--o]=r[e];return n};var xo=Math.abs;uo.range=function(t,e,n){if(arguments.length<3&&(n=1,arguments.length<2&&(e=t,t=0)),(e-t)/n===1/0)throw new Error("infinite range");var r,i=[],a=u(xo(n)),o=-1;if(t*=a,e*=a,n*=a,n<0)for(;(r=t+n*++o)>e;)i.push(r/a);else for(;(r=t+n*++o)=a.length)return r?r.call(i,o):n?o.sort(n):o;for(var u,c,h,d,f=-1,p=o.length,g=a[s++],v=new l;++f=a.length)return t;var r=[],i=o[n++];return t.forEach(function(t,i){r.push({key:t,values:e(i,n)})}),i?r.sort(function(t,e){return i(t.key,e.key)}):r}var n,r,i={},a=[],o=[];return i.map=function(e,n){return t(n,e,0)},i.entries=function(n){return e(t(uo.map,n,0),0)},i.key=function(t){return a.push(t),i},i.sortKeys=function(t){return o[a.length-1]=t,i},i.sortValues=function(t){return n=t,i},i.rollup=function(t){return r=t,i},i},uo.set=function(t){var e=new m;if(t)for(var n=0,r=t.length;n=0&&(r=t.slice(n+1),t=t.slice(0,n)),t)return arguments.length<2?this[t].on(r):this[t].on(r,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},uo.event=null,uo.requote=function(t){return t.replace(wo,"\\$&")};var wo=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,To={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]},Ao=function(t,e){return e.querySelector(t)},Co=function(t,e){return e.querySelectorAll(t)},Po=function(t,e){var n=t.matches||t[b(t,"matchesSelector")];return(Po=function(t,e){return n.call(t,e)})(t,e)};"function"==typeof Sizzle&&(Ao=function(t,e){return Sizzle(t,e)[0]||null},Co=Sizzle,Po=Sizzle.matchesSelector),uo.selection=function(){return uo.select(ho.documentElement)};var Mo=uo.selection.prototype=[];Mo.select=function(t){var e,n,r,i,a=[];t=L(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Eo.hasOwnProperty(n)?{space:Eo[n],local:t}:t}},Mo.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node();return t=uo.ns.qualify(t),t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(k(e,t[e]));return this}return this.each(k(t,e))},Mo.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),r=(t=I(t)).length,i=-1;if(e=n.classList){for(;++i=0;)(n=r[i])&&(a&&a!==n.nextSibling&&a.parentNode.insertBefore(n,a),a=n);return this},Mo.sort=function(t){t=X.apply(this,arguments);for(var e=-1,n=this.length;++e0&&(e=e.transition().duration(L)),e.call(t.event)}function s(){b&&b.domain(_.range().map(function(t){return(t-T.x)/T.k}).map(_.invert)),w&&w.domain(S.range().map(function(t){return(t-T.y)/T.k}).map(S.invert))}function u(t){E++||t({type:"zoomstart"})}function c(t){s(),t({type:"zoom",scale:T.k,translate:[T.x,T.y]})}function l(t){--E||(t({type:"zoomend"}),v=null)}function h(){function t(){s=1,a(uo.mouse(i),d),c(o)}function r(){h.on(V,null).on(O,null),f(s),l(o)}var i=this,o=R.of(i,arguments),s=0,h=uo.select(n(i)).on(V,t).on(O,r),d=e(uo.mouse(i)),f=Q(i);Hu.call(i),u(o)}function d(){function t(){var t=uo.touches(p);return f=T.k,t.forEach(function(t){t.identifier in v&&(v[t.identifier]=e(t))}),t}function n(){var e=uo.event.target;uo.select(e).on(_,r).on(b,s),S.push(e);for(var n=uo.event.changedTouches,i=0,a=n.length;i1){var l=u[0],h=u[1],d=l[0]-h[0],f=l[1]-h[1];y=d*d+f*f}}function r(){var t,e,n,r,o=uo.touches(p);Hu.call(p);for(var s=0,u=o.length;s=c)return o;if(i)return i=!1,a;var e=l;if(34===t.charCodeAt(e)){for(var n=e;n++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ds=uo.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=uo.round(t,Gt(t,e))).toFixed(Math.max(0,Math.min(20,Gt(t*(1+1e-15),e))))}}),fs=uo.time={},ps=Date;Ft.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){gs.setUTCDate.apply(this._,arguments)},setDay:function(){gs.setUTCDay.apply(this._,arguments)},setFullYear:function(){gs.setUTCFullYear.apply(this._,arguments)},setHours:function(){gs.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){gs.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){gs.setUTCMinutes.apply(this._,arguments)},setMonth:function(){gs.setUTCMonth.apply(this._,arguments)},setSeconds:function(){gs.setUTCSeconds.apply(this._,arguments)},setTime:function(){gs.setTime.apply(this._,arguments)}};var gs=Date.prototype;fs.year=Ht(function(t){return t=fs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),fs.years=fs.year.range,fs.years.utc=fs.year.utc.range,fs.day=Ht(function(t){var e=new ps(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),fs.days=fs.day.range,fs.days.utc=fs.day.utc.range,fs.dayOfYear=function(t){var e=fs.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var n=fs[t]=Ht(function(t){return(t=fs.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var n=fs.year(t).getDay();return Math.floor((fs.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});fs[t+"s"]=n.range,fs[t+"s"].utc=n.utc.range,fs[t+"OfYear"]=function(t){var n=fs.year(t).getDay();return Math.floor((fs.dayOfYear(t)+(n+e)%7)/7)}}),fs.week=fs.sunday,fs.weeks=fs.sunday.range,fs.weeks.utc=fs.sunday.utc.range,fs.weekOfYear=fs.sundayOfYear;var vs={"-":"",_:" ",0:"0"},ys=/^\s*\d+/,ms=/^%/;uo.locale=function(t){return{numberFormat:Dt(t),timeFormat:Xt(t)}};var xs=uo.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});uo.format=xs.numberFormat,uo.geo={},le.prototype={s:0,t:0,add:function(t){he(t,this.t,_s),he(_s.s,this.s,this),this.s?this.t+=_s.t:this.s=_s.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var _s=new le;uo.geo.stream=function(t,e){t&&bs.hasOwnProperty(t.type)?bs[t.type](t,e):de(t,e)};var bs={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++rf&&(f=e)}function e(e,n){var r=ve([e*zo,n*zo]);if(y){var i=me(y,r),a=[i[1],-i[0],0],o=me(a,i);be(o),o=Se(o);var u=e-p,c=u>0?1:-1,g=o[0]*Xo*c,v=xo(u)>180;if(v^(c*pf&&(f=m)}else if(g=(g+360)%360-180,v^(c*pf&&(f=n);v?es(l,d)&&(d=e):s(e,d)>s(l,d)&&(l=e):d>=l?(ed&&(d=e)):e>p?s(l,e)>s(l,d)&&(d=e):s(e,d)>s(l,d)&&(l=e)}else t(e,n);y=r,p=e}function n(){b.point=e}function r(){_[0]=l,_[1]=d,b.point=t,y=null}function i(t,n){if(y){var r=t-p;m+=xo(r)>180?r+(r>0?360:-360):r}else g=t,v=n;As.point(t,n),e(t,n)}function a(){As.lineStart()}function o(){i(g,v),As.lineEnd(),xo(m)>Go&&(l=-(d=180)),_[0]=l,_[1]=d,y=null}function s(t,e){return(e-=t)<0?e+360:e}function u(t,e){return t[0]-e[0]}function c(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tGo?f=90:m<-Go&&(h=-90),_[0]=l,_[1]=d}};return function(t){f=d=-(l=h=1/0),x=[],uo.geo.stream(t,b);var e=x.length;if(e){x.sort(u);for(var n,r=1,i=x[0],a=[i];rs(i[0],i[1])&&(i[1]=n[1]),s(n[0],i[1])>s(i[0],i[1])&&(i[0]=n[0])):a.push(i=n);for(var o,n,p=-(1/0),e=a.length-1,r=0,i=a[e];r<=e;i=n,++r)n=a[r],(o=s(i[1],n[0]))>p&&(p=o,l=n[0],d=i[1])}return x=_=null,l===1/0||h===1/0?[[NaN,NaN],[NaN,NaN]]:[[l,h],[d,f]]}}(),uo.geo.centroid=function(t){Cs=Ps=Ms=Ls=Es=ks=Vs=Os=Is=Rs=Gs=0,uo.geo.stream(t,Ns);var e=Is,n=Rs,r=Gs,i=e*e+n*n+r*r;return i=.12&&i<.234&&r>=-.425&&r<-.214?o:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:a).invert(t)},t.stream=function(t){var e=a.stream(t),n=o.stream(t),r=s.stream(t);return{point:function(t,i){e.point(t,i),n.point(t,i),r.point(t,i)},sphere:function(){e.sphere(),n.sphere(),r.sphere()},lineStart:function(){e.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){e.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){e.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){e.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},t.precision=function(e){return arguments.length?(a.precision(e),o.precision(e),s.precision(e),t):a.precision()},t.scale=function(e){return arguments.length?(a.scale(e),o.scale(.35*e),s.scale(e),t.translate(a.translate())):a.scale()},t.translate=function(e){if(!arguments.length)return a.translate();var c=a.scale(),l=+e[0],h=+e[1];return n=a.translate(e).clipExtent([[l-.455*c,h-.238*c],[l+.455*c,h+.238*c]]).stream(u).point,r=o.translate([l-.307*c,h+.201*c]).clipExtent([[l-.425*c+Go,h+.12*c+Go],[l-.214*c-Go,h+.234*c-Go]]).stream(u).point,i=s.translate([l-.205*c,h+.212*c]).clipExtent([[l-.214*c+Go,h+.166*c+Go],[l-.115*c-Go,h+.234*c-Go]]).stream(u).point,t},t.scale(1070)};var Fs,Hs,zs,Xs,Bs,qs,Ys={point:S,lineStart:S,lineEnd:S,polygonStart:function(){Hs=0,Ys.lineStart=Ue},polygonEnd:function(){Ys.lineStart=Ys.lineEnd=Ys.point=S,Fs+=xo(Hs/2)}},Us={point:We,lineStart:S,lineEnd:S,polygonStart:S,polygonEnd:S},Ws={point:Ze,lineStart:Je,lineEnd:Ke,polygonStart:function(){Ws.lineStart=tn},polygonEnd:function(){Ws.point=Ze,Ws.lineStart=Je,Ws.lineEnd=Ke}};uo.geo.path=function(){function t(t){return t&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=i(a)),uo.geo.stream(t,o)),a.result()}function e(){return o=null,t}var n,r,i,a,o,s=4.5;return t.area=function(t){return Fs=0,uo.geo.stream(t,i(Ys)),Fs},t.centroid=function(t){return Ms=Ls=Es=ks=Vs=Os=Is=Rs=Gs=0,uo.geo.stream(t,i(Ws)),Gs?[Is/Gs,Rs/Gs]:Os?[ks/Os,Vs/Os]:Es?[Ms/Es,Ls/Es]:[NaN,NaN]},t.bounds=function(t){return Bs=qs=-(zs=Xs=1/0),uo.geo.stream(t,i(Us)),[[zs,Xs],[Bs,qs]]},t.projection=function(t){return arguments.length?(i=(n=t)?t.stream||rn(t):x,e()):n},t.context=function(t){return arguments.length?(a=null==(r=t)?new $e:new en(t),"function"!=typeof s&&a.pointRadius(s),e()):r},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(a.pointRadius(+e),+e),t):s},t.projection(uo.geo.albersUsa()).context(null)},uo.geo.transform=function(t){return{stream:function(e){var n=new an(e);for(var r in t)n[r]=t[r];return n}}},an.prototype={point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},uo.geo.projection=sn,uo.geo.projectionMutator=un,(uo.geo.equirectangular=function(){return sn(ln)}).raw=ln.invert=ln,uo.geo.rotation=function(t){function e(e){return e=t(e[0]*zo,e[1]*zo),e[0]*=Xo,e[1]*=Xo,e}return t=dn(t[0]%360*zo,t[1]*zo,t.length>2?t[2]*zo:0),e.invert=function(e){return e=t.invert(e[0]*zo,e[1]*zo),e[0]*=Xo,e[1]*=Xo,e},e},hn.invert=ln,uo.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,e=dn(-t[0]*zo,-t[1]*zo,0).invert,i=[];return n(null,null,1,{point:function(t,n){i.push(t=e(t,n)),t[0]*=Xo,t[1]*=Xo}}),{type:"Polygon",coordinates:[i]}}var e,n,r=[0,0],i=6;return t.origin=function(e){return arguments.length?(r=e,t):r},t.angle=function(r){return arguments.length?(n=vn((e=+r)*zo,i*zo),t):e},t.precision=function(r){return arguments.length?(n=vn(e*zo,(i=+r)*zo),t):i},t.angle(90)},uo.geo.distance=function(t,e){var n,r=(e[0]-t[0])*zo,i=t[1]*zo,a=e[1]*zo,o=Math.sin(r),s=Math.cos(r),u=Math.sin(i),c=Math.cos(i),l=Math.sin(a),h=Math.cos(a);return Math.atan2(Math.sqrt((n=h*o)*n+(n=c*l-u*h*s)*n),u*l+c*h*s)},uo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return uo.range(Math.ceil(a/v)*v,i,v).map(d).concat(uo.range(Math.ceil(c/y)*y,u,y).map(f)).concat(uo.range(Math.ceil(r/p)*p,n,p).filter(function(t){return xo(t%v)>Go}).map(l)).concat(uo.range(Math.ceil(s/g)*g,o,g).filter(function(t){return xo(t%y)>Go}).map(h))}var n,r,i,a,o,s,u,c,l,h,d,f,p=10,g=p,v=90,y=360,m=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[d(a).concat(f(u).slice(1),d(i).reverse().slice(1),f(c).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(a=+e[0][0],i=+e[1][0],c=+e[0][1],u=+e[1][1],a>i&&(e=a,a=i,i=e),c>u&&(e=c,c=u,u=e),t.precision(m)):[[a,c],[i,u]]},t.minorExtent=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],s=+e[0][1],o=+e[1][1],r>n&&(e=r,r=n,n=e),s>o&&(e=s,s=o,o=e),t.precision(m)):[[r,s],[n,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(v=+e[0],y=+e[1],t):[v,y]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(m=+e,l=mn(s,o,90),h=xn(r,n,m),d=mn(c,u,90),f=xn(a,i,m),t):m},t.majorExtent([[-180,-90+Go],[180,90-Go]]).minorExtent([[-180,-80-Go],[180,80+Go]])},uo.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||r.apply(this,arguments),n||i.apply(this,arguments)]}}var e,n,r=_n,i=bn;return t.distance=function(){return uo.geo.distance(e||r.apply(this,arguments),n||i.apply(this,arguments))},t.source=function(n){return arguments.length?(r=n,e="function"==typeof n?null:n,t):r},t.target=function(e){return arguments.length?(i=e,n="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},uo.geo.interpolate=function(t,e){return Sn(t[0]*zo,t[1]*zo,e[0]*zo,e[1]*zo)},uo.geo.length=function(t){return $s=0,uo.geo.stream(t,Qs),$s};var $s,Qs={sphere:S,point:S,lineStart:wn,lineEnd:S,polygonStart:S,polygonEnd:S},Zs=Tn(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sn(Zs)}).raw=Zs;var Js=Tn(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sn(Js)}).raw=Js,(uo.geo.conicConformal=function(){return qe(An)}).raw=An,(uo.geo.conicEquidistant=function(){return qe(Cn)}).raw=Cn;var Ks=Tn(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sn(Ks)}).raw=Ks,Pn.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Ho]},(uo.geo.mercator=function(){return Mn(Pn)}).raw=Pn;var tu=Tn(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sn(tu)}).raw=tu;var eu=Tn(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sn(eu)}).raw=eu,Ln.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ho]},(uo.geo.transverseMercator=function(){var t=Mn(Ln),e=t.center,n=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?n([t[0],t[1],t.length>2?t[2]+90:90]):(t=n(),[t[0],t[1],t[2]-90])},n([0,0,90])}).raw=Ln,uo.geom={},uo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=Pt(n),a=Pt(r),o=t.length,s=[],u=[];for(e=0;e=0;--e)f.push(t[s[c[e]][2]]);for(e=+h;e=r&&c.x<=a&&c.y>=i&&c.y<=o?[[r,o],[a,o],[a,i],[r,i]]:[];l.point=t[s]}),e}function n(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/Go)*Go,y:Math.round(o(t,e)/Go)*Go,i:e}})}var r=En,i=kn,a=r,o=i,s=lu;return t?e(t):(e.links=function(t){return ur(n(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return ur(n(t)).cells.forEach(function(n,r){for(var i,a,o=n.site,s=n.edges.sort(Yn),u=-1,c=s.length,l=s[c-1].edge,h=l.l===o?l.r:l.l;++u=c,d=r>=l,f=d<<1|h;t.leaf=!1,t=t.nodes[f]||(t.nodes[f]=fr()),h?i=c:s=c,d?o=l:u=l,a(t,e,n,r,i,o,s,u)}var l,h,d,f,p,g,v,y,m,x=Pt(s),_=Pt(u);if(null!=e)g=e,v=n,y=r,m=i;else if(y=m=-(g=v=1/0),h=[],d=[],p=t.length,o)for(f=0;fy&&(y=l.x), -l.y>m&&(m=l.y),h.push(l.x),d.push(l.y);else for(f=0;fy&&(y=b),S>m&&(m=S),h.push(b),d.push(S)}var w=y-g,T=m-v;w>T?m=v+w:y=g+T;var A=fr();if(A.add=function(t){a(A,t,+x(t,++f),+_(t,f),g,v,y,m)},A.visit=function(t){pr(t,A,g,v,y,m)},A.find=function(t){return gr(A,t[0],t[1],g,v,y,m)},f=-1,null==e){for(;++f=0?t.slice(0,e):t,r=e>=0?t.slice(e+1):"in";return n=pu.get(n)||fu,r=gu.get(r)||x,Sr(r(n.apply(null,co.call(arguments,1))))},uo.interpolateHcl=Rr,uo.interpolateHsl=Gr,uo.interpolateLab=Nr,uo.interpolateRound=Dr,uo.transform=function(t){var e=ho.createElementNS(uo.ns.prefix.svg,"g");return(uo.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new jr(n?n.matrix:vu)})(t)},jr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var vu={a:1,b:0,c:0,d:1,e:0,f:0};uo.interpolateTransform=Wr,uo.layout={},uo.layout.bundle=function(){return function(t){for(var e=[],n=-1,r=t.length;++n0?i=t:(n.c=null,n.t=NaN,n=null,c.end({type:"end",alpha:i=0})):t>0&&(c.start({type:"start",alpha:i=t}),n=Vt(u.tick)),u):i},u.start=function(){function t(t,r){if(!n){for(n=new Array(i),u=0;u=0;)o.push(l=c[u]),l.parent=a,l.depth=a.depth+1;r&&(a.value=0),a.children=c}else r&&(a.value=+r.call(t,a,a.depth)||0),delete a.children;return si(i,function(t){var n,i;e&&(n=t.children)&&n.sort(e),r&&(i=t.parent)&&(i.value+=t.value)}),s}var e=li,n=ui,r=ci;return t.sort=function(n){return arguments.length?(e=n,t):e},t.children=function(e){return arguments.length?(n=e,t):n},t.value=function(e){return arguments.length?(r=e,t):r},t.revalue=function(e){return r&&(oi(e,function(t){t.children&&(t.value=0)}),si(e,function(e){var n;e.children||(e.value=+r.call(t,e,e.depth)||0),(n=e.parent)&&(n.value+=e.value)})),e},t},uo.layout.partition=function(){function t(e,n,r,i){var a=e.children;if(e.x=n,e.y=e.depth*i,e.dx=r,e.dy=i,a&&(o=a.length)){var o,s,u,c=-1;for(r=e.value?r/e.value:0;++cs&&(s=r),o.push(r)}for(n=0;n0)for(a=-1;++a=l[0]&&s<=l[1]&&(o=u[uo.bisect(h,s,1,f)-1],o.y+=p,o.push(t[a]));return u}var e=!0,n=Number,r=Si,i=_i;return t.value=function(e){return arguments.length?(n=e,t):n},t.range=function(e){return arguments.length?(r=Pt(e),t):r},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return bi(t,e)}:Pt(e),t):i},t.frequency=function(n){return arguments.length?(e=!!n,t):e},t},uo.layout.pack=function(){function t(t,a){var o=n.call(this,t,a),s=o[0],u=i[0],c=i[1],l=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,si(s,function(t){t.r=+l(t.value)}),si(s,Pi),r){var h=r*(e?1:Math.max(2*s.r/u,2*s.r/c))/2;si(s,function(t){t.r+=h}),si(s,Pi),si(s,function(t){t.r-=h})}return Ei(s,u/2,c/2,e?1:1/Math.max(2*s.r/u,2*s.r/c)),o}var e,n=uo.layout.hierarchy().sort(wi),r=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(n){return arguments.length?(e=null==n||"function"==typeof n?n:+n,t):e},t.padding=function(e){return arguments.length?(r=+e,t):r},ai(t,n)},uo.layout.tree=function(){function t(t,i){var l=o.call(this,t,i),h=l[0],d=e(h);if(si(d,n),d.parent.m=-d.z,oi(d,r),c)oi(h,a);else{var f=h,p=h,g=h;oi(h,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var v=s(f,p)/2-f.x,y=u[0]/(p.x+s(p,f)/2+v),m=u[1]/(g.depth||1);oi(h,function(t){t.x=(t.x+v)*y,t.y=t.depth*m})}return l}function e(t){for(var e,n={A:null,children:[t]},r=[n];null!=(e=r.pop());)for(var i,a=e.children,o=0,s=a.length;o0&&(Ri(Ni(o,t,n),t,r),c+=r,l+=r),h+=o.m,c+=i.m,d+=u.m,l+=a.m;o&&!Ii(a)&&(a.t=o,a.m+=h-l),i&&!Oi(u)&&(u.t=i,u.m+=c-d,n=t)}return n}function a(t){t.x*=u[0],t.y=t.depth*u[1]}var o=uo.layout.hierarchy().sort(null).value(null),s=Vi,u=[1,1],c=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(c=null==(u=e)?a:null,t):c?null:u},t.nodeSize=function(e){return arguments.length?(c=null==(u=e)?null:a,t):c?u:null},ai(t,o)},uo.layout.cluster=function(){function t(t,a){var o,s=e.call(this,t,a),u=s[0],c=0;si(u,function(t){var e=t.children;e&&e.length?(t.x=ji(e),t.y=Di(e)):(t.x=o?c+=n(t,o):0,t.y=0,o=t)});var l=Fi(u),h=Hi(u),d=l.x-n(l,h)/2,f=h.x+n(h,l)/2;return si(u,i?function(t){t.x=(t.x-u.x)*r[0],t.y=(u.y-t.y)*r[1]}:function(t){t.x=(t.x-d)/(f-d)*r[0],t.y=(1-(u.y?t.y/u.y:1))*r[1]}),s}var e=uo.layout.hierarchy().sort(null).value(null),n=Vi,r=[1,1],i=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(e){return arguments.length?(i=null==(r=e),t):i?null:r},t.nodeSize=function(e){return arguments.length?(i=null!=(r=e),t):i?r:null},ai(t,e)},uo.layout.treemap=function(){function t(t,e){for(var n,r,i=-1,a=t.length;++i0;)l.push(o=d[u-1]),l.area+=o.area,"squarify"!==f||(s=r(l,g))<=p?(d.pop(),p=s):(l.area-=l.pop().area,i(l,g,c,!1),g=Math.min(c.dx,c.dy),l.length=l.area=0,p=1/0);l.length&&(i(l,g,c,!0),l.length=l.area=0),a.forEach(e)}}function n(e){var r=e.children;if(r&&r.length){var a,o=h(e),s=r.slice(),u=[];for(t(s,o.dx*o.dy/e.value),u.area=0;a=s.pop();)u.push(a),u.area+=a.area,null!=a.z&&(i(u,a.z?o.dx:o.dy,o,!s.length),u.length=u.area=0);r.forEach(n)}}function r(t,e){for(var n,r=t.area,i=0,a=1/0,o=-1,s=t.length;++oi&&(i=n));return r*=r,e*=e,r?Math.max(e*i*p/r,r/(e*a*p)):1/0}function i(t,e,n,r){var i,a=-1,o=t.length,s=n.x,c=n.y,l=e?u(t.area/e):0;if(e==n.dx){for((r||l>n.dy)&&(l=n.dy);++an.dx)&&(l=n.dx);++a1);return t+e*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=uo.random.normal.apply(uo,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=uo.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;nh?0:1;if(c=Fo)return e(c,f)+(t?e(t,1-f):"")+"Z";var p,g,v,y,m,x,_,b,S,w,T,A,C=0,P=0,M=[];if((y=(+u.apply(this,arguments)||0)/2)&&(v=a===ku?Math.sqrt(t*t+c*c):+a.apply(this,arguments),f||(P*=-1),c&&(P=nt(v/c*Math.sin(y))),t&&(C=nt(v/t*Math.sin(y)))),c){m=c*Math.cos(l+P),x=c*Math.sin(l+P),_=c*Math.cos(h-P),b=c*Math.sin(h-P);var L=Math.abs(h-l-2*P)<=Do?0:1;if(P&&ma(m,x,_,b)===f^L){var E=(l+h)/2;m=c*Math.cos(E),x=c*Math.sin(E),_=b=null}}else m=x=0;if(t){S=t*Math.cos(h-C),w=t*Math.sin(h-C),T=t*Math.cos(l+C),A=t*Math.sin(l+C);var k=Math.abs(l-h+2*C)<=Do?0:1;if(C&&ma(S,w,T,A)===1-f^k){var V=(l+h)/2;S=t*Math.cos(V),w=t*Math.sin(V),T=A=null}}else S=w=0;if(d>Go&&(p=Math.min(Math.abs(c-t)/2,+i.apply(this,arguments)))>.001){g=tDo)+",1 "+e}function i(t,e,n,r){return"Q 0,0 "+r}var a=_n,o=bn,s=Xa,u=ga,c=va;return t.radius=function(e){return arguments.length?(s=Pt(e),t):s},t.source=function(e){return arguments.length?(a=Pt(e),t):a},t.target=function(e){return arguments.length?(o=Pt(e),t):o},t.startAngle=function(e){return arguments.length?(u=Pt(e),t):u},t.endAngle=function(e){return arguments.length?(c=Pt(e),t):c},t},uo.svg.diagonal=function(){function t(t,i){var a=e.call(this,t,i),o=n.call(this,t,i),s=(a.y+o.y)/2,u=[a,{x:a.x,y:s},{x:o.x,y:s},o];return u=u.map(r),"M"+u[0]+"C"+u[1]+" "+u[2]+" "+u[3]}var e=_n,n=bn,r=Ba;return t.source=function(n){return arguments.length?(e=Pt(n),t):e},t.target=function(e){return arguments.length?(n=Pt(e),t):n},t.projection=function(e){return arguments.length?(r=e,t):r},t},uo.svg.diagonal.radial=function(){var t=uo.svg.diagonal(),e=Ba,n=t.projection;return t.projection=function(t){return arguments.length?n(qa(e=t)):e},t},uo.svg.symbol=function(){function t(t,r){return(Gu.get(e.call(this,t,r))||Wa)(n.call(this,t,r))}var e=Ua,n=Ya;return t.type=function(n){return arguments.length?(e=Pt(n),t):e},t.size=function(e){return arguments.length?(n=Pt(e),t):n},t};var Gu=uo.map({circle:Wa,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*Du)),n=e*Du;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/Nu),n=e*Nu/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Nu),n=e*Nu/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});uo.svg.symbolTypes=Gu.keys();var Nu=Math.sqrt(3),Du=Math.tan(30*zo);Mo.transition=function(t){for(var e,n,r=ju||++Xu,i=Ka(t),a=[],o=Fu||{time:Date.now(),ease:Pr,delay:0,duration:250},s=-1,u=this.length;++srect,.s>rect").attr("width",h[1]-h[0])}function i(t){t.select(".extent").attr("y",d[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",d[1]-d[0])}function a(){function a(){32==uo.event.keyCode&&(L||(x=null,k[0]-=h[1],k[1]-=d[1],L=2),A())}function g(){32==uo.event.keyCode&&2==L&&(k[0]+=h[1],k[1]+=d[1],L=0,A())}function v(){var t=uo.mouse(b),n=!1;_&&(t[0]+=_[0],t[1]+=_[1]),L||(uo.event.altKey?(x||(x=[(h[0]+h[1])/2,(d[0]+d[1])/2]),k[0]=h[+(t[0]0&&e-1 in t)}function r(t,e,n){if(at.isFunction(e))return at.grep(t,function(t,r){return!!e.call(t,r,t)!==n});if(e.nodeType)return at.grep(t,function(t){return t===e!==n});if("string"==typeof e){if(gt.test(e))return at.filter(e,t,n);e=at.filter(e,t)}return at.grep(t,function(t){return K.call(e,t)>-1!==n})}function i(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}function a(t){var e={};return at.each(t.match(bt)||[],function(t,n){e[n]=!0}),e}function o(){$.removeEventListener("DOMContentLoaded",o),t.removeEventListener("load",o),at.ready()}function s(){this.expando=at.expando+s.uid++}function u(t,e,n){var r;if(void 0===n&&1===t.nodeType)if(r="data-"+e.replace(Mt,"-$&").toLowerCase(),n=t.getAttribute(r),"string"==typeof n){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:Pt.test(n)?at.parseJSON(n):n)}catch(t){}Ct.set(t,e,n)}else n=void 0;return n}function c(t,e,n,r){var i,a=1,o=20,s=r?function(){return r.cur()}:function(){return at.css(t,e,"")},u=s(),c=n&&n[3]||(at.cssNumber[e]?"":"px"),l=(at.cssNumber[e]||"px"!==c&&+u)&&Et.exec(at.css(t,e));if(l&&l[3]!==c){c=c||l[3],n=n||[],l=+u||1;do a=a||".5",l/=a,at.style(t,e,l+c);while(a!==(a=s()/u)&&1!==a&&--o)}return n&&(l=+l||+u||0,i=n[1]?l+(n[1]+1)*n[2]:+n[2],r&&(r.unit=c,r.start=l,r.end=i)),i}function l(t,e){var n="undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e||"*"):"undefined"!=typeof t.querySelectorAll?t.querySelectorAll(e||"*"):[];return void 0===e||e&&at.nodeName(t,e)?at.merge([t],n):n}function h(t,e){for(var n=0,r=t.length;n-1)i&&i.push(a);else if(c=at.contains(a.ownerDocument,a),o=l(f.appendChild(a),"script"),c&&h(o),n)for(d=0;a=o[d++];)Rt.test(a.type||"")&&n.push(a);return f}function f(){return!0}function p(){return!1}function g(){try{return $.activeElement}catch(t){}}function v(t,e,n,r,i,a){var o,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=void 0);for(s in e)v(t,s,n,r,e[s],a);return t}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),i===!1)i=p;else if(!i)return t;return 1===a&&(o=i,i=function(t){return at().off(t),o.apply(this,arguments)},i.guid=o.guid||(o.guid=at.guid++)),t.each(function(){at.event.add(this,e,i,r,n)})}function y(t,e){return at.nodeName(t,"table")&&at.nodeName(11!==e.nodeType?e:e.firstChild,"tr")?t.getElementsByTagName("tbody")[0]||t.appendChild(t.ownerDocument.createElement("tbody")):t}function m(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function x(t){var e=Bt.exec(t.type);return e?t.type=e[1]:t.removeAttribute("type"),t}function _(t,e){var n,r,i,a,o,s,u,c;if(1===e.nodeType){if(At.hasData(t)&&(a=At.access(t),o=At.set(e,a),c=a.events)){delete o.handle,o.events={};for(i in c)for(n=0,r=c[i].length;n1&&"string"==typeof g&&!rt.checkClone&&Xt.test(g))return t.each(function(i){var a=t.eq(i);v&&(e[0]=g.call(this,i,a.html())),S(a,e,n,r)});if(f&&(i=d(e,t[0].ownerDocument,!1,t,r),a=i.firstChild,1===i.childNodes.length&&(i=a),a||r)){for(o=at.map(l(i,"script"),m),s=o.length;h")).appendTo(e.documentElement),e=Yt[0].contentDocument,e.write(),e.close(),n=T(t,e),Yt.detach()),Ut[t]=n),n}function C(t,e,n){var r,i,a,o,s=t.style;return n=n||Qt(t),o=n?n.getPropertyValue(e)||n[e]:void 0,""!==o&&void 0!==o||at.contains(t.ownerDocument,t)||(o=at.style(t,e)),n&&!rt.pixelMarginRight()&&$t.test(o)&&Wt.test(e)&&(r=s.width,i=s.minWidth,a=s.maxWidth,s.minWidth=s.maxWidth=s.width=o,o=n.width,s.width=r,s.minWidth=i,s.maxWidth=a),void 0!==o?o+"":o}function P(t,e){return{get:function(){return t()?void delete this.get:(this.get=e).apply(this,arguments)}}}function M(t){if(t in re)return t;for(var e=t[0].toUpperCase()+t.slice(1),n=ne.length;n--;)if(t=ne[n]+e,t in re)return t}function L(t,e,n){var r=Et.exec(e);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):e}function E(t,e,n,r,i){for(var a=n===(r?"border":"content")?4:"width"===e?1:0,o=0;a<4;a+=2)"margin"===n&&(o+=at.css(t,n+kt[a],!0,i)),r?("content"===n&&(o-=at.css(t,"padding"+kt[a],!0,i)),"margin"!==n&&(o-=at.css(t,"border"+kt[a]+"Width",!0,i))):(o+=at.css(t,"padding"+kt[a],!0,i),"padding"!==n&&(o+=at.css(t,"border"+kt[a]+"Width",!0,i)));return o}function k(t,e,n){var r=!0,i="width"===e?t.offsetWidth:t.offsetHeight,a=Qt(t),o="border-box"===at.css(t,"boxSizing",!1,a);if(i<=0||null==i){if(i=C(t,e,a),(i<0||null==i)&&(i=t.style[e]),$t.test(i))return i;r=o&&(rt.boxSizingReliable()||i===t.style[e]),i=parseFloat(i)||0}return i+E(t,e,n||(o?"border":"content"),r,a)+"px"}function V(t,e){for(var n,r,i,a=[],o=0,s=t.length;o=0&&n=0},isPlainObject:function(t){var e;if("object"!==at.type(t)||t.nodeType||at.isWindow(t))return!1;if(t.constructor&&!nt.call(t,"constructor")&&!nt.call(t.constructor.prototype||{},"isPrototypeOf"))return!1;for(e in t);return void 0===e||nt.call(t,e)},isEmptyObject:function(t){var e;for(e in t)return!1;return!0},type:function(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?tt[et.call(t)]||"object":typeof t},globalEval:function(t){var e,n=eval;t=at.trim(t),t&&(1===t.indexOf("use strict")?(e=$.createElement("script"),e.text=t,$.head.appendChild(e).parentNode.removeChild(e)):n(t))},camelCase:function(t){return t.replace(st,"ms-").replace(ut,ct)},nodeName:function(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()},each:function(t,e){var r,i=0;if(n(t))for(r=t.length;iS.cacheLength&&delete t[e.shift()],t[n+" "]=r}var e=[];return t}function r(t){return t[j]=!0,t}function i(t){var e=V.createElement("div");try{return!!t(e)}catch(t){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function a(t,e){for(var n=t.split("|"),r=n.length;r--;)S.attrHandle[n[r]]=e}function o(t,e){var n=e&&t,r=n&&1===t.nodeType&&1===e.nodeType&&(~e.sourceIndex||U)-(~t.sourceIndex||U);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function s(t){return function(e){var n=e.nodeName.toLowerCase();return"input"===n&&e.type===t}}function u(t){return function(e){var n=e.nodeName.toLowerCase();return("input"===n||"button"===n)&&e.type===t}}function c(t){return r(function(e){return e=+e,r(function(n,r){for(var i,a=t([],n.length,e),o=a.length;o--;)n[i=a[o]]&&(n[i]=!(r[i]=n[i]))})})}function l(t){return t&&"undefined"!=typeof t.getElementsByTagName&&t}function h(){}function d(t){for(var e=0,n=t.length,r="";e1?function(e,n,r){for(var i=t.length;i--;)if(!t[i](e,n,r))return!1;return!0}:t[0]}function g(t,n,r){for(var i=0,a=n.length;i-1&&(r[c]=!(o[c]=h))}}else x=v(x===o?x.splice(p,x.length):x),a?a(null,o,x,u):J.apply(o,x)})}function m(t){for(var e,n,r,i=t.length,a=S.relative[t[0].type],o=a||S.relative[" "],s=a?1:0,u=f(function(t){return t===e},o,!0),c=f(function(t){return tt(e,t)>-1},o,!0),l=[function(t,n,r){var i=!a&&(r||n!==M)||((e=n).nodeType?u(t,n,r):c(t,n,r));return e=null,i}];s1&&p(l),s>1&&d(t.slice(0,s-1).concat({value:" "===t[s-2].type?"*":""})).replace(st,"$1"),n,s0,a=t.length>0,o=function(r,o,s,u,c){var l,h,d,f=0,p="0",g=r&&[],y=[],m=M,x=r||a&&S.find.TAG("*",c),_=H+=null==m?1:Math.random()||.1,b=x.length;for(c&&(M=o===V||o||c);p!==b&&null!=(l=x[p]);p++){if(a&&l){for(h=0,o||l.ownerDocument===V||(k(l),s=!I);d=t[h++];)if(d(l,o||V,s)){u.push(l);break}c&&(H=_)}i&&((l=!d&&l)&&f--,r&&g.push(l))}if(f+=p,i&&p!==f){for(h=0;d=n[h++];)d(g,y,o,s);if(r){if(f>0)for(;p--;)g[p]||y[p]||(y[p]=Q.call(u));y=v(y)}J.apply(u,y),c&&!r&&y.length>0&&f+n.length>1&&e.uniqueSort(u)}return c&&(H=_,M=m),g};return i?r(o):o}var _,b,S,w,T,A,C,P,M,L,E,k,V,O,I,R,G,N,D,j="sizzle"+1*new Date,F=t.document,H=0,z=0,X=n(),B=n(),q=n(),Y=function(t,e){return t===e&&(E=!0),0},U=1<<31,W={}.hasOwnProperty,$=[],Q=$.pop,Z=$.push,J=$.push,K=$.slice,tt=function(t,e){for(var n=0,r=t.length;n+~]|"+nt+")"+nt+"*"),lt=new RegExp("="+nt+"*([^\\]'\"]*?)"+nt+"*\\]","g"),ht=new RegExp(at),dt=new RegExp("^"+rt+"$"),ft={ID:new RegExp("^#("+rt+")"),CLASS:new RegExp("^\\.("+rt+")"),TAG:new RegExp("^("+rt+"|[*])"),ATTR:new RegExp("^"+it),PSEUDO:new RegExp("^"+at),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+nt+"*(even|odd|(([+-]|)(\\d*)n|)"+nt+"*(?:([+-]|)"+nt+"*(\\d+)|))"+nt+"*\\)|)","i"),bool:new RegExp("^(?:"+et+")$","i"),needsContext:new RegExp("^"+nt+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+nt+"*((?:-\\d)?\\d*)"+nt+"*\\)|)(?=[^-]|$)","i")},pt=/^(?:input|select|textarea|button)$/i,gt=/^h\d$/i,vt=/^[^{]+\{\s*\[native \w/,yt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,mt=/[+~]/,xt=/'|\\/g,_t=new RegExp("\\\\([\\da-f]{1,6}"+nt+"?|("+nt+")|.)","ig"),bt=function(t,e,n){var r="0x"+e-65536;return r!==r||n?e:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},St=function(){k()};try{J.apply($=K.call(F.childNodes),F.childNodes),$[F.childNodes.length].nodeType}catch(t){J={apply:$.length?function(t,e){Z.apply(t,K.call(e))}:function(t,e){for(var n=t.length,r=0;t[n++]=e[r++];);t.length=n-1}}}b=e.support={},T=e.isXML=function(t){var e=t&&(t.ownerDocument||t).documentElement;return!!e&&"HTML"!==e.nodeName},k=e.setDocument=function(t){var e,n,r=t?t.ownerDocument||t:F;return r!==V&&9===r.nodeType&&r.documentElement?(V=r,O=V.documentElement,I=!T(V),(n=V.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",St,!1):n.attachEvent&&n.attachEvent("onunload",St)),b.attributes=i(function(t){return t.className="i",!t.getAttribute("className")}),b.getElementsByTagName=i(function(t){return t.appendChild(V.createComment("")),!t.getElementsByTagName("*").length}),b.getElementsByClassName=vt.test(V.getElementsByClassName),b.getById=i(function(t){return O.appendChild(t).id=j,!V.getElementsByName||!V.getElementsByName(j).length}),b.getById?(S.find.ID=function(t,e){if("undefined"!=typeof e.getElementById&&I){var n=e.getElementById(t);return n?[n]:[]}},S.filter.ID=function(t){var e=t.replace(_t,bt);return function(t){return t.getAttribute("id")===e}}):(delete S.find.ID,S.filter.ID=function(t){var e=t.replace(_t,bt);return function(t){var n="undefined"!=typeof t.getAttributeNode&&t.getAttributeNode("id");return n&&n.value===e}}),S.find.TAG=b.getElementsByTagName?function(t,e){return"undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t):b.qsa?e.querySelectorAll(t):void 0}:function(t,e){var n,r=[],i=0,a=e.getElementsByTagName(t);if("*"===t){for(;n=a[i++];)1===n.nodeType&&r.push(n);return r}return a},S.find.CLASS=b.getElementsByClassName&&function(t,e){if("undefined"!=typeof e.getElementsByClassName&&I)return e.getElementsByClassName(t)},G=[],R=[],(b.qsa=vt.test(V.querySelectorAll))&&(i(function(t){O.appendChild(t).innerHTML="",t.querySelectorAll("[msallowcapture^='']").length&&R.push("[*^$]="+nt+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||R.push("\\["+nt+"*(?:value|"+et+")"),t.querySelectorAll("[id~="+j+"-]").length||R.push("~="),t.querySelectorAll(":checked").length||R.push(":checked"),t.querySelectorAll("a#"+j+"+*").length||R.push(".#.+[+~]")}),i(function(t){var e=V.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&R.push("name"+nt+"*[*^$|!~]?="),t.querySelectorAll(":enabled").length||R.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),R.push(",.*:")})),(b.matchesSelector=vt.test(N=O.matches||O.webkitMatchesSelector||O.mozMatchesSelector||O.oMatchesSelector||O.msMatchesSelector))&&i(function(t){b.disconnectedMatch=N.call(t,"div"), -N.call(t,"[s!='']:x"),G.push("!=",at)}),R=R.length&&new RegExp(R.join("|")),G=G.length&&new RegExp(G.join("|")),e=vt.test(O.compareDocumentPosition),D=e||vt.test(O.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,r=e&&e.parentNode;return t===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):t.compareDocumentPosition&&16&t.compareDocumentPosition(r)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},Y=e?function(t,e){if(t===e)return E=!0,0;var n=!t.compareDocumentPosition-!e.compareDocumentPosition;return n?n:(n=(t.ownerDocument||t)===(e.ownerDocument||e)?t.compareDocumentPosition(e):1,1&n||!b.sortDetached&&e.compareDocumentPosition(t)===n?t===V||t.ownerDocument===F&&D(F,t)?-1:e===V||e.ownerDocument===F&&D(F,e)?1:L?tt(L,t)-tt(L,e):0:4&n?-1:1)}:function(t,e){if(t===e)return E=!0,0;var n,r=0,i=t.parentNode,a=e.parentNode,s=[t],u=[e];if(!i||!a)return t===V?-1:e===V?1:i?-1:a?1:L?tt(L,t)-tt(L,e):0;if(i===a)return o(t,e);for(n=t;n=n.parentNode;)s.unshift(n);for(n=e;n=n.parentNode;)u.unshift(n);for(;s[r]===u[r];)r++;return r?o(s[r],u[r]):s[r]===F?-1:u[r]===F?1:0},V):V},e.matches=function(t,n){return e(t,null,null,n)},e.matchesSelector=function(t,n){if((t.ownerDocument||t)!==V&&k(t),n=n.replace(lt,"='$1']"),b.matchesSelector&&I&&!q[n+" "]&&(!G||!G.test(n))&&(!R||!R.test(n)))try{var r=N.call(t,n);if(r||b.disconnectedMatch||t.document&&11!==t.document.nodeType)return r}catch(t){}return e(n,V,null,[t]).length>0},e.contains=function(t,e){return(t.ownerDocument||t)!==V&&k(t),D(t,e)},e.attr=function(t,e){(t.ownerDocument||t)!==V&&k(t);var n=S.attrHandle[e.toLowerCase()],r=n&&W.call(S.attrHandle,e.toLowerCase())?n(t,e,!I):void 0;return void 0!==r?r:b.attributes||!I?t.getAttribute(e):(r=t.getAttributeNode(e))&&r.specified?r.value:null},e.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},e.uniqueSort=function(t){var e,n=[],r=0,i=0;if(E=!b.detectDuplicates,L=!b.sortStable&&t.slice(0),t.sort(Y),E){for(;e=t[i++];)e===t[i]&&(r=n.push(i));for(;r--;)t.splice(n[r],1)}return L=null,t},w=e.getText=function(t){var e,n="",r=0,i=t.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)n+=w(t)}else if(3===i||4===i)return t.nodeValue}else for(;e=t[r++];)n+=w(e);return n},S=e.selectors={cacheLength:50,createPseudo:r,match:ft,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(_t,bt),t[3]=(t[3]||t[4]||t[5]||"").replace(_t,bt),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||e.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&e.error(t[0]),t},PSEUDO:function(t){var e,n=!t[6]&&t[2];return ft.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":n&&ht.test(n)&&(e=A(n,!0))&&(e=n.indexOf(")",n.length-e)-n.length)&&(t[0]=t[0].slice(0,e),t[2]=n.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(_t,bt).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=X[t+" "];return e||(e=new RegExp("(^|"+nt+")"+t+"("+nt+"|$)"))&&X(t,function(t){return e.test("string"==typeof t.className&&t.className||"undefined"!=typeof t.getAttribute&&t.getAttribute("class")||"")})},ATTR:function(t,n,r){return function(i){var a=e.attr(i,t);return null==a?"!="===n:!n||(a+="","="===n?a===r:"!="===n?a!==r:"^="===n?r&&0===a.indexOf(r):"*="===n?r&&a.indexOf(r)>-1:"$="===n?r&&a.slice(-r.length)===r:"~="===n?(" "+a.replace(ot," ")+" ").indexOf(r)>-1:"|="===n&&(a===r||a.slice(0,r.length+1)===r+"-"))}},CHILD:function(t,e,n,r,i){var a="nth"!==t.slice(0,3),o="last"!==t.slice(-4),s="of-type"===e;return 1===r&&0===i?function(t){return!!t.parentNode}:function(e,n,u){var c,l,h,d,f,p,g=a!==o?"nextSibling":"previousSibling",v=e.parentNode,y=s&&e.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(v){if(a){for(;g;){for(d=e;d=d[g];)if(s?d.nodeName.toLowerCase()===y:1===d.nodeType)return!1;p=g="only"===t&&!p&&"nextSibling"}return!0}if(p=[o?v.firstChild:v.lastChild],o&&m){for(d=v,h=d[j]||(d[j]={}),l=h[d.uniqueID]||(h[d.uniqueID]={}),c=l[t]||[],f=c[0]===H&&c[1],x=f&&c[2],d=f&&v.childNodes[f];d=++f&&d&&d[g]||(x=f=0)||p.pop();)if(1===d.nodeType&&++x&&d===e){l[t]=[H,f,x];break}}else if(m&&(d=e,h=d[j]||(d[j]={}),l=h[d.uniqueID]||(h[d.uniqueID]={}),c=l[t]||[],f=c[0]===H&&c[1],x=f),x===!1)for(;(d=++f&&d&&d[g]||(x=f=0)||p.pop())&&((s?d.nodeName.toLowerCase()!==y:1!==d.nodeType)||!++x||(m&&(h=d[j]||(d[j]={}),l=h[d.uniqueID]||(h[d.uniqueID]={}),l[t]=[H,x]),d!==e)););return x-=i,x===r||x%r===0&&x/r>=0}}},PSEUDO:function(t,n){var i,a=S.pseudos[t]||S.setFilters[t.toLowerCase()]||e.error("unsupported pseudo: "+t);return a[j]?a(n):a.length>1?(i=[t,t,"",n],S.setFilters.hasOwnProperty(t.toLowerCase())?r(function(t,e){for(var r,i=a(t,n),o=i.length;o--;)r=tt(t,i[o]),t[r]=!(e[r]=i[o])}):function(t){return a(t,0,i)}):a}},pseudos:{not:r(function(t){var e=[],n=[],i=C(t.replace(st,"$1"));return i[j]?r(function(t,e,n,r){for(var a,o=i(t,null,r,[]),s=t.length;s--;)(a=o[s])&&(t[s]=!(e[s]=a))}):function(t,r,a){return e[0]=t,i(e,null,a,n),e[0]=null,!n.pop()}}),has:r(function(t){return function(n){return e(t,n).length>0}}),contains:r(function(t){return t=t.replace(_t,bt),function(e){return(e.textContent||e.innerText||w(e)).indexOf(t)>-1}}),lang:r(function(t){return dt.test(t||"")||e.error("unsupported lang: "+t),t=t.replace(_t,bt).toLowerCase(),function(e){var n;do if(n=I?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return n=n.toLowerCase(),n===t||0===n.indexOf(t+"-");while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(t){return t===O},focus:function(t){return t===V.activeElement&&(!V.hasFocus||V.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:function(t){return t.disabled===!1},disabled:function(t){return t.disabled===!0},checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,t.selected===!0},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!S.pseudos.empty(t)},header:function(t){return gt.test(t.nodeName)},input:function(t){return pt.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:c(function(){return[0]}),last:c(function(t,e){return[e-1]}),eq:c(function(t,e,n){return[n<0?n+e:n]}),even:c(function(t,e){for(var n=0;n=0;)t.push(r);return t}),gt:c(function(t,e,n){for(var r=n<0?n+e:n;++r2&&"ID"===(o=a[0]).type&&b.getById&&9===e.nodeType&&I&&S.relative[a[1].type]){if(e=(S.find.ID(o.matches[0].replace(_t,bt),e)||[])[0],!e)return n;c&&(e=e.parentNode),t=t.slice(a.shift().value.length)}for(i=ft.needsContext.test(t)?0:a.length;i--&&(o=a[i],!S.relative[s=o.type]);)if((u=S.find[s])&&(r=u(o.matches[0].replace(_t,bt),mt.test(a[0].type)&&l(e.parentNode)||e))){if(a.splice(i,1),t=r.length&&d(a),!t)return J.apply(n,r),n;break}}return(c||C(t,h))(r,e,!I,n,!e||mt.test(t)&&l(e.parentNode)||e),n},b.sortStable=j.split("").sort(Y).join("")===j,b.detectDuplicates=!!E,k(),b.sortDetached=i(function(t){return 1&t.compareDocumentPosition(V.createElement("div"))}),i(function(t){return t.innerHTML="","#"===t.firstChild.getAttribute("href")})||a("type|href|height|width",function(t,e,n){if(!n)return t.getAttribute(e,"type"===e.toLowerCase()?1:2)}),b.attributes&&i(function(t){return t.innerHTML="",t.firstChild.setAttribute("value",""),""===t.firstChild.getAttribute("value")})||a("value",function(t,e,n){if(!n&&"input"===t.nodeName.toLowerCase())return t.defaultValue}),i(function(t){return null==t.getAttribute("disabled")})||a(et,function(t,e,n){var r;if(!n)return t[e]===!0?e.toLowerCase():(r=t.getAttributeNode(e))&&r.specified?r.value:null}),e}(t);at.find=lt,at.expr=lt.selectors,at.expr[":"]=at.expr.pseudos,at.uniqueSort=at.unique=lt.uniqueSort,at.text=lt.getText,at.isXMLDoc=lt.isXML,at.contains=lt.contains;var ht=function(t,e,n){for(var r=[],i=void 0!==n;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(i&&at(t).is(n))break;r.push(t)}return r},dt=function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n},ft=at.expr.match.needsContext,pt=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,gt=/^.[^:#\[\.,]*$/;at.filter=function(t,e,n){var r=e[0];return n&&(t=":not("+t+")"),1===e.length&&1===r.nodeType?at.find.matchesSelector(r,t)?[r]:[]:at.find.matches(t,at.grep(e,function(t){return 1===t.nodeType}))},at.fn.extend({find:function(t){var e,n=this.length,r=[],i=this;if("string"!=typeof t)return this.pushStack(at(t).filter(function(){for(e=0;e1?at.unique(r):r),r.selector=this.selector?this.selector+" "+t:t,r},filter:function(t){return this.pushStack(r(this,t||[],!1))},not:function(t){return this.pushStack(r(this,t||[],!0))},is:function(t){return!!r(this,"string"==typeof t&&ft.test(t)?at(t):t||[],!1).length}});var vt,yt=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,mt=at.fn.init=function(t,e,n){var r,i;if(!t)return this;if(n=n||vt,"string"==typeof t){if(r="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:yt.exec(t),!r||!r[1]&&e)return!e||e.jquery?(e||n).find(t):this.constructor(e).find(t);if(r[1]){if(e=e instanceof at?e[0]:e,at.merge(this,at.parseHTML(r[1],e&&e.nodeType?e.ownerDocument||e:$,!0)),pt.test(r[1])&&at.isPlainObject(e))for(r in e)at.isFunction(this[r])?this[r](e[r]):this.attr(r,e[r]);return this}return i=$.getElementById(r[2]),i&&i.parentNode&&(this.length=1,this[0]=i),this.context=$,this.selector=t,this}return t.nodeType?(this.context=this[0]=t,this.length=1,this):at.isFunction(t)?void 0!==n.ready?n.ready(t):t(at):(void 0!==t.selector&&(this.selector=t.selector,this.context=t.context),at.makeArray(t,this))};mt.prototype=at.fn,vt=at($);var xt=/^(?:parents|prev(?:Until|All))/,_t={children:!0,contents:!0,next:!0,prev:!0};at.fn.extend({has:function(t){var e=at(t,this),n=e.length;return this.filter(function(){for(var t=0;t-1:1===n.nodeType&&at.find.matchesSelector(n,t))){a.push(n);break}return this.pushStack(a.length>1?at.uniqueSort(a):a)},index:function(t){return t?"string"==typeof t?K.call(at(t),this[0]):K.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(at.uniqueSort(at.merge(this.get(),at(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),at.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return ht(t,"parentNode")},parentsUntil:function(t,e,n){return ht(t,"parentNode",n)},next:function(t){return i(t,"nextSibling")},prev:function(t){return i(t,"previousSibling")},nextAll:function(t){return ht(t,"nextSibling")},prevAll:function(t){return ht(t,"previousSibling")},nextUntil:function(t,e,n){return ht(t,"nextSibling",n)},prevUntil:function(t,e,n){return ht(t,"previousSibling",n)},siblings:function(t){return dt((t.parentNode||{}).firstChild,t)},children:function(t){return dt(t.firstChild)},contents:function(t){return t.contentDocument||at.merge([],t.childNodes)}},function(t,e){at.fn[t]=function(n,r){var i=at.map(this,e,n);return"Until"!==t.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=at.filter(r,i)),this.length>1&&(_t[t]||at.uniqueSort(i),xt.test(t)&&i.reverse()),this.pushStack(i)}});var bt=/\S+/g;at.Callbacks=function(t){t="string"==typeof t?a(t):at.extend({},t);var e,n,r,i,o=[],s=[],u=-1,c=function(){for(i=t.once,r=e=!0;s.length;u=-1)for(n=s.shift();++u-1;)o.splice(n,1),n<=u&&u--}),this},has:function(t){return t?at.inArray(t,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=s=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=s=[],n||(o=n=""),this},locked:function(){return!!i},fireWith:function(t,n){return i||(n=n||[],n=[t,n.slice?n.slice():n],s.push(n),e||c()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l},at.extend({Deferred:function(t){var e=[["resolve","done",at.Callbacks("once memory"),"resolved"],["reject","fail",at.Callbacks("once memory"),"rejected"],["notify","progress",at.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var t=arguments;return at.Deferred(function(n){at.each(e,function(e,a){var o=at.isFunction(t[e])&&t[e];i[a[1]](function(){var t=o&&o.apply(this,arguments);t&&at.isFunction(t.promise)?t.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[a[0]+"With"](this===r?n.promise():this,o?[t]:arguments)})}),t=null}).promise()},promise:function(t){return null!=t?at.extend(t,r):r}},i={};return r.pipe=r.then,at.each(e,function(t,a){var o=a[2],s=a[3];r[a[1]]=o.add,s&&o.add(function(){n=s},e[1^t][2].disable,e[2][2].lock),i[a[0]]=function(){return i[a[0]+"With"](this===i?r:this,arguments),this},i[a[0]+"With"]=o.fireWith}),r.promise(i),t&&t.call(i,i),i},when:function(t){var e,n,r,i=0,a=Q.call(arguments),o=a.length,s=1!==o||t&&at.isFunction(t.promise)?o:0,u=1===s?t:at.Deferred(),c=function(t,n,r){return function(i){n[t]=this,r[t]=arguments.length>1?Q.call(arguments):i,r===e?u.notifyWith(n,r):--s||u.resolveWith(n,r)}};if(o>1)for(e=new Array(o),n=new Array(o),r=new Array(o);i0||(St.resolveWith($,[at]),at.fn.triggerHandler&&(at($).triggerHandler("ready"),at($).off("ready"))))}}),at.ready.promise=function(e){return St||(St=at.Deferred(),"complete"===$.readyState||"loading"!==$.readyState&&!$.documentElement.doScroll?t.setTimeout(at.ready):($.addEventListener("DOMContentLoaded",o),t.addEventListener("load",o))),St.promise(e)},at.ready.promise();var wt=function(t,e,n,r,i,a,o){var s=0,u=t.length,c=null==n;if("object"===at.type(n)){i=!0;for(s in n)wt(t,e,s,n[s],!0,a,o)}else if(void 0!==r&&(i=!0,at.isFunction(r)||(o=!0),c&&(o?(e.call(t,r),e=null):(c=e,e=function(t,e,n){return c.call(at(t),n)})),e))for(;s-1&&void 0!==n&&Ct.set(this,t,e)})},null,e,arguments.length>1,null,!0)},removeData:function(t){return this.each(function(){Ct.remove(this,t)})}}),at.extend({queue:function(t,e,n){var r;if(t)return e=(e||"fx")+"queue",r=At.get(t,e),n&&(!r||at.isArray(n)?r=At.access(t,e,at.makeArray(n)):r.push(n)),r||[]},dequeue:function(t,e){e=e||"fx";var n=at.queue(t,e),r=n.length,i=n.shift(),a=at._queueHooks(t,e),o=function(){at.dequeue(t,e)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===e&&n.unshift("inprogress"),delete a.stop,i.call(t,o,a)),!r&&a&&a.empty.fire()},_queueHooks:function(t,e){var n=e+"queueHooks";return At.get(t,n)||At.access(t,n,{empty:at.Callbacks("once memory").add(function(){At.remove(t,[e+"queue",n])})})}}),at.fn.extend({queue:function(t,e){var n=2;return"string"!=typeof t&&(e=t,t="fx",n--),arguments.length",""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};Gt.optgroup=Gt.option,Gt.tbody=Gt.tfoot=Gt.colgroup=Gt.caption=Gt.thead,Gt.th=Gt.td;var Nt=/<|&#?\w+;/;!function(){var t=$.createDocumentFragment(),e=t.appendChild($.createElement("div")),n=$.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),e.appendChild(n),rt.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="",rt.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var Dt=/^key/,jt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ft=/^([^.]*)(?:\.(.+)|)/;at.event={global:{},add:function(t,e,n,r,i){var a,o,s,u,c,l,h,d,f,p,g,v=At.get(t);if(v)for(n.handler&&(a=n,n=a.handler,i=a.selector),n.guid||(n.guid=at.guid++),(u=v.events)||(u=v.events={}),(o=v.handle)||(o=v.handle=function(e){return"undefined"!=typeof at&&at.event.triggered!==e.type?at.event.dispatch.apply(t,arguments):void 0}),e=(e||"").match(bt)||[""],c=e.length;c--;)s=Ft.exec(e[c])||[],f=g=s[1],p=(s[2]||"").split(".").sort(),f&&(h=at.event.special[f]||{},f=(i?h.delegateType:h.bindType)||f,h=at.event.special[f]||{},l=at.extend({type:f,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&at.expr.match.needsContext.test(i),namespace:p.join(".")},a),(d=u[f])||(d=u[f]=[],d.delegateCount=0,h.setup&&h.setup.call(t,r,p,o)!==!1||t.addEventListener&&t.addEventListener(f,o)),h.add&&(h.add.call(t,l),l.handler.guid||(l.handler.guid=n.guid)),i?d.splice(d.delegateCount++,0,l):d.push(l),at.event.global[f]=!0)},remove:function(t,e,n,r,i){var a,o,s,u,c,l,h,d,f,p,g,v=At.hasData(t)&&At.get(t);if(v&&(u=v.events)){for(e=(e||"").match(bt)||[""],c=e.length;c--;)if(s=Ft.exec(e[c])||[],f=g=s[1],p=(s[2]||"").split(".").sort(),f){for(h=at.event.special[f]||{},f=(r?h.delegateType:h.bindType)||f,d=u[f]||[],s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=a=d.length;a--;)l=d[a],!i&&g!==l.origType||n&&n.guid!==l.guid||s&&!s.test(l.namespace)||r&&r!==l.selector&&("**"!==r||!l.selector)||(d.splice(a,1),l.selector&&d.delegateCount--,h.remove&&h.remove.call(t,l));o&&!d.length&&(h.teardown&&h.teardown.call(t,p,v.handle)!==!1||at.removeEvent(t,f,v.handle),delete u[f])}else for(f in u)at.event.remove(t,f+e[c],n,r,!0);at.isEmptyObject(u)&&At.remove(t,"handle events")}},dispatch:function(t){t=at.event.fix(t);var e,n,r,i,a,o=[],s=Q.call(arguments),u=(At.get(this,"events")||{})[t.type]||[],c=at.event.special[t.type]||{};if(s[0]=t,t.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,t)!==!1){for(o=at.event.handlers.call(this,t,u),e=0;(i=o[e++])&&!t.isPropagationStopped();)for(t.currentTarget=i.elem,n=0;(a=i.handlers[n++])&&!t.isImmediatePropagationStopped();)t.rnamespace&&!t.rnamespace.test(a.namespace)||(t.handleObj=a,t.data=a.data,r=((at.event.special[a.origType]||{}).handle||a.handler).apply(i.elem,s),void 0!==r&&(t.result=r)===!1&&(t.preventDefault(),t.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,t),t.result}},handlers:function(t,e){var n,r,i,a,o=[],s=e.delegateCount,u=t.target;if(s&&u.nodeType&&("click"!==t.type||isNaN(t.button)||t.button<1))for(;u!==this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==t.type)){for(r=[],n=0;n-1:at.find(i,this,null,[u]).length),r[i]&&r.push(a);r.length&&o.push({elem:u,handlers:r})}return s]*)\/>/gi,zt=/\s*$/g;at.extend({htmlPrefilter:function(t){return t.replace(Ht,"<$1>")},clone:function(t,e,n){var r,i,a,o,s=t.cloneNode(!0),u=at.contains(t.ownerDocument,t);if(!(rt.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||at.isXMLDoc(t)))for(o=l(s),a=l(t),r=0,i=a.length;r0&&h(o,!u&&l(t,"script")),s},cleanData:function(t){for(var e,n,r,i=at.event.special,a=0;void 0!==(n=t[a]);a++)if(Tt(n)){if(e=n[At.expando]){if(e.events)for(r in e.events)i[r]?at.event.remove(n,r):at.removeEvent(n,r,e.handle);n[At.expando]=void 0}n[Ct.expando]&&(n[Ct.expando]=void 0)}}}),at.fn.extend({domManip:S,detach:function(t){return w(this,t,!0)},remove:function(t){return w(this,t)},text:function(t){return wt(this,function(t){return void 0===t?at.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)})},null,t,arguments.length)},append:function(){return S(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=y(this,t);e.appendChild(t)}})},prepend:function(){return S(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=y(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return S(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return S(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)})},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(at.cleanData(l(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map(function(){return at.clone(this,t,e)})},html:function(t){return wt(this,function(t){var e=this[0]||{},n=0,r=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!zt.test(t)&&!Gt[(It.exec(t)||["",""])[1].toLowerCase()]){t=at.htmlPrefilter(t);try{for(;n1)},show:function(){return V(this,!0)},hide:function(){return V(this)},toggle:function(t){return"boolean"==typeof t?t?this.show():this.hide():this.each(function(){Vt(this)?at(this).show():at(this).hide()})}}),at.Tween=O,O.prototype={constructor:O,init:function(t,e,n,r,i,a){this.elem=t,this.prop=n,this.easing=i||at.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=r,this.unit=a||(at.cssNumber[n]?"":"px")},cur:function(){var t=O.propHooks[this.prop];return t&&t.get?t.get(this):O.propHooks._default.get(this)},run:function(t){var e,n=O.propHooks[this.prop];return this.options.duration?this.pos=e=at.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):O.propHooks._default.set(this),this}},O.prototype.init.prototype=O.prototype,O.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=at.css(t.elem,t.prop,""),e&&"auto"!==e?e:0)},set:function(t){at.fx.step[t.prop]?at.fx.step[t.prop](t):1!==t.elem.nodeType||null==t.elem.style[at.cssProps[t.prop]]&&!at.cssHooks[t.prop]?t.elem[t.prop]=t.now:at.style(t.elem,t.prop,t.now+t.unit)}}},O.propHooks.scrollTop=O.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},at.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},at.fx=O.prototype.init,at.fx.step={};var ie,ae,oe=/^(?:toggle|show|hide)$/,se=/queueHooks$/;at.Animation=at.extend(j,{tweeners:{"*":[function(t,e){var n=this.createTween(t,e);return c(n.elem,t,Et.exec(e),n),n}]},tweener:function(t,e){at.isFunction(t)?(e=t,t=["*"]):t=t.match(bt);for(var n,r=0,i=t.length;r1)},removeAttr:function(t){return this.each(function(){at.removeAttr(this,t)})}}),at.extend({attr:function(t,e,n){var r,i,a=t.nodeType;if(3!==a&&8!==a&&2!==a)return"undefined"==typeof t.getAttribute?at.prop(t,e,n):(1===a&&at.isXMLDoc(t)||(e=e.toLowerCase(),i=at.attrHooks[e]||(at.expr.match.bool.test(e)?ue:void 0)),void 0!==n?null===n?void at.removeAttr(t,e):i&&"set"in i&&void 0!==(r=i.set(t,n,e))?r:(t.setAttribute(e,n+""),n):i&&"get"in i&&null!==(r=i.get(t,e))?r:(r=at.find.attr(t,e),null==r?void 0:r))},attrHooks:{type:{set:function(t,e){if(!rt.radioValue&&"radio"===e&&at.nodeName(t,"input")){var n=t.value;return t.setAttribute("type",e),n&&(t.value=n),e}}}},removeAttr:function(t,e){var n,r,i=0,a=e&&e.match(bt);if(a&&1===t.nodeType)for(;n=a[i++];)r=at.propFix[n]||n,at.expr.match.bool.test(n)&&(t[r]=!1),t.removeAttribute(n)}}),ue={set:function(t,e,n){return e===!1?at.removeAttr(t,n):t.setAttribute(n,n),n}},at.each(at.expr.match.bool.source.match(/\w+/g),function(t,e){var n=ce[e]||at.find.attr;ce[e]=function(t,e,r){var i,a;return r||(a=ce[e],ce[e]=i,i=null!=n(t,e,r)?e.toLowerCase():null,ce[e]=a),i}});var le=/^(?:input|select|textarea|button)$/i,he=/^(?:a|area)$/i;at.fn.extend({prop:function(t,e){return wt(this,at.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each(function(){delete this[at.propFix[t]||t]})}}),at.extend({prop:function(t,e,n){var r,i,a=t.nodeType;if(3!==a&&8!==a&&2!==a)return 1===a&&at.isXMLDoc(t)||(e=at.propFix[e]||e,i=at.propHooks[e]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(t,n,e))?r:t[e]=n:i&&"get"in i&&null!==(r=i.get(t,e))?r:t[e]},propHooks:{tabIndex:{get:function(t){var e=at.find.attr(t,"tabindex");return e?parseInt(e,10):le.test(t.nodeName)||he.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),rt.optSelected||(at.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),at.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){at.propFix[this.toLowerCase()]=this});var de=/[\t\r\n\f]/g;at.fn.extend({addClass:function(t){var e,n,r,i,a,o,s,u=0;if(at.isFunction(t))return this.each(function(e){at(this).addClass(t.call(this,e,F(this)))});if("string"==typeof t&&t)for(e=t.match(bt)||[];n=this[u++];)if(i=F(n),r=1===n.nodeType&&(" "+i+" ").replace(de," ")){for(o=0;a=e[o++];)r.indexOf(" "+a+" ")<0&&(r+=a+" ");s=at.trim(r),i!==s&&n.setAttribute("class",s)}return this},removeClass:function(t){var e,n,r,i,a,o,s,u=0;if(at.isFunction(t))return this.each(function(e){at(this).removeClass(t.call(this,e,F(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof t&&t)for(e=t.match(bt)||[];n=this[u++];)if(i=F(n),r=1===n.nodeType&&(" "+i+" ").replace(de," ")){for(o=0;a=e[o++];)for(;r.indexOf(" "+a+" ")>-1;)r=r.replace(" "+a+" "," ");s=at.trim(r),i!==s&&n.setAttribute("class",s)}return this},toggleClass:function(t,e){var n=typeof t;return"boolean"==typeof e&&"string"===n?e?this.addClass(t):this.removeClass(t):at.isFunction(t)?this.each(function(n){at(this).toggleClass(t.call(this,n,F(this),e),e)}):this.each(function(){var e,r,i,a;if("string"===n)for(r=0,i=at(this),a=t.match(bt)||[];e=a[r++];)i.hasClass(e)?i.removeClass(e):i.addClass(e);else void 0!==t&&"boolean"!==n||(e=F(this),e&&At.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||t===!1?"":At.get(this,"__className__")||""))})},hasClass:function(t){var e,n,r=0;for(e=" "+t+" ";n=this[r++];)if(1===n.nodeType&&(" "+F(n)+" ").replace(de," ").indexOf(e)>-1)return!0;return!1}});var fe=/\r/g,pe=/[\x20\t\r\n\f]+/g;at.fn.extend({val:function(t){var e,n,r,i=this[0];{if(arguments.length)return r=at.isFunction(t),this.each(function(n){var i;1===this.nodeType&&(i=r?t.call(this,n,at(this).val()):t,null==i?i="":"number"==typeof i?i+="":at.isArray(i)&&(i=at.map(i,function(t){return null==t?"":t+""})),e=at.valHooks[this.type]||at.valHooks[this.nodeName.toLowerCase()],e&&"set"in e&&void 0!==e.set(this,i,"value")||(this.value=i))});if(i)return e=at.valHooks[i.type]||at.valHooks[i.nodeName.toLowerCase()],e&&"get"in e&&void 0!==(n=e.get(i,"value"))?n:(n=i.value,"string"==typeof n?n.replace(fe,""):null==n?"":n)}}}),at.extend({valHooks:{option:{get:function(t){var e=at.find.attr(t,"value");return null!=e?e:at.trim(at.text(t)).replace(pe," ")}},select:{get:function(t){for(var e,n,r=t.options,i=t.selectedIndex,a="select-one"===t.type||i<0,o=a?null:[],s=a?i+1:r.length,u=i<0?s:a?i:0;u-1)&&(n=!0);return n||(t.selectedIndex=-1),a}}}}),at.each(["radio","checkbox"],function(){at.valHooks[this]={set:function(t,e){if(at.isArray(e))return t.checked=at.inArray(at(t).val(),e)>-1}},rt.checkOn||(at.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})});var ge=/^(?:focusinfocus|focusoutblur)$/;at.extend(at.event,{trigger:function(e,n,r,i){var a,o,s,u,c,l,h,d=[r||$],f=nt.call(e,"type")?e.type:e,p=nt.call(e,"namespace")?e.namespace.split("."):[];if(o=s=r=r||$,3!==r.nodeType&&8!==r.nodeType&&!ge.test(f+at.event.triggered)&&(f.indexOf(".")>-1&&(p=f.split("."),f=p.shift(),p.sort()),c=f.indexOf(":")<0&&"on"+f,e=e[at.expando]?e:new at.Event(f,"object"==typeof e&&e),e.isTrigger=i?2:3,e.namespace=p.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=r),n=null==n?[e]:at.makeArray(n,[e]),h=at.event.special[f]||{},i||!h.trigger||h.trigger.apply(r,n)!==!1)){if(!i&&!h.noBubble&&!at.isWindow(r)){for(u=h.delegateType||f,ge.test(u+f)||(o=o.parentNode);o;o=o.parentNode)d.push(o),s=o;s===(r.ownerDocument||$)&&d.push(s.defaultView||s.parentWindow||t)}for(a=0;(o=d[a++])&&!e.isPropagationStopped();)e.type=a>1?u:h.bindType||f,l=(At.get(o,"events")||{})[e.type]&&At.get(o,"handle"),l&&l.apply(o,n),l=c&&o[c],l&&l.apply&&Tt(o)&&(e.result=l.apply(o,n),e.result===!1&&e.preventDefault());return e.type=f,i||e.isDefaultPrevented()||h._default&&h._default.apply(d.pop(),n)!==!1||!Tt(r)||c&&at.isFunction(r[f])&&!at.isWindow(r)&&(s=r[c],s&&(r[c]=null),at.event.triggered=f,r[f](),at.event.triggered=void 0,s&&(r[c]=s)),e.result}},simulate:function(t,e,n){var r=at.extend(new at.Event,n,{type:t,isSimulated:!0});at.event.trigger(r,null,e)}}),at.fn.extend({trigger:function(t,e){return this.each(function(){at.event.trigger(t,e,this)})},triggerHandler:function(t,e){var n=this[0];if(n)return at.event.trigger(t,e,n,!0)}}),at.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(t,e){at.fn[e]=function(t,n){return arguments.length>0?this.on(e,null,t,n):this.trigger(e)}}),at.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)}}),rt.focusin="onfocusin"in t,rt.focusin||at.each({focus:"focusin",blur:"focusout"},function(t,e){var n=function(t){at.event.simulate(e,t.target,at.event.fix(t))};at.event.special[e]={setup:function(){var r=this.ownerDocument||this,i=At.access(r,e);i||r.addEventListener(t,n,!0),At.access(r,e,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=At.access(r,e)-1;i?At.access(r,e,i):(r.removeEventListener(t,n,!0),At.remove(r,e))}}});var ve=t.location,ye=at.now(),me=/\?/;at.parseJSON=function(t){return JSON.parse(t+"")},at.parseXML=function(e){var n;if(!e||"string"!=typeof e)return null;try{n=(new t.DOMParser).parseFromString(e,"text/xml")}catch(t){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||at.error("Invalid XML: "+e),n};var xe=/#.*$/,_e=/([?&])_=[^&]*/,be=/^(.*?):[ \t]*([^\r\n]*)$/gm,Se=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,we=/^(?:GET|HEAD)$/,Te=/^\/\//,Ae={},Ce={},Pe="*/".concat("*"),Me=$.createElement("a");Me.href=ve.href,at.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ve.href,type:"GET",isLocal:Se.test(ve.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Pe,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":at.parseJSON,"text xml":at.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?X(X(t,at.ajaxSettings),e):X(at.ajaxSettings,t)},ajaxPrefilter:H(Ae),ajaxTransport:H(Ce),ajax:function(e,n){function r(e,n,r,s){var c,h,m,x,b,w=n;2!==_&&(_=2,u&&t.clearTimeout(u),i=void 0,o=s||"",S.readyState=e>0?4:0,c=e>=200&&e<300||304===e,r&&(x=B(d,S,r)),x=q(d,x,S,c),c?(d.ifModified&&(b=S.getResponseHeader("Last-Modified"),b&&(at.lastModified[a]=b),b=S.getResponseHeader("etag"),b&&(at.etag[a]=b)),204===e||"HEAD"===d.type?w="nocontent":304===e?w="notmodified":(w=x.state,h=x.data,m=x.error,c=!m)):(m=w,!e&&w||(w="error",e<0&&(e=0))),S.status=e,S.statusText=(n||w)+"",c?g.resolveWith(f,[h,w,S]):g.rejectWith(f,[S,w,m]),S.statusCode(y),y=void 0,l&&p.trigger(c?"ajaxSuccess":"ajaxError",[S,d,c?h:m]),v.fireWith(f,[S,w]),l&&(p.trigger("ajaxComplete",[S,d]),--at.active||at.event.trigger("ajaxStop")))}"object"==typeof e&&(n=e,e=void 0),n=n||{};var i,a,o,s,u,c,l,h,d=at.ajaxSetup({},n),f=d.context||d,p=d.context&&(f.nodeType||f.jquery)?at(f):at.event,g=at.Deferred(),v=at.Callbacks("once memory"),y=d.statusCode||{},m={},x={},_=0,b="canceled",S={readyState:0,getResponseHeader:function(t){var e;if(2===_){if(!s)for(s={};e=be.exec(o);)s[e[1].toLowerCase()]=e[2];e=s[t.toLowerCase()]}return null==e?null:e},getAllResponseHeaders:function(){return 2===_?o:null},setRequestHeader:function(t,e){var n=t.toLowerCase();return _||(t=x[n]=x[n]||t,m[t]=e),this},overrideMimeType:function(t){return _||(d.mimeType=t),this},statusCode:function(t){var e;if(t)if(_<2)for(e in t)y[e]=[y[e],t[e]];else S.always(t[S.status]);return this},abort:function(t){var e=t||b;return i&&i.abort(e),r(0,e),this}};if(g.promise(S).complete=v.add,S.success=S.done,S.error=S.fail,d.url=((e||d.url||ve.href)+"").replace(xe,"").replace(Te,ve.protocol+"//"),d.type=n.method||n.type||d.method||d.type,d.dataTypes=at.trim(d.dataType||"*").toLowerCase().match(bt)||[""],null==d.crossDomain){c=$.createElement("a");try{c.href=d.url,c.href=c.href,d.crossDomain=Me.protocol+"//"+Me.host!=c.protocol+"//"+c.host}catch(t){d.crossDomain=!0}}if(d.data&&d.processData&&"string"!=typeof d.data&&(d.data=at.param(d.data,d.traditional)),z(Ae,d,n,S),2===_)return S;l=at.event&&d.global,l&&0===at.active++&&at.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!we.test(d.type),a=d.url,d.hasContent||(d.data&&(a=d.url+=(me.test(a)?"&":"?")+d.data,delete d.data),d.cache===!1&&(d.url=_e.test(a)?a.replace(_e,"$1_="+ye++):a+(me.test(a)?"&":"?")+"_="+ye++)),d.ifModified&&(at.lastModified[a]&&S.setRequestHeader("If-Modified-Since",at.lastModified[a]),at.etag[a]&&S.setRequestHeader("If-None-Match",at.etag[a])),(d.data&&d.hasContent&&d.contentType!==!1||n.contentType)&&S.setRequestHeader("Content-Type",d.contentType),S.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Pe+"; q=0.01":""):d.accepts["*"]);for(h in d.headers)S.setRequestHeader(h,d.headers[h]);if(d.beforeSend&&(d.beforeSend.call(f,S,d)===!1||2===_))return S.abort();b="abort";for(h in{success:1,error:1,complete:1})S[h](d[h]);if(i=z(Ce,d,n,S)){if(S.readyState=1,l&&p.trigger("ajaxSend",[S,d]),2===_)return S;d.async&&d.timeout>0&&(u=t.setTimeout(function(){S.abort("timeout")},d.timeout));try{_=1,i.send(m,r)}catch(t){if(!(_<2))throw t;r(-1,t)}}else r(-1,"No Transport");return S},getJSON:function(t,e,n){return at.get(t,e,n,"json")},getScript:function(t,e){return at.get(t,void 0,e,"script")}}),at.each(["get","post"],function(t,e){at[e]=function(t,n,r,i){return at.isFunction(n)&&(i=i||r,r=n,n=void 0),at.ajax(at.extend({url:t,type:e,dataType:i,data:n,success:r},at.isPlainObject(t)&&t))}}),at._evalUrl=function(t){return at.ajax({url:t,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})},at.fn.extend({wrapAll:function(t){var e;return at.isFunction(t)?this.each(function(e){at(this).wrapAll(t.call(this,e))}):(this[0]&&(e=at(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t}).append(this)),this)},wrapInner:function(t){return at.isFunction(t)?this.each(function(e){at(this).wrapInner(t.call(this,e))}):this.each(function(){var e=at(this),n=e.contents();n.length?n.wrapAll(t):e.append(t)})},wrap:function(t){var e=at.isFunction(t);return this.each(function(n){at(this).wrapAll(e?t.call(this,n):t)})},unwrap:function(){return this.parent().each(function(){at.nodeName(this,"body")||at(this).replaceWith(this.childNodes)}).end()}}),at.expr.filters.hidden=function(t){return!at.expr.filters.visible(t)},at.expr.filters.visible=function(t){return t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0};var Le=/%20/g,Ee=/\[\]$/,ke=/\r?\n/g,Ve=/^(?:submit|button|image|reset|file)$/i,Oe=/^(?:input|select|textarea|keygen)/i;at.param=function(t,e){var n,r=[],i=function(t,e){e=at.isFunction(e)?e():null==e?"":e,r[r.length]=encodeURIComponent(t)+"="+encodeURIComponent(e)};if(void 0===e&&(e=at.ajaxSettings&&at.ajaxSettings.traditional),at.isArray(t)||t.jquery&&!at.isPlainObject(t))at.each(t,function(){i(this.name,this.value)});else for(n in t)Y(n,t[n],e,i);return r.join("&").replace(Le,"+")},at.fn.extend({serialize:function(){return at.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=at.prop(this,"elements");return t?at.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!at(this).is(":disabled")&&Oe.test(this.nodeName)&&!Ve.test(t)&&(this.checked||!Ot.test(t))}).map(function(t,e){var n=at(this).val();return null==n?null:at.isArray(n)?at.map(n,function(t){return{name:e.name,value:t.replace(ke,"\r\n")}}):{name:e.name,value:n.replace(ke,"\r\n")}}).get()}}),at.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch(t){}};var Ie={0:200,1223:204},Re=at.ajaxSettings.xhr();rt.cors=!!Re&&"withCredentials"in Re,rt.ajax=Re=!!Re,at.ajaxTransport(function(e){var n,r;if(rt.cors||Re&&!e.crossDomain)return{send:function(i,a){var o,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)s[o]=e.xhrFields[o];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(o in i)s.setRequestHeader(o,i[o]);n=function(t){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.onreadystatechange=null,"abort"===t?s.abort():"error"===t?"number"!=typeof s.status?a(0,"error"):a(s.status,s.statusText):a(Ie[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&t.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(e.hasContent&&e.data||null)}catch(t){if(n)throw t}},abort:function(){n&&n()}}}),at.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return at.globalEval(t),t}}}),at.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")}),at.ajaxTransport("script",function(t){if(t.crossDomain){var e,n;return{send:function(r,i){e=at(" {%- endraw %} diff --git a/boxoffice/views/participant.py b/boxoffice/views/participant.py index d7e922ab..c5525c6c 100644 --- a/boxoffice/views/participant.py +++ b/boxoffice/views/participant.py @@ -19,9 +19,9 @@ def assign(order): """ Assign a line_item to a participant """ - assignee_dict = request.json.get('attendee') + assignee_dict = request.json.get('assignee') if not request.json or not assignee_dict or not assignee_dict.get('email') or not assignee_dict.get('fullname'): - return make_response(jsonify(status='error', error='missing_attendee_details', error_description="Attendee details are missing"), 400) + return make_response(jsonify(status='error', error='missing_assignee_details', error_description="Assignee details are missing"), 400) line_item = LineItem.query.get(request.json.get('line_item_id')) if line_item.is_cancelled: return make_response(jsonify(status='error', error='cancelled_ticket', error_description="Ticket has been cancelled"), 400) From e53c518cccc8e2a0f407817284c2e14d55bdf568 Mon Sep 17 00:00:00 2001 From: Vidya Ramakrishnan Date: Mon, 30 Jan 2017 11:19:56 +0530 Subject: [PATCH 2/8] Add frontend tests on travis. --- .travis.yml | 3 + boxoffice/templates/boxoffice.html | 6 +- instance/testing.py | 2 +- runtestserver.py | 28 +--- tests/fixtures.py | 2 +- tests/index.html | 33 +++++ tests/test_booking_workflow.js | 136 ++++++++++++++++++ ...test_discounted_ticket_booking_workflow.js | 92 ++++++++++++ tests/test_free_ticket_booking_workflow.js | 72 ++++++++++ tests/test_workflow.js | 114 --------------- 10 files changed, 342 insertions(+), 146 deletions(-) create mode 100644 tests/index.html create mode 100644 tests/test_booking_workflow.js create mode 100644 tests/test_discounted_ticket_booking_workflow.js create mode 100644 tests/test_free_ticket_booking_workflow.js delete mode 100644 tests/test_workflow.js diff --git a/.travis.yml b/.travis.yml index d40ced0f..b78f502d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ cache: - $HOME/.cache/pip before_script: - sudo -- sh -c "echo '127.0.0.1 boxoffice.travis.dev' >> /etc/hosts" + - sudo -- sh -c "echo '127.0.0.1 testing.travis.dev' >> /etc/hosts" - psql -c 'create database boxoffice_testing;' -U postgres install: - pip install -U pip wheel @@ -15,7 +16,9 @@ install: script: - nosetests -v tests - nohup python runtestserver.py & + - nohup tests/python -m SimpleHTTPServer 8000 & - sleep 10 + - casperjs test tests addons: postgresql: "9.4" services: diff --git a/boxoffice/templates/boxoffice.html b/boxoffice/templates/boxoffice.html index 844ae6d8..34bf78a8 100644 --- a/boxoffice/templates/boxoffice.html +++ b/boxoffice/templates/boxoffice.html @@ -153,7 +153,7 @@

{{title}}

-
@@ -170,8 +170,8 @@

{{title}}

We’ve mailed you the cash receipt.

- {{#if line_item.quantity_available > 0}} + {{#if lineItem.quantityAvailable > 0}}

- {{#if line_item.hasHigherPrice}} + {{#if lineItem.hasHigherPrice}} - Price goes up on {{line_item.price_valid_upto}} + Price goes up on {{lineItem.priceValidUpto}} {{else}} - Sale closes on {{line_item.price_valid_upto}} + Sale closes on {{lineItem.priceValidUpto}} {{/if}}

{{/if}} diff --git a/boxoffice/templates/boxoffice.js b/boxoffice/templates/boxoffice.js index f7690d77..b07014e7 100644 --- a/boxoffice/templates/boxoffice.js +++ b/boxoffice/templates/boxoffice.js @@ -336,7 +336,7 @@ $(function() { if (lineItem.quantity < quantityAvailable) { lineItem.quantity += 1; } - boxoffice.widget.fire('eventAnalytics', 'add ticket', itemName, lineItem.base_price); + boxoffice.widget.fire('eventAnalytics', 'add ticket', itemName, lineItem.basePrice); } else if (lineItem.quantity !== 0) { lineItem.quantity -= 1; boxoffice.widget.fire('eventAnalytics', 'remove ticket', itemName, 0); diff --git a/boxoffice/templates/order.html b/boxoffice/templates/order.html index 5a312540..eff1273b 100644 --- a/boxoffice/templates/order.html +++ b/boxoffice/templates/order.html @@ -52,12 +52,12 @@

{{ order.item_collection.title }} Ticket Assignment

{{#if assignee.id || isTicketAssigned}}
- +
{{else}}

Fill attendee details

- +
{{/if}}
@@ -117,7 +117,7 @@

Please fill the assignee details

- diff --git a/instance/testing.py b/instance/testing.py index 39eaa1cf..740a21de 100644 --- a/instance/testing.py +++ b/instance/testing.py @@ -7,7 +7,7 @@ RAZORPAY_KEY_ID = os.environ.get('RAZORPAY_KEY_ID') RAZORPAY_KEY_SECRET = os.environ.get('RAZORPAY_KEY_SECRET') -ALLOWED_ORIGINS = ['http://testing.travis.dev:8000'] +ALLOWED_ORIGINS = [BASE_URL, 'http://testing.travis.dev:8000'] LASTUSER_SERVER = 'https://auth.hasgeek.com' LASTUSER_CLIENT_ID = '' LASTUSER_CLIENT_SECRET = '' diff --git a/tests/test_booking_workflow.js b/tests/test_booking_workflow.js index e0564318..23919b39 100644 --- a/tests/test_booking_workflow.js +++ b/tests/test_booking_workflow.js @@ -108,7 +108,7 @@ casper.test.begin("Boxoffice UI test for ticket booking workflow", 17, function casper.withFrame(0, function() { test.assertExist('div#payment-options', "Razorpay checkout window exists"); this.click('div.payment-option'); - casper.wait(casper.options.waitTimeout, function() { + casper.wait(120000, function() { this.sendKeys('#card_number', "4111111111111111"); this.sendKeys('#card_expiry', "11/99"); this.sendKeys('#card_cvv', "123"); @@ -125,10 +125,11 @@ casper.test.begin("Boxoffice UI test for ticket booking workflow", 17, function }); casper.wait(120000, function() { - this.capture('boxoffice_test1_stage3.png'); + //this.capture('boxoffice_test1_stage3.png'); test.assertExist('div.confirmation-msg', "Ticket booking confirmation message exists"); test.assertExist('#view-ticket', "View ticket button exist"); - test.assertExist('#view-ticket', "View cash receipt button exist"); + test.assertExist('#view-receipt', "View cash receipt button exist"); + this.click('#view-ticket'); }); casper.run(function() { diff --git a/tests/test_discounted_ticket_booking_workflow.js b/tests/test_discounted_ticket_booking_workflow.js index 69ef2638..aac65c4d 100644 --- a/tests/test_discounted_ticket_booking_workflow.js +++ b/tests/test_discounted_ticket_booking_workflow.js @@ -1,7 +1,7 @@ var system = require('system'); casper.options.waitTimeout = 120000; -casper.options.stepTimeout = 120000; +casper.options.stepTimeout = 60000; var host = "http://testing.travis.dev:8000?code=forever"; //presumably 127.0.0.1 var items = { @@ -84,7 +84,7 @@ casper.test.begin("Boxoffice UI test for discounted ticket booking workflow", 12 this.capture('boxoffice_test1_stage3.png'); test.assertExist('div.confirmation-msg', "Ticket booking confirmation message exists"); test.assertExist('#view-ticket', "View ticket button exist"); - test.assertExist('#view-ticket', "View cash receipt button exist"); + test.assertExist('#view-receipt', "View cash receipt button exist"); }); casper.run(function() { diff --git a/tests/test_free_ticket_booking_workflow.js b/tests/test_free_ticket_booking_workflow.js index cb93c032..034661e7 100644 --- a/tests/test_free_ticket_booking_workflow.js +++ b/tests/test_free_ticket_booking_workflow.js @@ -1,7 +1,7 @@ var system = require('system'); casper.options.waitTimeout = 120000; -casper.options.stepTimeout = 120000; +casper.options.stepTimeout = 60000; var host = "http://testing.travis.dev:8000?code=coupon2"; //presumably 127.0.0.1 var items = { @@ -16,7 +16,7 @@ var items = { }; var finalAmount = '₹0'; -casper.test.begin("Boxoffice UI test for free ticket booking workflow", 13, function suite(test) { +casper.test.begin("Boxoffice UI test for free ticket booking workflow", 14, function suite(test) { casper.start(host, function() { test.assertHttpStatus(200, "Ticketing page loaded"); @@ -63,10 +63,29 @@ casper.test.begin("Boxoffice UI test for free ticket booking workflow", 13, func casper.waitForSelector('.confirmation-icon', function() { test.assertExist('div.confirmation-msg', "Ticket booking confirmation message exists"); test.assertExist('#view-ticket', "View ticket button exist"); - test.assertExist('#view-ticket', "View cash receipt button exist"); + test.assertExist('#view-receipt', "View cash receipt button exist"); // this.capture('boxoffice_test3_stage3.png'); }); + casper.wait(120000, function() { + casper.withPopup(/order/, function() { + this.echo(this.getTitle()); + test.assertExist('.fill-details', "Fill attendee details button exists"); + this.click('.fill-details'); + casper.wait(6000, function() { + this.fill('form.assignee-form', { + 'fullname': 'HasGeek', + 'email': 'testing@hasgeek.com', + 'phone': '+919900011234' + }, false); + this.click('.assign-ticket'); + casper.wait(6000, function() { + test.assertExist('.confirmation-msg', "Ticket assignment confirmation exists"); + }); + }); + }); + }); + casper.run(function() { test.done(); }); From 6ab79523cdfe58cda6fad6fa619834d5ac433dae Mon Sep 17 00:00:00 2001 From: Vidya Ramakrishnan Date: Tue, 31 Jan 2017 14:40:12 +0530 Subject: [PATCH 5/8] Add test for attendee form. --- boxoffice/templates/boxoffice.html | 4 +-- tests/test_booking_workflow.js | 4 +-- ...test_discounted_ticket_booking_workflow.js | 4 +-- tests/test_free_ticket_booking_workflow.js | 34 +++++++++---------- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/boxoffice/templates/boxoffice.html b/boxoffice/templates/boxoffice.html index 29571267..4f712421 100644 --- a/boxoffice/templates/boxoffice.html +++ b/boxoffice/templates/boxoffice.html @@ -177,8 +177,8 @@

{{title}}

We’ve mailed you the cash receipt.

- +

Organization id

-

{{ id }}

+

{{id}}

{{#details:k,v}} {{#if k !== 'logo'}} -

{{ k }}

-
{{{ details[k] }}}
+

{{k}}

+
{{{details[k]}}}
{{/if}} {{/details}}

Contact email

-
{{ contact_email }}
+
{{contact_email}}
+ {{#infoMsg}} +

{{ infoMsg }}

+ {{/}}
{{/orgs}} diff --git a/boxoffice/static/js/templates/item_collection.html.js b/boxoffice/static/js/templates/item_collection.html.js index 1c5b650d..1f92a01c 100644 --- a/boxoffice/static/js/templates/item_collection.html.js +++ b/boxoffice/static/js/templates/item_collection.html.js @@ -51,7 +51,7 @@ export const ItemCollectionTemplate = `

Net sales

-

{{ netSales }}

+

{{net_sales}}

@@ -62,16 +62,16 @@ export const ItemCollectionTemplate = `

Today's sales

-

{{ todaySales }}

+

{{today_sales}}

- {{#if salesDelta > 0 }} + {{#if sales_delta > 0 }}

- {{elseif salesDelta < 0 }} + {{elseif sales_delta < 0 }}

{{else}}

@@ -79,7 +79,7 @@ export const ItemCollectionTemplate = `

Sales since yesterday

-

{{ salesDelta }}%

+

{{sales_delta}}%

diff --git a/boxoffice/static/js/templates/org.html.js b/boxoffice/static/js/templates/org.html.js index 0ddd163c..b8005b8f 100644 --- a/boxoffice/static/js/templates/org.html.js +++ b/boxoffice/static/js/templates/org.html.js @@ -2,7 +2,7 @@ export const orgTemplate = `

{{ title }}

- {{#itemCollections:itemCollection}} + {{#item_collections:item_collection}}
{{#title}} @@ -12,15 +12,18 @@ export const orgTemplate = `

Item collection id

-

{{ id }}

+

{{id}}

Item collection description

-
{{{ description_html }}}
+
{{{description_html}}}
+ {{#infoMsg}} +

{{ infoMsg }}

+ {{/}}
- {{/itemCollections}} + {{/item_collections}}
` diff --git a/boxoffice/static/js/views/admin_order.js b/boxoffice/static/js/views/admin_order.js index 6ebd477c..0cb53b94 100644 --- a/boxoffice/static/js/views/admin_order.js +++ b/boxoffice/static/js/views/admin_order.js @@ -1,5 +1,5 @@ -import {Util, ScrollToElement} from '../models/util.js'; +import {scrollToElement} from '../models/util.js'; import {OrderModel} from '../models/admin_order.js'; import {OrderTemplate} from '../templates/admin_order.html.js'; import {SideBarView} from './sidebar.js'; @@ -8,22 +8,19 @@ export const OrderView = { render: function(config) { OrderModel.fetch({ - url: OrderModel.urlFor('index', {icId: config.id})['path'] + url: OrderModel.urlFor('index', {ic_id: config.id})['path'] }).done((remoteData) => { // Initial render - let orderComponent = new Ractive({ + let main_ractive = new Ractive({ el: '#main-content-area', template: OrderTemplate, data: { title: remoteData.title, - orders: remoteData.orders, - formatCurrency: function(value) { - return Util.formatToIndianRupee(value); - } + orders: remoteData.orders } }); - SideBarView.render('orders', {'orgName': remoteData.org_name, 'icId': config.id}); + SideBarView.render('orders', {'org_name': remoteData.org_name, 'ic_id': config.id}); NProgress.done(); @@ -55,56 +52,55 @@ export const OrderView = { } }); - orderComponent.on('showOrder', function(event){ + main_ractive.on('showOrder', function(event){ //Close all other open side panels - orderComponent.set('orders.*.showOrder', false); + main_ractive.set('orders.*.show_order', false); //Show individual order - orderComponent.set(event.keypath + '.loading', true); + main_ractive.set(event.keypath + '.loading', true); NProgress.configure({ showSpinner: false}).start(); - let orderId = event.context.id; + let order_id = event.context.id; OrderModel.fetch({ - url: OrderModel.urlFor('view', {orderId: orderId})['path'] + url: OrderModel.urlFor('view', {order_id: order_id})['path'] }).done((remoteData) => { - orderComponent.set(event.keypath + '.lineItems', remoteData.line_items); - orderComponent.set(event.keypath + '.showOrder', true); + main_ractive.set(event.keypath + '.line_items', remoteData.line_items); + main_ractive.set(event.keypath + '.show_order', true); NProgress.done(); - orderComponent.set(event.keypath + '.loading', false); - let ractiveId = "#" + orderComponent.el.id; - //Scroll to the top of the page to view the order slider - ScrollToElement(ractiveId); + main_ractive.set(event.keypath + '.loading', false); + let ractive_id = "#" + main_ractive.el.id; + scrollToElement(ractive_id); }); }); - orderComponent.on('hideOrder', function(event){ + main_ractive.on('hideOrder', function(event){ //Show individual order - orderComponent.set(event.keypath + '.showOrder', false); + main_ractive.set(event.keypath + '.show_order', false); }); - orderComponent.on('cancelTicket', function(event, method) { + main_ractive.on('cancelTicket', function(event, method) { if (window.confirm("Are you sure you want to cancel this ticket?")) { - orderComponent.set(event.keypath + '.cancelError', ""); - orderComponent.set(event.keypath + '.cancelling', true); + main_ractive.set(event.keypath + '.cancel_error', ""); + main_ractive.set(event.keypath + '.cancelling', true); OrderModel.post({ url: event.context.cancel_ticket_url }).done(function(response) { - orderComponent.set(event.keypath + '.cancelled_at', response.result.cancelled_at); - orderComponent.set(event.keypath + '.cancelling', false); + main_ractive.set(event.keypath + '.cancelled_at', response.result.cancelled_at); + main_ractive.set(event.keypath + '.cancelling', false); }).fail(function(response) { - let errorMsg; + let error_text; if (response.readyState === 4) { if (response.status === 500) { - errorMsg = "Server Error"; + error_text = "Server Error"; } else { - errorMsg = JSON.parse(response.responseText).error_description; + error_text = JSON.parse(response.responseText).error_description; } } else { - errorMsg = "Unable to connect. Please try again later."; + error_text = "Unable to connect. Please try again later."; } - orderComponent.set(event.keypath + '.cancelError', errorMsg); - orderComponent.set(event.keypath + '.cancelling', false); + main_ractive.set(event.keypath + '.cancel_error', error_text); + main_ractive.set(event.keypath + '.cancelling', false); }); } }); diff --git a/boxoffice/static/js/views/admin_report.js b/boxoffice/static/js/views/admin_report.js index ffaebaab..c1ca7593 100644 --- a/boxoffice/static/js/views/admin_report.js +++ b/boxoffice/static/js/views/admin_report.js @@ -7,26 +7,26 @@ export const ReportView = { render: function(config) { ReportModel.fetch({ - url: ReportModel.urlFor('index', {icId: config.id})['path'] + url: ReportModel.urlFor('index', {ic_id: config.id})['path'] }).done((remoteData) => { // Initial render - let reportComponent = new Ractive({ + let main_ractive = new Ractive({ el: '#main-content-area', template: ReportTemplate, data: { title: remoteData.item_collection_title, - reportsUrl: function() { - let reportType = this.get('reportType'); - return ReportModel.urlFor(reportType, {icId: config.id})['path']; + reports_url: function() { + let report_type = this.get('report_type'); + return ReportModel.urlFor(report_type, {ic_id: config.id})['path']; }, - reportsFilename: function() { + reports_filename: function() { let filename = this.get('title').replace(/ /g, '_'); - return filename + '_' + this.get('reportType') + '.csv'; + return filename + '_' + this.get('report_type') + '.csv'; } } }); - SideBarView.render('reports', {'orgName': remoteData.org_name, 'icId': config.id}); + SideBarView.render('reports', {'org_name': remoteData.org_name, 'ic_id': config.id}); NProgress.done(); diff --git a/boxoffice/static/js/views/index.js b/boxoffice/static/js/views/index.js index 9bfcc6ad..5f49c26d 100644 --- a/boxoffice/static/js/views/index.js +++ b/boxoffice/static/js/views/index.js @@ -9,7 +9,7 @@ export const IndexView = { IndexModel.fetch({ url: IndexModel.urlFor('index')['path'] }).then(function(data){ - let indexComponent = new Ractive({ + let ractive = new Ractive({ el: '#main-content-area', template: IndexTemplate, data: { @@ -21,7 +21,7 @@ export const IndexView = { NProgress.done(); - indexComponent.on('navigate', function(event, method){ + ractive.on('navigate', function(event, method){ NProgress.configure({ showSpinner: false}).start(); eventBus.trigger('navigate', event.context.url); }); diff --git a/boxoffice/static/js/views/item_collection.js b/boxoffice/static/js/views/item_collection.js index 800cad9d..8f7f3012 100644 --- a/boxoffice/static/js/views/item_collection.js +++ b/boxoffice/static/js/views/item_collection.js @@ -10,54 +10,54 @@ let TableComponent = Ractive.extend({ let AggChartComponent = Ractive.extend({ template: AggChartTemplate, - formatColumns: function(){ - let dateItemCounts = this.parent.get('dateItemCounts'); + format_columns: function(){ + let date_item_counts = this.parent.get('date_item_counts'); const items = this.parent.get('items'); - const dateSales = this.parent.get('dateSales'); + const date_sales = this.parent.get('date_sales'); let dates = ['x']; - let itemCounts = {}; - let dateSalesColumn = ['sales']; - for (let itemDate in dateItemCounts) { - dates.push(itemDate); - dateSalesColumn.push(dateSales[itemDate]); + let item_counts = {} + let date_sales_column = ['sales'] + for (let item_date in date_item_counts) { + dates.push(item_date); + date_sales_column.push(date_sales[item_date]); items.forEach((item) => { - if (!itemCounts[item.id]) { - itemCounts[item.id] = []; + if (!item_counts[item.id]) { + item_counts[item.id] = []; } - if (dateItemCounts[itemDate].hasOwnProperty(item.id)) { + if (date_item_counts[item_date].hasOwnProperty(item.id)) { // If an item has been bought on this item_date - itemCounts[item.id].push(dateItemCounts[itemDate][item.id]); + item_counts[item.id].push(date_item_counts[item_date][item.id]); } else { // Item not bought on this date - itemCounts[item.id].push(0); + item_counts[item.id].push(0); } }) } let columns = [dates]; items.forEach((item) =>{ - columns.push([item.title].concat(itemCounts[item.id])); + columns.push([item.title].concat(item_counts[item.id])); }) // let bar_graph_headers = columns.map((col) => col[0]).filter((header) => header !== 'x'); - columns.push(dateSalesColumn); + columns.push(date_sales_column); return columns; }, oncomplete: function(){ - let columns = this.formatColumns(); - let barGraphHeaders = _.without(_.map(columns, _.first), 'x', 'sales') + let columns = this.format_columns(); + let bar_graph_headers = _.without(_.map(columns, _.first), 'x', 'sales') this.chart = c3.generate({ data: { x: 'x', - columns: this.formatColumns(), + columns: this.format_columns(), type: 'bar', types: { sales: 'line' }, groups: [ - barGraphHeaders + bar_graph_headers ], axes: { sales: 'y2' @@ -88,7 +88,7 @@ let AggChartComponent = Ractive.extend({ this.parent.on('data_update', () => { this.chart.load({ - columns: this.formatColumns() + columns: this.format_columns() }); }); @@ -99,10 +99,10 @@ export const ItemCollectionView = { render: function(config) { ItemCollectionModel.fetch({ - url: ItemCollectionModel.urlFor('index', {icId: config.id})['path'] + url: ItemCollectionModel.urlFor('index', {ic_id: config.id})['path'] }).done((remoteData) => { // Initial render - let icComponent = new Ractive({ + let main_ractive = new Ractive({ el: '#main-content-area', template: ItemCollectionTemplate, data: ItemCollectionModel.formatData(remoteData), @@ -111,7 +111,7 @@ export const ItemCollectionView = { NProgress.done(); - SideBarView.render('dashboard', {'orgName': remoteData.org_name, 'icId': config.id}); + SideBarView.render('dashboard', {'org_name': remoteData.org_name, 'ic_id': config.id}); window.addEventListener('popstate', (event) => { NProgress.configure({ showSpinner: false}).start(); diff --git a/boxoffice/static/js/views/org.js b/boxoffice/static/js/views/org.js index 23209c80..4a69da2e 100644 --- a/boxoffice/static/js/views/org.js +++ b/boxoffice/static/js/views/org.js @@ -7,14 +7,14 @@ export const OrgView = { render: function(org) { OrgModel.fetch({ - url: OrgModel.urlFor('index', {orgName: org.name})['path'] + url: OrgModel.urlFor('index', {org_name: org.name})['path'] }).then(function(data){ - let orgComponent = new Ractive({ + let ractive = new Ractive({ el: '#main-content-area', template: orgTemplate, data: { title: data.title, - itemCollections: data.item_collections + item_collections: data.item_collections } }); @@ -22,7 +22,7 @@ export const OrgView = { NProgress.done(); - orgComponent.on('navigate', function(event, method){ + ractive.on('navigate', function(event, method){ NProgress.configure({ showSpinner: false}).start(); eventBus.trigger('navigate', event.context.url); }); diff --git a/boxoffice/static/js/views/router.js b/boxoffice/static/js/views/router.js index b077774f..92403fd2 100644 --- a/boxoffice/static/js/views/router.js +++ b/boxoffice/static/js/views/router.js @@ -10,7 +10,7 @@ export const Router = Backbone.Router.extend({ routes: { "": "index", "o/:org": "org", - "ic/:icId": "itemCollection", + "ic/:icId": "item_collection", "ic/:icId/orders": "order", "ic/:icId/reports": "report" }, @@ -20,7 +20,7 @@ export const Router = Backbone.Router.extend({ org: function(org){ OrgView.render({name: org}); }, - itemCollection: function(icId){ + item_collection: function(icId){ ItemCollectionView.render({id: icId}); }, order: function(icId){ diff --git a/boxoffice/static/js/views/sidebar.js b/boxoffice/static/js/views/sidebar.js index a2c5c0d8..e8d323de 100644 --- a/boxoffice/static/js/views/sidebar.js +++ b/boxoffice/static/js/views/sidebar.js @@ -2,15 +2,15 @@ import {SideBarModel} from '../models/sidebar.js'; import {SideBarTemplate} from '../templates/sidebar.html.js'; export const SideBarView = { - init: function(view, icConfig) { + init: function(view, ic_config) { this.on = true; - this.component = new Ractive({ + this.ractive = new Ractive({ el: '#sidebar', template: SideBarTemplate, data: { sidebarMobileOn: false, - sidebarItems: SideBarModel.getItems(icConfig), + sidebarItems: SideBarModel.getItems(ic_config), activeItem: view, sidebarHide: false }, @@ -26,22 +26,22 @@ export const SideBarView = { } }); }, - render: function(view, icConfig) { + render: function(view, ic_config) { if (this.on) { - this.component.set({ - 'sidebarItems': SideBarModel.getItems(icConfig), + this.ractive.set({ + 'sidebarItems': SideBarModel.getItems(ic_config), 'activeItem': view, 'sidebarHide': false, 'sidebarMobileOn': false }); } else { - this.init(view, icConfig); + this.init(view, ic_config); } }, hide: function() { if (this.on) { - this.component.set('sidebarHide', true); + this.ractive.set('sidebarHide', true); } } };