Repository navigation
Expand file tree
/
Copy pathplottable.min.js
More file actions
7 lines (7 loc) · 208 KB
/
Copy pathplottable.min.js
File metadata and controls
7 lines (7 loc) · 208 KB
1
2
3
4
5
6
7
!function(a,b){if("object"==typeof exports)module.exports=b(require,exports,module);else if("function"==typeof define&&define.amd)define(["require","exports","module"],b);else{var c=function(b){return a[b]},d=a,e={exports:d};a.Plottable=b(c,d,e)}}(this,function(){var a;!function(a){var b;!function(b){var c;!function(b){function c(a,b,c){return k.min(b,c)<=a&&a<=k.max(b,c)}function d(a,b,c){return k.min(k.max(b,a),c)}function e(a,b,c){var d="function"==typeof b?b:null,e=null==d?b:c,f=null==d?d3.max(a):d3.max(a,d);return void 0!==f?f:e}function f(a,b,c){var d="function"==typeof b?b:null,e=null==d?b:c,f=null==d?d3.min(a):d3.min(a,d);return void 0!==f?f:e}function g(a){return a!==a}function h(b){return"number"==typeof b&&!a.Utils.Math.isNaN(b)&&isFinite(b)}function i(a,b,c){if(void 0===c&&(c=1),0===c)throw new Error("step cannot be 0");for(var d=k.max(k.ceil((b-a)/c),0),e=[],f=0;d>f;++f)e[f]=a+c*f;return e}function j(a,b){return k.pow(b.y-a.y,2)+k.pow(b.x-a.x,2)}var k=window.Math;b.inRange=c,b.clamp=d,b.max=e,b.min=f,b.isNaN=g,b.isValidNumber=h,b.range=i,b.distanceSquared=j}(c=b.Math||(b.Math={}))}(b=a.Utils||(a.Utils={}))}(a||(a={}));var a;!function(a){var b;!function(a){var b=function(){function b(){"function"==typeof window.Map?this._es6Map=new window.Map:this._keyValuePairs=[]}return b.prototype.set=function(b,c){if(a.Math.isNaN(b))throw new Error("NaN may not be used as a key to the Map");if(null!=this._es6Map)return this._es6Map.set(b,c),this;for(var d=0;d<this._keyValuePairs.length;d++)if(this._keyValuePairs[d].key===b)return this._keyValuePairs[d].value=c,this;return this._keyValuePairs.push({key:b,value:c}),this},b.prototype.get=function(a){if(null!=this._es6Map)return this._es6Map.get(a);for(var b=0;b<this._keyValuePairs.length;b++)if(this._keyValuePairs[b].key===a)return this._keyValuePairs[b].value;return void 0},b.prototype.has=function(a){if(null!=this._es6Map)return this._es6Map.has(a);for(var b=0;b<this._keyValuePairs.length;b++)if(this._keyValuePairs[b].key===a)return!0;return!1},b.prototype.forEach=function(a,b){var c=this;if(null!=this._es6Map){var d=function(d,e){return a.call(b,d,e,c)};return void this._es6Map.forEach(d,b)}this._keyValuePairs.forEach(function(d){a.call(b,d.value,d.key,c)})},b.prototype["delete"]=function(a){if(null!=this._es6Map)return this._es6Map["delete"](a);for(var b=0;b<this._keyValuePairs.length;b++)if(this._keyValuePairs[b].key===a)return this._keyValuePairs.splice(b,1),!0;return!1},b}();a.Map=b}(b=a.Utils||(a.Utils={}))}(a||(a={}));var a;!function(a){var b;!function(a){var b=function(){function a(){"function"==typeof window.Set?this._es6Set=new window.Set:this._values=[],this.size=0}return a.prototype.add=function(a){return null!=this._es6Set?(this._es6Set.add(a),this.size=this._es6Set.size,this):(this.has(a)||(this._values.push(a),this.size=this._values.length),this)},a.prototype["delete"]=function(a){if(null!=this._es6Set){var b=this._es6Set["delete"](a);return this.size=this._es6Set.size,b}var c=this._values.indexOf(a);return-1!==c?(this._values.splice(c,1),this.size=this._values.length,!0):!1},a.prototype.has=function(a){return null!=this._es6Set?this._es6Set.has(a):-1!==this._values.indexOf(a)},a.prototype.forEach=function(a,b){var c=this;if(null!=this._es6Set){var d=function(d,e){return a.call(b,d,e,c)};return void this._es6Set.forEach(d,b)}this._values.forEach(function(d){a.call(b,d,d,c)})},a}();a.Set=b}(b=a.Utils||(a.Utils={}))}(a||(a={}));var a;!function(a){var b;!function(a){var b;!function(a){function b(a){var b;try{b=a.node().getBBox()}catch(c){b={x:0,y:0,width:0,height:0}}return b}function c(b){null!=window.requestAnimationFrame?window.requestAnimationFrame(b):setTimeout(b,a.SCREEN_REFRESH_RATE_MILLISECONDS)}function d(a){var b=window.getComputedStyle(a);return m(b,"width")+m(b,"padding-left")+m(b,"padding-right")+m(b,"border-left-width")+m(b,"border-right-width")}function e(a){var b=window.getComputedStyle(a);return m(b,"height")+m(b,"padding-top")+m(b,"padding-bottom")+m(b,"border-top-width")+m(b,"border-bottom-width")}function f(a,b,c){var d=d3.transform(a.attr("transform"));return null==b?d.translate:(c=null==c?0:c,d.translate[0]=b,d.translate[1]=c,a.attr("transform",d.toString()),a)}function g(a,b){return a.right<b.left?!1:a.left>b.right?!1:a.bottom<b.top?!1:a.top>b.bottom?!1:!0}function h(a,b){return n.floor(b.left)<=n.ceil(a.left)&&n.floor(b.top)<=n.ceil(a.top)&&n.floor(a.right)<=n.ceil(b.right)&&n.floor(a.bottom)<=n.ceil(b.bottom)}function i(a){var b=a.ownerSVGElement;return null!=b?b:"svg"===a.nodeName.toLowerCase()?a:null}function j(){return"plottableClipPath"+ ++o}function k(a,b,c,d){void 0===d&&(d=.5);var e=l(a),f=l(b);return c.x+c.width>=e.min-d&&c.x<=e.max+d&&c.y+c.height>=f.min-d&&c.y<=f.max+d}function l(a){if("number"==typeof a){var b=a;return{min:b,max:b}}var c=a;if(c instanceof Object&&"min"in c&&"max"in c)return c;throw new Error("input '"+a+"' can't be parsed as an Range")}function m(a,b){var c=a.getPropertyValue(b),d=parseFloat(c);return d||0}var n=window.Math;a.elementBBox=b,a.SCREEN_REFRESH_RATE_MILLISECONDS=1e3/60,a.requestAnimationFramePolyfill=c,a.elementWidth=d,a.elementHeight=e,a.translate=f,a.clientRectsOverlap=g,a.clientRectInside=h,a.boundingSVG=i;var o=0;a.generateUniqueClipPathId=j,a.intersectsBBox=k}(b=a.DOM||(a.DOM={}))}(b=a.Utils||(a.Utils={}))}(a||(a={}));var a;!function(a){var b;!function(a){var b;!function(a){function b(a,b){var c=e(a)+.05,d=e(b)+.05;return c>d?c/d:d/c}function c(a,b){var c=d3.hsl(a).brighter(b);return c.rgb().toString()}function d(a,b){a.classed(b,!0);var c=a.style("background-color");if("transparent"===c)return null;var d=/\((.+)\)/.exec(c)[1].split(",").map(function(a){var b=+a,c=b.toString(16);return 16>b?"0"+c:c});if(4===d.length&&"00"===d[3])return null;var e="#"+d.join("");return a.classed(b,!1),e}function e(a){var b=d3.rgb(a),c=function(a){return a/=255,.03928>=a?a/12.92:f.pow((a+.055)/1.055,2.4)},d=c(b.r),e=c(b.g),g=c(b.b);return.2126*d+.7152*e+.0722*g}var f=window.Math;a.contrast=b,a.lightenColor=c,a.colorTest=d}(b=a.Color||(a.Color={}))}(b=a.Utils||(a.Utils={}))}(a||(a={}));var a;!function(a){var b;!function(a){var b;!function(a){function b(a,b){if(a.length!==b.length)throw new Error("attempted to add arrays of unequal length");return a.map(function(c,d){return a[d]+b[d]})}function c(a){var b=d3.set(),c=[];return a.forEach(function(a){b.has(String(a))||(b.add(String(a)),c.push(a))}),c}function d(a){return f.prototype.concat.apply([],a)}function e(a,b){for(var c=[],d=0;b>d;d++)c[d]="function"==typeof a?a(d):a;return c}var f=window.Array;a.add=b,a.uniq=c,a.flatten=d,a.createFilledArray=e}(b=a.Array||(a.Array={}))}(b=a.Utils||(a.Utils={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(a){var c=function(a){function c(){a.apply(this,arguments)}return b(c,a),c.prototype.callCallbacks=function(){for(var a=this,b=[],c=0;c<arguments.length;c++)b[c-0]=arguments[c];return this.forEach(function(c){c.apply(a,b)}),this},c}(a.Set);a.CallbackSet=c}(c=a.Utils||(a.Utils={}))}(a||(a={}));var a;!function(a){var b;!function(a){var b;!function(b){function c(b,c,d){var f=d3.map(),g=d3.map(),h=new a.Map;return b.forEach(function(b){var i=new a.Map;b.data().forEach(function(a,h){var j,k=e(c(a,h,b)),l=+d(a,h,b),m=l>=0?f:g;m.has(k)?(j=m.get(k),m.set(k,j+l)):(j=0,m.set(k,l)),i.set(k,{value:l,offset:j})}),h.set(b,i)}),h}function d(b,c,d){var g=[];b.forEach(function(a,b){b.data().forEach(function(f,h){if(null==d||d(f,h,b)){var i=a.get(e(c(f,h,b)));g.push(i.value+i.offset)}})});var h=a.Math.max(g,0),i=a.Math.min(g,0);return[f.min(i,0),f.max(0,h)]}function e(a){return String(a)}var f=window.Math;b.stack=c,b.stackedExtent=d,b.normalizeKey=e}(b=a.Stacking||(a.Stacking={}))}(b=a.Utils||(a.Utils={}))}(a||(a={}));var a;!function(a){var b;!function(b){var c;!function(c){function d(b){a.Configs.SHOW_WARNINGS&&null!=window.console&&(null!=window.console.warn?console.warn(b):null!=window.console.log&&console.log(b))}function e(a,b){for(var c=[],d=2;d<arguments.length;d++)c[d-2]=arguments[d];return 0===b?(a(c),-1):window.setTimeout(a,b,c)}function f(a,c,d){void 0===d&&(d=""),b.Window.warn("Method "+a+" has been deprecated in version "+c+". Please refer to the release notes. "+d)}c.warn=d,c.setTimeout=e,c.deprecated=f}(c=b.Window||(b.Window={}))}(b=a.Utils||(a.Utils={}))}(a||(a={}));var a;!function(a){var b;!function(a){var b=function(){function b(a){this._svg=a,this._measureRect=document.createElementNS(a.namespaceURI,"rect"),this._measureRect.setAttribute("class","measure-rect"),this._measureRect.setAttribute("style","opacity: 0; visibility: hidden;"),this._measureRect.setAttribute("width","1"),this._measureRect.setAttribute("height","1"),this._svg.appendChild(this._measureRect)}return b.getTranslator=function(c){var d=a.DOM.boundingSVG(c),e=d[b._TRANSLATOR_KEY];return null==e&&(e=new b(d),d[b._TRANSLATOR_KEY]=e),e},b.prototype.computePosition=function(a,b){this._measureRect.setAttribute("x","0"),this._measureRect.setAttribute("y","0");var c=this._measureRect.getBoundingClientRect(),d={x:c.left,y:c.top},e=100;this._measureRect.setAttribute("x",String(e)),this._measureRect.setAttribute("y",String(e)),c=this._measureRect.getBoundingClientRect();var f={x:c.left,y:c.top};if(d.x===f.x||d.y===f.y)return null;var g=(f.x-d.x)/e,h=(f.y-d.y)/e;this._measureRect.setAttribute("x",String((a-d.x)/g)),this._measureRect.setAttribute("y",String((b-d.y)/h)),c=this._measureRect.getBoundingClientRect();var i={x:c.left,y:c.top},j={x:(i.x-d.x)/g,y:(i.y-d.y)/h};return j},b.prototype.insideSVG=function(b){return a.DOM.boundingSVG(b.target)===this._svg},b._TRANSLATOR_KEY="__Plottable_ClientToSVGTranslator",b}();a.ClientToSVGTranslator=b}(b=a.Utils||(a.Utils={}))}(a||(a={}));var a;!function(a){var b;!function(a){a.SHOW_WARNINGS=!0}(b=a.Configs||(a.Configs={}))}(a||(a={}));var a;!function(a){a.version="1.6.1"}(a||(a={}));var a;!function(a){var b=function(){function b(b,c){void 0===b&&(b=[]),void 0===c&&(c={}),this._data=b,this._metadata=c,this._callbacks=new a.Utils.CallbackSet}return b.prototype.onUpdate=function(a){return this._callbacks.add(a),this},b.prototype.offUpdate=function(a){return this._callbacks["delete"](a),this},b.prototype.data=function(a){return null==a?this._data:(this._data=a,this._callbacks.callCallbacks(this),this)},b.prototype.metadata=function(a){return null==a?this._metadata:(this._metadata=a,this._callbacks.callCallbacks(this),this)},b}();a.Dataset=b}(a||(a={}));var a;!function(a){var b;!function(b){var c=function(){function b(){}return b.prototype.render=function(){a.RenderController.flush()},b}();b.Immediate=c;var d=function(){function b(){}return b.prototype.render=function(){a.Utils.DOM.requestAnimationFramePolyfill(a.RenderController.flush)},b}();b.AnimationFrame=d;var e=function(){function b(){this._timeoutMsec=a.Utils.DOM.SCREEN_REFRESH_RATE_MILLISECONDS}return b.prototype.render=function(){setTimeout(a.RenderController.flush,this._timeoutMsec)},b}();b.Timeout=e}(b=a.RenderPolicies||(a.RenderPolicies={}))}(a||(a={}));var a;!function(a){var b;!function(b){function c(b){if(null==b)return m;switch(b.toLowerCase()){case h.IMMEDIATE:m=new a.RenderPolicies.Immediate;break;case h.ANIMATION_FRAME:m=new a.RenderPolicies.AnimationFrame;break;case h.TIMEOUT:m=new a.RenderPolicies.Timeout;break;default:a.Utils.Window.warn("Unrecognized renderPolicy: "+b)}}function d(b){l&&a.Utils.Window.warn("Registered to render while other components are flushing: request may be ignored"),i.add(b),f()}function e(a){j.add(a),i.add(a),f()}function f(){k||(k=!0,m.render())}function g(){if(k){j.forEach(function(a){return a.computeLayout()}),i.forEach(function(a){return a.render()}),l=!0;var b=new a.Utils.Set;i.forEach(function(a){try{a.renderImmediately()}catch(c){window.setTimeout(function(){throw c},0),b.add(a)}}),j=new a.Utils.Set,i=b,k=!1,l=!1}}var h,i=new a.Utils.Set,j=new a.Utils.Set,k=!1,l=!1;!function(a){a.IMMEDIATE="immediate",a.ANIMATION_FRAME="animationframe",a.TIMEOUT="timeout"}(h=b.Policy||(b.Policy={}));var m=new a.RenderPolicies.AnimationFrame;b.renderPolicy=c,b.registerToRender=d,b.registerToComputeLayout=e,b.flush=g}(b=a.RenderController||(a.RenderController={}))}(a||(a={}));var a;!function(a){a.MILLISECONDS_IN_ONE_DAY=864e5;var b;!function(b){function c(a,c,d){void 0===a&&(a=2),void 0===c&&(c="$"),void 0===d&&(d=!0);var e=b.fixed(a);return function(a){var b=e(Math.abs(a));return""!==b&&(d?b=c+b:b+=c,0>a&&(b="-"+b)),b}}function d(a){return void 0===a&&(a=3),m(a),function(b){return b.toFixed(a)}}function e(a){return void 0===a&&(a=3),m(a),function(b){if("number"==typeof b){var c=Math.pow(10,a);return String(Math.round(b*c)/c)}return String(b)}}function f(){return function(a){return String(a)}}function g(a){void 0===a&&(a=0);var c=b.fixed(a);return function(a){var b=100*a,d=a.toString(),e=Math.pow(10,d.length-(d.indexOf(".")+1));return b=parseInt((b*e).toString(),10)/e,c(b)+"%"}}function h(a){return void 0===a&&(a=3),m(a),function(b){return d3.format("."+a+"s")(b)}}function i(a){void 0===a&&(a=3),m(a),a=Math.floor(a);var b="KMBTQ",c=d3.format("."+a+"e"),d=d3.format("."+a+"f"),e=Math.pow(10,3*(b.length+1)),f=Math.pow(10,-a);return function(a){var g=Math.abs(a);if((f>g||g>=e)&&0!==g)return c(a);for(var h=-1;g>=Math.pow(1e3,h+2)&&h<b.length-1;)h++;var i="";return i=-1===h?d(a):d(a/Math.pow(1e3,h+1))+b[h],(a>0&&"1000"===i.substr(0,4)||0>a&&"-1000"===i.substr(0,5))&&(h<b.length-1?(h++,i=d(a/Math.pow(1e3,h+1))+b[h]):i=c(a)),i}}function j(){var a=8,b={};return b[0]={format:".%L",filter:function(a){return 0!==a.getMilliseconds()}},b[1]={format:":%S",filter:function(a){return 0!==a.getSeconds()}},b[2]={format:"%I:%M",filter:function(a){return 0!==a.getMinutes()}},b[3]={format:"%I %p",filter:function(a){return 0!==a.getHours()}},b[4]={format:"%a %d",filter:function(a){return 0!==a.getDay()&&1!==a.getDate()}},b[5]={format:"%b %d",filter:function(a){return 1!==a.getDate()}},b[6]={format:"%b",filter:function(a){return 0!==a.getMonth()}},b[7]={format:"%Y",filter:function(){return!0}},function(c){for(var d=0;a>d;d++)if(b[d].filter(c))return d3.time.format(b[d].format)(c)}}function k(a){return d3.time.format(a)}function l(b,c,d){return void 0===b&&(b=0),void 0===c&&(c=a.MILLISECONDS_IN_ONE_DAY),void 0===d&&(d=""),a.Utils.Window.deprecated("relativeDate()","1.3","Not safe for use with time zones."),function(a){var e=Math.round((a.valueOf()-b)/c);return e.toString()+d}}function m(a){if(0>a||a>20)throw new RangeError("Formatter precision must be between 0 and 20")}b.currency=c,b.fixed=d,b.general=e,b.identity=f,b.percentage=g,b.siSuffix=h,b.shortScale=i,b.multiTime=j,b.time=k,b.relativeDate=l}(b=a.Formatters||(a.Formatters={}))}(a||(a={}));var a;!function(a){var b;!function(a){function b(){return function(a){return d3.svg.symbol().type("circle").size(Math.PI*Math.pow(a/2,2))(null)}}function c(){return function(a){return d3.svg.symbol().type("square").size(Math.pow(a,2))(null)}}function d(){return function(a){return d3.svg.symbol().type("cross").size(5/9*Math.pow(a,2))(null)}}function e(){return function(a){return d3.svg.symbol().type("diamond").size(Math.tan(Math.PI/6)*Math.pow(a,2)/2)(null)}}function f(){return function(a){return d3.svg.symbol().type("triangle-up").size(Math.sqrt(3)*Math.pow(a/2,2))(null)}}function g(){return function(a){return d3.svg.symbol().type("triangle-down").size(Math.sqrt(3)*Math.pow(a/2,2))(null)}}a.circle=b,a.square=c,a.cross=d,a.diamond=e,a.triangleUp=f,a.triangleDown=g}(b=a.SymbolFactories||(a.SymbolFactories={}))}(a||(a={}));var a;!function(a){var b=function(){function b(){this._autoDomainAutomatically=!0,this._domainModificationInProgress=!1,this._callbacks=new a.Utils.CallbackSet,this._includedValuesProviders=new a.Utils.Set}return b.prototype.extentOfValues=function(){return[]},b.prototype._getAllIncludedValues=function(){var a=this,b=[];return this._includedValuesProviders.forEach(function(c){var d=c(a);b=b.concat(d)}),b},b.prototype._getExtent=function(){return[]},b.prototype.onUpdate=function(a){return this._callbacks.add(a),this},b.prototype.offUpdate=function(a){return this._callbacks["delete"](a),this},b.prototype._dispatchUpdate=function(){this._callbacks.callCallbacks(this)},b.prototype.autoDomain=function(){return this._autoDomainAutomatically=!0,this._setDomain(this._getExtent()),this},b.prototype._autoDomainIfAutomaticMode=function(){this._autoDomainAutomatically&&this.autoDomain()},b.prototype.scale=function(){throw new Error("Subclasses should override scale")},b.prototype.domain=function(a){return null==a?this._getDomain():(this._autoDomainAutomatically=!1,this._setDomain(a),this)},b.prototype._getDomain=function(){throw new Error("Subclasses should override _getDomain")},b.prototype._setDomain=function(a){this._domainModificationInProgress||(this._domainModificationInProgress=!0,this._setBackingScaleDomain(a),this._dispatchUpdate(),this._domainModificationInProgress=!1)},b.prototype._setBackingScaleDomain=function(){throw new Error("Subclasses should override _setBackingDomain")},b.prototype.range=function(a){return null==a?this._getRange():(this._setRange(a),this)},b.prototype._getRange=function(){throw new Error("Subclasses should override _getRange")},b.prototype._setRange=function(){throw new Error("Subclasses should override _setRange")},b.prototype.addIncludedValuesProvider=function(a){return this._includedValuesProviders.add(a),this._autoDomainIfAutomaticMode(),this},b.prototype.removeIncludedValuesProvider=function(a){return this._includedValuesProviders["delete"](a),this._autoDomainIfAutomaticMode(),this},b}();a.Scale=b}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c=function(c){function d(){c.call(this),this._tickGenerator=function(a){return a.defaultTicks()},this._padProportion=.05,this._paddingExceptionsProviders=new a.Utils.Set}return b(d,c),d.prototype.autoDomain=function(){return this._domainMin=null,this._domainMax=null,c.prototype.autoDomain.call(this),this},d.prototype._autoDomainIfAutomaticMode=function(){if(null!=this._domainMin&&null!=this._domainMax)return void this._setDomain([this._domainMin,this._domainMax]);var a=this._getExtent();if(null!=this._domainMin){var b=a[1];return this._domainMin>=b&&(b=this._expandSingleValueDomain([this._domainMin,this._domainMin])[1]),void this._setDomain([this._domainMin,b])}if(null!=this._domainMax){var d=a[0];return this._domainMax<=d&&(d=this._expandSingleValueDomain([this._domainMax,this._domainMax])[0]),void this._setDomain([d,this._domainMax])}c.prototype._autoDomainIfAutomaticMode.call(this)},d.prototype._getExtent=function(){var b=this._getAllIncludedValues(),c=this._defaultExtent();if(0!==b.length){var d=[a.Utils.Math.min(b,c[0]),a.Utils.Math.max(b,c[1])];c=this._padDomain(d)}return null!=this._domainMin&&(c[0]=this._domainMin),null!=this._domainMax&&(c[1]=this._domainMax),c},d.prototype.addPaddingExceptionsProvider=function(a){return this._paddingExceptionsProviders.add(a),this._autoDomainIfAutomaticMode(),this},d.prototype.removePaddingExceptionsProvider=function(a){return this._paddingExceptionsProviders["delete"](a),this._autoDomainIfAutomaticMode(),this},d.prototype.padProportion=function(a){if(null==a)return this._padProportion;if(0>a)throw new Error("padProportion must be non-negative");return this._padProportion=a,this._autoDomainIfAutomaticMode(),this},d.prototype._padDomain=function(a){var b=this;if(a[0].valueOf()===a[1].valueOf())return this._expandSingleValueDomain(a);if(0===this._padProportion)return a;var c=this._padProportion/2,d=a[0],e=a[1],f=!1,g=!1;this._paddingExceptionsProviders.forEach(function(a){var c=a(b);c.forEach(function(a){a.valueOf()===d.valueOf()&&(f=!0),a.valueOf()===e.valueOf()&&(g=!0)})});var h=f?d:this.invert(this.scale(d)-(this.scale(e)-this.scale(d))*c),i=g?e:this.invert(this.scale(e)+(this.scale(e)-this.scale(d))*c);return this._niceDomain([h,i])},d.prototype._expandSingleValueDomain=function(a){return a},d.prototype.invert=function(){throw new Error("Subclasses should override invert")},d.prototype.domain=function(a){return null!=a&&(this._domainMin=a[0],this._domainMax=a[1]),c.prototype.domain.call(this,a)},d.prototype.domainMin=function(a){return null==a?this.domain()[0]:(this._domainMin=a,this._autoDomainIfAutomaticMode(),this)},d.prototype.domainMax=function(a){return null==a?this.domain()[1]:(this._domainMax=a,this._autoDomainIfAutomaticMode(),this)},d.prototype.extentOfValues=function(b){var c=d3.extent(b.filter(function(b){return a.Utils.Math.isValidNumber(+b)}));return null==c[0]||null==c[1]?[]:c},d.prototype._setDomain=function(b){var d=function(b){return a.Utils.Math.isNaN(b)||1/0===b||b===-1/0};return d(b[0])||d(b[1])?void a.Utils.Window.warn("Warning: QuantitativeScales cannot take NaN or Infinity as a domain value. Ignoring."):void c.prototype._setDomain.call(this,b)},d.prototype.defaultTicks=function(){throw new Error("Subclasses should override _getDefaultTicks")},d.prototype.ticks=function(){return this._tickGenerator(this)},d.prototype._niceDomain=function(){throw new Error("Subclasses should override _niceDomain")},d.prototype._defaultExtent=function(){throw new Error("Subclasses should override _defaultExtent")},d.prototype.tickGenerator=function(a){return null==a?this._tickGenerator:(this._tickGenerator=a,this)},d._DEFAULT_NUM_TICKS=10,d}(a.Scale);a.QuantitativeScale=c}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(a){function d(){a.call(this),this._d3Scale=d3.scale.linear()}return b(d,a),d.prototype._defaultExtent=function(){return[0,1]},d.prototype._expandSingleValueDomain=function(a){return a[0]===a[1]?[a[0]-1,a[1]+1]:a},d.prototype.scale=function(a){return this._d3Scale(a)},d.prototype._getDomain=function(){return this._d3Scale.domain()},d.prototype._setBackingScaleDomain=function(a){this._d3Scale.domain(a)},d.prototype._getRange=function(){return this._d3Scale.range()},d.prototype._setRange=function(a){this._d3Scale.range(a)},d.prototype.invert=function(a){return this._d3Scale.invert(a)},d.prototype.defaultTicks=function(){return this._d3Scale.ticks(c.Linear._DEFAULT_NUM_TICKS)},d.prototype._niceDomain=function(a,b){return this._d3Scale.copy().domain(a).nice(b).domain()},d}(a.QuantitativeScale);c.Linear=d}(c=a.Scales||(a.Scales={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(d){function e(a){if(void 0===a&&(a=10),d.call(this),this._d3Scale=d3.scale.linear(),this._base=a,this._pivot=this._base,this._setDomain(this._defaultExtent()),1>=a)throw new Error("ModifiedLogScale: The base must be > 1")}return b(e,d),e.prototype._adjustedLog=function(a){var b=0>a?-1:1;return a*=b,a<this._pivot&&(a+=(this._pivot-a)/this._pivot),a=Math.log(a)/Math.log(this._base),a*=b},e.prototype._invertedAdjustedLog=function(a){var b=0>a?-1:1;return a*=b,a=Math.pow(this._base,a),a<this._pivot&&(a=this._pivot*(a-1)/(this._pivot-1)),a*=b},e.prototype.scale=function(a){return this._d3Scale(this._adjustedLog(a))},e.prototype.invert=function(a){return this._invertedAdjustedLog(this._d3Scale.invert(a))},e.prototype._getDomain=function(){return this._untransformedDomain},e.prototype._setDomain=function(a){this._untransformedDomain=a;var b=[this._adjustedLog(a[0]),this._adjustedLog(a[1])];d.prototype._setDomain.call(this,b)},e.prototype._setBackingScaleDomain=function(a){this._d3Scale.domain(a)},e.prototype.ticks=function(){var b=function(a,b,c){return[a,b,c].sort(function(a,b){return a-b})[1]},d=a.Utils.Math.min(this._untransformedDomain,0),e=a.Utils.Math.max(this._untransformedDomain,0),f=d,g=b(d,e,-this._pivot),h=b(d,e,this._pivot),i=e,j=this._logTicks(-g,-f).map(function(a){return-a}).reverse(),k=this._logTicks(h,i),l=Math.max(d,-this._pivot),m=Math.min(e,this._pivot),n=d3.scale.linear().domain([l,m]).ticks(this._howManyTicks(l,m)),o=j.concat(n).concat(k);return o.length<=1&&(o=d3.scale.linear().domain([d,e]).ticks(c.ModifiedLog._DEFAULT_NUM_TICKS)),o},e.prototype._logTicks=function(b,c){var d=this,e=this._howManyTicks(b,c);if(0===e)return[];var f=Math.floor(Math.log(b)/Math.log(this._base)),g=Math.ceil(Math.log(c)/Math.log(this._base)),h=d3.range(g,f,-Math.ceil((g-f)/e)),i=d3.range(this._base,1,-(this._base-1)).map(Math.floor),j=a.Utils.Array.uniq(i),k=h.map(function(a){return j.map(function(b){return Math.pow(d._base,a-1)*b})}),l=a.Utils.Array.flatten(k),m=l.filter(function(a){return a>=b&&c>=a}),n=m.sort(function(a,b){return a-b});return n},e.prototype._howManyTicks=function(b,d){var e=this._adjustedLog(a.Utils.Math.min(this._untransformedDomain,0)),f=this._adjustedLog(a.Utils.Math.max(this._untransformedDomain,0)),g=this._adjustedLog(b),h=this._adjustedLog(d),i=(h-g)/(f-e),j=Math.ceil(i*c.ModifiedLog._DEFAULT_NUM_TICKS);return j},e.prototype._niceDomain=function(a){return a},e.prototype._defaultExtent=function(){return[0,this._base]},e.prototype._expandSingleValueDomain=function(a){if(a[0]===a[1]){var b=a[0];return b>0?[b/this._base,b*this._base]:0===b?[-this._base,this._base]:[b*this._base,b/this._base]}return a},e.prototype._getRange=function(){return this._d3Scale.range()},e.prototype._setRange=function(a){this._d3Scale.range(a)},e.prototype.defaultTicks=function(){return this._d3Scale.ticks(c.ModifiedLog._DEFAULT_NUM_TICKS)},e}(a.QuantitativeScale);c.ModifiedLog=d}(c=a.Scales||(a.Scales={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(){c.call(this),this._range=[0,1],this._d3Scale=d3.scale.ordinal();var a=.3;this._innerPadding=d._convertToPlottableInnerPadding(a),this._outerPadding=d._convertToPlottableOuterPadding(.5,a)}return b(d,c),d.prototype.extentOfValues=function(b){return a.Utils.Array.uniq(b)},d.prototype._getExtent=function(){return a.Utils.Array.uniq(this._getAllIncludedValues())},d.prototype.domain=function(a){return c.prototype.domain.call(this,a)},d.prototype._setDomain=function(a){c.prototype._setDomain.call(this,a),this.range(this.range())},d.prototype.range=function(a){if(null==a)return this._range;this._range=a;var b=1-1/(1+this.innerPadding()),c=this.outerPadding()/(1+this.innerPadding());return this._d3Scale.rangeBands(a,b,c),this},d._convertToPlottableInnerPadding=function(a){return 1/(1-a)-1},d._convertToPlottableOuterPadding=function(a,b){return a/(1-b)},d.prototype.rangeBand=function(){return this._d3Scale.rangeBand()},d.prototype.stepWidth=function(){return this.rangeBand()*(1+this.innerPadding())},d.prototype.innerPadding=function(a){return null==a?this._innerPadding:(this._innerPadding=a,this.range(this.range()),this._dispatchUpdate(),this)},d.prototype.outerPadding=function(a){return null==a?this._outerPadding:(this._outerPadding=a,this.range(this.range()),this._dispatchUpdate(),this)},d.prototype.scale=function(a){return this._d3Scale(a)+this.rangeBand()/2},d.prototype._getDomain=function(){return this._d3Scale.domain()},d.prototype._setBackingScaleDomain=function(a){this._d3Scale.domain(a)},d.prototype._getRange=function(){return this._d3Scale.range()},d.prototype._setRange=function(a){this._d3Scale.range(a)},d}(a.Scale);c.Category=d}(c=a.Scales||(a.Scales={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(a){c.call(this);var b;switch(a){case null:case void 0:null==d._plottableColorCache&&(d._plottableColorCache=d._getPlottableColors()),b=d3.scale.ordinal().range(d._plottableColorCache);break;case"Category10":case"category10":case"10":b=d3.scale.category10();break;case"Category20":case"category20":case"20":b=d3.scale.category20();break;case"Category20b":case"category20b":case"20b":b=d3.scale.category20b();break;case"Category20c":case"category20c":case"20c":b=d3.scale.category20c();break;default:throw new Error("Unsupported ColorScale type")}this._d3Scale=b}return b(d,c),d.prototype.extentOfValues=function(b){return a.Utils.Array.uniq(b)},d.prototype._getExtent=function(){return a.Utils.Array.uniq(this._getAllIncludedValues())},d.invalidateColorCache=function(){d._plottableColorCache=null},d._getPlottableColors=function(){for(var b,c=[],d=d3.select("body").append("plottable-color-tester"),e=a.Utils.Color.colorTest(d,""),f=0;null!==(b=a.Utils.Color.colorTest(d,"plottable-colors-"+f))&&f<this._MAXIMUM_COLORS_FROM_CSS&&(b!==e||b!==c[c.length-1]);)c.push(b),f++;return d.remove(),c},d.prototype.scale=function(b){var c=this._d3Scale(b),e=this.domain().indexOf(b),f=Math.floor(e/this.range().length),g=Math.log(f*d._LOOP_LIGHTEN_FACTOR+1);return a.Utils.Color.lightenColor(c,g)},d.prototype._getDomain=function(){return this._d3Scale.domain()},d.prototype._setBackingScaleDomain=function(a){this._d3Scale.domain(a)},d.prototype._getRange=function(){return this._d3Scale.range()},d.prototype._setRange=function(a){this._d3Scale.range(a)},d._LOOP_LIGHTEN_FACTOR=1.6,d._MAXIMUM_COLORS_FROM_CSS=256,d}(a.Scale);c.Color=d}(c=a.Scales||(a.Scales={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(d){function e(){d.call(this),this._d3Scale=d3.time.scale()}return b(e,d),e.prototype.tickInterval=function(a,b){var c=d3.time.scale(),d=e.timeIntervalToD3Time(a);return c.domain(this.domain()),c.range(this.range()),c.ticks(d,b)},e.prototype._setDomain=function(a){if(a[1]<a[0])throw new Error("Scale.Time domain values must be in chronological order");return d.prototype._setDomain.call(this,a)},e.prototype._defaultExtent=function(){var a=new Date,b=a.valueOf();a.setDate(a.getDate()-1);var c=a.valueOf();return[new Date(c),new Date(b)]},e.prototype._expandSingleValueDomain=function(a){var b=a[0].getTime(),c=a[1].getTime();if(b===c){var d=new Date(b);d.setDate(d.getDate()-1);var e=new Date(c);return e.setDate(e.getDate()+1),[d,e]}return a},e.prototype.scale=function(a){return this._d3Scale(a)},e.prototype._getDomain=function(){return this._d3Scale.domain()},e.prototype._setBackingScaleDomain=function(a){this._d3Scale.domain(a)},e.prototype._getRange=function(){return this._d3Scale.range()},e.prototype._setRange=function(a){this._d3Scale.range(a)},e.prototype.invert=function(a){return this._d3Scale.invert(a)},e.prototype.defaultTicks=function(){return this._d3Scale.ticks(c.Time._DEFAULT_NUM_TICKS)},e.prototype._niceDomain=function(a){return this._d3Scale.copy().domain(a).nice().domain()},e.timeIntervalToD3Time=function(b){switch(b){case a.TimeInterval.second:return d3.time.second;case a.TimeInterval.minute:return d3.time.minute;case a.TimeInterval.hour:return d3.time.hour;case a.TimeInterval.day:return d3.time.day;case a.TimeInterval.week:return d3.time.week;case a.TimeInterval.month:return d3.time.month;case a.TimeInterval.year:return d3.time.year;default:throw Error("TimeInterval specified does not exist: "+b)}},e}(a.QuantitativeScale);c.Time=d}(c=a.Scales||(a.Scales={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(a){switch(void 0===a&&(a="linear"),c.call(this),a){case"linear":this._colorScale=d3.scale.linear();
break;case"log":this._colorScale=d3.scale.log();break;case"sqrt":this._colorScale=d3.scale.sqrt();break;case"pow":this._colorScale=d3.scale.pow()}if(null==this._colorScale)throw new Error("unknown QuantitativeScale scale type "+a);this.range(d.REDS)}return b(d,c),d.prototype.extentOfValues=function(a){var b=d3.extent(a);return null==b[0]||null==b[1]?[]:b},d.prototype._d3InterpolatedScale=function(){return this._colorScale.range([0,1]).interpolate(this._interpolateColors())},d.prototype._interpolateColors=function(){var a=this._colorRange;if(a.length<2)throw new Error("Color scale arrays must have at least two elements.");return function(){return function(b){b=Math.max(0,Math.min(1,b));var c=b*(a.length-1),d=Math.floor(c),e=Math.ceil(c),f=c-d;return d3.interpolateLab(a[d],a[e])(f)}}},d.prototype._resetScale=function(){this._d3Scale=this._d3InterpolatedScale(),this._autoDomainIfAutomaticMode(),this._dispatchUpdate()},d.prototype.autoDomain=function(){var b=this._getAllIncludedValues();return b.length>0&&this._setDomain([a.Utils.Math.min(b,0),a.Utils.Math.max(b,0)]),this},d.prototype.scale=function(a){return this._d3Scale(a)},d.prototype._getDomain=function(){return this._d3Scale.domain()},d.prototype._setBackingScaleDomain=function(a){this._d3Scale.domain(a)},d.prototype._getRange=function(){return this._colorRange},d.prototype._setRange=function(a){this._colorRange=a,this._resetScale()},d.REDS=["#FFFFFF","#FFF6E1","#FEF4C0","#FED976","#FEB24C","#FD8D3C","#FC4E2A","#E31A1C","#B10026"],d.BLUES=["#FFFFFF","#CCFFFF","#A5FFFD","#85F7FB","#6ED3EF","#55A7E0","#417FD0","#2545D3","#0B02E1"],d.POSNEG=["#0B02E1","#2545D3","#417FD0","#55A7E0","#6ED3EF","#85F7FB","#A5FFFD","#CCFFFF","#FFFFFF","#FFF6E1","#FEF4C0","#FED976","#FEB24C","#FD8D3C","#FC4E2A","#E31A1C","#B10026"],d}(a.Scale);c.InterpolatedColor=d}(c=a.Scales||(a.Scales={}))}(a||(a={}));var a;!function(a){var b;!function(b){var c;!function(b){function c(b){if(0>=b)throw new Error("interval must be positive number");return function(c){var d=c.domain(),e=Math.min(d[0],d[1]),f=Math.max(d[0],d[1]),g=Math.ceil(e/b)*b,h=Math.floor((f-g)/b)+1,i=e%b===0?[]:[e],j=a.Utils.Math.range(0,h).map(function(a){return g+a*b}),k=f%b===0?[]:[f];return i.concat(j).concat(k)}}function d(){return function(a){var b=a.defaultTicks();return b.filter(function(a,c){return a%1===0||0===c||c===b.length-1})}}b.intervalTickGenerator=c,b.integerTickGenerator=d}(c=b.TickGenerators||(b.TickGenerators={}))}(b=a.Scales||(a.Scales={}))}(a||(a={}));var a;!function(a){var b=function(){function b(a){this._cachedSelectionValid=!1,this._dataset=a}return b.prototype.renderArea=function(a){return null==a?this._renderArea:(this._renderArea=a,this._cachedSelectionValid=!1,this)},b.prototype.remove=function(){null!=this.renderArea()&&this.renderArea().remove()},b.prototype._bindSelectionData=function(a){var b=this.selection().data(a);b.enter().append(this._svgElementName),b.exit().remove(),this._applyDefaultAttributes(b)},b.prototype._applyDefaultAttributes=function(a){null!=this._className&&a.classed(this._className,!0)},b.prototype._drawStep=function(a){var b=this.selection(),c=["fill","stroke"];c.forEach(function(c){null!=a.attrToAppliedProjector[c]&&b.attr(c,a.attrToAppliedProjector[c])}),a.animator.animate(b,a.attrToAppliedProjector),null!=this._className&&this.selection().classed(this._className,!0)},b.prototype._appliedProjectors=function(a){var b=this,c={};return Object.keys(a).forEach(function(d){c[d]=function(c,e){return a[d](c,e,b._dataset)}}),c},b.prototype.totalDrawTime=function(a,b){var c=0;return b.forEach(function(b){c+=b.animator.totalTime(a.length)}),c},b.prototype.draw=function(b,c){var d=this,e=c.map(function(a){var b=d._appliedProjectors(a.attrToProjector);return{attrToAppliedProjector:b,animator:a.animator}});this._bindSelectionData(b),this._cachedSelectionValid=!1;var f=0;return e.forEach(function(c){a.Utils.Window.setTimeout(function(){return d._drawStep(c)},f),f+=c.animator.totalTime(b.length)}),this},b.prototype.selection=function(){return this._cachedSelectionValid||(this._cachedSelection=this.renderArea().selectAll(this.selector()),this._cachedSelectionValid=!0),this._cachedSelection},b.prototype.selector=function(){return this._svgElementName},b.prototype.selectionForIndex=function(a){return d3.select(this.selection()[0][a])},b}();a.Drawer=b}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(a){function c(b){a.call(this,b),this._className="line",this._svgElementName="path"}return b(c,a),c.prototype._applyDefaultAttributes=function(b){a.prototype._applyDefaultAttributes.call(this,b),b.style("fill","none")},c.prototype.selectionForIndex=function(){return d3.select(this.selection()[0][0])},c}(a.Drawer);c.Line=d}(c=a.Drawers||(a.Drawers={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(a){function c(b){a.call(this,b),this._className="area",this._svgElementName="path"}return b(c,a),c.prototype._applyDefaultAttributes=function(b){a.prototype._applyDefaultAttributes.call(this,b),b.style("stroke","none")},c.prototype.selectionForIndex=function(){return d3.select(this.selection()[0][0])},c}(a.Drawer);c.Area=d}(c=a.Drawers||(a.Drawers={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(a){function c(b){a.call(this,b),this._svgElementName="rect"}return b(c,a),c}(a.Drawer);c.Rectangle=d}(c=a.Drawers||(a.Drawers={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(a){function c(b){a.call(this,b),this._className="arc",this._svgElementName="path"}return b(c,a),c}(a.Drawer);c.Arc=d}(c=a.Drawers||(a.Drawers={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(a){function c(b){a.call(this,b),this._svgElementName="path",this._className="symbol"}return b(c,a),c}(a.Drawer);c.Symbol=d}(c=a.Drawers||(a.Drawers={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(a){function c(b){a.call(this,b),this._svgElementName="line"}return b(c,a),c}(a.Drawer);c.Segment=d}(c=a.Drawers||(a.Drawers={}))}(a||(a={}));var a;!function(a){var b;!function(a){var b=function(){function a(){}return a.TOP="top",a.BOTTOM="bottom",a.LEFT="left",a.RIGHT="right",a.CENTER="center",a}();a.Alignment=b}(b=a.Components||(a.Components={}));var c=function(){function b(){this._clipPathEnabled=!1,this._origin={x:0,y:0},this._xAlignment="left",this._yAlignment="top",this._isSetup=!1,this._isAnchored=!1,this._boxes=[],this._isTopLevelComponent=!1,this._cssClasses=new a.Utils.Set,this._destroyed=!1,this._onAnchorCallbacks=new a.Utils.CallbackSet,this._onDetachCallbacks=new a.Utils.CallbackSet,this._cssClasses.add("component")}return b.prototype.anchor=function(a){if(this._destroyed)throw new Error("Can't reuse destroy()-ed Components!");return"svg"===a.node().nodeName.toLowerCase()&&(this._rootSVG=a,this._rootSVG.classed("plottable",!0),this._rootSVG.style("overflow","visible"),this._isTopLevelComponent=!0),null!=this._element?a.node().appendChild(this._element.node()):(this._element=a.append("g"),this._setup()),this._isAnchored=!0,this._onAnchorCallbacks.callCallbacks(this),this},b.prototype.onAnchor=function(a){return this._isAnchored&&a(this),this._onAnchorCallbacks.add(a),this},b.prototype.offAnchor=function(a){return this._onAnchorCallbacks["delete"](a),this},b.prototype._setup=function(){var b=this;this._isSetup||(this._cssClasses.forEach(function(a){b._element.classed(a,!0)}),this._cssClasses=new a.Utils.Set,this._backgroundContainer=this._element.append("g").classed("background-container",!0),this._addBox("background-fill",this._backgroundContainer),this._content=this._element.append("g").classed("content",!0),this._foregroundContainer=this._element.append("g").classed("foreground-container",!0),this._boxContainer=this._element.append("g").classed("box-container",!0),this._clipPathEnabled&&this._generateClipPath(),this._boundingBox=this._addBox("bounding-box"),this._isSetup=!0)},b.prototype.requestedSpace=function(){return{minWidth:0,minHeight:0}},b.prototype.computeLayout=function(c,d,e){var f=this;if(null==c||null==d||null==e){if(null==this._element)throw new Error("anchor() must be called before computeLayout()");if(!this._isTopLevelComponent)throw new Error("null arguments cannot be passed to computeLayout() on a non-root node");c={x:0,y:0},null==this._rootSVG.attr("width")&&this._rootSVG.attr("width","100%"),null==this._rootSVG.attr("height")&&this._rootSVG.attr("height","100%");var g=this._rootSVG.node();d=a.Utils.DOM.elementWidth(g),e=a.Utils.DOM.elementHeight(g)}var h=this._sizeFromOffer(d,e);this._width=h.width,this._height=h.height;var i=b._xAlignToProportion[this._xAlignment],j=b._yAlignToProportion[this._yAlignment];return this._origin={x:c.x+(d-this.width())*i,y:c.y+(e-this.height())*j},this._element.attr("transform","translate("+this._origin.x+","+this._origin.y+")"),this._boxes.forEach(function(a){return a.attr("width",f.width()).attr("height",f.height())}),this},b.prototype._sizeFromOffer=function(a,b){var c=this.requestedSpace(a,b);return{width:this.fixedWidth()?Math.min(a,c.minWidth):a,height:this.fixedHeight()?Math.min(b,c.minHeight):b}},b.prototype.render=function(){return this._isAnchored&&this._isSetup&&this.width()>=0&&this.height()>=0&&a.RenderController.registerToRender(this),this},b.prototype._scheduleComputeLayout=function(){this._isAnchored&&this._isSetup&&a.RenderController.registerToComputeLayout(this)},b.prototype.renderImmediately=function(){return this},b.prototype.redraw=function(){return this._isAnchored&&this._isSetup&&(this._isTopLevelComponent?this._scheduleComputeLayout():this.parent().redraw()),this},b.prototype.renderTo=function(b){if(this.detach(),null!=b){var c;if(c="string"==typeof b?d3.select(b):b,!c.node()||"svg"!==c.node().nodeName.toLowerCase())throw new Error("Plottable requires a valid SVG to renderTo");this.anchor(c)}if(null==this._element)throw new Error("If a Component has never been rendered before, then renderTo must be given a node to render to, or a d3.Selection, or a selector string");return this.computeLayout(),this.render(),a.RenderController.flush(),this},b.prototype.xAlignment=function(a){if(null==a)return this._xAlignment;if(a=a.toLowerCase(),null==b._xAlignToProportion[a])throw new Error("Unsupported alignment: "+a);return this._xAlignment=a,this.redraw(),this},b.prototype.yAlignment=function(a){if(null==a)return this._yAlignment;if(a=a.toLowerCase(),null==b._yAlignToProportion[a])throw new Error("Unsupported alignment: "+a);return this._yAlignment=a,this.redraw(),this},b.prototype._addBox=function(a,b){if(null==this._element)throw new Error("Adding boxes before anchoring is currently disallowed");b=null==b?this._boxContainer:b;var c=b.append("rect");return null!=a&&c.classed(a,!0),this._boxes.push(c),null!=this.width()&&null!=this.height()&&c.attr("width",this.width()).attr("height",this.height()),c},b.prototype._generateClipPath=function(){var b=/MSIE [5-9]/.test(navigator.userAgent)?"":document.location.href;b=b.split("#")[0];var c=a.Utils.DOM.generateUniqueClipPathId();this._element.attr("clip-path",'url("'+b+"#"+c+'")');var d=this._boxContainer.append("clipPath").attr("id",c);this._addBox("clip-rect",d)},b.prototype.hasClass=function(a){return null==a?!1:null==this._element?this._cssClasses.has(a):this._element.classed(a)},b.prototype.addClass=function(a){return null==a?this:(null==this._element?this._cssClasses.add(a):this._element.classed(a,!0),this)},b.prototype.removeClass=function(a){return null==a?this:(null==this._element?this._cssClasses["delete"](a):this._element.classed(a,!1),this)},b.prototype.fixedWidth=function(){return!1},b.prototype.fixedHeight=function(){return!1},b.prototype.detach=function(){return this.parent(null),this._isAnchored&&this._element.remove(),this._isAnchored=!1,this._onDetachCallbacks.callCallbacks(this),this},b.prototype.onDetach=function(a){return this._onDetachCallbacks.add(a),this},b.prototype.offDetach=function(a){return this._onDetachCallbacks["delete"](a),this},b.prototype.parent=function(a){if(void 0===a)return this._parent;if(null!==a&&!a.has(this))throw new Error("Passed invalid parent");return this._parent=a,this},b.prototype.destroy=function(){this._destroyed=!0,this.detach()},b.prototype.width=function(){return this._width},b.prototype.height=function(){return this._height},b.prototype.origin=function(){return{x:this._origin.x,y:this._origin.y}},b.prototype.originToSVG=function(){for(var a=this.origin(),b=this.parent();null!=b;){var c=b.origin();a.x+=c.x,a.y+=c.y,b=b.parent()}return a},b.prototype.foreground=function(){return this._foregroundContainer},b.prototype.content=function(){return this._content},b.prototype.background=function(){return this._backgroundContainer},b._xAlignToProportion={left:0,center:.5,right:1},b._yAlignToProportion={top:0,center:.5,bottom:1},b}();a.Component=c}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c=function(a){function c(){var b=this;a.call(this),this._detachCallback=function(a){return b.remove(a)}}return b(c,a),c.prototype.anchor=function(b){var c=this;return a.prototype.anchor.call(this,b),this._forEach(function(a){return a.anchor(c.content())}),this},c.prototype.render=function(){return this._forEach(function(a){return a.render()}),this},c.prototype.has=function(){throw new Error("has() is not implemented on ComponentContainer")},c.prototype._adoptAndAnchor=function(a){a.parent(this),a.onDetach(this._detachCallback),this._isAnchored&&a.anchor(this.content())},c.prototype.remove=function(a){return this.has(a)&&(a.offDetach(this._detachCallback),this._remove(a),a.detach(),this.redraw()),this},c.prototype._remove=function(){return!1},c.prototype._forEach=function(){throw new Error("_forEach() is not implemented on ComponentContainer")},c.prototype.destroy=function(){a.prototype.destroy.call(this),this._forEach(function(a){return a.destroy()})},c}(a.Component);a.ComponentContainer=c}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(a){var b=this;void 0===a&&(a=[]),c.call(this),this._components=[],this.addClass("component-group"),a.forEach(function(a){return b.append(a)})}return b(d,c),d.prototype._forEach=function(a){this.components().forEach(a)},d.prototype.has=function(a){return this._components.indexOf(a)>=0},d.prototype.requestedSpace=function(b,c){var d=this._components.map(function(a){return a.requestedSpace(b,c)});return{minWidth:a.Utils.Math.max(d,function(a){return a.minWidth},0),minHeight:a.Utils.Math.max(d,function(a){return a.minHeight},0)}},d.prototype.computeLayout=function(a,b,d){var e=this;return c.prototype.computeLayout.call(this,a,b,d),this._forEach(function(a){a.computeLayout({x:0,y:0},e.width(),e.height())}),this},d.prototype._sizeFromOffer=function(a,b){return{width:a,height:b}},d.prototype.fixedWidth=function(){return this._components.every(function(a){return a.fixedWidth()})},d.prototype.fixedHeight=function(){return this._components.every(function(a){return a.fixedHeight()})},d.prototype.components=function(){return this._components.slice()},d.prototype.append=function(a){return null==a||this.has(a)||(a.detach(),this._components.push(a),this._adoptAndAnchor(a),this.redraw()),this},d.prototype._remove=function(a){var b=this._components.indexOf(a);return b>=0?(this._components.splice(b,1),!0):!1},d}(a.ComponentContainer);c.Group=d}(c=a.Components||(a.Components={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c=function(c){function d(b,d){var e=this;if(c.call(this),this._endTickLength=5,this._innerTickLength=5,this._tickLabelPadding=10,this._margin=15,this._showEndTickLabels=!1,null==b||null==d)throw new Error("Axis requires a scale and orientation");this._scale=b,this.orientation(d),this._setDefaultAlignment(),this.addClass("axis"),this.addClass(this._isHorizontal()?"x-axis":"y-axis"),this.formatter(a.Formatters.identity()),this._rescaleCallback=function(){return e._rescale()},this._scale.onUpdate(this._rescaleCallback)}return b(d,c),d.prototype.destroy=function(){c.prototype.destroy.call(this),this._scale.offUpdate(this._rescaleCallback)},d.prototype._isHorizontal=function(){return"top"===this._orientation||"bottom"===this._orientation},d.prototype._computeWidth=function(){return this._computedWidth=this._maxLabelTickLength(),this._computedWidth},d.prototype._computeHeight=function(){return this._computedHeight=this._maxLabelTickLength(),this._computedHeight},d.prototype.requestedSpace=function(){var a=0,b=0;return this._isHorizontal()?(null==this._computedHeight&&this._computeHeight(),b=this._computedHeight+this._margin):(null==this._computedWidth&&this._computeWidth(),a=this._computedWidth+this._margin),{minWidth:a,minHeight:b}},d.prototype.fixedHeight=function(){return this._isHorizontal()},d.prototype.fixedWidth=function(){return!this._isHorizontal()},d.prototype._rescale=function(){this.render()},d.prototype.computeLayout=function(a,b,d){return c.prototype.computeLayout.call(this,a,b,d),this._scale.range(this._isHorizontal()?[0,this.width()]:[this.height(),0]),this},d.prototype._setup=function(){c.prototype._setup.call(this),this._tickMarkContainer=this.content().append("g").classed(d.TICK_MARK_CLASS+"-container",!0),this._tickLabelContainer=this.content().append("g").classed(d.TICK_LABEL_CLASS+"-container",!0),this._baseline=this.content().append("line").classed("baseline",!0)},d.prototype._getTickValues=function(){return[]},d.prototype.renderImmediately=function(){var a=this._getTickValues(),b=this._tickMarkContainer.selectAll("."+d.TICK_MARK_CLASS).data(a);return b.enter().append("line").classed(d.TICK_MARK_CLASS,!0),b.attr(this._generateTickMarkAttrHash()),d3.select(b[0][0]).classed(d.END_TICK_MARK_CLASS,!0).attr(this._generateTickMarkAttrHash(!0)),d3.select(b[0][a.length-1]).classed(d.END_TICK_MARK_CLASS,!0).attr(this._generateTickMarkAttrHash(!0)),b.exit().remove(),this._baseline.attr(this._generateBaselineAttrHash()),this},d.prototype._generateBaselineAttrHash=function(){var a={x1:0,y1:0,x2:0,y2:0};switch(this._orientation){case"bottom":a.x2=this.width();break;case"top":a.x2=this.width(),a.y1=this.height(),a.y2=this.height();break;case"left":a.x1=this.width(),a.x2=this.width(),a.y2=this.height();break;case"right":a.y2=this.height()}return a},d.prototype._generateTickMarkAttrHash=function(a){var b=this;void 0===a&&(a=!1);var c={x1:0,y1:0,x2:0,y2:0},d=function(a){return b._scale.scale(a)};this._isHorizontal()?(c.x1=d,c.x2=d):(c.y1=d,c.y2=d);var e=a?this._endTickLength:this._innerTickLength;switch(this._orientation){case"bottom":c.y2=e;break;case"top":c.y1=this.height(),c.y2=this.height()-e;break;case"left":c.x1=this.width(),c.x2=this.width()-e;break;case"right":c.x2=e}return c},d.prototype.redraw=function(){return this._computedWidth=null,this._computedHeight=null,c.prototype.redraw.call(this)},d.prototype._setDefaultAlignment=function(){switch(this._orientation){case"bottom":this.yAlignment("top");break;case"top":this.yAlignment("bottom");break;case"left":this.xAlignment("right");break;case"right":this.xAlignment("left")}},d.prototype.formatter=function(a){return null==a?this._formatter:(this._formatter=a,this.redraw(),this)},d.prototype.tickLength=function(b){return a.Utils.Window.deprecated("tickLength()","v1.3.0","Replaced by innerTickLength()"),this.innerTickLength(b)},d.prototype.innerTickLength=function(a){if(null==a)return this._innerTickLength;if(0>a)throw new Error("inner tick length must be positive");return this._innerTickLength=a,this.redraw(),this},d.prototype.endTickLength=function(a){if(null==a)return this._endTickLength;if(0>a)throw new Error("end tick length must be positive");return this._endTickLength=a,this.redraw(),this},d.prototype._maxLabelTickLength=function(){return this.showEndTickLabels()?Math.max(this.innerTickLength(),this.endTickLength()):this.innerTickLength()},d.prototype.tickLabelPadding=function(a){if(null==a)return this._tickLabelPadding;if(0>a)throw new Error("tick label padding must be positive");return this._tickLabelPadding=a,this.redraw(),this},d.prototype.margin=function(a){if(null==a)return this._margin;if(0>a)throw new Error("margin size must be positive");return this._margin=a,this.redraw(),this},d.prototype.orientation=function(a){if(null==a)return this._orientation;var b=a.toLowerCase();if("top"!==b&&"bottom"!==b&&"left"!==b&&"right"!==b)throw new Error("unsupported orientation");return this._orientation=b,this.redraw(),this},d.prototype.showEndTickLabels=function(a){return null==a?this._showEndTickLabels:(this._showEndTickLabels=a,this.render(),this)},d.END_TICK_MARK_CLASS="end-tick-mark",d.TICK_MARK_CLASS="tick-mark",d.TICK_LABEL_CLASS="tick-label",d}(a.Component);a.Axis=c}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var d;!function(a){a.second="second",a.minute="minute",a.hour="hour",a.day="day",a.week="week",a.month="month",a.year="year"}(d=a.TimeInterval||(a.TimeInterval={}));var e;!function(e){var f=function(e){function f(a,b){e.call(this,a,b),this._tierLabelPositions=[],this.addClass("time-axis"),this.tickLabelPadding(5),this.axisConfigurations(f._DEFAULT_TIME_AXIS_CONFIGURATIONS)}return b(f,e),f.prototype.tierLabelPositions=function(a){if(null==a)return this._tierLabelPositions;if(!a.every(function(a){return"between"===a.toLowerCase()||"center"===a.toLowerCase()}))throw new Error("Unsupported position for tier labels");return this._tierLabelPositions=a,this.redraw(),this},f.prototype.axisConfigurations=function(b){if(null==b)return this._possibleTimeAxisConfigurations;this._possibleTimeAxisConfigurations=b,this._numTiers=a.Utils.Math.max(this._possibleTimeAxisConfigurations.map(function(a){return a.length}),0),this._isAnchored&&this._setupDomElements();for(var c=this.tierLabelPositions(),d=[],e=0;e<this._numTiers;e++)d.push(c[e]||"between");return this.tierLabelPositions(d),this.redraw(),this},f.prototype._getMostPreciseConfigurationIndex=function(){var b=this,c=this._possibleTimeAxisConfigurations.length;return this._possibleTimeAxisConfigurations.forEach(function(a,d){c>d&&a.every(function(a){return b._checkTimeAxisTierConfigurationWidth(a)})&&(c=d)}),c===this._possibleTimeAxisConfigurations.length&&(a.Utils.Window.warn("zoomed out too far: could not find suitable interval to display labels"),--c),c},f.prototype.orientation=function(a){if(a&&("right"===a.toLowerCase()||"left"===a.toLowerCase()))throw new Error(a+" is not a supported orientation for TimeAxis - only horizontal orientations are supported");return e.prototype.orientation.call(this,a)},f.prototype._computeHeight=function(){var a=this._measurer.measure().height;this._tierHeights=[];for(var b=0;b<this._numTiers;b++)this._tierHeights.push(a+this.tickLabelPadding()+("between"===this._tierLabelPositions[b]?0:this._maxLabelTickLength()));return this._computedHeight=d3.sum(this._tierHeights),this._computedHeight},f.prototype._getIntervalLength=function(b){var c=this._scale.domain()[0],d=a.Scales.Time.timeIntervalToD3Time(b.interval),e=d.offset(c,b.step);if(e>this._scale.domain()[1])return this.width();var f=Math.abs(this._scale.scale(e)-this._scale.scale(c));return f},f.prototype._maxWidthForInterval=function(a){return this._measurer.measure(a.formatter(f._LONG_DATE)).width},f.prototype._checkTimeAxisTierConfigurationWidth=function(a){var b=this._maxWidthForInterval(a)+2*this.tickLabelPadding();return Math.min(this._getIntervalLength(a),this.width())>=b},f.prototype._sizeFromOffer=function(a,b){var c=e.prototype._sizeFromOffer.call(this,a,b);return c.height=this._tierHeights.reduce(function(a,b){return a+b>c.height?a:a+b}),c},f.prototype._setup=function(){e.prototype._setup.call(this),this._setupDomElements()},f.prototype._setupDomElements=function(){this.content().selectAll("."+f.TIME_AXIS_TIER_CLASS).remove(),this._tierLabelContainers=[],this._tierMarkContainers=[],this._tierBaselines=[],this._tickLabelContainer.remove(),this._baseline.remove();for(var b=0;b<this._numTiers;++b){var d=this.content().append("g").classed(f.TIME_AXIS_TIER_CLASS,!0);this._tierLabelContainers.push(d.append("g").classed(a.Axis.TICK_LABEL_CLASS+"-container",!0)),this._tierMarkContainers.push(d.append("g").classed(a.Axis.TICK_MARK_CLASS+"-container",!0)),this._tierBaselines.push(d.append("line").classed("baseline",!0))}this._measurer=new c.Measurers.Measurer(this._tierLabelContainers[0])},f.prototype._getTickIntervalValues=function(a){return this._scale.tickInterval(a.interval,a.step)},f.prototype._getTickValues=function(){var a=this;return this._possibleTimeAxisConfigurations[this._mostPreciseConfigIndex].reduce(function(b,c){return b.concat(a._getTickIntervalValues(c))},[])},f.prototype._cleanTiers=function(){for(var b=0;b<this._tierLabelContainers.length;b++)this._tierLabelContainers[b].selectAll("."+a.Axis.TICK_LABEL_CLASS).remove(),this._tierMarkContainers[b].selectAll("."+a.Axis.TICK_MARK_CLASS).remove(),this._tierBaselines[b].style("visibility","hidden")},f.prototype._getTickValuesForConfiguration=function(a){var b=this._scale.tickInterval(a.interval,a.step),c=this._scale.domain(),d=b.map(function(a){return a.valueOf()});return-1===d.indexOf(c[0].valueOf())&&b.unshift(c[0]),-1===d.indexOf(c[1].valueOf())&&b.push(c[1]),b},f.prototype._renderTierLabels=function(b,c,d){var e=this,f=this._getTickValuesForConfiguration(c),g=[];"between"===this._tierLabelPositions[d]&&1===c.step?f.map(function(a,b){b+1>=f.length||g.push(new Date((f[b+1].valueOf()-f[b].valueOf())/2+f[b].valueOf()))}):g=f;var h=b.selectAll("."+a.Axis.TICK_LABEL_CLASS).data(g,function(a){return String(a.valueOf())}),i=h.enter().append("g").classed(a.Axis.TICK_LABEL_CLASS,!0);i.append("text");var j="center"===this._tierLabelPositions[d]||1===c.step?0:this.tickLabelPadding(),k="bottom"===this.orientation()?d3.sum(this._tierHeights.slice(0,d+1))-this.tickLabelPadding():this.height()-d3.sum(this._tierHeights.slice(0,d))-this.tickLabelPadding(),l=h.selectAll("text");l.size()>0&&a.Utils.DOM.translate(l,j,k),h.exit().remove(),h.attr("transform",function(a){return"translate("+e._scale.scale(a)+",0)"});var m="center"===this._tierLabelPositions[d]||1===c.step?"middle":"start";h.selectAll("text").text(c.formatter).style("text-anchor",m)},f.prototype._renderTickMarks=function(b,c){var d=this._tierMarkContainers[c].selectAll("."+a.Axis.TICK_MARK_CLASS).data(b);d.enter().append("line").classed(a.Axis.TICK_MARK_CLASS,!0);var e=this._generateTickMarkAttrHash(),f=this._tierHeights.slice(0,c).reduce(function(a,b){return a+b},0);"bottom"===this.orientation()?(e.y1=f,e.y2=f+("center"===this._tierLabelPositions[c]?this.innerTickLength():this._tierHeights[c])):(e.y1=this.height()-f,e.y2=this.height()-(f+("center"===this._tierLabelPositions[c]?this.innerTickLength():this._tierHeights[c]))),d.attr(e),"bottom"===this.orientation()?(e.y1=f,e.y2=f+this._tierHeights[c]):(e.y1=this.height()-f,e.y2=this.height()-(f+this._tierHeights[c])),d3.select(d[0][0]).attr(e),d3.select(d[0][0]).classed(a.Axis.END_TICK_MARK_CLASS,!0),d3.select(d[0][d.size()-1]).classed(a.Axis.END_TICK_MARK_CLASS,!0),d.exit().remove()},f.prototype._renderLabellessTickMarks=function(b){var c=this._tickMarkContainer.selectAll("."+a.Axis.TICK_MARK_CLASS).data(b);c.enter().append("line").classed(a.Axis.TICK_MARK_CLASS,!0);var d=this._generateTickMarkAttrHash();d.y2="bottom"===this.orientation()?this.tickLabelPadding():this.height()-this.tickLabelPadding(),c.attr(d),c.exit().remove()},f.prototype._generateLabellessTicks=function(){return this._mostPreciseConfigIndex<1?[]:this._getTickIntervalValues(this._possibleTimeAxisConfigurations[this._mostPreciseConfigIndex-1][0])},f.prototype.renderImmediately=function(){var a=this;this._mostPreciseConfigIndex=this._getMostPreciseConfigurationIndex();var b=this._possibleTimeAxisConfigurations[this._mostPreciseConfigIndex];this._cleanTiers(),b.forEach(function(b,c){return a._renderTierLabels(a._tierLabelContainers[c],b,c)});for(var c=b.map(function(b){return a._getTickValuesForConfiguration(b)}),d=0,e=0;e<Math.max(b.length,1);++e){var f=this._generateBaselineAttrHash();f.y1+="bottom"===this.orientation()?d:-d,f.y2=f.y1,this._tierBaselines[e].attr(f).style("visibility","inherit"),d+=this._tierHeights[e]}var g=[],h=this._scale.domain(),i=this._scale.scale(h[1])-this._scale.scale(h[0]);for(1.5*this._getIntervalLength(b[0])>=i&&(g=this._generateLabellessTicks()),this._renderLabellessTickMarks(g),this._hideOverflowingTiers(),e=0;e<b.length;++e)this._renderTickMarks(c[e],e),this._hideOverlappingAndCutOffLabels(e);return this},f.prototype._hideOverflowingTiers=function(){var a=this,b=this.height(),c=0;this.content().selectAll("."+f.TIME_AXIS_TIER_CLASS).attr("visibility",function(d,e){return c+=a._tierHeights[e],b>=c?"inherit":"hidden"})},f.prototype._hideOverlappingAndCutOffLabels=function(b){var c,d=this,e=this._boundingBox.node().getBoundingClientRect(),f=function(a){return Math.floor(e.left)<=Math.ceil(a.left)&&Math.floor(e.top)<=Math.ceil(a.top)&&Math.floor(a.right)<=Math.ceil(e.left+d.width())&&Math.floor(a.bottom)<=Math.ceil(e.top+d.height())},g=this._tierMarkContainers[b].selectAll("."+a.Axis.TICK_MARK_CLASS).filter(function(){var a=d3.select(this).style("visibility");return"visible"===a||"inherit"===a}),h=g[0].map(function(a){return a.getBoundingClientRect()}),i=this._tierLabelContainers[b].selectAll("."+a.Axis.TICK_LABEL_CLASS).filter(function(){var a=d3.select(this).style("visibility");return"visible"===a||"inherit"===a});i.each(function(b,d){var e=this.getBoundingClientRect(),g=d3.select(this),i=h[d],j=h[d+1];!f(e)||null!=c&&a.Utils.DOM.clientRectsOverlap(e,c)||i.right>e.left||j.left<e.right?g.style("visibility","hidden"):(c=e,g.style("visibility","inherit"))})},f.TIME_AXIS_TIER_CLASS="time-axis-tier",f._DEFAULT_TIME_AXIS_CONFIGURATIONS=[[{interval:d.second,step:1,formatter:a.Formatters.time("%I:%M:%S %p")},{interval:d.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d.second,step:5,formatter:a.Formatters.time("%I:%M:%S %p")},{interval:d.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d.second,step:10,formatter:a.Formatters.time("%I:%M:%S %p")},{interval:d.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d.second,step:15,formatter:a.Formatters.time("%I:%M:%S %p")},{interval:d.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d.second,step:30,formatter:a.Formatters.time("%I:%M:%S %p")},{interval:d.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d.minute,step:1,formatter:a.Formatters.time("%I:%M %p")},{interval:d.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d.minute,step:5,formatter:a.Formatters.time("%I:%M %p")},{interval:d.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d.minute,step:10,formatter:a.Formatters.time("%I:%M %p")},{interval:d.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d.minute,step:15,formatter:a.Formatters.time("%I:%M %p")},{interval:d.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d.minute,step:30,formatter:a.Formatters.time("%I:%M %p")},{interval:d.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d.hour,step:1,formatter:a.Formatters.time("%I %p")},{interval:d.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d.hour,step:3,formatter:a.Formatters.time("%I %p")},{interval:d.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d.hour,step:6,formatter:a.Formatters.time("%I %p")},{interval:d.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d.hour,step:12,formatter:a.Formatters.time("%I %p")},{interval:d.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d.day,step:1,formatter:a.Formatters.time("%a %e")},{interval:d.month,step:1,formatter:a.Formatters.time("%B %Y")}],[{interval:d.day,step:1,formatter:a.Formatters.time("%e")},{interval:d.month,step:1,formatter:a.Formatters.time("%B %Y")}],[{interval:d.month,step:1,formatter:a.Formatters.time("%B")},{interval:d.year,step:1,formatter:a.Formatters.time("%Y")}],[{interval:d.month,step:1,formatter:a.Formatters.time("%b")},{interval:d.year,step:1,formatter:a.Formatters.time("%Y")}],[{interval:d.month,step:3,formatter:a.Formatters.time("%b")},{interval:d.year,step:1,formatter:a.Formatters.time("%Y")}],[{interval:d.month,step:6,formatter:a.Formatters.time("%b")},{interval:d.year,step:1,formatter:a.Formatters.time("%Y")}],[{interval:d.year,step:1,formatter:a.Formatters.time("%Y")}],[{interval:d.year,step:1,formatter:a.Formatters.time("%y")}],[{interval:d.year,step:5,formatter:a.Formatters.time("%Y")}],[{interval:d.year,step:25,formatter:a.Formatters.time("%Y")}],[{interval:d.year,step:50,formatter:a.Formatters.time("%Y")}],[{interval:d.year,step:100,formatter:a.Formatters.time("%Y")}],[{interval:d.year,step:200,formatter:a.Formatters.time("%Y")}],[{interval:d.year,step:500,formatter:a.Formatters.time("%Y")}],[{interval:d.year,step:1e3,formatter:a.Formatters.time("%Y")}]],f._LONG_DATE=new Date(9999,8,29,12,59,9999),f
}(a.Axis);e.Time=f}(e=a.Axes||(a.Axes={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var d;!function(d){var e=function(d){function e(b,c){d.call(this,b,c),this._tickLabelPositioning="center",this._usesTextWidthApproximation=!1,this.formatter(a.Formatters.general())}return b(e,d),e.prototype._setup=function(){d.prototype._setup.call(this),this._measurer=new c.Measurers.Measurer(this._tickLabelContainer,a.Axis.TICK_LABEL_CLASS),this._wrapper=(new c.Wrappers.Wrapper).maxLines(1)},e.prototype._computeWidth=function(){var a=this._usesTextWidthApproximation?this._computeApproximateTextWidth():this._computeExactTextWidth();return this._computedWidth="center"===this._tickLabelPositioning?this._maxLabelTickLength()+this.tickLabelPadding()+a:Math.max(this._maxLabelTickLength(),this.tickLabelPadding()+a),this._computedWidth},e.prototype._computeExactTextWidth=function(){var b=this,c=this._getTickValues(),d=c.map(function(a){var c=b.formatter()(a);return b._measurer.measure(c).width});return a.Utils.Math.max(d,0)},e.prototype._computeApproximateTextWidth=function(){var b=this,c=this._getTickValues(),d=this._measurer.measure("M").width,e=c.map(function(a){var c=b.formatter()(a);return c.length*d});return a.Utils.Math.max(e,0)},e.prototype._computeHeight=function(){var a=this._measurer.measure().height;return this._computedHeight="center"===this._tickLabelPositioning?this._maxLabelTickLength()+this.tickLabelPadding()+a:Math.max(this._maxLabelTickLength(),this.tickLabelPadding()+a),this._computedHeight},e.prototype._getTickValues=function(){var a=this._scale,b=a.domain(),c=b[0]<=b[1]?b[0]:b[1],d=b[0]>=b[1]?b[0]:b[1];return c===b[0]?a.ticks().filter(function(a){return a>=c&&d>=a}):a.ticks().filter(function(a){return a>=c&&d>=a}).reverse()},e.prototype._rescale=function(){if(this._isSetup){if(!this._isHorizontal()){var a=this._computeWidth();if(a>this.width()||a<this.width()-this.margin())return void this.redraw()}this.render()}},e.prototype.renderImmediately=function(){var b=this;d.prototype.renderImmediately.call(this);var c={x:0,y:0,dx:"0em",dy:"0.3em"},e=this._maxLabelTickLength(),f=this.tickLabelPadding(),g="middle",h=0,i=0,j=0,k=0;if(this._isHorizontal())switch(this._tickLabelPositioning){case"left":g="end",h=-f,k=f;break;case"center":k=e+f;break;case"right":g="start",h=f,k=f}else switch(this._tickLabelPositioning){case"top":c.dy="-0.3em",j=f,i=-f;break;case"center":j=e+f;break;case"bottom":c.dy="1em",j=f,i=f}var l=this._generateTickMarkAttrHash();switch(this.orientation()){case"bottom":c.x=l.x1,c.dy="0.95em",i=l.y1+k;break;case"top":c.x=l.x1,c.dy="-.25em",i=l.y1-k;break;case"left":g="end",h=l.x1-j,c.y=l.y1;break;case"right":g="start",h=l.x1+j,c.y=l.y1}var m=this._getTickValues(),n=this._tickLabelContainer.selectAll("."+a.Axis.TICK_LABEL_CLASS).data(m);n.enter().append("text").classed(a.Axis.TICK_LABEL_CLASS,!0),n.exit().remove(),n.style("text-anchor",g).style("visibility","inherit").attr(c).text(function(a){return b.formatter()(a)});var o="translate("+h+", "+i+")";return this._tickLabelContainer.attr("transform",o),this._showAllTickMarks(),this.showEndTickLabels()||this._hideEndTickLabels(),this._hideOverflowingTickLabels(),this._hideOverlappingTickLabels(),("bottom"===this._tickLabelPositioning||"top"===this._tickLabelPositioning||"left"===this._tickLabelPositioning||"right"===this._tickLabelPositioning)&&this._hideTickMarksWithoutLabel(),this},e.prototype._showAllTickMarks=function(){this._tickMarkContainer.selectAll("."+a.Axis.TICK_MARK_CLASS).each(function(){d3.select(this).style("visibility","inherit")})},e.prototype._hideTickMarksWithoutLabel=function(){var b=this._tickMarkContainer.selectAll("."+a.Axis.TICK_MARK_CLASS),c=this._tickLabelContainer.selectAll("."+a.Axis.TICK_LABEL_CLASS).filter(function(){var a=d3.select(this).style("visibility");return"inherit"===a||"visible"===a}),d=[];c.each(function(a){return d.push(a)}),b.each(function(a){-1===d.indexOf(a)&&d3.select(this).style("visibility","hidden")})},e.prototype.tickLabelPosition=function(a){if(null==a)return this._tickLabelPositioning;var b=a.toLowerCase();if(this._isHorizontal()){if("left"!==b&&"center"!==b&&"right"!==b)throw new Error(b+" is not a valid tick label position for a horizontal NumericAxis")}else if("top"!==b&&"center"!==b&&"bottom"!==b)throw new Error(b+" is not a valid tick label position for a vertical NumericAxis");return this._tickLabelPositioning=b,this.redraw(),this},e.prototype.usesTextWidthApproximation=function(a){return null==a?this._usesTextWidthApproximation:(this._usesTextWidthApproximation=a,this)},e.prototype._hideEndTickLabels=function(){var b=this._boundingBox.node().getBoundingClientRect(),c=this._tickLabelContainer.selectAll("."+a.Axis.TICK_LABEL_CLASS);if(0!==c[0].length){var d=c[0][0];a.Utils.DOM.clientRectInside(d.getBoundingClientRect(),b)||d3.select(d).style("visibility","hidden");var e=c[0][c[0].length-1];a.Utils.DOM.clientRectInside(e.getBoundingClientRect(),b)||d3.select(e).style("visibility","hidden")}},e.prototype._hideOverflowingTickLabels=function(){var b=this._boundingBox.node().getBoundingClientRect(),c=this._tickLabelContainer.selectAll("."+a.Axis.TICK_LABEL_CLASS);c.empty()||c.each(function(){a.Utils.DOM.clientRectInside(this.getBoundingClientRect(),b)||d3.select(this).style("visibility","hidden")})},e.prototype._hideOverlappingTickLabels=function(){for(var b=this._tickLabelContainer.selectAll("."+a.Axis.TICK_LABEL_CLASS).filter(function(){var a=d3.select(this).style("visibility");return"inherit"===a||"visible"===a}),c=b[0].map(function(a){return a.getBoundingClientRect()}),d=1;!this._hasOverlapWithInterval(d,c)&&d<c.length;)d+=1;b.each(function(a,b){var c=d3.select(this);b%d!==0&&c.style("visibility","hidden")})},e.prototype._hasOverlapWithInterval=function(a,b){var c=this.tickLabelPadding();("bottom"===this._tickLabelPositioning||"top"===this._tickLabelPositioning||"left"===this._tickLabelPositioning||"right"===this._tickLabelPositioning)&&(c*=3);for(var d=0;d<b.length-a;d+=a){var e=b[d],f=b[d+a];if(this._isHorizontal()){if(e.right+c>=f.left)return!1}else if(e.top-c<=f.bottom)return!1}return!0},e}(a.Axis);d.Numeric=e}(d=a.Axes||(a.Axes={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var d;!function(d){var e=function(d){function e(a,b){d.call(this,a,b),this._tickLabelAngle=0,this.addClass("category-axis")}return b(e,d),e.prototype._setup=function(){d.prototype._setup.call(this),this._measurer=new c.Measurers.CacheCharacterMeasurer(this._tickLabelContainer),this._wrapper=new c.Wrappers.SingleLineWrapper,this._writer=new c.Writers.Writer(this._measurer,this._wrapper)},e.prototype._rescale=function(){return this.redraw()},e.prototype.requestedSpace=function(a,b){var c=this._isHorizontal()?0:this._maxLabelTickLength()+this.tickLabelPadding()+this.margin(),d=this._isHorizontal()?this._maxLabelTickLength()+this.tickLabelPadding()+this.margin():0;if(0===this._scale.domain().length)return{minWidth:0,minHeight:0};var e=this._scale,f=this._measureTicks(a,b,e,e.domain());return{minWidth:f.usedWidth+c,minHeight:f.usedHeight+d}},e.prototype._getTickValues=function(){return this._scale.domain()},e.prototype.tickLabelAngle=function(a){if(null==a)return this._tickLabelAngle;if(0!==a&&90!==a&&-90!==a)throw new Error("Angle "+a+" not supported; only 0, 90, and -90 are valid values");return this._tickLabelAngle=a,this.redraw(),this},e.prototype._drawTicks=function(a,b,c,d){var e,f,g=this;switch(this.tickLabelAngle()){case 0:e={left:"right",right:"left",top:"center",bottom:"center"},f={left:"center",right:"center",top:"bottom",bottom:"top"};break;case 90:e={left:"center",right:"center",top:"right",bottom:"left"},f={left:"top",right:"bottom",top:"center",bottom:"center"};break;case-90:e={left:"center",right:"center",top:"left",bottom:"right"},f={left:"bottom",right:"top",top:"center",bottom:"center"}}d.each(function(d){var h=c.stepWidth(),i=g._isHorizontal()?h:a-g._maxLabelTickLength()-g.tickLabelPadding(),j=g._isHorizontal()?b-g._maxLabelTickLength()-g.tickLabelPadding():h,k={selection:d3.select(this),xAlign:e[g.orientation()],yAlign:f[g.orientation()],textRotation:g.tickLabelAngle()};g._writer.write(g.formatter()(d),i,j,k)})},e.prototype._measureTicks=function(b,d,e,f){var g=this,h=this._isHorizontal()?b:d,i=2*e.outerPadding(),j=(f.length-1)*e.innerPadding(),k=h/(i+j+f.length),l=k*(1+e.innerPadding()),m=f.map(function(a){var c=b-g._maxLabelTickLength()-g.tickLabelPadding();g._isHorizontal()&&(c=l,0!==g._tickLabelAngle&&(c=d-g._maxLabelTickLength()-g.tickLabelPadding()),c=Math.max(c,0));var e=l;return g._isHorizontal()&&(e=d-g._maxLabelTickLength()-g.tickLabelPadding(),0!==g._tickLabelAngle&&(e=b-g._maxLabelTickLength()-g.tickLabelPadding()),e=Math.max(e,0)),g._wrapper.wrap(g.formatter()(a),g._measurer,c,e)}),n=this._isHorizontal()&&0===this._tickLabelAngle?d3.sum:a.Utils.Math.max,o=this._isHorizontal()&&0===this._tickLabelAngle?a.Utils.Math.max:d3.sum,p=m.every(function(a){return!c.Utils.StringMethods.isNotEmptyString(a.truncatedText)&&1===a.noLines}),q=n(m,function(a){return g._measurer.measure(a.wrappedText).width},0),r=o(m,function(a){return g._measurer.measure(a.wrappedText).height},0);if(0!==this._tickLabelAngle){var s=r;r=q,q=s}return{textFits:p,usedWidth:q,usedHeight:r}},e.prototype.renderImmediately=function(){var b=this;d.prototype.renderImmediately.call(this);var c=this._scale,e=this._tickLabelContainer.selectAll("."+a.Axis.TICK_LABEL_CLASS).data(this._scale.domain(),function(a){return a}),f=function(a){var d=c.stepWidth()-c.rangeBand(),e=c.scale(a)-c.rangeBand()/2-d/2,f=b._isHorizontal()?e:0,g=b._isHorizontal()?0:e;return"translate("+f+","+g+")"};e.enter().append("g").classed(a.Axis.TICK_LABEL_CLASS,!0),e.exit().remove(),e.attr("transform",f),e.text(""),this._drawTicks(this.width(),this.height(),c,e);var g="right"===this.orientation()?this._maxLabelTickLength()+this.tickLabelPadding():0,h="bottom"===this.orientation()?this._maxLabelTickLength()+this.tickLabelPadding():0;return a.Utils.DOM.translate(this._tickLabelContainer,g,h),this},e.prototype.computeLayout=function(a,b,c){return this._measurer.reset(),d.prototype.computeLayout.call(this,a,b,c)},e}(a.Axis);d.Category=e}(d=a.Axes||(a.Axes={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var d;!function(d){var e=function(a){function d(b,c){void 0===b&&(b=""),void 0===c&&(c=0),a.call(this),this.addClass("label"),this.text(b),this.angle(c),this.xAlignment("center").yAlignment("center"),this._padding=0}return b(d,a),d.prototype.requestedSpace=function(){var a=this._measurer.measure(this._text),b=(0===this.angle()?a.width:a.height)+2*this.padding(),c=(0===this.angle()?a.height:a.width)+2*this.padding();return{minWidth:b,minHeight:c}},d.prototype._setup=function(){a.prototype._setup.call(this),this._textContainer=this.content().append("g"),this._measurer=new c.Measurers.Measurer(this._textContainer),this._wrapper=new c.Wrappers.Wrapper,this._writer=new c.Writers.Writer(this._measurer,this._wrapper),this.text(this._text)},d.prototype.text=function(a){if(null==a)return this._text;if("string"!=typeof a)throw new Error("Label.text() only takes strings as input");return this._text=a,this.redraw(),this},d.prototype.angle=function(a){if(null==a)return this._angle;if(a%=360,a>180?a-=360:-180>a&&(a+=360),-90!==a&&0!==a&&90!==a)throw new Error(a+" is not a valid angle for Label");return this._angle=a,this.redraw(),this},d.prototype.padding=function(a){if(null==a)return this._padding;if(a=+a,0>a)throw new Error(a+" is not a valid padding value. Cannot be less than 0.");return this._padding=a,this.redraw(),this},d.prototype.fixedWidth=function(){return!0},d.prototype.fixedHeight=function(){return!0},d.prototype.renderImmediately=function(){a.prototype.renderImmediately.call(this),this._textContainer.selectAll("g").remove();var b=this._measurer.measure(this._text),c=Math.max(Math.min((this.height()-b.height)/2,this.padding()),0),d=Math.max(Math.min((this.width()-b.width)/2,this.padding()),0);this._textContainer.attr("transform","translate("+d+","+c+")");var e=this.width()-2*d,f=this.height()-2*c,g={selection:this._textContainer,xAlign:this.xAlignment(),yAlign:this.yAlignment(),textRotation:this.angle()};return this._writer.write(this._text,e,f,g),this},d}(a.Component);d.Label=e;var f=function(a){function c(b,d){a.call(this,b,d),this.addClass(c.TITLE_LABEL_CLASS)}return b(c,a),c.TITLE_LABEL_CLASS="title-label",c}(e);d.TitleLabel=f;var g=function(a){function c(b,d){a.call(this,b,d),this.addClass(c.AXIS_LABEL_CLASS)}return b(c,a),c.AXIS_LABEL_CLASS="axis-label",c}(e);d.AxisLabel=g}(d=a.Components||(a.Components={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var d;!function(d){var e=function(d){function e(b){var c=this;if(d.call(this),this._padding=5,this.addClass("legend"),this.maxEntriesPerRow(1),null==b)throw new Error("Legend requires a colorScale");this._colorScale=b,this._redrawCallback=function(){return c.redraw()},this._colorScale.onUpdate(this._redrawCallback),this.xAlignment("right").yAlignment("top"),this.comparator(function(a,b){return c._colorScale.domain().indexOf(a)-c._colorScale.domain().indexOf(b)}),this._symbolFactoryAccessor=function(){return a.SymbolFactories.circle()},this._symbolOpacityAccessor=function(){return 1}}return b(e,d),e.prototype._setup=function(){d.prototype._setup.call(this);var a=this.content().append("g").classed(e.LEGEND_ROW_CLASS,!0),b=a.append("g").classed(e.LEGEND_ENTRY_CLASS,!0);b.append("text"),this._measurer=new c.Measurers.Measurer(a),this._wrapper=(new c.Wrappers.Wrapper).maxLines(1),this._writer=new c.Writers.Writer(this._measurer,this._wrapper).addTitleElement(!0)},e.prototype.maxEntriesPerRow=function(a){return null==a?this._maxEntriesPerRow:(this._maxEntriesPerRow=a,this.redraw(),this)},e.prototype.comparator=function(a){return null==a?this._comparator:(this._comparator=a,this.redraw(),this)},e.prototype.colorScale=function(a){return null!=a?(this._colorScale.offUpdate(this._redrawCallback),this._colorScale=a,this._colorScale.onUpdate(this._redrawCallback),this.redraw(),this):this._colorScale},e.prototype.destroy=function(){d.prototype.destroy.call(this),this._colorScale.offUpdate(this._redrawCallback)},e.prototype._calculateLayoutInfo=function(a,b){var c=this,d=this._measurer.measure().height,e=Math.max(0,a-this._padding),f=this._colorScale.domain().slice();f.sort(this.comparator());var g=d3.map(),h=d3.map();f.forEach(function(a){var b=d+c._measurer.measure(a).width+c._padding,f=Math.min(b,e);g.set(a,f),h.set(a,b)});var i=this._packRows(e,f,g),j=Math.floor((b-2*this._padding)/d);return j!==j&&(j=0),{textHeight:d,entryLengths:g,untruncatedEntryLengths:h,rows:i,numRowsToDraw:Math.max(Math.min(j,i.length),0)}},e.prototype.requestedSpace=function(b,c){var d=this._calculateLayoutInfo(b,c),e=d.rows.map(function(a){return d3.sum(a,function(a){return d.untruncatedEntryLengths.get(a)})}),f=a.Utils.Math.max(e,0);return{minWidth:this._padding+f,minHeight:d.rows.length*d.textHeight+2*this._padding}},e.prototype._packRows=function(a,b,c){var d=this,e=[],f=[],g=a;return b.forEach(function(b){var h=c.get(b);(h>g||f.length===d._maxEntriesPerRow)&&(e.push(f),f=[],g=a),f.push(b),g-=h}),0!==f.length&&e.push(f),e},e.prototype.entitiesAt=function(a){if(!this._isSetup)return[];var b=[],c=this._calculateLayoutInfo(this.width(),this.height()),d=this._padding,f=this;return this.content().selectAll("g."+e.LEGEND_ROW_CLASS).each(function(g,h){var i=h*c.textHeight+d,j=(h+1)*c.textHeight+d,k=(i+j)/2,l=d,m=d;d3.select(this).selectAll("g."+e.LEGEND_ENTRY_CLASS).each(function(d){m+=c.entryLengths.get(d);var e=l+c.textHeight/2;if(m>=a.x&&l<=a.x&&j>=a.y&&i<=a.y){var g=d3.select(this),h=g.datum();b.push({datum:h,position:{x:e,y:k},selection:g,component:f})}l+=c.entryLengths.get(d)})}),b},e.prototype.renderImmediately=function(){var a=this;d.prototype.renderImmediately.call(this);var b=this._calculateLayoutInfo(this.width(),this.height()),c=b.rows.slice(0,b.numRowsToDraw),f=this.content().selectAll("g."+e.LEGEND_ROW_CLASS).data(c);f.enter().append("g").classed(e.LEGEND_ROW_CLASS,!0),f.exit().remove(),f.attr("transform",function(c,d){return"translate(0, "+(d*b.textHeight+a._padding)+")"});var g=f.selectAll("g."+e.LEGEND_ENTRY_CLASS).data(function(a){return a}),h=g.enter().append("g").classed(e.LEGEND_ENTRY_CLASS,!0);h.append("path"),h.append("g").classed("text-container",!0),g.exit().remove();var i=this._padding;f.each(function(){var a=i,c=d3.select(this).selectAll("g."+e.LEGEND_ENTRY_CLASS);c.attr("transform",function(c){var d="translate("+a+", 0)";return a+=b.entryLengths.get(c),d})}),g.select("path").attr("d",function(c,d,e){return a.symbol()(c,e)(.6*b.textHeight)}).attr("transform","translate("+b.textHeight/2+","+b.textHeight/2+")").attr("fill",function(b){return a._colorScale.scale(b)}).attr("opacity",function(b,c,d){return a.symbolOpacity()(b,d)}).classed(e.LEGEND_SYMBOL_CLASS,!0);var j=this._padding,k=g.select("g.text-container");k.text(""),k.append("title").text(function(a){return a});var l=this;return k.attr("transform","translate("+b.textHeight+", 0)").each(function(a){var c=d3.select(this),d=b.entryLengths.get(a)-b.textHeight-j,e={selection:c,xAlign:"left",yAlign:"top",textRotation:0};l._writer.write(a,d,l.height(),e)}),this},e.prototype.symbol=function(a){return null==a?this._symbolFactoryAccessor:(this._symbolFactoryAccessor=a,this.render(),this)},e.prototype.symbolOpacity=function(a){return null==a?this._symbolOpacityAccessor:(this._symbolOpacityAccessor="number"==typeof a?function(){return a}:a,this.render(),this)},e.prototype.fixedWidth=function(){return!0},e.prototype.fixedHeight=function(){return!0},e.LEGEND_ROW_CLASS="legend-row",e.LEGEND_ENTRY_CLASS="legend-entry",e.LEGEND_SYMBOL_CLASS="legend-symbol",e}(a.Component);d.Legend=e}(d=a.Components||(a.Components={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var d;!function(d){var e=function(d){function e(b){var c=this;if(d.call(this),this._padding=5,this._numSwatches=10,null==b)throw new Error("InterpolatedColorLegend requires a interpolatedColorScale");this._scale=b,this._redrawCallback=function(){return c.redraw()},this._scale.onUpdate(this._redrawCallback),this._formatter=a.Formatters.general(),this._orientation="horizontal",this.addClass("legend"),this.addClass("interpolated-color-legend")}return b(e,d),e.prototype.destroy=function(){d.prototype.destroy.call(this),this._scale.offUpdate(this._redrawCallback)},e.prototype.formatter=function(a){return void 0===a?this._formatter:(this._formatter=a,this.redraw(),this)},e._ensureOrientation=function(a){if(a=a.toLowerCase(),"horizontal"===a||"left"===a||"right"===a)return a;throw new Error('"'+a+'" is not a valid orientation for InterpolatedColorLegend')},e.prototype.orientation=function(a){return null==a?this._orientation:(this._orientation=e._ensureOrientation(a),this.redraw(),this)},e.prototype.fixedWidth=function(){return!0},e.prototype.fixedHeight=function(){return!0},e.prototype._generateTicks=function(){for(var a=this._scale.domain(),b=(a[1]-a[0])/this._numSwatches,c=[],d=0;d<=this._numSwatches;d++)c.push(a[0]+b*d);return c},e.prototype._setup=function(){d.prototype._setup.call(this),this._swatchContainer=this.content().append("g").classed("swatch-container",!0),this._swatchBoundingBox=this.content().append("rect").classed("swatch-bounding-box",!0),this._lowerLabel=this.content().append("g").classed(e.LEGEND_LABEL_CLASS,!0),this._upperLabel=this.content().append("g").classed(e.LEGEND_LABEL_CLASS,!0),this._measurer=new c.Measurers.Measurer(this.content()),this._wrapper=new c.Wrappers.Wrapper,this._writer=new c.Writers.Writer(this._measurer,this._wrapper)},e.prototype.requestedSpace=function(){var b,c,d=this,e=this._measurer.measure().height,f=this._generateTicks(),g=f.length,h=this._scale.domain(),i=h.map(function(a){return d._measurer.measure(d._formatter(a)).width});if(this._isVertical()){var j=a.Utils.Math.max(i,0);c=this._padding+e+this._padding+j+this._padding,b=this._padding+g*e+this._padding}else b=this._padding+e+this._padding,c=this._padding+i[0]+this._padding+g*e+this._padding+i[1]+this._padding;return{minWidth:c,minHeight:b}},e.prototype._isVertical=function(){return"horizontal"!==this._orientation},e.prototype.renderImmediately=function(){var a=this;d.prototype.renderImmediately.call(this);var b,c,e,f,g=this._scale.domain(),h=this._formatter(g[0]),i=this._measurer.measure(h).width,j=this._formatter(g[1]),k=this._measurer.measure(j).width,l=this._generateTicks(),m=l.length,n=this._padding,o={x:0,y:0},p={x:0,y:0},q={selection:this._lowerLabel,xAlign:"center",yAlign:"center",textRotation:0},r={selection:this._upperLabel,xAlign:"center",yAlign:"center",textRotation:0},s={x:0,y:n,width:0,height:0};if(this._isVertical()){var t=Math.max(i,k);b=Math.max(this.width()-3*n-t,0),c=Math.max((this.height()-2*n)/m,0),f=function(a,b){return n+(m-(b+1))*c},r.yAlign="top",o.y=n,q.yAlign="bottom",p.y=-n,"left"===this._orientation?(e=function(){return n+t+n},r.xAlign="right",o.x=-(n+b+n),q.xAlign="right",p.x=-(n+b+n)):(e=function(){return n},r.xAlign="left",o.x=n+b+n,q.xAlign="left",p.x=n+b+n),s.width=b,s.height=m*c}else b=Math.max((this.width()-4*n-i-k)/m,0),c=Math.max(this.height()-2*n,0),e=function(a,c){return n+i+n+c*b},f=function(){return n},r.xAlign="right",o.x=-n,q.xAlign="left",p.x=n,s.width=m*b,s.height=c;s.x=e(null,0),this._upperLabel.text(""),this._writer.write(j,this.width(),this.height(),r);var u="translate("+o.x+", "+o.y+")";this._upperLabel.attr("transform",u),this._lowerLabel.text(""),this._writer.write(h,this.width(),this.height(),q);var v="translate("+p.x+", "+p.y+")";this._lowerLabel.attr("transform",v),this._swatchBoundingBox.attr(s);var w=this._swatchContainer.selectAll("rect.swatch").data(l);return w.enter().append("rect").classed("swatch",!0),w.exit().remove(),w.attr({fill:function(b){return a._scale.scale(b)},width:b,height:c,x:e,y:f}),this},e.LEGEND_LABEL_CLASS="legend-label",e}(a.Component);d.InterpolatedColorLegend=e}(d=a.Components||(a.Components={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(b,d){var e=this;if(null!=b&&!a.QuantitativeScale.prototype.isPrototypeOf(b))throw new Error("xScale needs to inherit from Scale.QuantitativeScale");if(null!=d&&!a.QuantitativeScale.prototype.isPrototypeOf(d))throw new Error("yScale needs to inherit from Scale.QuantitativeScale");c.call(this),this.addClass("gridlines"),this._xScale=b,this._yScale=d,this._renderCallback=function(){return e.render()},this._xScale&&this._xScale.onUpdate(this._renderCallback),this._yScale&&this._yScale.onUpdate(this._renderCallback)}return b(d,c),d.prototype.destroy=function(){return c.prototype.destroy.call(this),this._xScale&&this._xScale.offUpdate(this._renderCallback),this._yScale&&this._yScale.offUpdate(this._renderCallback),this},d.prototype._setup=function(){c.prototype._setup.call(this),this._xLinesContainer=this.content().append("g").classed("x-gridlines",!0),this._yLinesContainer=this.content().append("g").classed("y-gridlines",!0)},d.prototype.renderImmediately=function(){return c.prototype.renderImmediately.call(this),this._redrawXLines(),this._redrawYLines(),this},d.prototype.computeLayout=function(a,b,d){return c.prototype.computeLayout.call(this,a,b,d),null!=this._xScale&&this._xScale.range([0,this.width()]),null!=this._yScale&&this._yScale.range([this.height(),0]),this},d.prototype._redrawXLines=function(){var a=this;if(this._xScale){var b=this._xScale.ticks(),c=function(b){return a._xScale.scale(b)},d=this._xLinesContainer.selectAll("line").data(b);d.enter().append("line"),d.attr("x1",c).attr("y1",0).attr("x2",c).attr("y2",this.height()).classed("zeroline",function(a){return 0===a}),d.exit().remove()}},d.prototype._redrawYLines=function(){var a=this;if(this._yScale){var b=this._yScale.ticks(),c=function(b){return a._yScale.scale(b)},d=this._yLinesContainer.selectAll("line").data(b);d.enter().append("line"),d.attr("x1",0).attr("y1",c).attr("x2",this.width()).attr("y2",c).classed("zeroline",function(a){return 0===a}),d.exit().remove()}},d}(a.Component);c.Gridlines=d}(c=a.Components||(a.Components={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(a){var b=this;void 0===a&&(a=[]),c.call(this),this._rowPadding=0,this._columnPadding=0,this._rows=[],this._rowWeights=[],this._columnWeights=[],this._nRows=0,this._nCols=0,this._calculatedLayout=null,this.addClass("table"),a.forEach(function(a,c){a.forEach(function(a,d){null!=a&&b.add(a,c,d)})})}return b(d,c),d.prototype._forEach=function(a){for(var b=0;b<this._nRows;b++)for(var c=0;c<this._nCols;c++)null!=this._rows[b][c]&&a(this._rows[b][c])},d.prototype.has=function(a){for(var b=0;b<this._nRows;b++)for(var c=0;c<this._nCols;c++)if(this._rows[b][c]===a)return!0;return!1},d.prototype.add=function(a,b,c){if(null==a)throw Error("Cannot add null to a table cell");if(!this.has(a)){var d=this._rows[b]&&this._rows[b][c];if(null!=d)throw new Error("cell is occupied");a.detach(),this._nRows=Math.max(b+1,this._nRows),this._nCols=Math.max(c+1,this._nCols),this._padTableToSize(this._nRows,this._nCols),this._rows[b][c]=a,this._adoptAndAnchor(a),this.redraw()}return this},d.prototype._remove=function(a){for(var b=0;b<this._nRows;b++)for(var c=0;c<this._nCols;c++)if(this._rows[b][c]===a)return this._rows[b][c]=null,!0;return!1},d.prototype._iterateLayout=function(b,c,e){void 0===e&&(e=!1);for(var f,g,h=this._rows,i=d3.transpose(this._rows),j=b-this._columnPadding*(this._nCols-1),k=c-this._rowPadding*(this._nRows-1),l=d._calcComponentWeights(this._rowWeights,h,function(a){return null==a||a.fixedHeight()}),m=d._calcComponentWeights(this._columnWeights,i,function(a){return null==a||a.fixedWidth()}),n=m.map(function(a){return 0===a?.5:a}),o=l.map(function(a){return 0===a?.5:a}),p=d._calcProportionalSpace(n,j),q=d._calcProportionalSpace(o,k),r=a.Utils.Array.createFilledArray(0,this._nCols),s=a.Utils.Array.createFilledArray(0,this._nRows),t=0;;){var u=a.Utils.Array.add(s,q),v=a.Utils.Array.add(r,p),w=this._determineGuarantees(v,u,e);r=w.guaranteedWidths,s=w.guaranteedHeights;var x=w.wantsWidthArr.some(function(a){return a}),y=w.wantsHeightArr.some(function(a){return a}),z=f,A=g;f=j-d3.sum(w.guaranteedWidths),g=k-d3.sum(w.guaranteedHeights);var B;x?(B=w.wantsWidthArr.map(function(a){return a?.1:0}),B=a.Utils.Array.add(B,m)):B=m;var C;y?(C=w.wantsHeightArr.map(function(a){return a?.1:0}),C=a.Utils.Array.add(C,l)):C=l,p=d._calcProportionalSpace(B,f),q=d._calcProportionalSpace(C,g),t++;var D=f>0&&f!==z,E=g>0&&g!==A;if(!D&&!E)break;if(t>5)break}return f=j-d3.sum(w.guaranteedWidths),g=k-d3.sum(w.guaranteedHeights),p=d._calcProportionalSpace(m,f),q=d._calcProportionalSpace(l,g),{colProportionalSpace:p,rowProportionalSpace:q,guaranteedWidths:w.guaranteedWidths,guaranteedHeights:w.guaranteedHeights,wantsWidth:x,wantsHeight:y}},d.prototype._determineGuarantees=function(b,c,d){void 0===d&&(d=!1);var e=a.Utils.Array.createFilledArray(0,this._nCols),f=a.Utils.Array.createFilledArray(0,this._nRows),g=a.Utils.Array.createFilledArray(!1,this._nCols),h=a.Utils.Array.createFilledArray(!1,this._nRows);return this._rows.forEach(function(a,i){a.forEach(function(a,j){var k;k=null!=a?a.requestedSpace(b[j],c[i]):{minWidth:0,minHeight:0};var l=d?Math.min(k.minWidth,b[j]):k.minWidth;e[j]=Math.max(e[j],l);var m=d?Math.min(k.minHeight,c[i]):k.minHeight;f[i]=Math.max(f[i],m);var n=k.minWidth>b[j];g[j]=g[j]||n;var o=k.minHeight>c[i];h[i]=h[i]||o})}),{guaranteedWidths:e,guaranteedHeights:f,wantsWidthArr:g,wantsHeightArr:h}},d.prototype.requestedSpace=function(a,b){return this._calculatedLayout=this._iterateLayout(a,b),{minWidth:d3.sum(this._calculatedLayout.guaranteedWidths),minHeight:d3.sum(this._calculatedLayout.guaranteedHeights)}},d.prototype.computeLayout=function(b,d,e){var f=this;c.prototype.computeLayout.call(this,b,d,e);var g=d3.sum(this._calculatedLayout.guaranteedWidths),h=d3.sum(this._calculatedLayout.guaranteedHeights),i=this._calculatedLayout;(g>this.width()||h>this.height())&&(i=this._iterateLayout(this.width(),this.height(),!0));var j=0,k=a.Utils.Array.add(i.rowProportionalSpace,i.guaranteedHeights),l=a.Utils.Array.add(i.colProportionalSpace,i.guaranteedWidths);return this._rows.forEach(function(a,b){var c=0;a.forEach(function(a,d){null!=a&&a.computeLayout({x:c,y:j},l[d],k[b]),c+=l[d]+f._columnPadding}),j+=k[b]+f._rowPadding}),this},d.prototype.rowPadding=function(a){return null==a?this._rowPadding:(this._rowPadding=a,this.redraw(),this)},d.prototype.columnPadding=function(a){return null==a?this._columnPadding:(this._columnPadding=a,this.redraw(),this)},d.prototype.rowWeight=function(a,b){return null==b?this._rowWeights[a]:(this._rowWeights[a]=b,this.redraw(),this)},d.prototype.columnWeight=function(a,b){return null==b?this._columnWeights[a]:(this._columnWeights[a]=b,this.redraw(),this)},d.prototype.fixedWidth=function(){var a=d3.transpose(this._rows);return d._fixedSpace(a,function(a){return null==a||a.fixedWidth()})},d.prototype.fixedHeight=function(){return d._fixedSpace(this._rows,function(a){return null==a||a.fixedHeight()})},d.prototype._padTableToSize=function(a,b){for(var c=0;a>c;c++){void 0===this._rows[c]&&(this._rows[c]=[],this._rowWeights[c]=null);for(var d=0;b>d;d++)void 0===this._rows[c][d]&&(this._rows[c][d]=null)}for(d=0;b>d;d++)void 0===this._columnWeights[d]&&(this._columnWeights[d]=null)},d._calcComponentWeights=function(a,b,c){return a.map(function(a,d){if(null!=a)return a;var e=b[d].map(c),f=e.reduce(function(a,b){return a&&b},!0);return f?0:1})},d._calcProportionalSpace=function(b,c){var d=d3.sum(b);return 0===d?a.Utils.Array.createFilledArray(0,b.length):b.map(function(a){return c*a/d})},d._fixedSpace=function(a,b){var c=function(a){return a.reduce(function(a,b){return a&&b},!0)},d=function(a){return c(a.map(b))};return c(a.map(d))},d}(a.ComponentContainer);c.Table=d}(c=a.Components||(a.Components={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(a){function c(){var b=this;a.call(this),this._boxVisible=!1,this._boxBounds={topLeft:{x:0,y:0},bottomRight:{x:0,y:0}},this.addClass("selection-box-layer"),this._adjustBoundsCallback=function(){b.bounds({topLeft:{x:b._xScale?b._xScale.scale(b._boxLeftDataValue):b._boxBounds.topLeft.x,y:b._yScale?b._yScale.scale(b._boxTopDataValue):b._boxBounds.topLeft.y},bottomRight:{x:b._xScale?b._xScale.scale(b._boxRightDataValue):b._boxBounds.bottomRight.x,y:b._yScale?b._yScale.scale(b._boxBottomDataValue):b._boxBounds.bottomRight.y}})}}return b(c,a),c.prototype._setup=function(){a.prototype._setup.call(this),this._box=this.content().append("g").classed("selection-box",!0).remove(),this._boxArea=this._box.append("rect").classed("selection-area",!0)},c.prototype._sizeFromOffer=function(a,b){return{width:a,height:b}},c.prototype.bounds=function(a){return null==a?this._boxBounds:(this._setBounds(a),this.render(),this)
},c.prototype._setBounds=function(a){var b={x:Math.min(a.topLeft.x,a.bottomRight.x),y:Math.min(a.topLeft.y,a.bottomRight.y)},c={x:Math.max(a.topLeft.x,a.bottomRight.x),y:Math.max(a.topLeft.y,a.bottomRight.y)};this._boxBounds={topLeft:b,bottomRight:c},this._bindBoxDataValues()},c.prototype.renderImmediately=function(){if(this._boxVisible){var a=this._boxBounds.topLeft.y,b=this._boxBounds.bottomRight.y,c=this._boxBounds.topLeft.x,d=this._boxBounds.bottomRight.x;this._boxArea.attr({x:c,y:a,width:d-c,height:b-a}),this.content().node().appendChild(this._box.node())}else this._box.remove();return this},c.prototype.boxVisible=function(a){return null==a?this._boxVisible:(this._boxVisible=a,this.render(),this)},c.prototype.fixedWidth=function(){return!0},c.prototype.fixedHeight=function(){return!0},c.prototype.xScale=function(a){return null==a?this._xScale:(null!=this._xScale&&this._xScale.offUpdate(this._adjustBoundsCallback),this._xScale=a,this._xScale.onUpdate(this._adjustBoundsCallback),this._bindBoxDataValues(),this)},c.prototype.yScale=function(a){return null==a?this._yScale:(null!=this._yScale&&this._yScale.offUpdate(this._adjustBoundsCallback),this._yScale=a,this._yScale.onUpdate(this._adjustBoundsCallback),this._bindBoxDataValues(),this)},c.prototype.xExtent=function(){return[this._boxLeftDataValue,this._boxRightDataValue]},c.prototype.yExtent=function(){return[this._boxTopDataValue,this._boxBottomDataValue]},c.prototype._bindBoxDataValues=function(){this._boxLeftDataValue=this._xScale?this._xScale.invert(this._boxBounds.topLeft.x):null,this._boxTopDataValue=this._yScale?this._yScale.invert(this._boxBounds.topLeft.y):null,this._boxRightDataValue=this._xScale?this._xScale.invert(this._boxBounds.bottomRight.x):null,this._boxBottomDataValue=this._yScale?this._yScale.invert(this._boxBounds.bottomRight.y):null},c.prototype.destroy=function(){a.prototype.destroy.call(this),null!=this._xScale&&this.xScale().offUpdate(this._adjustBoundsCallback),null!=this._yScale&&this.yScale().offUpdate(this._adjustBoundsCallback)},c}(a.Component);c.SelectionBoxLayer=d}(c=a.Components||(a.Components={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(a){var b;!function(a){a.MAIN="main",a.RESET="reset"}(b=a.Animator||(a.Animator={}))}(c=a.Plots||(a.Plots={}));var d=function(d){function e(){var b=this;d.call(this),this._dataChanged=!1,this._animate=!1,this._animators={},this._clipPathEnabled=!0,this.addClass("plot"),this._datasetToDrawer=new a.Utils.Map,this._attrBindings=d3.map(),this._attrExtents=d3.map(),this._includedValuesProvider=function(a){return b._includedValuesForScale(a)},this._renderCallback=function(){return b.render()},this._onDatasetUpdateCallback=function(){return b._onDatasetUpdate()},this._propertyBindings=d3.map(),this._propertyExtents=d3.map();var f=(new a.Animators.Easing).maxTotalDuration(e._ANIMATION_MAX_DURATION);this.animator(c.Animator.MAIN,f),this.animator(c.Animator.RESET,new a.Animators.Null)}return b(e,d),e.prototype.anchor=function(a){return d.prototype.anchor.call(this,a),this._dataChanged=!0,this._updateExtents(),this},e.prototype._setup=function(){var a=this;d.prototype._setup.call(this),this._renderArea=this.content().append("g").classed("render-area",!0),this.datasets().forEach(function(b){return a._createNodesForDataset(b)})},e.prototype.destroy=function(){var a=this;d.prototype.destroy.call(this),this._scales().forEach(function(b){return b.offUpdate(a._renderCallback)}),this.datasets().forEach(function(b){return a.removeDataset(b)})},e.prototype.addDataset=function(a){this.datasets().indexOf(a)>-1&&this.removeDataset(a);var b=this._createDrawer(a);return this._datasetToDrawer.set(a,b),this._isSetup&&this._createNodesForDataset(a),a.onUpdate(this._onDatasetUpdateCallback),this._onDatasetUpdate(),this},e.prototype._createNodesForDataset=function(a){var b=this._datasetToDrawer.get(a);return b.renderArea(this._renderArea.append("g")),b},e.prototype._createDrawer=function(b){return new a.Drawer(b)},e.prototype._getAnimator=function(b){return this._animateOnNextRender()?this._animators[b]||new a.Animators.Null:new a.Animators.Null},e.prototype._onDatasetUpdate=function(){this._updateExtents(),this._dataChanged=!0,this.render()},e.prototype.attr=function(a,b,c){return null==b?this._attrBindings.get(a):(this._bindAttr(a,b,c),this.render(),this)},e.prototype._bindProperty=function(a,b,c){this._bind(a,b,c,this._propertyBindings,this._propertyExtents),this._updateExtentsForProperty(a)},e.prototype._bindAttr=function(a,b,c){this._bind(a,b,c,this._attrBindings,this._attrExtents),this._updateExtentsForAttr(a)},e.prototype._bind=function(a,b,c,d){var e=d.get(a),f=null!=e?e.scale:null;null!=f&&this._uninstallScaleForKey(f,a),null!=c&&this._installScaleForKey(c,a),d.set(a,{accessor:d3.functor(b),scale:c})},e.prototype._generateAttrToProjector=function(){var a={};this._attrBindings.forEach(function(b,c){var d=c.accessor,e=c.scale,f=e?function(a,b,c){return e.scale(d(a,b,c))}:d;a[b]=f});var b=this._propertyProjectors();return Object.keys(b).forEach(function(c){null==a[c]&&(a[c]=b[c])}),a},e.prototype.renderImmediately=function(){return this._isAnchored&&(this._paint(),this._dataChanged=!1),this},e.prototype.animated=function(a){return null==a?this._animate:(this._animate=a,this)},e.prototype.detach=function(){return d.prototype.detach.call(this),this._updateExtents(),this},e.prototype._scales=function(){var a=[];return this._attrBindings.forEach(function(b,c){var d=c.scale;null!=d&&-1===a.indexOf(d)&&a.push(d)}),this._propertyBindings.forEach(function(b,c){var d=c.scale;null!=d&&-1===a.indexOf(d)&&a.push(d)}),a},e.prototype._updateExtents=function(){var a=this;this._attrBindings.forEach(function(b){return a._updateExtentsForAttr(b)}),this._propertyExtents.forEach(function(b){return a._updateExtentsForProperty(b)}),this._scales().forEach(function(b){return b.addIncludedValuesProvider(a._includedValuesProvider)})},e.prototype._updateExtentsForAttr=function(a){this._updateExtentsForKey(a,this._attrBindings,this._attrExtents,null)},e.prototype._updateExtentsForProperty=function(a){this._updateExtentsForKey(a,this._propertyBindings,this._propertyExtents,this._filterForProperty(a))},e.prototype._filterForProperty=function(){return null},e.prototype._updateExtentsForKey=function(a,b,c,d){var e=this,f=b.get(a);null!=f&&null!=f.accessor&&c.set(a,this.datasets().map(function(a){return e._computeExtent(a,f,d)}))},e.prototype._computeExtent=function(a,b,c){var d=b.accessor,e=b.scale;if(null==e)return[];var f=a.data();null!=c&&(f=f.filter(function(b,d){return c(b,d,a)}));var g=function(b,c){return d(b,c,a)},h=f.map(g);return e.extentOfValues(h)},e.prototype._extentsForProperty=function(a){return this._propertyExtents.get(a)},e.prototype._includedValuesForScale=function(a){var b=this;if(!this._isAnchored)return[];var c=[];return this._attrBindings.forEach(function(d,e){if(e.scale===a){var f=b._attrExtents.get(d);null!=f&&(c=c.concat(d3.merge(f)))}}),this._propertyBindings.forEach(function(d,e){if(e.scale===a){var f=b._extentsForProperty(d);null!=f&&(c=c.concat(d3.merge(f)))}}),c},e.prototype.animator=function(a,b){return void 0===b?this._animators[a]:(this._animators[a]=b,this)},e.prototype.removeDataset=function(a){return this.datasets().indexOf(a)>-1&&(this._removeDatasetNodes(a),a.offUpdate(this._onDatasetUpdateCallback),this._datasetToDrawer["delete"](a),this._onDatasetUpdate()),this},e.prototype._removeDatasetNodes=function(a){var b=this._datasetToDrawer.get(a);b.remove()},e.prototype.datasets=function(a){var b=this,c=[];return this._datasetToDrawer.forEach(function(a,b){return c.push(b)}),null==a?c:(c.forEach(function(a){return b.removeDataset(a)}),a.forEach(function(a){return b.addDataset(a)}),this)},e.prototype._getDrawersInOrder=function(){var a=this;return this.datasets().map(function(b){return a._datasetToDrawer.get(b)})},e.prototype._generateDrawSteps=function(){return[{attrToProjector:this._generateAttrToProjector(),animator:new a.Animators.Null}]},e.prototype._additionalPaint=function(){},e.prototype._getDataToDraw=function(){var b=new a.Utils.Map;return this.datasets().forEach(function(a){return b.set(a,a.data())}),b},e.prototype._paint=function(){var b=this._generateDrawSteps(),c=this._getDataToDraw(),d=this._getDrawersInOrder();this.datasets().forEach(function(a,e){return d[e].draw(c.get(a),b)});var e=this.datasets().map(function(a,e){return d[e].totalDrawTime(c.get(a),b)}),f=a.Utils.Math.max(e,0);this._additionalPaint(f)},e.prototype.selections=function(a){var b=this;void 0===a&&(a=this.datasets());var c=[];return a.forEach(function(a){var d=b._datasetToDrawer.get(a);null!=d&&d.renderArea().selectAll(d.selector()).each(function(){c.push(this)})}),d3.selectAll(c)},e.prototype.entities=function(a){var b=this;return void 0===a&&(a=this.datasets()),this._lightweightEntities(a).map(function(a){return b._lightweightPlotEntityToPlotEntity(a)})},e.prototype._lightweightEntities=function(b){var c=this;void 0===b&&(b=this.datasets());var d=[];return b.forEach(function(b){var e=c._datasetToDrawer.get(b),f=0;b.data().forEach(function(g,h){var i=c._pixelPoint(g,h,b);a.Utils.Math.isNaN(i.x)||a.Utils.Math.isNaN(i.y)||(d.push({datum:g,index:h,dataset:b,position:i,component:c,drawer:e,validDatumIndex:f}),f++)})}),d},e.prototype._lightweightPlotEntityToPlotEntity=function(a){var b={datum:a.datum,position:a.position,dataset:a.dataset,index:a.index,component:a.component,selection:a.drawer.selectionForIndex(a.validDatumIndex)};return b},e.prototype.entityNearest=function(b){var c,d=this,e=1/0,f=this._lightweightEntities();return f.forEach(function(f){if(d._entityVisibleOnPlot(f.position,f.datum,f.index,f.dataset)){var g=a.Utils.Math.distanceSquared(f.position,b);e>g&&(e=g,c=f)}}),this._lightweightPlotEntityToPlotEntity(c)},e.prototype._visibleOnPlot=function(b,c){return a.Utils.Window.deprecated("Plot._visibleOnPlot()","v1.1.0"),!(c.x<0||c.y<0||c.x>this.width()||c.y>this.height())},e.prototype._entityVisibleOnPlot=function(a){return!(a.x<0||a.y<0||a.x>this.width()||a.y>this.height())},e.prototype._uninstallScaleForKey=function(a){a.offUpdate(this._renderCallback),a.removeIncludedValuesProvider(this._includedValuesProvider)},e.prototype._installScaleForKey=function(a){a.onUpdate(this._renderCallback),a.addIncludedValuesProvider(this._includedValuesProvider)},e.prototype._propertyProjectors=function(){return{}},e._scaledAccessor=function(a){return null==a.scale?a.accessor:function(b,c,d){return a.scale.scale(a.accessor(b,c,d))}},e.prototype._pixelPoint=function(){return{x:0,y:0}},e.prototype._animateOnNextRender=function(){return this._animate&&this._dataChanged},e._ANIMATION_MAX_DURATION=600,e}(a.Component);a.Plot=d}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var d;!function(d){var e=function(d){function e(){var b=this;d.call(this),this._labelFormatter=a.Formatters.identity(),this._labelsEnabled=!1,this.innerRadius(0),this.outerRadius(function(){return Math.min(b.width(),b.height())/2}),this.addClass("pie-plot"),this.attr("fill",function(a,b){return String(b)},new a.Scales.Color)}return b(e,d),e.prototype.computeLayout=function(a,b,c){d.prototype.computeLayout.call(this,a,b,c),this._renderArea.attr("transform","translate("+this.width()/2+","+this.height()/2+")");var e=Math.min(this.width(),this.height())/2;return null!=this.innerRadius().scale&&this.innerRadius().scale.range([0,e]),null!=this.outerRadius().scale&&this.outerRadius().scale.range([0,e]),this},e.prototype.addDataset=function(b){return 1===this.datasets().length?(a.Utils.Window.warn("Only one dataset is supported in Pie plots"),this):(this._updatePieAngles(),d.prototype.addDataset.call(this,b),this)},e.prototype.removeDataset=function(a){return d.prototype.removeDataset.call(this,a),this._startAngles=[],this._endAngles=[],this},e.prototype._onDatasetUpdate=function(){this._updatePieAngles(),d.prototype._onDatasetUpdate.call(this)},e.prototype._createDrawer=function(b){return new a.Drawers.Arc(b)},e.prototype.entities=function(a){var b=this;void 0===a&&(a=this.datasets());var c=d.prototype.entities.call(this,a);return c.forEach(function(a){a.position.x+=b.width()/2,a.position.y+=b.height()/2}),c},e.prototype.sectorValue=function(a,b){return null==a?this._propertyBindings.get(e._SECTOR_VALUE_KEY):(this._bindProperty(e._SECTOR_VALUE_KEY,a,b),this._updatePieAngles(),this.render(),this)},e.prototype.innerRadius=function(a,b){return null==a?this._propertyBindings.get(e._INNER_RADIUS_KEY):(this._bindProperty(e._INNER_RADIUS_KEY,a,b),this.render(),this)},e.prototype.outerRadius=function(a,b){return null==a?this._propertyBindings.get(e._OUTER_RADIUS_KEY):(this._bindProperty(e._OUTER_RADIUS_KEY,a,b),this.render(),this)},e.prototype.labelsEnabled=function(a){return void 0===a?this._labelsEnabled:(this._labelsEnabled=a,this.render(),this)},e.prototype.labelFormatter=function(a){return null==a?this._labelFormatter:(this._labelFormatter=a,this.render(),this)},e.prototype.entitiesAt=function(a){var b={x:this.width()/2,y:this.height()/2},c={x:a.x-b.x,y:a.y-b.y},d=this._sliceIndexForPoint(c);return null==d?[]:[this.entities()[d]]},e.prototype._propertyProjectors=function(){var b=this,c=d.prototype._propertyProjectors.call(this),e=a.Plot._scaledAccessor(this.innerRadius()),f=a.Plot._scaledAccessor(this.outerRadius());return c.d=function(a,c,d){return d3.svg.arc().innerRadius(e(a,c,d)).outerRadius(f(a,c,d)).startAngle(b._startAngles[c]).endAngle(b._endAngles[c])(a,c)},c},e.prototype._updatePieAngles=function(){if(null!=this.sectorValue()&&0!==this.datasets().length){var b=a.Plot._scaledAccessor(this.sectorValue()),c=this.datasets()[0],d=c.data().filter(function(d,e){return a.Utils.Math.isValidNumber(b(d,e,c))}),e=d3.layout.pie().sort(null).value(function(a,d){return b(a,d,c)})(d);e.some(function(a){return a.value<0})&&a.Utils.Window.warn("Negative values will not render correctly in a Pie Plot."),this._startAngles=e.map(function(a){return a.startAngle}),this._endAngles=e.map(function(a){return a.endAngle})}},e.prototype._getDataToDraw=function(){var b=d.prototype._getDataToDraw.call(this);if(0===this.datasets().length)return b;var c=a.Plot._scaledAccessor(this.sectorValue()),e=this.datasets()[0],f=b.get(e),g=f.filter(function(b,d){return a.Utils.Math.isValidNumber(c(b,d,e))});return b.set(e,g),b},e.prototype._pixelPoint=function(b,c,d){var e=a.Plot._scaledAccessor(this.innerRadius())(b,c,d),f=a.Plot._scaledAccessor(this.outerRadius())(b,c,d),g=(e+f)/2,h=a.Plot._scaledAccessor(this.sectorValue()),i=d3.layout.pie().sort(null).value(function(a,b){return h(a,b,d)})(d.data()),j=i[c].startAngle,k=i[c].endAngle,l=(j+k)/2;return{x:g*Math.sin(l),y:-g*Math.cos(l)}},e.prototype._additionalPaint=function(b){var c=this;this._renderArea.select(".label-area").remove(),this._labelsEnabled&&a.Utils.Window.setTimeout(function(){return c._drawLabels()},b)},e.prototype._sliceIndexForPoint=function(a){var b=Math.sqrt(Math.pow(a.x,2)+Math.pow(a.y,2)),c=Math.acos(-a.y/b);a.x<0&&(c=2*Math.PI-c);for(var d,e=0;e<this._startAngles.length;e++)if(this._startAngles[e]<c&&this._endAngles[e]>c){d=e;break}if(void 0!==d){var f=this.datasets()[0],g=f.data()[d],h=this.innerRadius().accessor(g,d,f),i=this.outerRadius().accessor(g,d,f);if(b>h&&i>b)return d}return null},e.prototype._drawLabels=function(){var b=this,d=this._generateAttrToProjector(),e=this._renderArea.append("g").classed("label-area",!0),f=new c.Measurers.Measurer(e),g=new c.Writers.Writer(f),h=this.datasets()[0],i=this._getDataToDraw().get(h);i.forEach(function(c,i){var j=b.sectorValue().accessor(c,i,h);if(a.Utils.Math.isValidNumber(j)){j=b._labelFormatter(j);var k=f.measure(j),l=(b._endAngles[i]+b._startAngles[i])/2,m=b.outerRadius().accessor(c,i,h);b.outerRadius().scale&&(m=b.outerRadius().scale.scale(m));var n=b.innerRadius().accessor(c,i,h);b.innerRadius().scale&&(n=b.innerRadius().scale.scale(n));var o=(m+n)/2,p=Math.sin(l)*o-k.width/2,q=-Math.cos(l)*o-k.height/2,r=[{x:p,y:q},{x:p,y:q+k.height},{x:p+k.width,y:q},{x:p+k.width,y:q+k.height}],s=r.every(function(a){return Math.abs(a.x)<=b.width()/2&&Math.abs(a.y)<=b.height()/2});if(s){var t=r.map(function(a){return b._sliceIndexForPoint(a)});s=t.every(function(a){return a===i})}var u=d.fill(c,i,h),v=1.6*a.Utils.Color.contrast("white",u)<a.Utils.Color.contrast("black",u),w=e.append("g").attr("transform","translate("+p+","+q+")"),x=v?"dark-label":"light-label";w.classed(x,!0),w.style("visibility",s?"inherit":"hidden"),g.write(j,k.width,k.height,{selection:w,xAlign:"center",yAlign:"center",textRotation:0})}})},e._INNER_RADIUS_KEY="inner-radius",e._OUTER_RADIUS_KEY="outer-radius",e._SECTOR_VALUE_KEY="sector-value",e}(a.Plot);d.Pie=e}(d=a.Plots||(a.Plots={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c=function(c){function d(){var a=this;c.call(this),this._autoAdjustXScaleDomain=!1,this._autoAdjustYScaleDomain=!1,this._deferredRendering=!1,this._cachedDomainX=[null,null],this._cachedDomainY=[null,null],this.addClass("xy-plot"),this._adjustYDomainOnChangeFromXCallback=function(){return a._adjustYDomainOnChangeFromX()},this._adjustXDomainOnChangeFromYCallback=function(){return a._adjustXDomainOnChangeFromY()};var b=0,d=0,e=1,f=1,g=[null,null],h=[null,null],i=0,j=500,k=function(){null!=a._renderArea&&(a._renderArea.attr("transform","translate("+b+", "+d+")scale("+e+", "+f+")"),clearTimeout(i),i=setTimeout(function(){a._cachedDomainX=g,a._cachedDomainY=h,b=0,d=0,e=1,f=1,a.render(),a._renderArea.attr("transform","translate(0, 0) scale(1, 1)")},j))},l=function(c){a._isAnchored&&(g=c.domain(),e=(c.scale(a._cachedDomainX[1])-c.scale(a._cachedDomainX[0]))/(c.scale(g[1])-c.scale(g[0]))||1,b=c.scale(a._cachedDomainX[0])-c.scale(g[0])||0,k())},m=function(b){a._isAnchored&&(h=b.domain(),f=(b.scale(a._cachedDomainY[1])-b.scale(a._cachedDomainY[0]))/(b.scale(h[1])-b.scale(h[0]))||1,d=b.scale(a._cachedDomainY[0])-b.scale(h[0])*f||0,k())};this._renderCallback=function(b){a.deferredRendering()&&a.x()&&a.x().scale===b?l(b):a.deferredRendering()&&a.y()&&a.y().scale===b?m(b):a.render()}}return b(d,c),d.prototype.deferredRendering=function(a){return null==a?this._deferredRendering:(a&&this._isAnchored&&(this.x()&&this.x().scale&&(this._cachedDomainX=this.x().scale.domain()),this.y()&&this.y().scale&&(this._cachedDomainY=this.y().scale.domain())),this._deferredRendering=a,this)},d.prototype.x=function(a,b){return null==a?this._propertyBindings.get(d._X_KEY):(this._bindProperty(d._X_KEY,a,b),this._autoAdjustYScaleDomain&&this._updateYExtentsAndAutodomain(),this.render(),this)},d.prototype.y=function(a,b){return null==a?this._propertyBindings.get(d._Y_KEY):(this._bindProperty(d._Y_KEY,a,b),this._autoAdjustXScaleDomain&&this._updateXExtentsAndAutodomain(),this.render(),this)},d.prototype._filterForProperty=function(a){return"x"===a&&this._autoAdjustXScaleDomain?this._makeFilterByProperty("y"):"y"===a&&this._autoAdjustYScaleDomain?this._makeFilterByProperty("x"):null},d.prototype._makeFilterByProperty=function(b){var c=this._propertyBindings.get(b);if(null!=c){var d=c.accessor,e=c.scale;if(null!=e)return function(b,c,f){var g=e.range();return a.Utils.Math.inRange(e.scale(d(b,c,f)),g[0],g[1])}}return null},d.prototype._uninstallScaleForKey=function(a,b){c.prototype._uninstallScaleForKey.call(this,a,b);var e=b===d._X_KEY?this._adjustYDomainOnChangeFromXCallback:this._adjustXDomainOnChangeFromYCallback;a.offUpdate(e)},d.prototype._installScaleForKey=function(a,b){c.prototype._installScaleForKey.call(this,a,b);var e=b===d._X_KEY?this._adjustYDomainOnChangeFromXCallback:this._adjustXDomainOnChangeFromYCallback;a.onUpdate(e)},d.prototype.destroy=function(){return c.prototype.destroy.call(this),this.x().scale&&this.x().scale.offUpdate(this._adjustYDomainOnChangeFromXCallback),this.y().scale&&this.y().scale.offUpdate(this._adjustXDomainOnChangeFromYCallback),this},d.prototype.autorangeMode=function(a){if(null==a)return this._autoAdjustXScaleDomain?"x":this._autoAdjustYScaleDomain?"y":"none";switch(a){case"x":this._autoAdjustXScaleDomain=!0,this._autoAdjustYScaleDomain=!1,this._adjustXDomainOnChangeFromY();break;case"y":this._autoAdjustXScaleDomain=!1,this._autoAdjustYScaleDomain=!0,this._adjustYDomainOnChangeFromX();break;case"none":this._autoAdjustXScaleDomain=!1,this._autoAdjustYScaleDomain=!1;break;default:throw new Error("Invalid scale name '"+a+"', must be 'x', 'y' or 'none'")}return this},d.prototype.computeLayout=function(b,d,e){c.prototype.computeLayout.call(this,b,d,e);var f=this.x(),g=f&&f.scale;null!=g&&g.range([0,this.width()]);var h=this.y(),i=h&&h.scale;return null!=i&&this.y().scale.range(this.y().scale instanceof a.Scales.Category?[0,this.height()]:[this.height(),0]),this},d.prototype._updateXExtentsAndAutodomain=function(){this._updateExtentsForProperty("x");var a=this.x().scale;null!=a&&a.autoDomain()},d.prototype._updateYExtentsAndAutodomain=function(){this._updateExtentsForProperty("y");var a=this.y().scale;null!=a&&a.autoDomain()},d.prototype.showAllData=function(){return this._updateXExtentsAndAutodomain(),this._updateYExtentsAndAutodomain(),this},d.prototype._adjustYDomainOnChangeFromX=function(){this._projectorsReady()&&this._autoAdjustYScaleDomain&&this._updateYExtentsAndAutodomain()},d.prototype._adjustXDomainOnChangeFromY=function(){this._projectorsReady()&&this._autoAdjustXScaleDomain&&this._updateXExtentsAndAutodomain()},d.prototype._projectorsReady=function(){var a=this.x(),b=this.y();return null!=a&&null!=a.accessor&&null!=b&&null!=b.accessor},d.prototype._pixelPoint=function(b,c,d){var e=a.Plot._scaledAccessor(this.x()),f=a.Plot._scaledAccessor(this.y());return{x:e(b,c,d),y:f(b,c,d)}},d.prototype._getDataToDraw=function(){var b=this,d=c.prototype._getDataToDraw.call(this),e=function(c,d,e){var f=a.Plot._scaledAccessor(b.x())(c,d,e),g=a.Plot._scaledAccessor(b.y())(c,d,e);return a.Utils.Math.isValidNumber(f)&&a.Utils.Math.isValidNumber(g)};return this.datasets().forEach(function(a){d.set(a,d.get(a).filter(function(b,c){return e(b,c,a)}))}),d},d._X_KEY="x",d._Y_KEY="y",d}(a.Plot);a.XYPlot=c}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(){c.call(this),this.animator("rectangles",new a.Animators.Null),this.addClass("rectangle-plot")}return b(d,c),d.prototype._createDrawer=function(b){return new a.Drawers.Rectangle(b)},d.prototype._generateAttrToProjector=function(){var b=this,e=c.prototype._generateAttrToProjector.call(this),f=a.Plot._scaledAccessor(this.x()),g=e[d._X2_KEY],h=a.Plot._scaledAccessor(this.y()),i=e[d._Y2_KEY],j=this.x().scale,k=this.y().scale;return null!=g?(e.width=function(a,b,c){return Math.abs(g(a,b,c)-f(a,b,c))},e.x=function(a,b,c){return Math.min(g(a,b,c),f(a,b,c))}):(e.width=function(){return b._rectangleWidth(j)},e.x=function(a,b,c){return f(a,b,c)-.5*e.width(a,b,c)}),null!=i?(e.height=function(a,b,c){return Math.abs(i(a,b,c)-h(a,b,c))},e.y=function(a,b,c){return Math.max(i(a,b,c),h(a,b,c))-e.height(a,b,c)}):(e.height=function(){return b._rectangleWidth(k)},e.y=function(a,b,c){return h(a,b,c)-.5*e.height(a,b,c)}),delete e[d._X2_KEY],delete e[d._Y2_KEY],e},d.prototype._generateDrawSteps=function(){return[{attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator("rectangles")}]},d.prototype._updateExtentsForProperty=function(a){c.prototype._updateExtentsForProperty.call(this,a),"x"===a?c.prototype._updateExtentsForProperty.call(this,"x2"):"y"===a&&c.prototype._updateExtentsForProperty.call(this,"y2")},d.prototype._filterForProperty=function(a){return"x2"===a?c.prototype._filterForProperty.call(this,"x"):"y2"===a?c.prototype._filterForProperty.call(this,"y"):c.prototype._filterForProperty.call(this,a)},d.prototype.x=function(b,e){if(null==b)return c.prototype.x.call(this);if(null==e?c.prototype.x.call(this,b):c.prototype.x.call(this,b,e),null!=e){var f=this.x2(),g=f&&f.accessor;null!=g&&this._bindProperty(d._X2_KEY,g,e)}return e instanceof a.Scales.Category&&e.innerPadding(0).outerPadding(0),this},d.prototype.x2=function(a){if(null==a)return this._propertyBindings.get(d._X2_KEY);var b=this.x(),c=b&&b.scale;return this._bindProperty(d._X2_KEY,a,c),this.render(),this},d.prototype.y=function(b,e){if(null==b)return c.prototype.y.call(this);if(null==e?c.prototype.y.call(this,b):c.prototype.y.call(this,b,e),null!=e){var f=this.y2(),g=f&&f.accessor;null!=g&&this._bindProperty(d._Y2_KEY,g,e)}return e instanceof a.Scales.Category&&e.innerPadding(0).outerPadding(0),this},d.prototype.y2=function(a){if(null==a)return this._propertyBindings.get(d._Y2_KEY);var b=this.y(),c=b&&b.scale;return this._bindProperty(d._Y2_KEY,a,c),this.render(),this},d.prototype.entitiesAt=function(a){var b=this._generateAttrToProjector();return this.entities().filter(function(c){var d=c.datum,e=c.index,f=c.dataset,g=b.x(d,e,f),h=b.y(d,e,f),i=b.width(d,e,f),j=b.height(d,e,f);return g<=a.x&&a.x<=g+i&&h<=a.y&&a.y<=h+j})},d.prototype._propertyProjectors=function(){var b=c.prototype._propertyProjectors.call(this);return null!=this.x2()&&(b.x2=a.Plot._scaledAccessor(this.x2())),null!=this.y2()&&(b.y2=a.Plot._scaledAccessor(this.y2())),b},d.prototype._pixelPoint=function(a,b,c){var d=this._generateAttrToProjector(),e=d.x(a,b,c),f=d.y(a,b,c),g=d.width(a,b,c),h=d.height(a,b,c),i=e+g/2,j=f+h/2;return{x:i,y:j}},d.prototype._rectangleWidth=function(b){if(b instanceof a.Scales.Category)return b.rangeBand();var c=b===this.x().scale?this.x().accessor:this.y().accessor,d=d3.set(a.Utils.Array.flatten(this.datasets().map(function(a){return a.data().map(function(b,d){return c(b,d,a).valueOf()})}))).values().map(function(a){return+a}),e=a.Utils.Math.min(d,0),f=a.Utils.Math.max(d,0),g=b.scale(e),h=b.scale(f);return(h-g)/Math.abs(f-e)},d.prototype._getDataToDraw=function(){var b=new a.Utils.Map,c=this._generateAttrToProjector();return this.datasets().forEach(function(d){var e=d.data().filter(function(b,e){return a.Utils.Math.isValidNumber(c.x(b,e,d))&&a.Utils.Math.isValidNumber(c.y(b,e,d))&&a.Utils.Math.isValidNumber(c.width(b,e,d))&&a.Utils.Math.isValidNumber(c.height(b,e,d))});b.set(d,e)}),b},d._X2_KEY="x2",d._Y2_KEY="y2",d}(a.XYPlot);c.Rectangle=d}(c=a.Plots||(a.Plots={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(d){function e(){d.call(this),this.addClass("scatter-plot");var b=new a.Animators.Easing;b.startDelay(5),b.stepDuration(250),b.maxTotalDuration(a.Plot._ANIMATION_MAX_DURATION),this.animator(c.Animator.MAIN,b),this.attr("opacity",.6),this.attr("fill",(new a.Scales.Color).range()[0]),this.size(6);var e=a.SymbolFactories.circle();this.symbol(function(){return e})}return b(e,d),e.prototype._createDrawer=function(b){return new a.Drawers.Symbol(b)},e.prototype.size=function(a,b){return null==a?this._propertyBindings.get(e._SIZE_KEY):(this._bindProperty(e._SIZE_KEY,a,b),this.render(),this)},e.prototype.symbol=function(a){return null==a?this._propertyBindings.get(e._SYMBOL_KEY):(this._propertyBindings.set(e._SYMBOL_KEY,{accessor:a}),this.render(),this)},e.prototype._generateDrawSteps=function(){var a=[];if(this._animateOnNextRender()){var b=this._generateAttrToProjector();b.d=function(){return""},a.push({attrToProjector:b,animator:this._getAnimator(c.Animator.RESET)})}return a.push({attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator(c.Animator.MAIN)}),a},e.prototype._visibleOnPlot=function(b,c,d){a.Utils.Window.deprecated("Scatter._visibleOnPlot()","v1.1.0");var e={min:0,max:this.width()},f={min:0,max:this.height()},g=d3.transform(d.attr("transform")).translate,h=a.Utils.DOM.elementBBox(d),i={x:h.x+g[0],y:h.y+g[1],width:h.width,height:h.height};return a.Utils.DOM.intersectsBBox(e,f,i)},e.prototype._entityVisibleOnPlot=function(b,c,d,e){var f={min:0,max:this.width()},g={min:0,max:this.height()},h=a.Plot._scaledAccessor(this.size())(c,d,e),i={x:b.x-h,y:b.y-h,width:h,height:h};return a.Utils.DOM.intersectsBBox(f,g,i)},e.prototype._propertyProjectors=function(){var b=d.prototype._propertyProjectors.call(this),c=a.Plot._scaledAccessor(this.x()),e=a.Plot._scaledAccessor(this.y()),f=a.Plot._scaledAccessor(this.size());b.transform=function(a,b,d){return"translate("+c(a,b,d)+","+e(a,b,d)+")"};var g=a.Plot._scaledAccessor(this.symbol());return b.d=function(a,b,c){return g(a,b,c)(f(a,b,c))},b},e.prototype.entitiesIn=function(b,c){var d,e;if(null==c){var f=b;d={min:f.topLeft.x,max:f.bottomRight.x},e={min:f.topLeft.y,max:f.bottomRight.y}}else d=b,e=c;var g=a.Plot._scaledAccessor(this.x()),h=a.Plot._scaledAccessor(this.y());return this.entities().filter(function(a){var b=a.datum,c=a.index,f=a.dataset,i=g(b,c,f),j=h(b,c,f);return d.min<=i&&i<=d.max&&e.min<=j&&j<=e.max})},e._SIZE_KEY="size",e._SYMBOL_KEY="symbol",e}(a.XYPlot);c.Scatter=d}(c=a.Plots||(a.Plots={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var d;!function(d){var e=function(e){function f(b){var c=this;if(void 0===b&&(b=f.ORIENTATION_VERTICAL),e.call(this),this._labelFormatter=a.Formatters.identity(),this._labelsEnabled=!1,this._hideBarsIfAnyAreTooWide=!0,this._barPixelWidth=0,this.addClass("bar-plot"),b!==f.ORIENTATION_VERTICAL&&b!==f.ORIENTATION_HORIZONTAL)throw new Error(b+" is not a valid orientation for Plots.Bar");this._isVertical=b===f.ORIENTATION_VERTICAL,this.animator("baseline",new a.Animators.Null),this.attr("fill",(new a.Scales.Color).range()[0]),this.attr("width",function(){return c._barPixelWidth}),this._labelConfig=new a.Utils.Map,this._baselineValueProvider=function(){return[c.baselineValue()]},this._updateBarPixelWidthCallback=function(){return c._updateBarPixelWidth()}}return b(f,e),f.prototype.x=function(a,b){return null==a?e.prototype.x.call(this):(null==b?e.prototype.x.call(this,a):(e.prototype.x.call(this,a,b),b.onUpdate(this._updateBarPixelWidthCallback)),this._updateValueScale(),this)},f.prototype.y=function(a,b){return null==a?e.prototype.y.call(this):(null==b?e.prototype.y.call(this,a):(e.prototype.y.call(this,a,b),b.onUpdate(this._updateBarPixelWidthCallback)),this._updateValueScale(),this)},f.prototype.orientation=function(){return this._isVertical?f.ORIENTATION_VERTICAL:f.ORIENTATION_HORIZONTAL},f.prototype.render=function(){return e.prototype.render.call(this),this._updateBarPixelWidth(),this},f.prototype._createDrawer=function(b){return new a.Drawers.Rectangle(b)},f.prototype._setup=function(){e.prototype._setup.call(this),this._baseline=this._renderArea.append("line").classed("baseline",!0)},f.prototype.baselineValue=function(b){if(null==b){if(null!=this._baselineValue)return this._baselineValue;if(!this._projectorsReady())return 0;var c=this._isVertical?this.y().scale:this.x().scale;return c&&c instanceof a.Scales.Time?new Date(0):0}return this._baselineValue=b,this._updateValueScale(),this.render(),this},f.prototype.addDataset=function(a){return a.onUpdate(this._updateBarPixelWidthCallback),e.prototype.addDataset.call(this,a),this._updateBarPixelWidth(),this},f.prototype.removeDataset=function(a){return a.offUpdate(this._updateBarPixelWidthCallback),e.prototype.removeDataset.call(this,a),this._updateBarPixelWidth(),this},f.prototype.labelsEnabled=function(a){return void 0===a?this._labelsEnabled:(this._labelsEnabled=a,this.render(),this)
},f.prototype.labelFormatter=function(a){return null==a?this._labelFormatter:(this._labelFormatter=a,this.render(),this)},f.prototype._createNodesForDataset=function(a){var b=e.prototype._createNodesForDataset.call(this,a);b.renderArea().classed(f._BAR_AREA_CLASS,!0);var d=this._renderArea.append("g").classed(f._LABEL_AREA_CLASS,!0),g=new c.Measurers.CacheCharacterMeasurer(d),h=new c.Writers.Writer(g);return this._labelConfig.set(a,{labelArea:d,measurer:g,writer:h}),b},f.prototype._removeDatasetNodes=function(a){e.prototype._removeDatasetNodes.call(this,a);var b=this._labelConfig.get(a);null!=b&&(b.labelArea.remove(),this._labelConfig["delete"](a))},f.prototype.entityNearest=function(b){var c,d=this,e=1/0,f=1/0,g=this._isVertical?b.x:b.y,h=this._isVertical?b.y:b.x,i=.5;return this.entities().forEach(function(j){if(d._entityVisibleOnPlot(j.position,j.datum,j.index,j.dataset)){var k=0,l=0,m=j.position,n=a.Utils.DOM.elementBBox(j.selection);if(!a.Utils.DOM.intersectsBBox(b.x,b.y,n,i)){var o=d._isVertical?m.x:m.y;k=Math.abs(g-o);var p=d._isVertical?n.y:n.x,q=p+(d._isVertical?n.height:n.width);if(h>=p-i&&q+i>=h)l=0;else{var r=d._isVertical?m.y:m.x;l=Math.abs(h-r)}}(e>k||k===e&&f>l)&&(c=j,e=k,f=l)}}),c},f.prototype._visibleOnPlot=function(b,c,d){a.Utils.Window.deprecated("Bar._visibleOnPlot()","v1.1.0");var e={min:0,max:this.width()},f={min:0,max:this.height()},g=a.Utils.DOM.elementBBox(d);return a.Utils.DOM.intersectsBBox(e,f,g)},f.prototype._entityVisibleOnPlot=function(b,c,d,e){var f={min:0,max:this.width()},g={min:0,max:this.height()},h=this._generateAttrToProjector(),i=h.width(c,d,e),j=h.height(c,d,e),k={x:b.x-i/2,y:b.y,width:i,height:j};return a.Utils.DOM.intersectsBBox(f,g,k)},f.prototype.entitiesAt=function(a){return this._entitiesIntersecting(a.x,a.y)},f.prototype.entitiesIn=function(a,b){var c,d;if(null==b){var e=a;c={min:e.topLeft.x,max:e.bottomRight.x},d={min:e.topLeft.y,max:e.bottomRight.y}}else c=a,d=b;return this._entitiesIntersecting(c,d)},f.prototype._entitiesIntersecting=function(b,c){var d=[];return this.entities().forEach(function(e){a.Utils.DOM.intersectsBBox(b,c,a.Utils.DOM.elementBBox(e.selection))&&d.push(e)}),d},f.prototype._updateValueScale=function(){if(this._projectorsReady()){var b=this._isVertical?this.y().scale:this.x().scale;if(b instanceof a.QuantitativeScale){var c=b;c.addPaddingExceptionsProvider(this._baselineValueProvider),c.addIncludedValuesProvider(this._baselineValueProvider)}}},f.prototype._additionalPaint=function(b){var c=this,d=this._isVertical?this.y().scale:this.x().scale,e=d.scale(this.baselineValue()),f={x1:this._isVertical?0:e,y1:this._isVertical?e:0,x2:this._isVertical?this.width():e,y2:this._isVertical?e:this.height()};this._getAnimator("baseline").animate(this._baseline,f),this.datasets().forEach(function(a){return c._labelConfig.get(a).labelArea.selectAll("g").remove()}),this._labelsEnabled&&a.Utils.Window.setTimeout(function(){return c._drawLabels()},b)},f.prototype._drawLabels=function(){var a=this,b=this._getDataToDraw(),c=!1;this.datasets().forEach(function(d){return c=c||a._drawLabel(b.get(d),d)}),this._hideBarsIfAnyAreTooWide&&c&&this.datasets().forEach(function(b){return a._labelConfig.get(b).labelArea.selectAll("g").remove()})},f.prototype._drawLabel=function(b,c){var d=this,e=this._generateAttrToProjector(),g=this._labelConfig.get(c),h=g.labelArea,i=g.measurer,j=g.writer,k=b.map(function(b,g){var k=d._isVertical?d.y().accessor:d.x().accessor,l=a.Plot._scaledAccessor(d._isVertical?d.y():d.x()),m=d._isVertical?d.y().scale:d.x().scale,n=m.scale(d.baselineValue()),o=d._labelFormatter(k(b,g,c)).toString(),p=e.width(b,g,c),q=e.height(b,g,c),r=e.x(b,g,c),s=e.y(b,g,c),t=l(b,g,c)<=n,u=i.measure(o),v=e.fill(b,g,c),w=1.6*a.Utils.Color.contrast("white",v)<a.Utils.Color.contrast("black",v),x=d._isVertical?q:p,y=d._isVertical?u.height:u.width,z=d._isVertical?u.width:u.height,A=d._isVertical?p:q,B=z+2*f._LABEL_HORIZONTAL_PADDING>A;if(u.height<=q&&u.width<=p){var C=Math.min((x-y)/2,f._LABEL_VERTICAL_PADDING);t||(C=-1*C),d._isVertical?s+=C:r+=C;var D=!0,E={x:r,y:t?s:s+q-u.height};E.x=d._isVertical?r+p/2-u.width/2:t?r:r+p-u.width,(E.x<0||E.x+u.width>d.width()||E.y<0||E.y+u.height>d.height())&&(D=!1);var F=h.append("g").attr("transform","translate("+r+","+s+")"),G=w?"dark-label":"light-label";F.classed(G,!0),F.style("visibility",D?"inherit":"hidden");var H,I;d._isVertical?(H="center",I=t?"top":"bottom"):(H=t?"left":"right",I="center");var J={selection:F,xAlign:H,yAlign:I,textRotation:0};j.write(o,p,q,J)}return B});return k.some(function(a){return a})},f.prototype._generateDrawSteps=function(){var a=[];if(this._animateOnNextRender()){var b=this._generateAttrToProjector(),c=this._isVertical?this.y().scale:this.x().scale,e=c.scale(this.baselineValue()),f=this._isVertical?"y":"x",g=this._isVertical?"height":"width";b[f]=function(){return e},b[g]=function(){return 0},a.push({attrToProjector:b,animator:this._getAnimator(d.Animator.RESET)})}return a.push({attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator(d.Animator.MAIN)}),a},f.prototype._generateAttrToProjector=function(){var b=e.prototype._generateAttrToProjector.call(this),c=this._isVertical?this.y().scale:this.x().scale,d=this._isVertical?"y":"x",f=this._isVertical?"x":"y",g=c.scale(this.baselineValue()),h=a.Plot._scaledAccessor(this._isVertical?this.x():this.y()),i=b.width,j=a.Plot._scaledAccessor(this._isVertical?this.y():this.x()),k=function(a,b,c){return Math.abs(g-j(a,b,c))};return b.width=this._isVertical?i:k,b.height=this._isVertical?k:i,b[f]=function(a,b,c){return h(a,b,c)-i(a,b,c)/2},b[d]=function(a,b,c){var d=j(a,b,c);return d>g?g:d},b},f.prototype._getBarPixelWidth=function(){if(!this._projectorsReady())return 0;var b,c=this._isVertical?this.x().scale:this.y().scale;if(c instanceof a.Scales.Category)b=c.rangeBand();else{var d=this._isVertical?this.x().accessor:this.y().accessor,e=d3.set(a.Utils.Array.flatten(this.datasets().map(function(a){return a.data().map(function(b,c){return d(b,c,a)}).filter(function(a){return null!=a}).map(function(a){return a.valueOf()})}))).values().map(function(a){return+a});e.sort(function(a,b){return a-b});var g=e.map(function(a){return c.scale(a)}),h=d3.pairs(g),i=this._isVertical?this.width():this.height();b=a.Utils.Math.min(h,function(a){return Math.abs(a[1]-a[0])},i*f._SINGLE_BAR_DIMENSION_RATIO);var j=a.Utils.Math.min(g,0);j>0&&(b=Math.min(b,2*j));var k=a.Utils.Math.max(g,0);if(i>k){var l=i-k;b=Math.min(b,2*l)}b*=f._BAR_WIDTH_RATIO}return b},f.prototype._updateBarPixelWidth=function(){this._barPixelWidth=this._getBarPixelWidth()},f.prototype.entities=function(a){var b=this;if(void 0===a&&(a=this.datasets()),!this._projectorsReady())return[];var c=e.prototype.entities.call(this,a),d=(this._isVertical?this.y().scale:this.x().scale).scale(this.baselineValue());return c.forEach(function(a){var c=a.selection;b._isVertical&&Math.floor(+c.attr("y"))>=Math.floor(d)?a.position.y+=+c.attr("height"):!b._isVertical&&Math.floor(+c.attr("x"))<Math.floor(d)&&(a.position.x-=+c.attr("width")),b._isVertical?a.position.x=+c.attr("x")+ +c.attr("width")/2:a.position.y=+c.attr("y")+ +c.attr("height")/2}),c},f.prototype._pixelPoint=function(a,b,c){var d=this._generateAttrToProjector(),e=d.x(a,b,c),f=d.y(a,b,c),g=d.width(a,b,c),h=d.height(a,b,c),i=this._isVertical?e+g/2:e+g,j=this._isVertical?f:f+h/2;return{x:i,y:j}},f.prototype._uninstallScaleForKey=function(a,b){a.offUpdate(this._updateBarPixelWidthCallback),e.prototype._uninstallScaleForKey.call(this,a,b)},f.prototype._getDataToDraw=function(){var b=new a.Utils.Map,c=this._generateAttrToProjector();return this.datasets().forEach(function(d){var e=d.data().filter(function(b,e){return a.Utils.Math.isValidNumber(c.x(b,e,d))&&a.Utils.Math.isValidNumber(c.y(b,e,d))&&a.Utils.Math.isValidNumber(c.width(b,e,d))&&a.Utils.Math.isValidNumber(c.height(b,e,d))});b.set(d,e)}),b},f.ORIENTATION_VERTICAL="vertical",f.ORIENTATION_HORIZONTAL="horizontal",f._BAR_WIDTH_RATIO=.95,f._SINGLE_BAR_DIMENSION_RATIO=.4,f._BAR_AREA_CLASS="bar-area",f._LABEL_AREA_CLASS="bar-label-text-area",f._LABEL_VERTICAL_PADDING=5,f._LABEL_HORIZONTAL_PADDING=5,f}(a.XYPlot);d.Bar=e}(d=a.Plots||(a.Plots={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(d){function e(){d.call(this),this._interpolator="linear",this.addClass("line-plot");var b=new a.Animators.Easing;b.stepDuration(a.Plot._ANIMATION_MAX_DURATION),b.easingMode("exp-in-out"),b.maxTotalDuration(a.Plot._ANIMATION_MAX_DURATION),this.animator(c.Animator.MAIN,b),this.attr("stroke",(new a.Scales.Color).range()[0]),this.attr("stroke-width","2px")}return b(e,d),e.prototype.interpolator=function(a){return null==a?this._interpolator:(this._interpolator=a,this.render(),this)},e.prototype._createDrawer=function(b){return new a.Drawers.Line(b)},e.prototype._getResetYFunction=function(){var a=this.y().scale.domain(),b=Math.max(a[0],a[1]),c=Math.min(a[0],a[1]),d=0>b&&b||c>0&&c||0,e=this.y().scale.scale(d);return function(){return e}},e.prototype._generateDrawSteps=function(){var b=[];if(this._animateOnNextRender()){var d=this._generateAttrToProjector();d.d=this._constructLineProjector(a.Plot._scaledAccessor(this.x()),this._getResetYFunction()),b.push({attrToProjector:d,animator:this._getAnimator(c.Animator.RESET)})}return b.push({attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator(c.Animator.MAIN)}),b},e.prototype._generateAttrToProjector=function(){var a=d.prototype._generateAttrToProjector.call(this);return Object.keys(a).forEach(function(b){if("d"!==b){var c=a[b];a[b]=function(a,b,d){return a.length>0?c(a[0],b,d):null}}}),a},e.prototype.entityNearest=function(a){var b,c=this,d=1/0,e=1/0;return this.entities().forEach(function(f){if(c._entityVisibleOnPlot(f.position,f.datum,f.index,f.dataset)){var g=Math.abs(a.x-f.position.x),h=Math.abs(a.y-f.position.y);(d>g||g===d&&e>h)&&(b=f,d=g,e=h)}}),b},e.prototype._propertyProjectors=function(){var b=d.prototype._propertyProjectors.call(this);return b.d=this._constructLineProjector(a.Plot._scaledAccessor(this.x()),a.Plot._scaledAccessor(this.y())),b},e.prototype._constructLineProjector=function(b,c){var d=this,e=function(b,c,e){var f=a.Plot._scaledAccessor(d.x())(b,c,e),g=a.Plot._scaledAccessor(d.y())(b,c,e);return null!=f&&!a.Utils.Math.isNaN(f)&&null!=g&&!a.Utils.Math.isNaN(g)};return function(a,f,g){return d3.svg.line().x(function(a,c){return b(a,c,g)}).y(function(a,b){return c(a,b,g)}).interpolate(d.interpolator()).defined(function(a,b){return e(a,b,g)})(a)}},e.prototype._getDataToDraw=function(){var b=new a.Utils.Map;return this.datasets().forEach(function(a){return b.set(a,[a.data()])}),b},e}(a.XYPlot);c.Line=d}(c=a.Plots||(a.Plots={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(d){function e(){d.call(this),this.addClass("area-plot"),this.y0(0),this.attr("fill-opacity",.25),this.attr("fill",(new a.Scales.Color).range()[0]),this._lineDrawers=new a.Utils.Map}return b(e,d),e.prototype._setup=function(){var a=this;d.prototype._setup.call(this),this._lineDrawers.forEach(function(b){return b.renderArea(a._renderArea.append("g"))})},e.prototype.y=function(a,b){if(null==a)return d.prototype.y.call(this);if(null==b?d.prototype.y.call(this,a):d.prototype.y.call(this,a,b),null!=b){var c=this.y0().accessor;null!=c&&this._bindProperty(e._Y0_KEY,c,b),this._updateYScale()}return this},e.prototype.y0=function(a){if(null==a)return this._propertyBindings.get(e._Y0_KEY);var b=this.y(),c=b&&b.scale;return this._bindProperty(e._Y0_KEY,a,c),this._updateYScale(),this.render(),this},e.prototype._onDatasetUpdate=function(){d.prototype._onDatasetUpdate.call(this),this._updateYScale()},e.prototype.addDataset=function(b){var c=new a.Drawers.Line(b);return this._isSetup&&c.renderArea(this._renderArea.append("g")),this._lineDrawers.set(b,c),d.prototype.addDataset.call(this,b),this},e.prototype._removeDatasetNodes=function(a){d.prototype._removeDatasetNodes.call(this,a),this._lineDrawers.get(a).remove()},e.prototype._additionalPaint=function(){var a=this,b=this._generateLineDrawSteps(),c=this._getDataToDraw();this.datasets().forEach(function(d){return a._lineDrawers.get(d).draw(c.get(d),b)})},e.prototype._generateLineDrawSteps=function(){var b=[];if(this._animateOnNextRender()){var d=this._generateLineAttrToProjector();d.d=this._constructLineProjector(a.Plot._scaledAccessor(this.x()),this._getResetYFunction()),b.push({attrToProjector:d,animator:this._getAnimator(c.Animator.RESET)})}return b.push({attrToProjector:this._generateLineAttrToProjector(),animator:this._getAnimator(c.Animator.MAIN)}),b},e.prototype._generateLineAttrToProjector=function(){var b=this._generateAttrToProjector();return b.d=this._constructLineProjector(a.Plot._scaledAccessor(this.x()),a.Plot._scaledAccessor(this.y())),b},e.prototype._createDrawer=function(b){return new a.Drawers.Area(b)},e.prototype._generateDrawSteps=function(){var b=[];if(this._animateOnNextRender()){var d=this._generateAttrToProjector();d.d=this._constructAreaProjector(a.Plot._scaledAccessor(this.x()),this._getResetYFunction(),a.Plot._scaledAccessor(this.y0())),b.push({attrToProjector:d,animator:this._getAnimator(c.Animator.RESET)})}return b.push({attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator(c.Animator.MAIN)}),b},e.prototype._updateYScale=function(){var b=this._propertyExtents.get("y0"),c=a.Utils.Array.flatten(b),d=a.Utils.Array.uniq(c),e=1===d.length?d[0]:null,f=this.y(),g=f&&f.scale;null!=g&&(null!=this._constantBaselineValueProvider&&(g.removePaddingExceptionsProvider(this._constantBaselineValueProvider),this._constantBaselineValueProvider=null),null!=e&&(this._constantBaselineValueProvider=function(){return[e]},g.addPaddingExceptionsProvider(this._constantBaselineValueProvider)))},e.prototype._getResetYFunction=function(){return a.Plot._scaledAccessor(this.y0())},e.prototype._propertyProjectors=function(){var b=d.prototype._propertyProjectors.call(this);return b.d=this._constructAreaProjector(a.Plot._scaledAccessor(this.x()),a.Plot._scaledAccessor(this.y()),a.Plot._scaledAccessor(this.y0())),b},e.prototype.selections=function(a){var b=this;void 0===a&&(a=this.datasets());var c=d.prototype.selections.call(this,a)[0],e=a.map(function(a){return b._lineDrawers.get(a)}).filter(function(a){return null!=a});return e.forEach(function(a,b){return c.push(a.selectionForIndex(b).node())}),d3.selectAll(c)},e.prototype._constructAreaProjector=function(b,c,d){var e=this,f=function(b,c,d){var f=a.Plot._scaledAccessor(e.x())(b,c,d),g=a.Plot._scaledAccessor(e.y())(b,c,d);return a.Utils.Math.isValidNumber(f)&&a.Utils.Math.isValidNumber(g)};return function(a,g,h){var i=d3.svg.area().x(function(a,c){return b(a,c,h)}).y1(function(a,b){return c(a,b,h)}).y0(function(a,b){return d(a,b,h)}).interpolate(e.interpolator()).defined(function(a,b){return f(a,b,h)});return i(a)}},e._Y0_KEY="y0",e}(c.Line);c.Area=d}(c=a.Plots||(a.Plots={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(d){function e(b){void 0===b&&(b=c.Bar.ORIENTATION_VERTICAL),d.call(this,b),this._clusterOffsets=new a.Utils.Map}return b(e,d),e.prototype._generateAttrToProjector=function(){var a=this,b=d.prototype._generateAttrToProjector.call(this),c=this._makeInnerScale(),e=function(){return c.rangeBand()};b.width=this._isVertical?e:b.width,b.height=this._isVertical?b.height:e;var f=b.x,g=b.y;return b.x=this._isVertical?function(b,c,d){return f(b,c,d)+a._clusterOffsets.get(d)}:function(a,b,c){return f(a,b,c)},b.y=this._isVertical?function(a,b,c){return g(a,b,c)}:function(b,c,d){return g(b,c,d)+a._clusterOffsets.get(d)},b},e.prototype._updateClusterPosition=function(){var a=this,b=this._makeInnerScale();this.datasets().forEach(function(c,d){return a._clusterOffsets.set(c,b.scale(String(d))-b.rangeBand()/2)})},e.prototype._makeInnerScale=function(){var b=new a.Scales.Category;b.domain(this.datasets().map(function(a,b){return String(b)}));var c=a.Plot._scaledAccessor(this.attr("width"));return b.range([0,c(null,0,null)]),b},e.prototype._getDataToDraw=function(){return this._updateClusterPosition(),d.prototype._getDataToDraw.call(this)},e}(c.Bar);c.ClusteredBar=d}(c=a.Plots||(a.Plots={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(){var b=this;c.call(this),this._baselineValue=0,this.addClass("stacked-area-plot"),this.attr("fill-opacity",1),this._stackingResult=new a.Utils.Map,this._stackedExtent=[],this._baselineValueProvider=function(){return[b._baselineValue]}}return b(d,c),d.prototype._getAnimator=function(){return new a.Animators.Null},d.prototype._setup=function(){c.prototype._setup.call(this),this._baseline=this._renderArea.append("line").classed("baseline",!0)},d.prototype.x=function(a,b){return null==a?c.prototype.x.call(this):(null==b?c.prototype.x.call(this,a):c.prototype.x.call(this,a,b),this._updateStackExtentsAndOffsets(),this)},d.prototype.y=function(a,b){return null==a?c.prototype.y.call(this):(null==b?c.prototype.y.call(this,a):c.prototype.y.call(this,a,b),this._updateStackExtentsAndOffsets(),this)},d.prototype._additionalPaint=function(){var a=this.y().scale.scale(this._baselineValue),b={x1:0,y1:a,x2:this.width(),y2:a};this._getAnimator("baseline").animate(this._baseline,b)},d.prototype._updateYScale=function(){var a=this.y(),b=a&&a.scale;null!=b&&(b.addPaddingExceptionsProvider(this._baselineValueProvider),b.addIncludedValuesProvider(this._baselineValueProvider))},d.prototype._onDatasetUpdate=function(){return this._updateStackExtentsAndOffsets(),c.prototype._onDatasetUpdate.call(this),this},d.prototype._updateExtentsForProperty=function(a){c.prototype._updateExtentsForProperty.call(this,a),"x"!==a&&"y"!==a||!this._projectorsReady()||this._updateStackExtentsAndOffsets()},d.prototype._extentsForProperty=function(a){var b="y";return a===b?[this._stackedExtent]:c.prototype._extentsForProperty.call(this,a)},d.prototype._updateStackExtentsAndOffsets=function(){if(this._projectorsReady()){var b=this.datasets(),c=this.x().accessor,d=this.y().accessor,e=this._filterForProperty("y");this._checkSameDomain(b,c),this._stackingResult=a.Utils.Stacking.stack(b,c,d),this._stackedExtent=a.Utils.Stacking.stackedExtent(this._stackingResult,c,e)}},d.prototype._checkSameDomain=function(b,c){var e=b.map(function(a){return d3.set(a.data().map(function(b,d){return c(b,d,a).toString()})).values()}),f=d._domainKeys(b,c);e.some(function(a){return a.length!==f.length})&&a.Utils.Window.warn("the domains across the datasets are not the same. Plot may produce unintended behavior.")},d._domainKeys=function(a,b){var c=d3.set();return a.forEach(function(a){a.data().forEach(function(d,e){c.add(b(d,e,a))})}),c.values()},d.prototype._propertyProjectors=function(){var b=this,d=c.prototype._propertyProjectors.call(this),e=this.y().accessor,f=this.x().accessor,g=function(b,c,d){return a.Utils.Stacking.normalizeKey(f(b,c,d))},h=function(a,c,d){return b.y().scale.scale(+e(a,c,d)+b._stackingResult.get(d).get(g(a,c,d)).offset)},i=function(a,c,d){return b.y().scale.scale(b._stackingResult.get(d).get(g(a,c,d)).offset)};return d.d=this._constructAreaProjector(a.Plot._scaledAccessor(this.x()),h,i),d},d.prototype._pixelPoint=function(b,d,e){var f=c.prototype._pixelPoint.call(this,b,d,e),g=this.x().accessor(b,d,e),h=this.y().accessor(b,d,e),i=this.y().scale.scale(+h+this._stackingResult.get(e).get(a.Utils.Stacking.normalizeKey(g)).offset);return{x:f.x,y:i}},d}(c.Area);c.StackedArea=d}(c=a.Plots||(a.Plots={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(d){function e(b){void 0===b&&(b=c.Bar.ORIENTATION_VERTICAL),d.call(this,b),this.addClass("stacked-bar-plot"),this._stackingResult=new a.Utils.Map,this._stackedExtent=[]}return b(e,d),e.prototype.x=function(a,b){return null==a?d.prototype.x.call(this):(null==b?d.prototype.x.call(this,a):d.prototype.x.call(this,a,b),this._updateStackExtentsAndOffsets(),this)},e.prototype.y=function(a,b){return null==a?d.prototype.y.call(this):(null==b?d.prototype.y.call(this,a):d.prototype.y.call(this,a,b),this._updateStackExtentsAndOffsets(),this)},e.prototype._generateAttrToProjector=function(){var b=this,c=d.prototype._generateAttrToProjector.call(this),e=this._isVertical?"y":"x",f=this._isVertical?"x":"y",g=this._isVertical?this.y().scale:this.x().scale,h=this._propertyBindings.get(e).accessor,i=this._propertyBindings.get(f).accessor,j=function(b,c,d){return a.Utils.Stacking.normalizeKey(i(b,c,d))},k=function(a,c,d){return g.scale(b._stackingResult.get(d).get(j(a,c,d)).offset)},l=function(a,c,d){return g.scale(+h(a,c,d)+b._stackingResult.get(d).get(j(a,c,d)).offset)},m=function(a,b,c){return Math.abs(l(a,b,c)-k(a,b,c))};c[this._isVertical?"height":"width"]=m;var n=function(a,b,c){return+h(a,b,c)<0?k(a,b,c):l(a,b,c)};return c[e]=function(a,c,d){return b._isVertical?n(a,c,d):n(a,c,d)-m(a,c,d)},c},e.prototype._onDatasetUpdate=function(){return this._updateStackExtentsAndOffsets(),d.prototype._onDatasetUpdate.call(this),this},e.prototype._updateExtentsForProperty=function(a){d.prototype._updateExtentsForProperty.call(this,a),"x"!==a&&"y"!==a||!this._projectorsReady()||this._updateStackExtentsAndOffsets()},e.prototype._extentsForProperty=function(a){var b=this._isVertical?"y":"x";return a===b?[this._stackedExtent]:d.prototype._extentsForProperty.call(this,a)},e.prototype._updateStackExtentsAndOffsets=function(){if(this._projectorsReady()){var b=this.datasets(),c=this._isVertical?this.x().accessor:this.y().accessor,d=this._isVertical?this.y().accessor:this.x().accessor,e=this._filterForProperty(this._isVertical?"y":"x");this._stackingResult=a.Utils.Stacking.stack(b,c,d),this._stackedExtent=a.Utils.Stacking.stackedExtent(this._stackingResult,c,e)}},e}(c.Bar);c.StackedBar=d}(c=a.Plots||(a.Plots={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(){c.call(this),this.addClass("segment-plot"),this.attr("stroke",(new a.Scales.Color).range()[0]),this.attr("stroke-width","2px")}return b(d,c),d.prototype._createDrawer=function(b){return new a.Drawers.Segment(b)},d.prototype._generateDrawSteps=function(){return[{attrToProjector:this._generateAttrToProjector(),animator:new a.Animators.Null}]},d.prototype._updateExtentsForProperty=function(a){c.prototype._updateExtentsForProperty.call(this,a),"x"===a?c.prototype._updateExtentsForProperty.call(this,"x2"):"y"===a&&c.prototype._updateExtentsForProperty.call(this,"y2")},d.prototype._filterForProperty=function(a){return"x2"===a?c.prototype._filterForProperty.call(this,"x"):"y2"===a?c.prototype._filterForProperty.call(this,"y"):c.prototype._filterForProperty.call(this,a)},d.prototype.x=function(a,b){if(null==a)return c.prototype.x.call(this);if(null==b)c.prototype.x.call(this,a);else{c.prototype.x.call(this,a,b);var e=this.x2(),f=e&&e.accessor;null!=f&&this._bindProperty(d._X2_KEY,f,b)}return this},d.prototype.x2=function(a){if(null==a)return this._propertyBindings.get(d._X2_KEY);var b=this.x(),c=b&&b.scale;return this._bindProperty(d._X2_KEY,a,c),this.render(),this},d.prototype.y=function(a,b){if(null==a)return c.prototype.y.call(this);if(null==b)c.prototype.y.call(this,a);else{c.prototype.y.call(this,a,b);var e=this.y2(),f=e&&e.accessor;null!=f&&this._bindProperty(d._Y2_KEY,f,b)}return this},d.prototype.y2=function(a){if(null==a)return this._propertyBindings.get(d._Y2_KEY);var b=this.y(),c=b&&b.scale;return this._bindProperty(d._Y2_KEY,a,c),this.render(),this},d.prototype._propertyProjectors=function(){var b=c.prototype._propertyProjectors.call(this);return b.x1=a.Plot._scaledAccessor(this.x()),b.x2=a.Plot._scaledAccessor(null==this.x2()?this.x():this.x2()),b.y1=a.Plot._scaledAccessor(this.y()),b.y2=a.Plot._scaledAccessor(null==this.y2()?this.y():this.y2()),b},d._X2_KEY="x2",d._Y2_KEY="y2",d}(a.XYPlot);c.Segment=d}(c=a.Plots||(a.Plots={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(){c.call(this),this._connectorsEnabled=!1,this.addClass("waterfall-plot")}return b(d,c),d.prototype.connectorsEnabled=function(a){return null==a?this._connectorsEnabled:(this._connectorsEnabled=a,this)},d.prototype.total=function(a){return null==a?this._propertyBindings.get(d._TOTAL_KEY):(this._bindProperty(d._TOTAL_KEY,a,null),this)},d.prototype._additionalPaint=function(b){var c=this;this._connectorArea.selectAll("line").remove(),this._connectorsEnabled&&a.Utils.Window.setTimeout(function(){return c._drawConnectors()},b)},d.prototype._createNodesForDataset=function(a){var b=c.prototype._createNodesForDataset.call(this,a);return this._connectorArea=this._renderArea.append("g").classed(d._CONNECTOR_AREA_CLASS,!0),b},d.prototype._extentsForProperty=function(a){var b="y";return a===b?[this._extent]:c.prototype._extentsForProperty.call(this,a)},d.prototype._generateAttrToProjector=function(){var b=this,e=c.prototype._generateAttrToProjector.call(this),f=this.y().scale,g=a.Plot._scaledAccessor(this.total()),h=this.attr("y");null==h&&(e.y=function(a,c,d){var e=b.y().accessor(a,c,d),h=g(a,c,d);if(h)return Math.min(f.scale(e),f.scale(0));var i=b._subtotals[c];if(0===c)return f.scale(0>e?i-e:i);var j=b._subtotals[c-1];return f.scale(i>j?i:j)});var i=this.attr("height");return null==i&&(e.height=function(a,c,d){var e=g(a,c,d),h=b.y().accessor(a,c,d);if(e)return Math.abs(f.scale(h)-f.scale(0));var i=b._subtotals[c];if(0===c)return Math.abs(f.scale(i)-f.scale(i-h));var j=b._subtotals[c-1];return Math.abs(f.scale(i)-f.scale(j))}),e["class"]=function(a,c,e){var f="";null!=b.attr("class")&&(f=b.attr("class").accessor(a,c,e)+" ");var h=g(a,c,e);if(h)return f+d._BAR_TOTAL_CLASS;var i=b.y().accessor(a,c,e);return f+(i>0?d._BAR_GROWTH_CLASS:d._BAR_DECLINE_CLASS)},e},d.prototype._onDatasetUpdate=function(){return this._updateSubtotals(),c.prototype._onDatasetUpdate.call(this),this},d.prototype._calculateSubtotalsAndExtent=function(a){var b=this,c=Number.MAX_VALUE,d=Number.MIN_VALUE,e=0,f=-1/0;a.data().forEach(function(g,h){var i=b.y().accessor(g,h,a),j=b.total().accessor(g,h,a);if(j&&0!==h||(e+=i),b._subtotals.push(e),c>e&&(c=e),e>d&&(d=e),j&&(c>i&&(c=i),i>d&&(d=i)),f===-1/0&&j){for(var k=i-e,l=0;l<b._subtotals.length;l++)b._subtotals[l]+=k;f=b._subtotals[l],e+=k,c+=k,d+=k}}),this._extent=[c,d]},d.prototype._drawConnectors=function(){for(var a=this._generateAttrToProjector(),b=this.datasets()[0],c=1;c<b.data().length;c++){var e=c-1,f=b.data()[c],g=b.data()[e],h=a.x(g,e,b),i=a.x(f,c,b)+a.width(f,c,b),j=a.y(f,c,b);(this._subtotals[c]>0&&this._subtotals[c]>this._subtotals[e]||this._subtotals[c]<0&&this._subtotals[c]>=this._subtotals[e])&&(j=a.y(f,c,b)+a.height(f,c,b)),this._connectorArea.append("line").classed(d._CONNECTOR_CLASS,!0).attr("x1",h).attr("x2",i).attr("y1",j).attr("y2",j)}},d.prototype._updateSubtotals=function(){var a=this.datasets();if(a.length>0){var b=a[a.length-1];this._subtotals=new Array,this._calculateSubtotalsAndExtent(b)}},d._BAR_DECLINE_CLASS="waterfall-decline",d._BAR_GROWTH_CLASS="waterfall-growth",d._BAR_TOTAL_CLASS="waterfall-total",d._CONNECTOR_CLASS="connector",d._CONNECTOR_AREA_CLASS="connector-area",d._TOTAL_KEY="total",d}(c.Bar);c.Waterfall=d}(c=a.Plots||(a.Plots={}))}(a||(a={}));var a;!function(a){var b;!function(a){var b=function(){function a(){}return a.prototype.totalTime=function(){return 0},a.prototype.animate=function(a,b){return a.attr(b)},a}();a.Null=b}(b=a.Animators||(a.Animators={}))}(a||(a={}));var a;!function(a){var b;!function(a){var b=function(){function a(){this._startDelay=a._DEFAULT_START_DELAY_MILLISECONDS,this._stepDuration=a._DEFAULT_STEP_DURATION_MILLISECONDS,this._stepDelay=a._DEFAULT_ITERATIVE_DELAY_MILLISECONDS,this._maxTotalDuration=a._DEFAULT_MAX_TOTAL_DURATION_MILLISECONDS,this._easingMode=a._DEFAULT_EASING_MODE}return a.prototype.totalTime=function(a){var b=this._getAdjustedIterativeDelay(a);return this.startDelay()+b*Math.max(a-1,0)+this.stepDuration()},a.prototype.animate=function(a,b){var c=this,d=a[0].length,e=this._getAdjustedIterativeDelay(d);return a.transition().ease(this.easingMode()).duration(this.stepDuration()).delay(function(a,b){return c.startDelay()+e*b}).attr(b)},a.prototype.startDelay=function(a){return null==a?this._startDelay:(this._startDelay=a,this)},a.prototype.stepDuration=function(a){return null==a?Math.min(this._stepDuration,this._maxTotalDuration):(this._stepDuration=a,this)},a.prototype.stepDelay=function(a){return null==a?this._stepDelay:(this._stepDelay=a,this)},a.prototype.maxTotalDuration=function(a){return null==a?this._maxTotalDuration:(this._maxTotalDuration=a,this)},a.prototype.easingMode=function(a){return null==a?this._easingMode:(this._easingMode=a,this)},a.prototype._getAdjustedIterativeDelay=function(a){var b=this.maxTotalDuration()-this.stepDuration();b=Math.max(b,0);var c=b/Math.max(a-1,1);return Math.min(this.stepDelay(),c)},a._DEFAULT_START_DELAY_MILLISECONDS=0,a._DEFAULT_STEP_DURATION_MILLISECONDS=300,a._DEFAULT_ITERATIVE_DELAY_MILLISECONDS=15,a._DEFAULT_MAX_TOTAL_DURATION_MILLISECONDS=1/0,a._DEFAULT_EASING_MODE="exp-out",a}();a.Easing=b}(b=a.Animators||(a.Animators={}))}(a||(a={}));var a;!function(a){var b=function(){function a(){this._eventToCallback={},this._callbacks=[],this._connected=!1}return a.prototype._hasNoListeners=function(){return this._callbacks.every(function(a){return 0===a.size})},a.prototype._connect=function(){var a=this;this._connected||(Object.keys(this._eventToCallback).forEach(function(b){var c=a._eventToCallback[b];document.addEventListener(b,c)}),this._connected=!0)},a.prototype._disconnect=function(){var a=this;this._connected&&this._hasNoListeners()&&(Object.keys(this._eventToCallback).forEach(function(b){var c=a._eventToCallback[b];document.removeEventListener(b,c)}),this._connected=!1)},a.prototype._setCallback=function(a,b){this._connect(),a.add(b)},a.prototype._unsetCallback=function(a,b){a["delete"](b),this._disconnect()},a}();a.Dispatcher=b}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(b){var d=this;c.call(this),this._translator=a.Utils.ClientToSVGTranslator.getTranslator(b),this._lastMousePosition={x:-1,y:-1},this._moveCallbacks=new a.Utils.CallbackSet,this._downCallbacks=new a.Utils.CallbackSet,this._upCallbacks=new a.Utils.CallbackSet,this._wheelCallbacks=new a.Utils.CallbackSet,this._dblClickCallbacks=new a.Utils.CallbackSet,this._callbacks=[this._moveCallbacks,this._downCallbacks,this._upCallbacks,this._wheelCallbacks,this._dblClickCallbacks];var e=function(a){return d._measureAndDispatch(a,d._moveCallbacks,"page")};this._eventToCallback.mouseover=e,this._eventToCallback.mousemove=e,this._eventToCallback.mouseout=e,this._eventToCallback.mousedown=function(a){return d._measureAndDispatch(a,d._downCallbacks)},this._eventToCallback.mouseup=function(a){return d._measureAndDispatch(a,d._upCallbacks,"page")
},this._eventToCallback.wheel=function(a){return d._measureAndDispatch(a,d._wheelCallbacks)},this._eventToCallback.dblclick=function(a){return d._measureAndDispatch(a,d._dblClickCallbacks)}}return b(d,c),d.getDispatcher=function(b){var c=a.Utils.DOM.boundingSVG(b),e=c[d._DISPATCHER_KEY];return null==e&&(e=new d(c),c[d._DISPATCHER_KEY]=e),e},d.prototype.onMouseMove=function(a){return this._setCallback(this._moveCallbacks,a),this},d.prototype.offMouseMove=function(a){return this._unsetCallback(this._moveCallbacks,a),this},d.prototype.onMouseDown=function(a){return this._setCallback(this._downCallbacks,a),this},d.prototype.offMouseDown=function(a){return this._unsetCallback(this._downCallbacks,a),this},d.prototype.onMouseUp=function(a){return this._setCallback(this._upCallbacks,a),this},d.prototype.offMouseUp=function(a){return this._unsetCallback(this._upCallbacks,a),this},d.prototype.onWheel=function(a){return this._setCallback(this._wheelCallbacks,a),this},d.prototype.offWheel=function(a){return this._unsetCallback(this._wheelCallbacks,a),this},d.prototype.onDblClick=function(a){return this._setCallback(this._dblClickCallbacks,a),this},d.prototype.offDblClick=function(a){return this._unsetCallback(this._dblClickCallbacks,a),this},d.prototype._measureAndDispatch=function(a,b,c){if(void 0===c&&(c="element"),"page"!==c&&"element"!==c)throw new Error("Invalid scope '"+c+"', must be 'element' or 'page'");if("page"===c||this._translator.insideSVG(a)){var d=this._translator.computePosition(a.clientX,a.clientY);null!=d&&(this._lastMousePosition=d,b.callCallbacks(this.lastMousePosition(),a))}},d.prototype.lastMousePosition=function(){return this._lastMousePosition},d._DISPATCHER_KEY="__Plottable_Dispatcher_Mouse",d}(a.Dispatcher);c.Mouse=d}(c=a.Dispatchers||(a.Dispatchers={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(b){var d=this;c.call(this),this._translator=a.Utils.ClientToSVGTranslator.getTranslator(b),this._startCallbacks=new a.Utils.CallbackSet,this._moveCallbacks=new a.Utils.CallbackSet,this._endCallbacks=new a.Utils.CallbackSet,this._cancelCallbacks=new a.Utils.CallbackSet,this._callbacks=[this._moveCallbacks,this._startCallbacks,this._endCallbacks,this._cancelCallbacks],this._eventToCallback.touchstart=function(a){return d._measureAndDispatch(a,d._startCallbacks)},this._eventToCallback.touchmove=function(a){return d._measureAndDispatch(a,d._moveCallbacks,"page")},this._eventToCallback.touchend=function(a){return d._measureAndDispatch(a,d._endCallbacks,"page")},this._eventToCallback.touchcancel=function(a){return d._measureAndDispatch(a,d._cancelCallbacks,"page")}}return b(d,c),d.getDispatcher=function(b){var c=a.Utils.DOM.boundingSVG(b),e=c[d._DISPATCHER_KEY];return null==e&&(e=new d(c),c[d._DISPATCHER_KEY]=e),e},d.prototype.onTouchStart=function(a){return this._setCallback(this._startCallbacks,a),this},d.prototype.offTouchStart=function(a){return this._unsetCallback(this._startCallbacks,a),this},d.prototype.onTouchMove=function(a){return this._setCallback(this._moveCallbacks,a),this},d.prototype.offTouchMove=function(a){return this._unsetCallback(this._moveCallbacks,a),this},d.prototype.onTouchEnd=function(a){return this._setCallback(this._endCallbacks,a),this},d.prototype.offTouchEnd=function(a){return this._unsetCallback(this._endCallbacks,a),this},d.prototype.onTouchCancel=function(a){return this._setCallback(this._cancelCallbacks,a),this},d.prototype.offTouchCancel=function(a){return this._unsetCallback(this._cancelCallbacks,a),this},d.prototype._measureAndDispatch=function(a,b,c){if(void 0===c&&(c="element"),"page"!==c&&"element"!==c)throw new Error("Invalid scope '"+c+"', must be 'element' or 'page'");if("element"!==c||this._translator.insideSVG(a)){for(var d=a.changedTouches,e={},f=[],g=0;g<d.length;g++){var h=d[g],i=h.identifier,j=this._translator.computePosition(h.clientX,h.clientY);null!=j&&(e[i]=j,f.push(i))}f.length>0&&b.callCallbacks(f,e,a)}},d._DISPATCHER_KEY="__Plottable_Dispatcher_Touch",d}(a.Dispatcher);c.Touch=d}(c=a.Dispatchers||(a.Dispatchers={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(){var b=this;c.call(this),this._eventToCallback.keydown=function(a){return b._processKeydown(a)},this._eventToCallback.keyup=function(a){return b._processKeyup(a)},this._keydownCallbacks=new a.Utils.CallbackSet,this._keyupCallbacks=new a.Utils.CallbackSet,this._callbacks=[this._keydownCallbacks,this._keyupCallbacks]}return b(d,c),d.getDispatcher=function(){var a=document[d._DISPATCHER_KEY];return null==a&&(a=new d,document[d._DISPATCHER_KEY]=a),a},d.prototype.onKeyDown=function(a){return this._setCallback(this._keydownCallbacks,a),this},d.prototype.offKeyDown=function(a){return this._unsetCallback(this._keydownCallbacks,a),this},d.prototype.onKeyUp=function(a){return this._setCallback(this._keyupCallbacks,a),this},d.prototype.offKeyUp=function(a){return this._unsetCallback(this._keyupCallbacks,a),this},d.prototype._processKeydown=function(a){this._keydownCallbacks.callCallbacks(a.keyCode,a)},d.prototype._processKeyup=function(a){this._keyupCallbacks.callCallbacks(a.keyCode,a)},d._DISPATCHER_KEY="__Plottable_Dispatcher_Key",d}(a.Dispatcher);c.Key=d}(c=a.Dispatchers||(a.Dispatchers={}))}(a||(a={}));var a;!function(a){var b=function(){function a(){var a=this;this._anchorCallback=function(b){return a._anchor(b)},this._enabled=!0}return a.prototype._anchor=function(){this._isAnchored=!0},a.prototype._unanchor=function(){this._isAnchored=!1},a.prototype.attachTo=function(a){return this._disconnect(),this._componentAttachedTo=a,this._connect(),this},a.prototype._connect=function(){this.enabled()&&null!=this._componentAttachedTo&&!this._isAnchored&&this._componentAttachedTo.onAnchor(this._anchorCallback)},a.prototype.detachFrom=function(){return this._disconnect(),this._componentAttachedTo=null,this},a.prototype._disconnect=function(){this._isAnchored&&this._unanchor(),null!=this._componentAttachedTo&&this._componentAttachedTo.offAnchor(this._anchorCallback)},a.prototype.enabled=function(a){return null==a?this._enabled:(this._enabled=a,this._enabled?this._connect():this._disconnect(),this)},a.prototype._translateToComponentSpace=function(a){var b=this._componentAttachedTo.originToSVG();return{x:a.x-b.x,y:a.y-b.y}},a.prototype._isInsideComponent=function(a){return 0<=a.x&&0<=a.y&&a.x<=this._componentAttachedTo.width()&&a.y<=this._componentAttachedTo.height()},a}();a.Interaction=b}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(){var b=this;c.apply(this,arguments),this._clickedDown=!1,this._onClickCallbacks=new a.Utils.CallbackSet,this._mouseDownCallback=function(a){return b._handleClickDown(a)},this._mouseUpCallback=function(a){return b._handleClickUp(a)},this._touchStartCallback=function(a,c){return b._handleClickDown(c[a[0]])},this._touchEndCallback=function(a,c){return b._handleClickUp(c[a[0]])},this._touchCancelCallback=function(){return b._clickedDown=!1}}return b(d,c),d.prototype._anchor=function(b){c.prototype._anchor.call(this,b),this._mouseDispatcher=a.Dispatchers.Mouse.getDispatcher(b.content().node()),this._mouseDispatcher.onMouseDown(this._mouseDownCallback),this._mouseDispatcher.onMouseUp(this._mouseUpCallback),this._touchDispatcher=a.Dispatchers.Touch.getDispatcher(b.content().node()),this._touchDispatcher.onTouchStart(this._touchStartCallback),this._touchDispatcher.onTouchEnd(this._touchEndCallback),this._touchDispatcher.onTouchCancel(this._touchCancelCallback)},d.prototype._unanchor=function(){c.prototype._unanchor.call(this),this._mouseDispatcher.offMouseDown(this._mouseDownCallback),this._mouseDispatcher.offMouseUp(this._mouseUpCallback),this._mouseDispatcher=null,this._touchDispatcher.offTouchStart(this._touchStartCallback),this._touchDispatcher.offTouchEnd(this._touchEndCallback),this._touchDispatcher.offTouchCancel(this._touchCancelCallback),this._touchDispatcher=null},d.prototype._handleClickDown=function(a){var b=this._translateToComponentSpace(a);this._isInsideComponent(b)&&(this._clickedDown=!0)},d.prototype._handleClickUp=function(a){var b=this._translateToComponentSpace(a);this._clickedDown&&this._isInsideComponent(b)&&this._onClickCallbacks.callCallbacks(b),this._clickedDown=!1},d.prototype.onClick=function(a){return this._onClickCallbacks.add(a),this},d.prototype.offClick=function(a){return this._onClickCallbacks["delete"](a),this},d}(a.Interaction);c.Click=d}(c=a.Interactions||(a.Interactions={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d;!function(a){a[a.NotClicked=0]="NotClicked",a[a.SingleClicked=1]="SingleClicked",a[a.DoubleClicked=2]="DoubleClicked"}(d||(d={}));var e=function(c){function e(){var b=this;c.apply(this,arguments),this._clickState=d.NotClicked,this._clickedDown=!1,this._onDoubleClickCallbacks=new a.Utils.CallbackSet,this._mouseDownCallback=function(a){return b._handleClickDown(a)},this._mouseUpCallback=function(a){return b._handleClickUp(a)},this._dblClickCallback=function(){return b._handleDblClick()},this._touchStartCallback=function(a,c){return b._handleClickDown(c[a[0]])},this._touchEndCallback=function(a,c){return b._handleClickUp(c[a[0]])},this._touchCancelCallback=function(){return b._handleClickCancel()}}return b(e,c),e.prototype._anchor=function(b){c.prototype._anchor.call(this,b),this._mouseDispatcher=a.Dispatchers.Mouse.getDispatcher(b.content().node()),this._mouseDispatcher.onMouseDown(this._mouseDownCallback),this._mouseDispatcher.onMouseUp(this._mouseUpCallback),this._mouseDispatcher.onDblClick(this._dblClickCallback),this._touchDispatcher=a.Dispatchers.Touch.getDispatcher(b.content().node()),this._touchDispatcher.onTouchStart(this._touchStartCallback),this._touchDispatcher.onTouchEnd(this._touchEndCallback),this._touchDispatcher.onTouchCancel(this._touchCancelCallback)},e.prototype._unanchor=function(){c.prototype._unanchor.call(this),this._mouseDispatcher.offMouseDown(this._mouseDownCallback),this._mouseDispatcher.offMouseUp(this._mouseUpCallback),this._mouseDispatcher.offDblClick(this._dblClickCallback),this._mouseDispatcher=null,this._touchDispatcher.offTouchStart(this._touchStartCallback),this._touchDispatcher.offTouchEnd(this._touchEndCallback),this._touchDispatcher.offTouchCancel(this._touchCancelCallback),this._touchDispatcher=null},e.prototype._handleClickDown=function(a){var b=this._translateToComponentSpace(a);this._isInsideComponent(b)&&(this._clickState===d.SingleClicked&&e._pointsEqual(b,this._clickedPoint)||(this._clickState=d.NotClicked),this._clickedPoint=b,this._clickedDown=!0)},e.prototype._handleClickUp=function(a){var b=this._translateToComponentSpace(a);this._clickState=this._clickedDown&&e._pointsEqual(b,this._clickedPoint)?this._clickState===d.NotClicked?d.SingleClicked:d.DoubleClicked:d.NotClicked,this._clickedDown=!1},e.prototype._handleDblClick=function(){this._clickState===d.DoubleClicked&&(this._onDoubleClickCallbacks.callCallbacks(this._clickedPoint),this._clickState=d.NotClicked)},e.prototype._handleClickCancel=function(){this._clickState=d.NotClicked,this._clickedDown=!1},e._pointsEqual=function(a,b){return a.x===b.x&&a.y===b.y},e.prototype.onDoubleClick=function(a){return this._onDoubleClickCallbacks.add(a),this},e.prototype.offDoubleClick=function(a){return this._onDoubleClickCallbacks["delete"](a),this},e}(a.Interaction);c.DoubleClick=e}(c=a.Interactions||(a.Interactions={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(){var b=this;c.apply(this,arguments),this._keyPressCallbacks={},this._keyReleaseCallbacks={},this._mouseMoveCallback=function(){return!1},this._downedKeys=new a.Utils.Set,this._keyDownCallback=function(a){return b._handleKeyDownEvent(a)},this._keyUpCallback=function(a){return b._handleKeyUpEvent(a)}}return b(d,c),d.prototype._anchor=function(b){c.prototype._anchor.call(this,b),this._positionDispatcher=a.Dispatchers.Mouse.getDispatcher(this._componentAttachedTo._element.node()),this._positionDispatcher.onMouseMove(this._mouseMoveCallback),this._keyDispatcher=a.Dispatchers.Key.getDispatcher(),this._keyDispatcher.onKeyDown(this._keyDownCallback),this._keyDispatcher.onKeyUp(this._keyUpCallback)},d.prototype._unanchor=function(){c.prototype._unanchor.call(this),this._positionDispatcher.offMouseMove(this._mouseMoveCallback),this._positionDispatcher=null,this._keyDispatcher.offKeyDown(this._keyDownCallback),this._keyDispatcher.offKeyUp(this._keyUpCallback),this._keyDispatcher=null},d.prototype._handleKeyDownEvent=function(a){var b=this._translateToComponentSpace(this._positionDispatcher.lastMousePosition());this._isInsideComponent(b)&&(this._keyPressCallbacks[a]&&this._keyPressCallbacks[a].callCallbacks(a),this._downedKeys.add(a))},d.prototype._handleKeyUpEvent=function(a){this._downedKeys.has(a)&&this._keyReleaseCallbacks[a]&&this._keyReleaseCallbacks[a].callCallbacks(a),this._downedKeys["delete"](a)},d.prototype.onKeyPress=function(b,c){return this._keyPressCallbacks[b]||(this._keyPressCallbacks[b]=new a.Utils.CallbackSet),this._keyPressCallbacks[b].add(c),this},d.prototype.offKeyPress=function(a,b){return this._keyPressCallbacks[a]["delete"](b),0===this._keyPressCallbacks[a].size&&delete this._keyPressCallbacks[a],this},d.prototype.onKeyRelease=function(b,c){return this._keyReleaseCallbacks[b]||(this._keyReleaseCallbacks[b]=new a.Utils.CallbackSet),this._keyReleaseCallbacks[b].add(c),this},d.prototype.offKeyRelease=function(a,b){return this._keyReleaseCallbacks[a]["delete"](b),0===this._keyReleaseCallbacks[a].size&&delete this._keyReleaseCallbacks[a],this},d}(a.Interaction);c.Key=d}(c=a.Interactions||(a.Interactions={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(){var b=this;c.apply(this,arguments),this._overComponent=!1,this._pointerEnterCallbacks=new a.Utils.CallbackSet,this._pointerMoveCallbacks=new a.Utils.CallbackSet,this._pointerExitCallbacks=new a.Utils.CallbackSet,this._mouseMoveCallback=function(a){return b._handlePointerEvent(a)},this._touchStartCallback=function(a,c){return b._handlePointerEvent(c[a[0]])}}return b(d,c),d.prototype._anchor=function(b){c.prototype._anchor.call(this,b),this._mouseDispatcher=a.Dispatchers.Mouse.getDispatcher(this._componentAttachedTo.content().node()),this._mouseDispatcher.onMouseMove(this._mouseMoveCallback),this._touchDispatcher=a.Dispatchers.Touch.getDispatcher(this._componentAttachedTo.content().node()),this._touchDispatcher.onTouchStart(this._touchStartCallback)},d.prototype._unanchor=function(){c.prototype._unanchor.call(this),this._mouseDispatcher.offMouseMove(this._mouseMoveCallback),this._mouseDispatcher=null,this._touchDispatcher.offTouchStart(this._touchStartCallback),this._touchDispatcher=null},d.prototype._handlePointerEvent=function(a){var b=this._translateToComponentSpace(a);if(this._isInsideComponent(b)){var c=this._overComponent;this._overComponent=!0,c||this._pointerEnterCallbacks.callCallbacks(b),this._pointerMoveCallbacks.callCallbacks(b)}else this._overComponent&&(this._overComponent=!1,this._pointerExitCallbacks.callCallbacks(b))},d.prototype.onPointerEnter=function(a){return this._pointerEnterCallbacks.add(a),this},d.prototype.offPointerEnter=function(a){return this._pointerEnterCallbacks["delete"](a),this},d.prototype.onPointerMove=function(a){return this._pointerMoveCallbacks.add(a),this},d.prototype.offPointerMove=function(a){return this._pointerMoveCallbacks["delete"](a),this},d.prototype.onPointerExit=function(a){return this._pointerExitCallbacks.add(a),this},d.prototype.offPointerExit=function(a){return this._pointerExitCallbacks["delete"](a),this},d}(a.Interaction);c.Pointer=d}(c=a.Interactions||(a.Interactions={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(d){function e(b,e){var f=this;d.call(this),this._wheelCallback=function(a,b){return f._handleWheelEvent(a,b)},this._touchStartCallback=function(a,b,c){return f._handleTouchStart(a,b,c)},this._touchMoveCallback=function(a,b,c){return f._handlePinch(a,b,c)},this._touchEndCallback=function(a,b,c){return f._handleTouchEnd(a,b,c)},this._touchCancelCallback=function(a,b,c){return f._handleTouchEnd(a,b,c)},this._xScales=new a.Utils.Set,this._yScales=new a.Utils.Set,this._dragInteraction=new c.Drag,this._setupDragInteraction(),this._touchIds=d3.map(),this._minDomainExtents=new a.Utils.Map,this._maxDomainExtents=new a.Utils.Map,null!=b&&this.addXScale(b),null!=e&&this.addYScale(e)}return b(e,d),e.prototype._anchor=function(b){d.prototype._anchor.call(this,b),this._dragInteraction.attachTo(b),this._mouseDispatcher=a.Dispatchers.Mouse.getDispatcher(this._componentAttachedTo.content().node()),this._mouseDispatcher.onWheel(this._wheelCallback),this._touchDispatcher=a.Dispatchers.Touch.getDispatcher(this._componentAttachedTo.content().node()),this._touchDispatcher.onTouchStart(this._touchStartCallback),this._touchDispatcher.onTouchMove(this._touchMoveCallback),this._touchDispatcher.onTouchEnd(this._touchEndCallback),this._touchDispatcher.onTouchCancel(this._touchCancelCallback)},e.prototype._unanchor=function(){d.prototype._unanchor.call(this),this._mouseDispatcher.offWheel(this._wheelCallback),this._mouseDispatcher=null,this._touchDispatcher.offTouchStart(this._touchStartCallback),this._touchDispatcher.offTouchMove(this._touchMoveCallback),this._touchDispatcher.offTouchEnd(this._touchEndCallback),this._touchDispatcher.offTouchCancel(this._touchCancelCallback),this._touchDispatcher=null,this._dragInteraction.detachFrom(this._componentAttachedTo)},e.prototype._handleTouchStart=function(a,b){for(var c=0;c<a.length&&this._touchIds.size()<2;c++){var d=a[c];this._touchIds.set(d.toString(),this._translateToComponentSpace(b[d]))}},e.prototype._handlePinch=function(a,b){var c=this;if(!(this._touchIds.size()<2)){var d=this._touchIds.values();if(this._isInsideComponent(this._translateToComponentSpace(d[0]))&&this._isInsideComponent(this._translateToComponentSpace(d[1]))){var f=e._pointDistance(d[0],d[1]);if(0!==f){a.forEach(function(a){c._touchIds.has(a.toString())&&c._touchIds.set(a.toString(),c._translateToComponentSpace(b[a]))});var g=this._touchIds.values(),h=e._pointDistance(g[0],g[1]);if(0!==h){var i=f/h,j=g.map(function(a,b){return{x:(a.x-d[b].x)/i,y:(a.y-d[b].y)/i}});this.xScales().forEach(function(a){i=c._constrainedZoomAmount(a,i)}),this.yScales().forEach(function(a){i=c._constrainedZoomAmount(a,i)});var k=d.map(function(a,b){return{x:j[b].x*i+a.x,y:j[b].y*i+a.y}}),l=e._centerPoint(d[0],d[1]),m=l.x-(k[0].x+k[1].x)/2;this.xScales().forEach(function(a){c._magnifyScale(a,i,l.x),c._translateScale(a,m)});var n=l.y-(k[0].y+k[1].y)/2;this.yScales().forEach(function(a){c._magnifyScale(a,i,l.y),c._translateScale(a,n)})}}}}},e._centerPoint=function(a,b){var c=Math.min(a.x,b.x),d=Math.max(a.x,b.x),e=Math.min(a.y,b.y),f=Math.max(a.y,b.y);return{x:(c+d)/2,y:(f+e)/2}},e._pointDistance=function(a,b){var c=Math.min(a.x,b.x),d=Math.max(a.x,b.x),e=Math.min(a.y,b.y),f=Math.max(a.y,b.y);return Math.sqrt(Math.pow(d-c,2)+Math.pow(f-e,2))},e.prototype._handleTouchEnd=function(a){var b=this;a.forEach(function(a){b._touchIds.remove(a.toString())})},e.prototype._magnifyScale=function(a,b,c){var d=function(d){return a.invert(c-(c-d)*b)};a.domain(a.range().map(d))},e.prototype._translateScale=function(a,b){var c=function(c){return a.invert(c+b)};a.domain(a.range().map(c))},e.prototype._handleWheelEvent=function(a,b){var c=this,d=this._translateToComponentSpace(a);if(this._isInsideComponent(d)){b.preventDefault();var f=b.deltaY*(b.deltaMode?e._PIXELS_PER_LINE:1),g=Math.pow(2,.002*f);this.xScales().forEach(function(a){g=c._constrainedZoomAmount(a,g)}),this.yScales().forEach(function(a){g=c._constrainedZoomAmount(a,g)}),this.xScales().forEach(function(a){c._magnifyScale(a,g,d.x)}),this.yScales().forEach(function(a){c._magnifyScale(a,g,d.y)})}},e.prototype._constrainedZoomAmount=function(a,b){var c=b>1,d=c?this.maxDomainExtent(a):this.minDomainExtent(a);if(null==d)return b;var e=a.domain(),f=Math.abs(e[1]-e[0]),g=c?Math.min:Math.max;return g(b,d/f)},e.prototype._setupDragInteraction=function(){var a=this;this._dragInteraction.constrainedToComponent(!1);var b;this._dragInteraction.onDragStart(function(){return b=null}),this._dragInteraction.onDrag(function(c,d){if(!(a._touchIds.size()>=2)){var e=(null==b?c.x:b.x)-d.x;a.xScales().forEach(function(b){a._translateScale(b,e)});var f=(null==b?c.y:b.y)-d.y;a.yScales().forEach(function(b){a._translateScale(b,f)}),b=d}})},e.prototype._nonLinearScaleWithExtents=function(b){return!(null==this.minDomainExtent(b)||null==this.maxDomainExtent(b)||b instanceof a.Scales.Linear||b instanceof a.Scales.Time)},e.prototype.xScales=function(b){var c=this;if(null==b){var d=[];return this._xScales.forEach(function(a){d.push(a)}),d}return this._xScales=new a.Utils.Set,b.forEach(function(a){c.addXScale(a)}),this},e.prototype.yScales=function(b){var c=this;if(null==b){var d=[];return this._yScales.forEach(function(a){d.push(a)}),d}return this._yScales=new a.Utils.Set,b.forEach(function(a){c.addYScale(a)}),this},e.prototype.addXScale=function(a){return this._xScales.add(a),this},e.prototype.removeXScale=function(a){return this._xScales["delete"](a),this._minDomainExtents["delete"](a),this._maxDomainExtents["delete"](a),this},e.prototype.addYScale=function(a){return this._yScales.add(a),this},e.prototype.removeYScale=function(a){return this._yScales["delete"](a),this._minDomainExtents["delete"](a),this._maxDomainExtents["delete"](a),this},e.prototype.minDomainExtent=function(b,c){if(null==c)return this._minDomainExtents.get(b);if(c.valueOf()<0)throw new Error("extent must be non-negative");var d=this.maxDomainExtent(b);if(null!=d&&d.valueOf()<c.valueOf())throw new Error("minDomainExtent must be smaller than maxDomainExtent for the same Scale");return this._nonLinearScaleWithExtents(b)&&a.Utils.Window.warn("Panning and zooming with extents on a nonlinear scale may have unintended behavior."),this._minDomainExtents.set(b,c),this},e.prototype.maxDomainExtent=function(b,c){if(null==c)return this._maxDomainExtents.get(b);if(c.valueOf()<=0)throw new Error("extent must be positive");var d=this.minDomainExtent(b);if(null!=d&&c.valueOf()<d.valueOf())throw new Error("maxDomainExtent must be larger than minDomainExtent for the same Scale");return this._nonLinearScaleWithExtents(b)&&a.Utils.Window.warn("Panning and zooming with extents on a nonlinear scale may have unintended behavior."),this._maxDomainExtents.set(b,c),this},e._PIXELS_PER_LINE=120,e}(a.Interaction);c.PanZoom=d}(c=a.Interactions||(a.Interactions={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(){var b=this;c.apply(this,arguments),this._dragging=!1,this._constrainedToComponent=!0,this._dragStartCallbacks=new a.Utils.CallbackSet,this._dragCallbacks=new a.Utils.CallbackSet,this._dragEndCallbacks=new a.Utils.CallbackSet,this._mouseDownCallback=function(a,c){return b._startDrag(a,c)},this._mouseMoveCallback=function(a,c){return b._doDrag(a,c)},this._mouseUpCallback=function(a,c){return b._endDrag(a,c)},this._touchStartCallback=function(a,c,d){return b._startDrag(c[a[0]],d)},this._touchMoveCallback=function(a,c,d){return b._doDrag(c[a[0]],d)},this._touchEndCallback=function(a,c,d){return b._endDrag(c[a[0]],d)}}return b(d,c),d.prototype._anchor=function(b){c.prototype._anchor.call(this,b),this._mouseDispatcher=a.Dispatchers.Mouse.getDispatcher(this._componentAttachedTo.content().node()),this._mouseDispatcher.onMouseDown(this._mouseDownCallback),this._mouseDispatcher.onMouseMove(this._mouseMoveCallback),this._mouseDispatcher.onMouseUp(this._mouseUpCallback),this._touchDispatcher=a.Dispatchers.Touch.getDispatcher(this._componentAttachedTo.content().node()),this._touchDispatcher.onTouchStart(this._touchStartCallback),this._touchDispatcher.onTouchMove(this._touchMoveCallback),this._touchDispatcher.onTouchEnd(this._touchEndCallback)},d.prototype._unanchor=function(){c.prototype._unanchor.call(this),this._mouseDispatcher.offMouseDown(this._mouseDownCallback),this._mouseDispatcher.offMouseMove(this._mouseMoveCallback),this._mouseDispatcher.offMouseUp(this._mouseUpCallback),this._mouseDispatcher=null,this._touchDispatcher.offTouchStart(this._touchStartCallback),this._touchDispatcher.offTouchMove(this._touchMoveCallback),this._touchDispatcher.offTouchEnd(this._touchEndCallback),this._touchDispatcher=null},d.prototype._translateAndConstrain=function(b){var c=this._translateToComponentSpace(b);return this._constrainedToComponent?{x:a.Utils.Math.clamp(c.x,0,this._componentAttachedTo.width()),y:a.Utils.Math.clamp(c.y,0,this._componentAttachedTo.height())}:c},d.prototype._startDrag=function(a,b){if(!(b instanceof MouseEvent&&0!==b.button)){var c=this._translateToComponentSpace(a);this._isInsideComponent(c)&&(b.preventDefault(),this._dragging=!0,this._dragOrigin=c,this._dragStartCallbacks.callCallbacks(this._dragOrigin))}},d.prototype._doDrag=function(a){this._dragging&&this._dragCallbacks.callCallbacks(this._dragOrigin,this._translateAndConstrain(a))},d.prototype._endDrag=function(a,b){b instanceof MouseEvent&&0!==b.button||this._dragging&&(this._dragging=!1,this._dragEndCallbacks.callCallbacks(this._dragOrigin,this._translateAndConstrain(a)))},d.prototype.constrainedToComponent=function(a){return null==a?this._constrainedToComponent:(this._constrainedToComponent=a,this)},d.prototype.onDragStart=function(a){return this._dragStartCallbacks.add(a),this},d.prototype.offDragStart=function(a){return this._dragStartCallbacks["delete"](a),this},d.prototype.onDrag=function(a){return this._dragCallbacks.add(a),this},d.prototype.offDrag=function(a){return this._dragCallbacks["delete"](a),this},d.prototype.onDragEnd=function(a){return this._dragEndCallbacks.add(a),this},d.prototype.offDragEnd=function(a){return this._dragEndCallbacks["delete"](a),this},d}(a.Interaction);c.Drag=d}(c=a.Interactions||(a.Interactions={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(){c.call(this),this._detectionRadius=3,this._resizable=!1,this._movable=!1,this._hasCorners=!0,this._clipPathEnabled=!0,this.addClass("drag-box-layer"),this._dragInteraction=new a.Interactions.Drag,this._setUpCallbacks(),this._dragInteraction.attachTo(this),this._dragStartCallbacks=new a.Utils.CallbackSet,this._dragCallbacks=new a.Utils.CallbackSet,this._dragEndCallbacks=new a.Utils.CallbackSet}return b(d,c),d.prototype._setUpCallbacks=function(){var a,b,c,d,e=this,f={newBox:0,resize:1,move:2},g=f.newBox;this._dragInteraction.onDragStart(function(h){a=e._getResizingEdges(h);var i=e.bounds(),j=i.topLeft.x<=h.x&&h.x<=i.bottomRight.x&&i.topLeft.y<=h.y&&h.y<=i.bottomRight.y;e.boxVisible()&&(a.top||a.bottom||a.left||a.right)?g=f.resize:e.boxVisible()&&e.movable()&&j?g=f.move:(g=f.newBox,e.bounds({topLeft:h,bottomRight:h})),e.boxVisible(!0),i=e.bounds(),b={x:i.topLeft.x,y:i.topLeft.y},c={x:i.bottomRight.x,y:i.bottomRight.y},d=h,e._dragStartCallbacks.callCallbacks(i)}),this._dragInteraction.onDrag(function(h,i){switch(g){case f.newBox:c.x=i.x,c.y=i.y;break;case f.resize:a.bottom?c.y=i.y:a.top&&(b.y=i.y),a.right?c.x=i.x:a.left&&(b.x=i.x);break;case f.move:var j=i.x-d.x,k=i.y-d.y;b.x+=j,b.y+=k,c.x+=j,c.y+=k,d=i}e.bounds({topLeft:b,bottomRight:c}),e._dragCallbacks.callCallbacks(e.bounds())}),this._dragInteraction.onDragEnd(function(a,b){g===f.newBox&&a.x===b.x&&a.y===b.y&&e.boxVisible(!1),e._dragEndCallbacks.callCallbacks(e.bounds())})},d.prototype._setup=function(){var a=this;c.prototype._setup.call(this);var b=function(){return a._box.append("line").style({opacity:0,stroke:"pink"})};if(this._detectionEdgeT=b().classed("drag-edge-tb",!0),this._detectionEdgeB=b().classed("drag-edge-tb",!0),this._detectionEdgeL=b().classed("drag-edge-lr",!0),this._detectionEdgeR=b().classed("drag-edge-lr",!0),this._hasCorners){var d=function(){return a._box.append("circle").style({opacity:0,fill:"pink"})};this._detectionCornerTL=d().classed("drag-corner-tl",!0),this._detectionCornerTR=d().classed("drag-corner-tr",!0),this._detectionCornerBL=d().classed("drag-corner-bl",!0),this._detectionCornerBR=d().classed("drag-corner-br",!0)}},d.prototype._getResizingEdges=function(a){var b={top:!1,bottom:!1,left:!1,right:!1};if(!this.resizable())return b;var c=this.bounds(),d=c.topLeft.y,e=c.bottomRight.y,f=c.topLeft.x,g=c.bottomRight.x,h=this._detectionRadius;return f-h<=a.x&&a.x<=g+h&&(b.top=d-h<=a.y&&a.y<=d+h,b.bottom=e-h<=a.y&&a.y<=e+h),d-h<=a.y&&a.y<=e+h&&(b.left=f-h<=a.x&&a.x<=f+h,b.right=g-h<=a.x&&a.x<=g+h),b},d.prototype.renderImmediately=function(){if(c.prototype.renderImmediately.call(this),this.boxVisible()){var a=this.bounds(),b=a.topLeft.y,d=a.bottomRight.y,e=a.topLeft.x,f=a.bottomRight.x;return this._detectionEdgeT.attr({x1:e,y1:b,x2:f,y2:b,"stroke-width":2*this._detectionRadius}),this._detectionEdgeB.attr({x1:e,y1:d,x2:f,y2:d,"stroke-width":2*this._detectionRadius}),this._detectionEdgeL.attr({x1:e,y1:b,x2:e,y2:d,"stroke-width":2*this._detectionRadius}),this._detectionEdgeR.attr({x1:f,y1:b,x2:f,y2:d,"stroke-width":2*this._detectionRadius}),this._hasCorners&&(this._detectionCornerTL.attr({cx:e,cy:b,r:this._detectionRadius}),this._detectionCornerTR.attr({cx:f,cy:b,r:this._detectionRadius}),this._detectionCornerBL.attr({cx:e,cy:d,r:this._detectionRadius}),this._detectionCornerBR.attr({cx:f,cy:d,r:this._detectionRadius})),this}},d.prototype.detectionRadius=function(a){if(null==a)return this._detectionRadius;if(0>a)throw new Error("detection radius cannot be negative.");return this._detectionRadius=a,this.render(),this},d.prototype.resizable=function(a){return null==a?this._resizable:(this._resizable=a,this._setResizableClasses(a),this)},d.prototype._setResizableClasses=function(a){a?(this.addClass("x-resizable"),this.addClass("y-resizable")):(this.removeClass("x-resizable"),this.removeClass("y-resizable"))},d.prototype.movable=function(a){return null==a?this._movable:(this._movable=a,a?this.addClass("movable"):this.removeClass("movable"),this)},d.prototype.onDragStart=function(a){return this._dragStartCallbacks.add(a),this},d.prototype.offDragStart=function(a){return this._dragStartCallbacks["delete"](a),this},d.prototype.onDrag=function(a){return this._dragCallbacks.add(a),this},d.prototype.offDrag=function(a){return this._dragCallbacks["delete"](a),this},d.prototype.onDragEnd=function(a){return this._dragEndCallbacks.add(a),this},d.prototype.offDragEnd=function(a){return this._dragEndCallbacks["delete"](a),this},d.prototype.dragInteraction=function(){return this._dragInteraction},d.prototype.enabled=function(a){return null==a?this._dragInteraction.enabled():(this._dragInteraction.enabled(a),this)
},d}(c.SelectionBoxLayer);c.DragBoxLayer=d}(c=a.Components||(a.Components={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(a){var c=function(a){function c(){a.call(this),this.addClass("x-drag-box-layer"),this._hasCorners=!1}return b(c,a),c.prototype.computeLayout=function(b,c,d){return a.prototype.computeLayout.call(this,b,c,d),this.bounds(this.bounds()),this},c.prototype._setBounds=function(b){a.prototype._setBounds.call(this,{topLeft:{x:b.topLeft.x,y:0},bottomRight:{x:b.bottomRight.x,y:this.height()}})},c.prototype._setResizableClasses=function(a){a?this.addClass("x-resizable"):this.removeClass("x-resizable")},c.prototype.yScale=function(a){if(null==a)throw new Error("XDragBoxLayer has no yScale");throw new Error("yScales cannot be set on an XDragBoxLayer")},c.prototype.yExtent=function(){throw new Error("XDragBoxLayer has no yExtent")},c}(a.DragBoxLayer);a.XDragBoxLayer=c}(c=a.Components||(a.Components={}))}(a||(a={}));var a,b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(a){var c=function(a){function c(){a.call(this),this.addClass("y-drag-box-layer"),this._hasCorners=!1}return b(c,a),c.prototype.computeLayout=function(b,c,d){return a.prototype.computeLayout.call(this,b,c,d),this.bounds(this.bounds()),this},c.prototype._setBounds=function(b){a.prototype._setBounds.call(this,{topLeft:{x:0,y:b.topLeft.y},bottomRight:{x:this.width(),y:b.bottomRight.y}})},c.prototype._setResizableClasses=function(a){a?this.addClass("y-resizable"):this.removeClass("y-resizable")},c.prototype.xScale=function(a){if(null==a)throw new Error("YDragBoxLayer has no xScale");throw new Error("xScales cannot be set on an YDragBoxLayer")},c.prototype.xExtent=function(){throw new Error("YDragBoxLayer has no xExtent")},c}(a.DragBoxLayer);a.YDragBoxLayer=c}(c=a.Components||(a.Components={}))}(a||(a={}));var c;!function(a){var b;!function(a){var b;!function(a){function b(a,b){if(null==a||null==b)return a===b;if(a.length!==b.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!==b[c])return!1;return!0}function c(a,c){if(null==a||null==c)return a===c;var d=Object.keys(a).sort(),e=Object.keys(c).sort(),f=d.map(function(b){return a[b]}),g=e.map(function(a){return c[a]});return b(d,e)&&b(f,g)}a.arrayEq=b,a.objEq=c}(b=a.Methods||(a.Methods={}))}(b=a.Utils||(a.Utils={}))}(c||(c={}));var c;!function(a){var b;!function(a){var b;!function(a){function b(a,b,c){var d=d3.transform(a.attr("transform"));return null==b?d.translate:(c=null==c?0:c,d.translate[0]=b,d.translate[1]=c,a.attr("transform",d.toString()),a)}function c(a){var b;try{b=a.node().getBBox()}catch(c){b={x:0,y:0,width:0,height:0}}return b}a.transform=b,a.getBBox=c}(b=a.DOM||(a.DOM={}))}(b=a.Utils||(a.Utils={}))}(c||(c={}));var c;!function(a){var b;!function(a){var b=function(){function a(a,b){void 0===b&&(b=function(a,b){return a===b}),this.cache=d3.map(),this.compute=a,this.valueEq=b}return a.prototype.get=function(a){return this.cache.has(a)||this.cache.set(a,this.compute(a)),this.cache.get(a)},a.prototype.clear=function(){return this.cache=d3.map(),this},a}();a.Cache=b}(b=a.Utils||(a.Utils={}))}(c||(c={}));var c;!function(a){var b;!function(a){var b=function(){function a(){this.WordDividerRegExp=new RegExp("\\W"),this.WhitespaceRegExp=new RegExp("\\s")}return a.prototype.tokenize=function(a){var b=this;return a.split("").reduce(function(a,c){return a.slice(0,-1).concat(b.shouldCreateNewToken(a[a.length-1],c))},[""])},a.prototype.shouldCreateNewToken=function(a,b){if(!a)return[b];var c=a[a.length-1];return this.WhitespaceRegExp.test(c)&&this.WhitespaceRegExp.test(b)?[a+b]:this.WhitespaceRegExp.test(c)||this.WhitespaceRegExp.test(b)?[a,b]:this.WordDividerRegExp.test(c)||this.WordDividerRegExp.test(b)?c===b?[a+b]:[a,b]:[a+b]},a}();a.Tokenizer=b}(b=a.Utils||(a.Utils={}))}(c||(c={}));var c;!function(a){var b;!function(a){var b;!function(a){function b(a){return a.replace(/\s+/g," ")}function c(a){return a&&""!==a.trim()}function d(a,b){if(!a)return a;var d=a.split(""),e=b?function(a){return a.split(b).some(c)}:c;return d.reduce(function(a,b){return e(a+b)?a+b:a},"")}function e(a,b){if(!a)return a;var c=a.split("");return c.reverse(),c=d(c.join(""),b).split(""),c.reverse(),c.join("")}a.combineWhitespace=b,a.isNotEmptyString=c,a.trimStart=d,a.trimEnd=e}(b=a.StringMethods||(a.StringMethods={}))}(b=a.Utils||(a.Utils={}))}(c||(c={}));var c;!function(a){var b;!function(a){var b=function(){function a(){this.duration(a.DEFAULT_DURATION_MILLISECONDS),this.delay(0),this.easing(a.DEFAULT_EASING),this.moveX(0),this.moveY(0)}return a.prototype.animate=function(a){var b=d3.transform("");return b.translate=[this.moveX(),this.moveY()],a.attr("transform",b.toString()),b.translate=[0,0],this._animate(a,{transform:b.toString()})},a.prototype._animate=function(a,b){return a.transition().ease(this.easing()).duration(this.duration()).delay(this.delay()).attr(b)},a.prototype.duration=function(a){return null==a?this._duration:(this._duration=a,this)},a.prototype.moveX=function(a){return null==a?this._moveX:(this._moveX=a,this)},a.prototype.moveY=function(a){return null==a?this._moveY:(this._moveY=a,this)},a.prototype.delay=function(a){return null==a?this._delay:(this._delay=a,this)},a.prototype.easing=function(a){return null==a?this._easing:(this._easing=a,this)},a.DEFAULT_DURATION_MILLISECONDS=300,a.DEFAULT_EASING="exp-out",a}();a.BaseAnimator=b}(b=a.Animators||(a.Animators={}))}(c||(c={}));var c,b=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(c){var d=function(c){function d(){this.direction("bottom"),c.call(this)}return b(d,c),d.prototype.direction=function(a){if(null==a)return this._direction;if(-1===d.SupportedDirections.indexOf(a))throw new Error("unsupported direction - "+a);return this._direction=a,this},d.prototype.animate=function(b){var d=a.Utils.DOM.getBBox(b),e=b.select(".clip-rect");switch(e.attr("width",0),e.attr("height",0),this._direction){case"top":e.attr("y",d.y+d.height),e.attr("x",d.x),e.attr("width",d.width);break;case"bottom":e.attr("y",d.y),e.attr("x",d.x),e.attr("width",d.width);break;case"left":e.attr("y",d.y),e.attr("x",d.x),e.attr("height",d.height);break;case"right":e.attr("y",d.y),e.attr("x",d.x+d.width),e.attr("height",d.height)}return this._animate(e,d),c.prototype.animate.call(this,b)},d.SupportedDirections=["top","bottom","left","right"],d}(c.BaseAnimator);c.UnveilAnimator=d}(c=a.Animators||(a.Animators={}))}(c||(c={}));var c,b=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(a){var c=function(a){function c(){a.apply(this,arguments)}return b(c,a),c.prototype.animate=function(b){var c=b.select(".text-area");c.attr("opacity",0);var d={opacity:1};return this._animate(c,d),a.prototype.animate.call(this,b)},c}(a.BaseAnimator);a.OpacityAnimator=c}(c=a.Animators||(a.Animators={}))}(c||(c={}));var c;!function(a){var b;!function(b){var c=function(){function b(){this.maxLines(1/0),this.textTrimming("ellipsis"),this.allowBreakingWords(!0),this._tokenizer=new a.Utils.Tokenizer,this._breakingCharacter="-"}return b.prototype.maxLines=function(a){return null==a?this._maxLines:(this._maxLines=a,this)},b.prototype.textTrimming=function(a){if(null==a)return this._textTrimming;if("ellipsis"!==a&&"none"!==a)throw new Error(a+" - unsupported text trimming option.");return this._textTrimming=a,this},b.prototype.allowBreakingWords=function(a){return null==a?this._allowBreakingWords:(this._allowBreakingWords=a,this)},b.prototype.wrap=function(a,b,c,d){var e=this;void 0===d&&(d=1/0);var f={originalText:a,wrappedText:"",noLines:0,noBrokeWords:0,truncatedText:""},g={wrapping:f,currentLine:"",availableWidth:c,availableLines:Math.min(Math.floor(d/b.measure().height),this._maxLines),canFitText:!0},h=a.split("\n");return h.reduce(function(a,c,d){return e.breakLineToFitWidth(a,c,d!==h.length-1,b)},g).wrapping},b.prototype.breakLineToFitWidth=function(b,c,d,e){var f=this;b.canFitText||""===b.wrapping.truncatedText||(b.wrapping.truncatedText+="\n");var g=this._tokenizer.tokenize(c);b=g.reduce(function(a,b){return f.wrapNextToken(b,a,e)},b);var h=a.Utils.StringMethods.trimEnd(b.currentLine);if(b.wrapping.noLines+=+(""!==h),b.wrapping.noLines===b.availableLines&&"none"!==this._textTrimming&&d){var i=this.addEllipsis(h,b.availableWidth,e);b.wrapping.wrappedText+=i.wrappedToken,b.wrapping.truncatedText+=i.remainingToken,b.canFitText=!1}else b.wrapping.wrappedText+=h;return b.currentLine="\n",b},b.prototype.canFitToken=function(a,b,c){var d=this,e=this._allowBreakingWords?a.split("").map(function(b,c){return c!==a.length-1?b+d._breakingCharacter:b}):[a];return c.measure(a).width<=b||e.every(function(a){return c.measure(a).width<=b})},b.prototype.addEllipsis=function(b,c,d){if("none"===this._textTrimming)return{wrappedToken:b,remainingToken:""};var e=b.substring(0).trim(),f=d.measure(e).width,g=d.measure("...").width,h=b.length>0&&"\n"===b[0]?"\n":"";if(g>=c){var i=g/3,j=Math.floor(c/i);return{wrappedToken:h+"...".substr(0,j),remainingToken:b}}for(;f+g>c;)e=a.Utils.StringMethods.trimEnd(e.substr(0,e.length-1)),f=d.measure(e).width;return{wrappedToken:h+e+"...",remainingToken:a.Utils.StringMethods.trimEnd(b.substring(e.length),"-").trim()}},b.prototype.wrapNextToken=function(b,c,d){if(!c.canFitText||c.availableLines===c.wrapping.noLines||!this.canFitToken(b,c.availableWidth,d))return this.finishWrapping(b,c,d);for(var e=b;e;){var f=this.breakTokenToFitInWidth(e,c.currentLine,c.availableWidth,d);if(c.currentLine=f.line,e=f.remainingToken,null!=e){if(c.wrapping.noBrokeWords+=+f.breakWord,++c.wrapping.noLines,c.availableLines===c.wrapping.noLines){var g=this.addEllipsis(c.currentLine,c.availableWidth,d);return c.wrapping.wrappedText+=g.wrappedToken,c.wrapping.truncatedText+=g.remainingToken+e,c.currentLine="\n",c}c.wrapping.wrappedText+=a.Utils.StringMethods.trimEnd(c.currentLine),c.currentLine="\n"}}return c},b.prototype.finishWrapping=function(a,b,c){if(b.canFitText&&b.availableLines!==b.wrapping.noLines&&this._allowBreakingWords&&"none"!==this._textTrimming){var d=this.addEllipsis(b.currentLine+a,b.availableWidth,c);b.wrapping.wrappedText+=d.wrappedToken,b.wrapping.truncatedText+=d.remainingToken,b.wrapping.noBrokeWords+=+(d.remainingToken.length<a.length),b.wrapping.noLines+=+(d.wrappedToken.length>0),b.currentLine=""}else b.wrapping.truncatedText+=a;return b.canFitText=!1,b},b.prototype.breakTokenToFitInWidth=function(a,b,c,d,e){if(void 0===e&&(e=this._breakingCharacter),d.measure(b+a).width<=c)return{remainingToken:null,line:b+a,breakWord:!1};if(""===a.trim())return{remainingToken:"",line:b,breakWord:!1};if(!this._allowBreakingWords)return{remainingToken:a,line:b,breakWord:!1};for(var f=0;f<a.length&&d.measure(b+a.substring(0,f+1)+e).width<=c;)++f;var g="";return f>0&&(g=e),{remainingToken:a.substring(f),line:b+a.substring(0,f)+g,breakWord:f>0}},b}();b.Wrapper=c}(b=a.Wrappers||(a.Wrappers={}))}(c||(c={}));var c,b=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(a){var c=function(a){function c(){a.apply(this,arguments)}return b(c,a),c.prototype.wrap=function(b,d,e,f){var g=this;void 0===f&&(f=1/0);var h=b.split("\n");if(h.length>1)throw new Error("SingleLineWrapper is designed to work only on single line");var i=function(c){return a.prototype.wrap.call(g,b,d,c,f)},j=i(e);if(j.noLines<2)return j;for(var k=0,l=e,m=0;m<c.NO_WRAP_ITERATIONS&&l>k;++m){var n=(l+k)/2,o=i(n);this.areSameResults(j,o)?(l=n,j=o):k=n}return j},c.prototype.areSameResults=function(a,b){return a.noLines===b.noLines&&a.truncatedText===b.truncatedText},c.NO_WRAP_ITERATIONS=5,c}(a.Wrapper);a.SingleLineWrapper=c}(c=a.Wrappers||(a.Wrappers={}))}(c||(c={}));var c;!function(a){var b;!function(b){var c=function(){function b(a,c){this._writerID=b.nextID++,this._elementID=0,this.measurer(a),c&&this.wrapper(c),this.addTitleElement(!1)}return b.prototype.measurer=function(a){return this._measurer=a,this},b.prototype.wrapper=function(a){return this._wrapper=a,this},b.prototype.addTitleElement=function(a){return this._addTitleElement=a,this},b.prototype.writeLine=function(c,d,e,f,g){var h=d.append("text");h.text(c);var i=e*b.XOffsetFactor[f],j=b.AnchorConverter[f];h.attr("text-anchor",j).classed("text-line",!0),a.Utils.DOM.transform(h,i,g).attr("y","-0.25em")},b.prototype.writeText=function(a,c,d,e,f,g){var h=this,i=a.split("\n"),j=this._measurer.measure().height,k=b.YOffsetFactor[g]*(e-i.length*j);i.forEach(function(a,b){h.writeLine(a,c,d,f,(b+1)*j+k)})},b.prototype.write=function(a,c,d,e){if(-1===b.SupportedRotation.indexOf(e.textRotation))throw new Error("unsupported rotation - "+e.textRotation);var f=Math.abs(Math.abs(e.textRotation)-90)>45,g=f?c:d,h=f?d:c,i=e.selection.append("g").classed("text-container",!0);this._addTitleElement&&i.append("title").text(a);var j=i.append("g").classed("text-area",!0),k=this._wrapper?this._wrapper.wrap(a,this._measurer,g,h).wrappedText:a;this.writeText(k,j,g,h,e.xAlign,e.yAlign);var l=d3.transform(""),m=d3.transform("");switch(l.rotate=e.textRotation,e.textRotation){case 90:l.translate=[c,0],m.rotate=-90,m.translate=[0,200];break;case-90:l.translate=[0,d],m.rotate=90,m.translate=[c,0];break;case 180:l.translate=[c,d],m.translate=[c,d],m.rotate=180}j.attr("transform",l.toString()),this.addClipPath(i,m),e.animator&&e.animator.animate(i)},b.prototype.addClipPath=function(b){var c=this._elementID++,d=/MSIE [5-9]/.test(navigator.userAgent)?"":document.location.href;d=d.split("#")[0];var e="clipPath"+this._writerID+"_"+c;b.select(".text-area").attr("clip-path",'url("'+d+"#"+e+'")');var f=b.append("clipPath").attr("id",e),g=a.Utils.DOM.getBBox(b.select(".text-area")),h=f.append("rect");h.classed("clip-rect",!0).attr({x:g.x,y:g.y,width:g.width,height:g.height})},b.nextID=0,b.SupportedRotation=[-90,0,180,90],b.AnchorConverter={left:"start",center:"middle",right:"end"},b.XOffsetFactor={left:0,center:.5,right:1},b.YOffsetFactor={top:0,center:.5,bottom:1},b}();b.Writer=c}(b=a.Writers||(a.Writers={}))}(c||(c={}));var c;!function(a){var b;!function(b){var c=function(){function b(a,b){this.textMeasurer=this.getTextMeasurer(a,b)}return b.prototype.checkSelectionIsText=function(a){return"text"===a[0][0].tagName||!a.select("text").empty()},b.prototype.getTextMeasurer=function(a,b){var c=this;if(this.checkSelectionIsText(a)){var d,e=a.node().parentNode;return d="text"===a[0][0].tagName?a:a.select("text"),a.remove(),function(b){e.appendChild(a.node());var f=c.measureBBox(d,b);return a.remove(),f}}var f=a.append("text");return b&&f.classed(b,!0),f.remove(),function(b){a.node().appendChild(f.node());var d=c.measureBBox(f,b);return f.remove(),d}},b.prototype.measureBBox=function(b,c){b.text(c);var d=a.Utils.DOM.getBBox(b);return{width:d.width,height:d.height}},b.prototype.measure=function(a){return void 0===a&&(a=b.HEIGHT_TEXT),this.textMeasurer(a)},b.HEIGHT_TEXT="bqpdl",b}();b.AbstractMeasurer=c}(b=a.Measurers||(a.Measurers={}))}(c||(c={}));var c,b=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(a){var c=function(c){function d(a,b,d){void 0===b&&(b=null),void 0===d&&(d=!1),c.call(this,a,b),this.useGuards=d}return b(d,c),d.prototype._addGuards=function(b){return a.AbstractMeasurer.HEIGHT_TEXT+b+a.AbstractMeasurer.HEIGHT_TEXT},d.prototype.getGuardWidth=function(){return null==this.guardWidth&&(this.guardWidth=c.prototype.measure.call(this).width),this.guardWidth},d.prototype._measureLine=function(a){var b=this.useGuards?this._addGuards(a):a,d=c.prototype.measure.call(this,b);return d.width-=this.useGuards?2*this.getGuardWidth():0,d},d.prototype.measure=function(b){var c=this;if(void 0===b&&(b=a.AbstractMeasurer.HEIGHT_TEXT),""===b.trim())return{width:0,height:0};var d=b.trim().split("\n").map(function(a){return c._measureLine(a)});return{width:d3.max(d,function(a){return a.width}),height:d3.sum(d,function(a){return a.height})}},d}(a.AbstractMeasurer);a.Measurer=c}(c=a.Measurers||(a.Measurers={}))}(c||(c={}));var c,b=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};!function(a){var c;!function(a){var c=function(a){function c(){a.apply(this,arguments)}return b(c,a),c.prototype._measureCharacter=function(b){return a.prototype._measureLine.call(this,b)},c.prototype._measureLine=function(a){var b=this,c=a.split("").map(function(a){return b._measureCharacter(a)});return{width:d3.sum(c,function(a){return a.width}),height:d3.max(c,function(a){return a.height})}},c}(a.Measurer);a.CharacterMeasurer=c}(c=a.Measurers||(a.Measurers={}))}(c||(c={}));var c,b=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};return function(a){var c;!function(c){var d=function(c){function d(b,d){var e=this;c.call(this,b,d),this.cache=new a.Utils.Cache(function(a){return e._measureCharacterNotFromCache(a)},a.Utils.Methods.objEq)}return b(d,c),d.prototype._measureCharacterNotFromCache=function(a){return c.prototype._measureCharacter.call(this,a)},d.prototype._measureCharacter=function(a){return this.cache.get(a)},d.prototype.reset=function(){this.cache.clear()},d}(c.CharacterMeasurer);c.CacheCharacterMeasurer=d}(c=a.Measurers||(a.Measurers={}))}(c||(c={})),a});