!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-array"),require("d3-scale"),require("d3-time"),require("d3-random"),require("d3-fetch"),require("d3-path"),require("d3-selection"),require("d3-shape"),require("d3-dispatch"),require("d3-brush")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-scale","d3-time","d3-random","d3-fetch","d3-path","d3-selection","d3-shape","d3-dispatch","d3-brush"],n):n(t.fc=t.fc||{},t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3)}(this,function(t,n,e,r,i,o,u,a,c,l,f){"use strict";function h(t){return t}function s(t){}function d(t){return"function"==typeof t?t:function(){return t}}function g(t){return"number"==typeof t&&isNaN(t)?void 0:t}function v(t,n){var e=[],r=!0,i=!1,o=void 0;try{for(var u,a=t[Symbol.iterator]();!(r=(u=a.next()).done);r=!0){var c=u.value,l=n.clampUp(c);l===n.clampDown(c)&&e.push(l)}}catch(t){i=!0,o=t}finally{try{!r&&a.return&&a.return()}finally{if(i)throw o}}return e}function m(t){var n=this;arguments.length||(t=e.scaleIdentity());var r=X(),i=function(n){var e=t.domain(),i=t.range(),o=r.distance(e[0],e[1]);return r.distance(e[0],n)/o*(i[1]-i[0])+i[0]};return i.invert=function(n){var e=t.domain(),i=t.range(),o=(n-i[0])/(i[1]-i[0]),u=r.distance(e[0],e[1]),a=o*u;return r.offset(e[0],a)},i.domain=function(){if(!arguments.length)return t.domain();var n=arguments.length<=0?void 0:arguments[0],e=r.clampUp(n[0]),o=r.clampDown(n[1]);return t.domain([e,o]),i},i.nice=function(){t.nice();var n=t.domain(),e=r.clampUp(n[0]),o=r.clampDown(n[1]);return t.domain([e,o]),i},i.ticks=function(){for(var e=arguments.length,i=Array(e),o=0;o2?e-2:0),i=2;i2?e-2:0),i=2;i=o&&(u.shift(),u.push(e(t,i))),i=t&&(i=n.mean(e)),i}},i=function(n){var i=e.apply(this,arguments),o=2/(i+1),u=r(i),a=void 0;return n.map(function(n,e){var r=t(n,e);return a=void 0===a?u(r):r*o+(1-o)*a,g(a)})};return i.period=function(){return arguments.length?(e=d(arguments.length<=0?void 0:arguments[0]),i):e},i.value=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],i):t},i},C=function(){var t=h,e=I().period(12),r=I().period(26),i=I().period(9),o=function(o){e.value(t),r.value(t);var u=n.zip(e(o),r(o)).map(function(t){return void 0!==t[0]&&void 0!==t[1]?t[0]-t[1]:void 0}),a=i(u);return n.zip(u,a).map(function(t){return{macd:t[0],signal:t[1],divergence:void 0!==t[0]&&void 0!==t[1]?t[0]-t[1]:void 0}})};return o.value=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],o):t},_(o,e,z({period:"fastPeriod"})),_(o,r,z({period:"slowPeriod"})),_(o,i,z({period:"signalPeriod"})),o},V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},L=function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")},R=function(){function t(t,n){for(var e=0;er?0:r-e},o=function(t,r){return void 0!==r?e(t,r):n.mean(t)},u=function(){var t=void 0,e=void 0,u=void 0;return function(a){if(!a)return void(void 0!==t&&(t=NaN));if(void 0===t)return void(t=a[0]);var c=n.pairs([t].concat(Q(a)));return e=o(c.map(r),e),u=o(c.map(i),u),g(100-100/(1+(isNaN(t)?NaN:u/e)))}},a=function(n){var e=u();return t.accumulator(e),t(n)};return S(a,t,"period","value"),a},U=function(){var t=O().accumulator(function(t){return t&&n.mean(t)}),e=function(n){return t(n)};return S(e,t,"period","value"),e},G=function(){var t=function(t,n){return t.close},e=function(t,n){return t.high},r=function(t,n){return t.low},i=O().period(5).defined(function(n){return null!=t(n)&&null!=e(n)&&null!=r(n)}).accumulator(function(i){var o=i&&n.max(i,e),u=i&&n.min(i,r);return g(i&&100*(t(i[i.length-1])-u)/(o-u))}),o=U().period(3),u=function(t){var n=i(t),e=o(n);return n.map(function(t,n){return{k:t,d:e[n]}})};return u.closeValue=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],u):t},u.highValue=function(){return arguments.length?(e=arguments.length<=0?void 0:arguments[0],u):e},u.lowValue=function(){return arguments.length?(r=arguments.length<=0?void 0:arguments[0],u):r},_(u,i,z({period:"kPeriod"})),_(u,o,z({period:"dPeriod"})),u},H=function(){var t=function(t,n){return t.volume},n=function(t,n){return t.close},e=I().period(13),r=O().period(2).defined(function(e){return null!=n(e)&&null!=t(e)}).accumulator(function(e){return e&&g((n(e[1])-n(e[0]))*t(e[1]))}),i=function(t){var n=r(t);return e(n)};return i.volumeValue=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],i):t},i.closeValue=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],i):n},S(i,e,"period"),i},Y=function(){var t=.1,n=h,e=function(e){return e.map(function(e){return{lower:g(n(e)*(1-t)),upper:g(n(e)*(1+t))}})};return e.factor=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],e):t},e.value=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],e):n},e},W=function(){var t=function(t,n){return t.close},e=function(t,n){return t.high},r=function(t,n){return t.low},i=I().period(13),o=function(o){return i.value(t),n.zip(o,i(o)).map(function(t){return{bullPower:g(e(t[0])-t[1]),bearPower:g(r(t[0])-t[1])}})};return o.closeValue=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],o):t},o.highValue=function(){return arguments.length?(e=arguments.length<=0?void 0:arguments[0],o):e},o.lowValue=function(){return arguments.length?(r=arguments.length<=0?void 0:arguments[0],o):r},S(o,i,"period"),o},X=function(){var t={};return t.distance=function(t,n){return n-t},t.offset=function(t,n){return t instanceof Date?new Date(t.getTime()+n):t+n},t.clampUp=function(t){return t},t.clampDown=function(t){return t},t.copy=function(){return t},t},K=function(){var t={sunday:0,monday:1,saturday:6},n={},e=function(t){return 0===t.getDay()||6===t.getDay()};return n.clampDown=function(n){if(n&&e(n)){var i=r.timeDay.ceil(n);return i.getDay()===t.sunday?r.timeDay.offset(i,-1):i.getDay()===t.monday?r.timeDay.offset(i,-2):i}return n},n.clampUp=function(n){if(n&&e(n)){var i=r.timeDay.floor(n);return i.getDay()===t.saturday?r.timeDay.offset(i,2):i.getDay()===t.sunday?r.timeDay.offset(i,1):i}return n},n.distance=function(t,e){t=n.clampUp(t),e=n.clampDown(e);var i=r.timeSaturday.ceil(t);if(e0,c=i,l=u?r.timeMonday.floor(o):r.timeSaturday.ceil(o);if(c-=l.getTime()-o.getTime(),u&&c>0||a&&c<0)return new Date(o.getTime()+i);o=u?l:r.timeDay.offset(l,2);var f=Math.floor(c/432e6);return o=r.timeDay.offset(o,7*f),c-=432e6*f,o=new Date(o.getTime()+c)},n.copy=function(){return n},n},J=function(){for(var t=arguments.length,n=Array(t),e=0;en[0]&&t=n[0]&&t[1]<=n[1]},o={};o.distance=function(t,e){t=o.clampUp(t),e=o.clampDown(e);var r=n.filter(function(n){return i(n,[t,e])}),u=r.map(function(t){return t[1]-t[0]});return e-t-u.reduce(function(t,n){return t+n},0)};var u=function(t,n){return t instanceof Date?new Date(t.getTime()+n):t+n};return o.offset=function(t,e){if(e>0){var r=function(){for(var r=o.clampUp(t),i=e;i>0;){var a=n.filter(function(t){return t[0]>r}).sort(function(t,n){return t[0]-n[0]});if(a.length){var c=a[0],l=c[0]-r;l>i?(r=u(r,i),i=0):(r=c[1],i-=l)}else r=u(r,i),i=0}return{v:r}}();if("object"===(void 0===r?"undefined":V(r)))return r.v}else{var i=function(){for(var r=o.clampDown(t),i=e;i<0;){var a=n.filter(function(t){return t[1]0&&void 0!==arguments[0]?arguments[0]:0,u=t/n,a=[],c=0;c=r.length)return r;var i=t(r),o=e(i),u=e(r.slice(1,r.length-1)),a=u.map(function(t,e){var r=o[e],i=n.max(r);return t[r.indexOf(i)]});return[].concat([r[0]],a,[r[r.length-1]])};return S(o,e,"bucketSize"),o.x=function(t){return arguments.length?(r=t,o):r},o.y=function(t){return arguments.length?(i=t,o):i},o},ut=function(){var t=function(t){return t},e=function(t){return t},r=it(),i=function(i){if(r.bucketSize()>=i.length)return i;var o=r(i.slice(1,i.length-1)),u=i[0],a=i[i.length-1],c=[].concat([u],o,[a]),l=t(u),f=e(u),h=o.map(function(r,i){var o=n.mean(c[i+1],t),u=n.mean(c[i+1],e),a=r.map(function(n){return[t(n),e(n)]}),h=a.map(function(t){return.5*Math.abs((l-o)*(t[1]-f)-(l-t[0])*(u-f))}),s=h.indexOf(n.max(h)),d=a[s];return l=d[0],f=d[1],r[s]});return[].concat([i[0]],h,[i[i.length-1]])};return S(i,r,"bucketSize"),i.x=function(n){return arguments.length?(t=n,i):t},i.y=function(t){return arguments.length?(e=t,i):e},i},at=function(){var t=it(),e=function(t){return t},r=function(r){if(t.bucketSize()>r.length)return r;var i=n.extent(r,e),o=t(r.slice(1,r.length-1)),u=o.map(function(t,n){var r,o,u={},a=!0,c=t.map(e),l=c.filter(function(t){return t===i[0]||t===i[1]}).map(function(t){return c.indexOf(t)})[0];return void 0!==l?t[l]:(c.forEach(function(t,n){void 0===u[t]&&(u[t]=0),u[t]++,u[t]>u[r]||void 0===r?(r=t,o=n,a=!0):u[t]===u[r]&&(a=!1)}),a?t[o]:t[Math.floor(t.length/2)])});return[].concat([r[0]],u,[r[r.length-1]])};return S(r,t,"bucketSize"),r.value=function(t){return arguments.length?(e=t,r):e},r},ct=function(t){return"function"==typeof t?t:function(){return t}},lt=function(){var t=null,n=function(t){return t.date},e=function(t){return t.open},r=function(t){return t.high},i=function(t){return t.low},o=function(t){return t.close},a="vertical",c=ct(3),l=function(l){var f=t||u.path();return l.forEach(function(t,u){var l=n(t,u),h=e(t,u),s=r(t,u),d=i(t,u),g=o(t,u),v=c(t,u)/2;"vertical"===a?(f.moveTo(l,d),f.lineTo(l,s),f.moveTo(l,h),f.lineTo(l-v,h),f.moveTo(l,g),f.lineTo(l+v,g)):(f.moveTo(d,l),f.lineTo(s,l),f.moveTo(h,l),f.lineTo(h,l+v),f.moveTo(g,l),f.lineTo(g,l-v))}),t?null:f.toString()};return l.context=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],l):t},l.x=function(){return arguments.length?(n=ct(arguments.length<=0?void 0:arguments[0]),l):n},l.open=function(){return arguments.length?(e=ct(arguments.length<=0?void 0:arguments[0]),l):e},l.high=function(){return arguments.length?(r=ct(arguments.length<=0?void 0:arguments[0]),l):r},l.low=function(){return arguments.length?(i=ct(arguments.length<=0?void 0:arguments[0]),l):i},l.close=function(){return arguments.length?(o=ct(arguments.length<=0?void 0:arguments[0]),l):o},l.width=function(){return arguments.length?(c=ct(arguments.length<=0?void 0:arguments[0]),l):c},l.orient=function(){return arguments.length?(a=arguments.length<=0?void 0:arguments[0],l):a},l},ft=function(){var t=null,n=function(t){return t.x},e=function(t){return t.y},r="center",i="center",o=function(t){return t.height},a=ct(3),c=function(c,l){var f=t||u.path();return c.forEach(function(t,u){var c=n.call(this,t,l||u),h=e.call(this,t,l||u),s=o.call(this,t,l||u),d=a.call(this,t,l||u),g=void 0;switch(r){case"left":g=d;break;case"right":g=0;break;case"center":g=d/2;break;default:throw new Error("Invalid horizontal alignment "+r)}var v=void 0;switch(i){case"bottom":v=-s;break;case"top":v=0;break;case"center":v=s/2;break;default:throw new Error("Invalid vertical alignment "+i)}f.rect(c-g,h-v,d,s)},this),t?null:f.toString()};return c.context=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],c):t},c.x=function(){return arguments.length?(n=ct(arguments.length<=0?void 0:arguments[0]),c):n},c.y=function(){return arguments.length?(e=ct(arguments.length<=0?void 0:arguments[0]),c):e},c.width=function(){return arguments.length?(a=ct(arguments.length<=0?void 0:arguments[0]),c):a},c.horizontalAlign=function(){return arguments.length?(r=arguments.length<=0?void 0:arguments[0],c):r},c.height=function(){return arguments.length?(o=ct(arguments.length<=0?void 0:arguments[0]),c):o},c.verticalAlign=function(){return arguments.length?(i=arguments.length<=0?void 0:arguments[0],c):i},c},ht=function(){var t=null,n=function(t){return t.date},e=function(t){return t.open},r=function(t){return t.high},i=function(t){return t.low},o=function(t){return t.close},a=ct(3),c=function(c){var l=t||u.path();return c.forEach(function(t,u){var c=n(t,u),f=e(t,u),h=r(t,u),s=i(t,u),d=o(t,u),g=a(t,u),v=g/2;l.rect(c-v,f,g,d-f),l.moveTo(c,Math.min(d,f)),l.lineTo(c,h),l.moveTo(c,Math.max(d,f)),l.lineTo(c,s)}),t?null:l.toString()};return c.context=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],c):t},c.x=function(){return arguments.length?(n=ct(arguments.length<=0?void 0:arguments[0]),c):n},c.open=function(){return arguments.length?(e=ct(arguments.length<=0?void 0:arguments[0]),c):e},c.high=function(){return arguments.length?(r=ct(arguments.length<=0?void 0:arguments[0]),c):r},c.low=function(){return arguments.length?(i=ct(arguments.length<=0?void 0:arguments[0]),c):i},c.close=function(){return arguments.length?(o=ct(arguments.length<=0?void 0:arguments[0]),c):o},c.width=function(){return arguments.length?(a=ct(arguments.length<=0?void 0:arguments[0]),c):a},c},st=function(){var t=null,n=function(t){return t.value},e=function(t){return t.median},r=function(t){return t.upperQuartile},i=function(t){return t.lowerQuartile},o=function(t){return t.high},a=function(t){return t.low},c="vertical",l=ct(5),f=ct(.5),h=function(h){var s=t||u.path();return h.forEach(function(t,u){var h=n(t,u),d=l(t,u),g=d/2,v=d*f(t,u),m=v/2,p=o(t,u),y=r(t,u),x=e(t,u),w=i(t,u),b=a(t,u),S=w-y;"vertical"===c?(s.moveTo(h-m,p),s.lineTo(h+m,p),s.moveTo(h,p),s.lineTo(h,y),s.rect(h-g,y,d,S),s.moveTo(h-g,x),s.lineTo(h+g,x),s.moveTo(h,w),s.lineTo(h,b),s.moveTo(h-m,b),s.lineTo(h+m,b)):(s.moveTo(b,h-m),s.lineTo(b,h+m),s.moveTo(b,h),s.lineTo(w,h),s.rect(w,h-g,-S,d),s.moveTo(x,h-g),s.lineTo(x,h+g),s.moveTo(y,h),s.lineTo(p,h),s.moveTo(p,h-m),s.lineTo(p,h+m))}),t?null:s.toString()};return h.context=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],h):t},h.value=function(){return arguments.length?(n=ct(arguments.length<=0?void 0:arguments[0]),h):n},h.median=function(){return arguments.length?(e=ct(arguments.length<=0?void 0:arguments[0]),h):e},h.upperQuartile=function(){return arguments.length?(r=ct(arguments.length<=0?void 0:arguments[0]),h):r},h.lowerQuartile=function(){return arguments.length?(i=ct(arguments.length<=0?void 0:arguments[0]),h):i},h.high=function(){return arguments.length?(o=ct(arguments.length<=0?void 0:arguments[0]),h):o},h.low=function(){return arguments.length?(a=ct(arguments.length<=0?void 0:arguments[0]),h):a},h.width=function(){return arguments.length?(l=ct(arguments.length<=0?void 0:arguments[0]),h):l},h.orient=function(){return arguments.length?(c=arguments.length<=0?void 0:arguments[0],h):c},h.cap=function(){return arguments.length?(f=ct(arguments.length<=0?void 0:arguments[0]),h):f},h},dt=function(){var t=null,n=function(t){return t.x},e=function(t){return t.high},r=function(t){return t.low},i="vertical",o=ct(5),a=function(a){var c=t||u.path();return a.forEach(function(t,u){var a=n(t,u),l=o(t,u),f=l/2,h=e(t,u),s=r(t,u);"vertical"===i?(c.moveTo(a-f,h),c.lineTo(a+f,h),c.moveTo(a,h),c.lineTo(a,s),c.moveTo(a-f,s),c.lineTo(a+f,s)):(c.moveTo(s,a-f),c.lineTo(s,a+f),c.moveTo(s,a),c.lineTo(h,a),c.moveTo(h,a-f),c.lineTo(h,a+f))}),t?null:c.toString()};return a.context=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],a):t},a.value=function(){return arguments.length?(n=ct(arguments.length<=0?void 0:arguments[0]),a):n},a.high=function(){return arguments.length?(e=ct(arguments.length<=0?void 0:arguments[0]),a):e},a.low=function(){return arguments.length?(r=ct(arguments.length<=0?void 0:arguments[0]),a):r},a.width=function(){return arguments.length?(o=ct(arguments.length<=0?void 0:arguments[0]),a):o},a.orient=function(){return arguments.length?(i=arguments.length<=0?void 0:arguments[0],a):i},a},gt=function(t){return"function"==typeof t?t:function(){return t}},vt=function(t,n){t=t||"g";var e=function(t,n){return n},r=null,i=function(i,o){o=o||function(t){return t};var u=i.selection?i:null;u&&(i=i.selection());var a=i.selectAll(function(t,n,e){return Array.from(e[n].childNodes).filter(function(t){return 1===t.nodeType})}).filter(null==n?t:t+"."+n),c=a.data(o,e),l=c.enter().append(t).attr("class",n),f=c.exit();c=c.merge(l);var h=u||r;return h&&(c=c.transition(h).style("opacity",1),l.style("opacity",1e-6),f=f.transition(h).style("opacity",1e-6)),f.remove(),c.enter=function(){return l},c.exit=function(){return f},c};return i.element=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],i):t},i.className=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],i):n},i.key=function(){return arguments.length?(e=arguments.length<=0?void 0:arguments[0],i):e},i.transition=function(){return arguments.length?(r=arguments.length<=0?void 0:arguments[0],i):r},i},mt=function(t){var n=function(){},r=function(){return[0,0]},i=function(t,n){return[t.x,t.y]},o=t||function(t){return t},u=function(){},c=e.scaleIdentity(),l=e.scaleIdentity(),f=vt("g","label"),h=function(t){t.each(function(t,e,h){var s=f(a.select(h[e]),t).call(u),d=s.nodes(),g=d.map(function(t,n){var e=a.select(t).datum(),o=i(e,n,d),u=[c(o[0]),l(o[1])],f=r(e,n,d);return{hidden:!1,x:u[0],y:u[1],width:f[0],height:f[1]}}),v=o(g);s.attr("style",function(t,n){return"display:"+(v[n].hidden?"none":"inherit")}).attr("transform",function(t,n){return"translate("+v[n].x+", "+v[n].y+")"}).attr("layout-width",function(t,n){return v[n].width}).attr("layout-height",function(t,n){return v[n].height}).attr("anchor-x",function(t,n,e){return g[n].x-v[n].x}).attr("anchor-y",function(t,n,e){return g[n].y-v[n].y}),s.call(u),n(s,t,e)})};return _(h,f,T("key")),_(h,o),h.size=function(){return arguments.length?(r=gt(arguments.length<=0?void 0:arguments[0]),h):r},h.position=function(){return arguments.length?(i=gt(arguments.length<=0?void 0:arguments[0]),h):i},h.component=function(){return arguments.length?(u=arguments.length<=0?void 0:arguments[0],h):u},h.decorate=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],h):n},h.xScale=function(){return arguments.length?(c=arguments.length<=0?void 0:arguments[0],h):c},h.yScale=function(){return arguments.length?(l=arguments.length<=0?void 0:arguments[0],h):l},h},pt=function(t){var n=2,e=function(t){return t},r=vt("text"),i=vt("rect"),o=vt("circle"),u=function(t){t.each(function(t,u,c){var l=c[u],f=a.select(l),h=Number(l.getAttribute("layout-width")),s=Number(l.getAttribute("layout-height"));i(f,[t]).attr("width",h).attr("height",s);var d=Number(l.getAttribute("anchor-x")),g=Number(l.getAttribute("anchor-y"));o(f,[t]).attr("r",2).attr("cx",d).attr("cy",g);var v=r(f,[t]);v.enter().attr("dy","0.9em").attr("transform","translate("+n+", "+n+")"),v.text(e)})};return u.padding=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],u):n},u.value=function(){return arguments.length?(e=gt(arguments.length<=0?void 0:arguments[0]),u):e},u},yt=function(t,n){return!(t.x>=n.x+n.width||t.x+t.width<=n.x||t.y>=n.y+n.height||t.y+t.height<=n.y)},xt=function(t,n){if(yt(t,n)){var e=Math.max(t.x,n.x),r=Math.min(t.x+t.width,n.x+n.width),i=Math.max(t.y,n.y);return(r-e)*(Math.min(t.y+t.height,n.y+n.height)-i)}return 0},wt=function(t,e){return n.sum(t.map(function(n,r){return e===r?0:xt(t[e],n)}))},bt=function(t,n,e,r,i){return{x:t,y:n,width:e,height:r,location:i}},St=function(t){var n=t.x,e=t.y,r=t.width,i=t.height;return[bt(n,e,r,i,"bottom-right"),bt(n-r,e,r,i,"bottom-left"),bt(n-r,e-i,r,i,"top-left"),bt(n,e-i,r,i,"top-right"),bt(n,e-i/2,r,i,"middle-right"),bt(n-r/2,e,r,i,"bottom-center"),bt(n-r,e-i/2,r,i,"middle-left"),bt(n-r/2,e-i,r,i,"top-center")]},kt=function(t,n,e){return[].concat(Q(t.slice(0,n)),[e],Q(t.slice(n+1)))},_t=function(t,n){return tMath.random()},u=At().locationScore(o).winningScore(i).rectangles(e);r>0;){var a=zt(e);u=u(Tt(St(e[a])),a),r-=n}return u.rectangles()};return u.temperature=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],u):t},u.cooling=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],u):n},u.bounds=function(){return arguments.length?(e=arguments.length<=0?void 0:arguments[0],u):e},u},Pt=function(t,e){return t[n.scan(t,e)]},Ot=function(t){t=t||function(t){return t};var n=function(n){n=t(n);for(;;){if("break"===function(){var t=n.filter(function(t){return!t.hidden}),e=t.map(function(n,e){return[n,wt(t,e)]}),r=Pt(e,function(t,n){return n[1]-t[1]});if(!(r[1]>0))return"break";r[0].hidden=!0}())break}return n};return _(n,t),n},Mt=function(){var t=[0,0],n=function(n){return n.map(function(n,e){var r=n.x,i=n.y;return r+n.width>t[0]&&(r-=n.width),i+n.height>t[1]&&(i-=n.height),{height:n.height,width:n.width,x:r,y:i}})};return n.bounds=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],n):t},n},It=function(t){return"function"==typeof t?t:function(){return t}},Ct=function(t,n){switch(t){case"left":return n/2;case"right":return-n/2;default:return 0}},Vt=function(t){var n=Object.assign({},t),e=function(){};return Object.keys(n).forEach(function(t){e[t]=function(){return arguments.length?(n[t]=arguments.length<=0?void 0:arguments[0],e):n[t]}}),e},Lt=function(){var t=function(){return 0},n=function(t){return t.x},r=function(t){return t.y},i="center",o=function(){return 5},u="vertical",a=Vt({decorate:function(){},defined:function(e,i){return y(t,n,r)(e,i)},xScale:e.scaleIdentity(),yScale:e.scaleIdentity()});return a.values=function(e,c){var l=o(e,c),f=Ct(i,l),h=a.xScale(),s=a.yScale();if("vertical"===u){var d=s(r(e,c),c),g=s(t(e,c),c),v=h(n(e,c),c)+f;return{d:e,x:v,y:d,y0:g,width:l,height:d-g,origin:[v,d],baseOrigin:[v,g],transposedX:v,transposedY:d}}var m=h(r(e,c),c),p=h(t(e,c),c),y=s(n(e,c),c)+f;return{d:e,x:y,y:m,y0:p,width:l,height:m-p,origin:[m,y],baseOrigin:[p,y],transposedX:m,transposedY:y}},a.baseValue=function(){return arguments.length?(t=It(arguments.length<=0?void 0:arguments[0]),a):t},a.crossValue=function(){return arguments.length?(n=It(arguments.length<=0?void 0:arguments[0]),a):n},a.mainValue=function(){return arguments.length?(r=It(arguments.length<=0?void 0:arguments[0]),a):r},a.bandwidth=function(){return arguments.length?(o=It(arguments.length<=0?void 0:arguments[0]),a):o},a.align=function(){return arguments.length?(i=arguments.length<=0?void 0:arguments[0],a):i},a.orient=function(){return arguments.length?(u=arguments.length<=0?void 0:arguments[0],a):u},a},Rt={red:"#c60",green:"#6c0",black:"#000",gray:"#ddd",darkGray:"#999"},Bt=function(){var t=Lt(),n=c.line().x(function(n,e){return t.values(n,e).transposedX}).y(function(n,e){return t.values(n,e).transposedY}),e=vt("path","line"),r=function(r){r.selection&&e.transition(r),n.defined(t.defined()),r.each(function(r,i,o){var u=e(a.select(o[i]),[r]);u.enter().attr("fill","none").attr("stroke",Rt.black),u.attr("d",n),t.decorate()(u,r,i)})};return _(r,t,E("baseValue","bandwidth","align")),S(r,e,"key"),S(r,n,"curve"),r},jt=function(){var t=Lt(),n=c.line().x(function(n,e){return t.values(n,e).transposedX}).y(function(n,e){return t.values(n,e).transposedY}),e=function(e){var r=n.context();r.beginPath(),n.defined(t.defined())(e),r.strokeStyle=Rt.black,r.fillStyle="transparent",t.decorate()(r,e),r.fill(),r.stroke(),r.closePath()};return _(e,t,E("baseValue","bandwidth","align")),S(e,n,"curve","context"),e},Nt=function(){var t=c.symbol(),n=Lt(),e=vt("g","point"),r=function(t){return"translate("+t[0]+", "+t[1]+")"},i=function(i){i.selection&&e.transition(i),i.each(function(i,o,u){var c=i.filter(n.defined()),l=e(a.select(u[o]),c);l.enter().attr("transform",function(t,e){return r(n.values(t,e).origin)}).attr("fill",Rt.gray).attr("stroke",Rt.black).append("path"),l.attr("transform",function(t,e){return r(n.values(t,e).origin)}).select("path").attr("d",t),n.decorate()(l,i,o)})};return _(i,n,E("baseValue","bandwidth","align")),S(i,e,"key"),S(i,t,"type","size"),i},qt=function(){var t=c.symbol(),n=Lt(),e=function(e){var r=e.filter(n.defined()),i=t.context();r.forEach(function(e,r){i.save();var o=n.values(e,r);i.translate(o.origin[0],o.origin[1]),i.beginPath(),t(e,r),i.strokeStyle=Rt.black,i.fillStyle=Rt.gray,n.decorate()(i,e,r),i.fill(),i.stroke(),i.closePath(),i.restore()})};return _(e,n,E("baseValue","bandwidth","align")),S(e,t,"size","type","context"),e},Qt=function(){var t=ft().x(0).y(0),n=Lt(),e=vt("g","bar"),r=function(t){return"vertical"===n.orient()?t.height:t.width},i=function(t){return"vertical"===n.orient()?t.width:t.height},o=function(t){return"translate("+t[0]+", "+t[1]+")"},u=function(u){u.selection&&e.transition(u),u.each(function(u,c,l){var f=n.orient();if("vertical"!==f&&"horizontal"!==f)throw new Error("The bar series does not support an orientation of "+f);var h=u.filter(n.defined()),s=h.map(n.values);t.width(0).height(0),"vertical"===n.orient()?(t.verticalAlign("top"),t.horizontalAlign("center")):(t.horizontalAlign("right"),t.verticalAlign("center"));var d=e(a.select(l[c]),h);d.enter().attr("transform",function(t,n){return o(s[n].baseOrigin)}).attr("class","bar "+n.orient()).attr("fill",Rt.darkGray).append("path").attr("d",function(n,e){return i(t)(s[e].width),t([n])}),d.attr("transform",function(t,n){return o(s[n].origin)}).select("path").attr("d",function(n,e){return i(t)(s[e].width),r(t)(-s[e].height),t([n])}),n.decorate()(d,h,c)})};return _(u,n),S(u,e,"key"),u},Ft=function(){var t=Lt(),n=ft().x(0).y(0),e=function(n){return"vertical"===t.orient()?n.height:n.width},r=function(n){return"vertical"===t.orient()?n.width:n.height},i=function(i){var o=n.context(),u=i.filter(t.defined()),a=u.map(t.values);"vertical"===t.orient()?(n.verticalAlign("top"),n.horizontalAlign("center")):(n.horizontalAlign("right"),n.verticalAlign("center")),a.forEach(function(i,u){o.save(),o.beginPath(),o.translate(i.origin[0],i.origin[1]),e(n)(-i.height),r(n)(i.width),n([i]),o.fillStyle=Rt.darkGray,o.strokeStyle="transparent",t.decorate()(o,i.d,u),o.fill(),o.stroke(),o.closePath(),o.restore()})};return _(i,t),S(i,n,"context"),i},Ut=function(){var t=function(t){return t.high},n=function(t){return t.low},r=function(t){return t.cross},i="vertical",o="center",u=function(){return 5},a=Vt({decorate:function(){},defined:function(e,i){return y(n,t,r)(e,i)},xScale:e.scaleIdentity(),yScale:e.scaleIdentity()});return a.values=function(e,c){var l=u(e,c),f=Ct(o,l),h=a.xScale(),s=a.yScale();if("vertical"===i){var d=s(t(e,c));return{origin:[h(r(e,c))+f,d],high:0,low:s(n(e,c))-d,width:l}}var g=h(n(e,c));return{origin:[g,s(r(e,c))+f],high:h(t(e,c))-g,low:0,width:l}},a.orient=function(){return arguments.length?(i=arguments.length<=0?void 0:arguments[0],a):i},a.lowValue=function(){return arguments.length?(n=It(arguments.length<=0?void 0:arguments[0]),a):n},a.highValue=function(){return arguments.length?(t=It(arguments.length<=0?void 0:arguments[0]),a):t},a.crossValue=function(){return arguments.length?(r=It(arguments.length<=0?void 0:arguments[0]),a):r},a.bandwidth=function(){return arguments.length?(u=It(arguments.length<=0?void 0:arguments[0]),a):u},a.align=function(){return arguments.length?(o=arguments.length<=0?void 0:arguments[0],a):o},a},Gt=function(){var t=Ut(),n=vt("g","error-bar"),e=dt().value(0),r=function(t){return function(n){return t.selection?n.transition(t):n}},i=function(t){return"translate("+t.origin[0]+", "+t.origin[1]+")"},o=function(o){o.selection&&n.transition(o);var u=r(o);o.each(function(r,o,c){var l=r.filter(t.defined()),f=l.map(t.values),h=n(a.select(c[o]),l);h.enter().attr("stroke",Rt.black).attr("fill",Rt.gray).attr("transform",function(n,e){return i(t.values(n,e))+" scale(1e-6, 1)"}).append("path"),e.orient(t.orient()),h.each(function(t,n,r){var o=f[n];e.high(o.high).low(o.low).width(o.width),u(a.select(r[n])).attr("transform",i(o)+" scale(1)").select("path").attr("d",e([t]))}),t.decorate()(h,r,o)})};return _(o,t),S(o,n,"key"),o},Ht=function(){var t=Ut(),n=dt().value(0),e=function(e){var r=e.filter(t.defined()),i=n.context();n.orient(t.orient()),r.forEach(function(e,r){i.save();var o=t.values(e,r);i.translate(o.origin[0],o.origin[1]),i.beginPath(),n.high(o.high).width(o.width).low(o.low)([e]),i.strokeStyle=Rt.black,i.fillStyle=Rt.gray,t.decorate()(i,e,r),i.fill(),i.stroke(),i.closePath(),i.restore()})};return _(e,t),S(e,n,"context"),e},Yt=function(){var t=Lt(),n=c.area(),e=vt("path","area"),r=function(r){r.selection&&e.transition(r),n.defined(t.defined()),r.each(function(r,i,o){var u=r.map(t.values);n.x(function(t,n){return u[n].transposedX}).y(function(t,n){return u[n].transposedY});var c="vertical"===t.orient()?"y":"x";n[c+"0"](function(t,n){return u[n].y0}),n[c+"1"](function(t,n){return u[n].y});var l=e(a.select(o[i]),[r]);l.enter().attr("fill",Rt.gray),l.attr("d",n),t.decorate()(l,r,i)})};return _(r,t,E("bandwidth","align")),S(r,e,"key"),S(r,n,"curve"),r},Wt=function(){var t=Lt(),n=c.area(),e=function(e){var r=n.context();n.defined(t.defined());var i=e.map(t.values);n.x(function(t,n){return i[n].transposedX}).y(function(t,n){return i[n].transposedY});var o="vertical"===t.orient()?"y":"x";n[o+"0"](function(t,n){return i[n].y0}),n[o+"1"](function(t,n){return i[n].y}),r.beginPath(),n(e),r.fillStyle=Rt.gray,r.strokeStyle="transparent",t.decorate()(r,e),r.fill(),r.stroke(),r.closePath()};return _(e,t,E("bandwidth","align")),S(e,n,"curve","context"),e},Xt=function(){var t=void 0,n=function(t){return t.date},r=function(t){return t.open},i=function(t){return t.high},o=function(t){return t.low},u=function(t){return t.close},a=function(){return 5},c="center",l=function(e,r){return t.xScale()(n(e,r))};return t=Vt({decorate:function(){},defined:function(t,e){return y(n,r,o,i,u)(t,e)},xScale:e.scaleIdentity(),yScale:e.scaleIdentity()}),t.values=function(n,e){var f=u(n,e),h=r(n,e),s=a(n,e),d=Ct(c,s),g="";return f>h?g="up":f2&&void 0!==arguments[2]?arguments[2]:{},r=[10],i=null,o=function(){},u=null,l=6,f=6,h=3,s=c.line(),d=vt("g","tick").key(Pn),g=vt("path","domain"),v=function(){return{offset:[0,f+h]}},m=function(){return{path:[[0,0],[0,f]]}},p=e.labelOffset||v,y=e.tickPath||m,x=function(t,n){var e=0;return t.bandwidth&&(e=t.bandwidth()/2,t.round()&&(e=Math.round(e))),function(r){return n(t(r)+e,0)}},w=function(t,n){return S()?"translate("+n+", "+t+")":"translate("+t+", "+n+")"},b=function(t){return S()?t.map(function(t){return[t[1],t[0]]}):t},S=function(){return"left"===t||"right"===t},k=function(t,e,r){return n[t]?n[t].apply(n,e):r},_=function(e){e.selection&&(d.transition(e),g.transition(e)),e.each(function(e,c,f){var h=f[c],v=a.select(h);h.__scale__||v.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor","right"===t?"start":"left"===t?"end":"middle");var m=h.__scale__||n;h.__scale__=n.copy();var _=null==i?k("ticks",r,n.domain()):i,A=null==u?k("tickFormat",r,Pn):u,E="bottom"===t||"right"===t?1:-1,T=function(t){var n=N(t,2),e=n[0],r=n[1];return[e,E*r]},z=n.range(),D=b([[z[0],E*l],[z[0],0],[z[1],0],[z[1],E*l]]);g(v,[e]).attr("d",s(D)).attr("stroke","#000");var P=d(v,_),O=_.map(function(t,n){return p(t,n,_)}),M=_.map(function(t,n){return y(t,n,_)});P.enter().attr("transform",x(m,w)).append("path").attr("stroke","#000"),P.enter().append("text").attr("transform",function(t,n){return w.apply(void 0,Q(T(O[n].offset)))}).attr("fill","#000"),P.exit().attr("transform",x(n,w)),P.select("path").attr("visibility",function(t,n){return M[n].hidden&&"hidden"}).attr("d",function(t,n){return s(b(M[n].path.map(T)))}),P.select("text").attr("visibility",function(t,n){return O[n].hidden&&"hidden"}).attr("transform",function(t,n){return w.apply(void 0,Q(T(O[n].offset)))}).attr("dy",function(){var n="0em";return S()?n="0.32em":"bottom"===t&&(n="0.71em"),n}).text(A),P.attr("transform",x(n,w)),o(P,e,c)})};return _.tickFormat=function(){return arguments.length?(u=arguments.length<=0?void 0:arguments[0],_):u},_.tickSize=function(){return arguments.length?(f=l=Number(arguments.length<=0?void 0:arguments[0]),_):f},_.tickSizeInner=function(){return arguments.length?(f=Number(arguments.length<=0?void 0:arguments[0]),_):f},_.tickSizeOuter=function(){return arguments.length?(l=Number(arguments.length<=0?void 0:arguments[0]),_):l},_.tickPadding=function(){return arguments.length?(h=arguments.length<=0?void 0:arguments[0],_):h},_.decorate=function(){return arguments.length?(o=arguments.length<=0?void 0:arguments[0],_):o},_.scale=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],_):n},_.ticks=function(){for(var t=arguments.length,n=Array(t),e=0;e-1)&&!n.some(function(n){return re(t,n)})){var e=n.filter(function(n){return!re(n,t)});e.push(t),ne(t,e)}};if(Object.setPrototypeOf(x.prototype,HTMLElement.prototype),Object.setPrototypeOf(x,HTMLElement),"function"!=typeof HTMLElement)throw new Error("d3fc-element depends on Custom Elements (v1). Make sure that you load a polyfill in older browsers. See README.");var oe=function(t){null==t.__measureListener__&&(t.__measureListener__=function(n){return t.setMeasurements(n.detail)},t.addEventListener("measure",t.__measureListener__))},ue=function(t){null!=t.__measureListener__&&(t.removeEventListener("measure",t.__measureListener__),t.__measureListener__=null)},ae=function(t,n){return function(e){function r(){return L(this,r),j(this,(r.__proto__||Object.getPrototypeOf(r)).apply(this,arguments))}return B(r,e),R(r,[{key:"attributeChangedCallback",value:function(t){switch(t){case"use-device-pixel-ratio":this.requestRedraw()}}},{key:"connectedCallback",value:function(){0===this.childNodes.length&&this.appendChild(t()),oe(this)}},{key:"disconnectedCallback",value:function(){ue(this)}},{key:"setMeasurements",value:function(t){var e=t.width,r=t.height,i=q(this.childNodes),o=i[0];if(i.slice(1).length>0)throw new Error("A d3fc-svg/canvas element must only contain a single svg/canvas element.");n(o,{width:e,height:r})}},{key:"requestRedraw",value:function(){ie(this)}},{key:"useDevicePixelRatio",get:function(){return this.hasAttribute("use-device-pixel-ratio")&&"false"!==this.getAttribute("use-device-pixel-ratio")},set:function(t){t&&!this.useDevicePixelRatio?this.setAttribute("use-device-pixel-ratio",""):!t&&this.useDevicePixelRatio&&this.removeAttribute("use-device-pixel-ratio"),this.requestRedraw()}}],[{key:"observedAttributes",get:function(){return["use-device-pixel-ratio"]}}]),r}(x)},ce=ae(function(){return document.createElement("canvas")},function(t,n){var e=n.width,r=n.height;t.setAttribute("width",e),t.setAttribute("height",r)});Object.setPrototypeOf(w.prototype,HTMLElement.prototype),Object.setPrototypeOf(w,HTMLElement);var le=function(t){t.autoResize?fe(t):he(t)},fe=function(t){null==t.__autoResizeListener__&&(t.__autoResizeListener__=function(){return ie(t)},addEventListener("resize",t.__autoResizeListener__))},he=function(t){null!=t.__autoResizeListener__&&(removeEventListener("resize",t.__autoResizeListener__),t.__autoResizeListener__=null)},se=function(t){function n(){return L(this,n),j(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return B(n,t),R(n,[{key:"connectedCallback",value:function(){le(this)}},{key:"disconnectedCallback",value:function(){he(this)}},{key:"requestRedraw",value:function(){ie(this)}},{key:"attributeChangedCallback",value:function(t){switch(t){case"auto-resize":le(this)}}},{key:"autoResize",get:function(){return this.hasAttribute("auto-resize")&&"false"!==this.getAttribute("auto-resize")},set:function(t){t&&!this.autoResize?this.setAttribute("auto-resize",""):!t&&this.autoResize&&this.removeAttribute("auto-resize"),le(this)}}],[{key:"observedAttributes",get:function(){return["auto-resize"]}}]),n}(w),de=ae(function(){return document.createElementNS("http://www.w3.org/2000/svg","svg")},function(t,n){var e=n.width,r=n.height;t.setAttribute("viewBox","0 0 "+e+" "+r)}),ge="d3fc-canvas,d3fc-svg{position:relative;display:block}d3fc-canvas>canvas,d3fc-svg>svg{position:absolute;height:100%;width:100%}d3fc-svg>svg{overflow:visible}",ve=document.createElement("style");if(ve.setAttribute("type","text/css"),document.querySelector("head").appendChild(ve),ve.styleSheet?ve.styleSheet.cssText+=ge:ve.textContent+=ge,"object"!==("undefined"==typeof customElements?"undefined":V(customElements))||"function"!=typeof customElements.define)throw new Error("d3fc-element depends on Custom Elements (v1). Make sure that you load a polyfill in older browsers. See README.");customElements.define("d3fc-canvas",ce),customElements.define("d3fc-group",se),customElements.define("d3fc-svg",de);var me=function(){function t(){var t=a.mouse(this);e.call("point",this,[{x:t[0],y:t[1]}])}function n(){e.call("point",this,[])}var e=l.dispatch("point"),r=function(e){e.on("mouseenter.pointer",t).on("mousemove.pointer",t).on("mouseleave.pointer",n)};return S(r,e,"on"),r},pe=function(){var t="",n="vertical",e=function(t,n){return Number(t[n])},r=function(n){return Object.keys(n[0]).filter(function(n){return n!==t}).map(function(r){var i=n.filter(function(t){return t[r]}).map(function(n){var i=[n[t],e(n,r)];return i.data=n,i});return i.key=r,i})},i=function(n){return n.map(function(n){var r=Object.keys(n).filter(function(n){return n!==t}).map(function(t){var r=[t,e(n,t)];return r.data=n,r});return r.key=n[t],r})},o=function(t){return"vertical"===n?r(t):i(t)};return o.key=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],o):t},o.value=function(){return arguments.length?(e=arguments.length<=0?void 0:arguments[0],o):e},o.orient=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],o):n},o},ye=function(){for(var t=arguments.length,n=Array(t),e=0;e'),T(_,[g(t)]).attr("class",function(t){return"x-label "+t+"-label"}).text(l(t)),z(_,[d(t)]).attr("class",function(t){return"y-label "+t+"-label"}).text(f(t)),k(_,[g(t)]).attr("class",function(t){return"x-axis "+t+"-axis"}).style("height",h(t)).on("measure",function(t,n,e){var r=a.event.detail,o=r.width,u=r.height;"top"===t&&a.select(e[n]).select("svg").attr("viewBox","0 "+-u+" "+o+" "+u),i.range([0,o])}).on("draw",function(t,e,r){var o="top"===t?u.top(i):u.bottom(i);o.decorate(y),n(a.select(r[e])).select("svg").call(p(o))}),A(_,[d(t)]).attr("class",function(t){return"y-axis "+t+"-axis"}).style("width",s(t)).on("measure",function(t,n,e){var r=a.event.detail,i=r.width,u=r.height;"left"===t&&a.select(e[n]).select("svg").attr("viewBox",-i+" 0 "+i+" "+u),o.range([u,0])}).on("draw",function(t,e,r){var i="left"===t?c.left(o):c.right(o);i.decorate(w),n(a.select(r[e])).select("svg").call(x(i))}),_.select("d3fc-canvas.plot-area").on("draw",function(t,n,e){var r=a.select(e[n]).select("canvas").node();v.context(r.getContext("2d")).xScale(i).yScale(o),v(t)}),_.select("d3fc-svg.plot-area").on("draw",function(t,e,r){m.xScale(i).yScale(o),n(a.select(r[e])).select("svg").call(m)}),_.each(function(t,n,e){return e[n].requestRedraw()}),b(_,t,e)})},M=E(/range\w*/,/tickFormat/);return _(O,i,M,P("x")),_(O,o,M,P("y")),_(O,p,P("x")),_(O,x,P("y")),O.xOrient=function(){return arguments.length?(g=be(arguments.length<=0?void 0:arguments[0]),O):g},O.yOrient=function(){return arguments.length?(d=be(arguments.length<=0?void 0:arguments[0]),O):d},O.xDecorate=function(){return arguments.length?(y=arguments.length<=0?void 0:arguments[0],O):y},O.yDecorate=function(){return arguments.length?(w=arguments.length<=0?void 0:arguments[0],O):w},O.xLabel=function(){return arguments.length?(l=be(arguments.length<=0?void 0:arguments[0]),O):l},O.yLabel=function(){return arguments.length?(f=be(arguments.length<=0?void 0:arguments[0]),O):f},O.xAxisHeight=function(){return arguments.length?(h=be(arguments.length<=0?void 0:arguments[0]),O):h},O.yAxisWidth=function(){return arguments.length?(s=be(arguments.length<=0?void 0:arguments[0]),O):s},O.canvasPlotArea=function(){return arguments.length?(v=arguments.length<=0?void 0:arguments[0],O):v},O.svgPlotArea=function(){return arguments.length?(m=arguments.length<=0?void 0:arguments[0],O):m},O.decorate=function(){return arguments.length?(b=arguments.length<=0?void 0:arguments[0],O):b},O},ke=function(){for(var t=arguments.length,n=Array(t),r=0;r.y-label").text(u),t.select(".top-label").style("margin-top","2em"),t.enter().append("div").attr("class","chart-label").style("grid-column",3).style("-ms-grid-column",3).style("grid-row",1).style("-ms-grid-row",1).style("height","2em").style("line-height","2em").style("text-align","center"),t.select(".chart-label").text(o(n)),c(t,n,e)}),n.call(l)};return _(f,l,T(/^x/,/^y/)),f.chartLabel=function(){return arguments.length?(o=_e(arguments.length<=0?void 0:arguments[0]),f):o},f.yLabel=function(){return arguments.length?(u=_e(arguments.length<=0?void 0:arguments[0]),f):u},f.plotArea=function(){return arguments.length?(a=arguments.length<=0?void 0:arguments[0],f):a},f.decorate=function(){return arguments.length?(c=arguments.length<=0?void 0:arguments[0],f):c},f}},Ee=Ae(function(t,n){return t.svgPlotArea(n)},Bt),Te=Ae(function(t,n){return t.canvasPlotArea(n)},jt),ze=function(t){switch(t){case"x":return f.brushX();case"y":return f.brushY();case"xy":return f.brush()}},De=function(t){return[t[1],t[0]]},Pe=function(t){var n=ze(t),r=l.dispatch("brush","start","end"),i=e.scaleIdentity(),o=e.scaleIdentity(),u=vt("g","brush"),c=function(n,e,r){switch(t){case"x":return n.map(e);case"y":return n.map(r);case"xy":return[[e(n[0][0]),r(n[0][1])],[e(n[1][0]),r(n[1][1])]]}},f=function(t){return c(t,e.scaleLinear().domain(i.range()).invert,e.scaleLinear().domain(De(o.range())).invert)},h=function(t){return c(t,e.scaleLinear().domain(i.range()),e.scaleLinear().domain(De(o.range())))},s=function(n){var r=e.scaleLinear().domain(i.domain());return"x"===t?n.map(r.invert):"xy"===t?[r.invert(n[0][0]),r.invert(n[1][0])]:void 0},d=function(n){var r=e.scaleLinear().domain(De(o.domain()));return"y"===t?[n[1],n[0]].map(r.invert):"xy"===t?[r.invert(n[1][1]),r.invert(n[0][1])]:void 0},g=function(t){if(!t.sourceEvent||"draw"!==t.sourceEvent.type)if(t.selection){var n=h(t.selection);r.call(t.type,{},{selection:n,xDomain:s(n),yDomain:d(n)})}else r.call(t.type,{},{})},v=function(t){t.each(function(t,e,r){n.extent([[i.range()[0],o.range()[1]],[i.range()[1],o.range()[0]]]),n.on("end",function(){return g(a.event)}).on("brush",function(){return g(a.event)}).on("start",function(){return g(a.event)}),u(a.select(r[e]),[t]).call(n).call(n.move,t?f(t):null)})};return v.xScale=function(){return arguments.length?(i=arguments.length<=0?void 0:arguments[0],v):i},v.yScale=function(){return arguments.length?(o=arguments.length<=0?void 0:arguments[0],v):o},S(v,r,"on"),S(v,n,"filter","handleSize"),v},Oe=function(){return Pe("x")},Me=function(){return Pe("y")},Ie=function(){return Pe("xy")};t.indicatorBollingerBands=M,t.indicatorExponentialMovingAverage=I,t.indicatorMacd=C,t.indicatorRelativeStrengthIndex=F,t.indicatorStochasticOscillator=G,t.indicatorForceIndex=H,t.indicatorEnvelope=Y,t.indicatorElderRay=W,t.indicatorMovingAverage=U,t.scaleDiscontinuous=m,t.discontinuitySkipWeekends=K,t.discontinuityIdentity=X,t.discontinuityRange=J,t.extentLinear=Z,t.extentTime=$,t.extentDate=$,t.randomFinancial=nt,t.randomGeometricBrownianMotion=tt,t.randomSkipWeekends=et,t.feedGdax=rt,t.bucket=it,t.largestTriangleOneBucket=ot,t.largestTriangleThreeBucket=ut,t.modeMedian=at,t.rebind=S,t.rebindAll=_,t.exclude=E,t.include=T,t.includeMap=z,t.prefix=P,t.shapeOhlc=lt,t.shapeBar=ft,t.shapeCandlestick=ht,t.shapeBoxPlot=st,t.shapeErrorBar=dt,t.layoutLabel=mt,t.layoutTextLabel=pt,t.layoutGreedy=Et,t.layoutAnnealing=Dt,t.layoutRemoveOverlaps=Ot,t.layoutBoundingBox=Mt,t.dataJoin=vt,t.effectivelyZero=1e-6,t.seriesSvgLine=Bt,t.seriesCanvasLine=jt,t.seriesSvgPoint=Nt,t.seriesCanvasPoint=qt,t.seriesSvgBar=Qt,t.seriesCanvasBar=Ft,t.seriesSvgErrorBar=Gt,t.seriesCanvasErrorBar=Ht,t.seriesSvgArea=Yt,t.seriesCanvasArea=Wt,t.seriesSvgCandlestick=Jt,t.seriesCanvasCandlestick=$t,t.seriesSvgBoxPlot=nn,t.seriesCanvasBoxPlot=en,t.seriesSvgOhlc=rn,t.seriesCanvasOhlc=on,t.seriesSvgMulti=an,t.seriesCanvasMulti=cn,t.seriesSvgGrouped=fn,t.seriesCanvasGrouped=hn,t.seriesSvgRepeat=sn,t.seriesCanvasRepeat=dn,t.autoBandwidth=vn,t.seriesSvgHeatmap=pn,t.seriesCanvasHeatmap=yn,t.annotationSvgBand=wn,t.annotationCanvasBand=bn,t.annotationSvgCrosshair=kn,t.annotationCanvasCrosshair=An,t.annotationSvgLine=Sn,t.annotationCanvasLine=_n,t.annotationSvgGridline=zn,t.annotationCanvasGridline=Dn,t.axisLabelRotate=Fn,t.axisLabelOffset=Un,t.axisTop=In,t.axisBottom=Cn,t.axisLeft=Vn,t.axisRight=Ln,t.axisOrdinalTop=Bn,t.axisOrdinalBottom=jn,t.axisOrdinalLeft=Nn,t.axisOrdinalRight=qn,t.pointer=me,t.group=pe,t.chartSvgCartesian=Ee,t.chartCanvasCartesian=Te,t.chartCartesian=Se,t.brushX=Oe,t.brushY=Me,t.brush=Ie,Object.defineProperty(t,"__esModule",{value:!0})});