@damoqiongqiu/ice-chart 0.30.0 → 0.30.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -22,4 +22,6 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import{FAMILY_PALETTE as e,FAMILY_PALETTE_DARK as t,ICEComponent as i,ICEStar as r,ICE_EVENT_NAME_CONSTS as n,ICEGroup as a,ICE as o}from"ice-render";function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}function _callSuper(e,t,i){return t=_getPrototypeOf(t),function _possibleConstructorReturn(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,_isNativeReflectConstruct()?Reflect.construct(t,i||[],_getPrototypeOf(e).constructor):t.apply(e,i))}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_toPropertyKey(r.key),r)}}function _createClass(e,t,i){return t&&_defineProperties(e.prototype,t),i&&_defineProperties(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function _createForOfIteratorHelper(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var r=0,F=function(){};return{s:F,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,a=!0,o=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){o=!0,n=e},f:function(){try{a||null==i.return||i.return()}finally{if(o)throw n}}}}function _defineProperty(e,t,i){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var r=function _superPropBase(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}(e,t);if(r){var n=Object.getOwnPropertyDescriptor(r,t);return n.get?n.get.call(arguments.length<3?e:i):n.value}},_get.apply(null,arguments)}function _getPrototypeOf(e){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _isNativeReflectConstruct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_isNativeReflectConstruct=function(){return!!e})()}function ownKeys(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(i),!0).forEach(function(t){_defineProperty(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var r,n,a,o,s=[],l=!0,h=!1;try{if(a=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;l=!1}else for(;!(l=(r=a.call(i)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){h=!0,n=e}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw n}}return s}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _superPropGet(e,t,i,r){var n=_get(_getPrototypeOf(1&r?e.prototype:e),t,i);return 2&r&&"function"==typeof n?function(e){return n.apply(i,e)}:n}function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _wrapNativeSuper(e){var t="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function(e){if(null===e||!function _isNativeFunction(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,Wrapper)}function Wrapper(){return function _construct(e,t,i){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var n=new(e.bind.apply(e,r));return i&&_setPrototypeOf(n,i.prototype),n}(e,arguments,_getPrototypeOf(this).constructor)}return Wrapper.prototype=Object.create(e.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,e)},_wrapNativeSuper(e)}function storeDomainOf(e){var t=e.columns||e.ring||e.chunks||e.raw;return t?{xDomain:t.xDomain,yDomain:t.yDomain,xMonotonic:t.xMonotonic,sizeExtent:t.sizeExtent}:null}function columnAccessors(e){var t=e.x,i=e.y,r=e.size,n=function yAt(e){var t=i[e];return isNaNNumber(t)?null:t};return{pointAt:function pointAt(e){var i=n(e),a=r?r[e]:NaN;return{index:e,xValue:t[e],y:i,raw:void 0,base:0,top:null===i?0:i,name:void 0,size:isNaNNumber(a)?void 0:a}},xValueAt:function xValueAt(e){return t[e]},yValueAt:n,baseAt:function baseAt(){return 0},topAt:function topAt(e){var t=n(e);return null===t?0:t},sizeAt:function sizeAt(e){if(r){var t=r[e];return isNaNNumber(t)?void 0:t}}}}function isNaNNumber(e){return"number"!=typeof e||Number.isNaN(e)}function toNumber(e){if(null==e)return null;var t=Number(e);return isFinite(t)?t:null}function readGenericPoint(e,t,i){var r,n,a=t,o=null,s=!1;if(Array.isArray(e)){if(a=e[0],o=toNumber(e[1]),e.length>2){var l=toNumber(e[2]);r=null===l?void 0:l}s=!0}else if("number"==typeof e||null===e)o=toNumber(e);else if(e&&"object"===_typeof(e)){var h=i.xField||"x",u=i.yField||"y";if(void 0!==e[h]?(a=e[h],s=!0):void 0!==e.x?(a=e.x,s=!0):void 0!==e.name&&"bar"===i.type&&(a=e.name,s=!0),void 0!==e[u]?o=toNumber(e[u]):void 0!==e.y?o=toNumber(e.y):void 0!==e.value&&(o=toNumber(e.value)),void 0!==e.size){var c=toNumber(e.size);r=null===c?void 0:c}}return e&&"object"===_typeof(e)&&!Array.isArray(e)&&void 0!==e.name?n=String(e.name):"pie"===i.type&&Array.isArray(e)&&"string"==typeof e[0]&&(n=e[0]),{xValue:a,y:o,size:r,name:n,explicitX:s}}function rawItemAt(e,t){if(!(t<0||t>=e.length))return e.capacity<=0?e.data[t]:e.data[(e.start+t)%e.capacity]}function appendRawItems(e,t,i){if(i>0&&e.capacity!==i){for(var r=Math.min(e.length,i),n=new Array(i),a=0;a<r;a++)n[a]=rawItemAt(e,e.length-r+a);e.data=n,e.capacity=i,e.start=0,e.length=r}if(e.capacity>0){var o,s=_createForOfIteratorHelper(t);try{for(s.s();!(o=s.n()).done;){var l=o.value,h=void 0;e.length>=e.capacity?(h=e.start,e.start=(e.start+1)%e.capacity):(h=(e.start+e.length)%e.capacity,e.length+=1),e.data[h]=l}}catch(e){s.e(e)}finally{s.f()}}else{var u,c=_createForOfIteratorHelper(t);try{for(c.s();!(u=c.n()).done;){var d=u.value;e.data.push(d)}}catch(e){c.e(e)}finally{c.f()}e.length=e.data.length}return function refreshRawDomains(e){for(var t={type:e.type,xField:e.xField,yField:e.yField},i=1/0,r=-1/0,n=1/0,a=-1/0,o=1/0,s=-1/0,l=!0,h=-1/0,u=!1,c=0;c<e.length;c++){var d=readGenericPoint(rawItemAt(e,c),c,t),f=Number(d.xValue);isFinite(f)?(f<i&&(i=f),f>r&&(r=f),f<h&&(l=!1),h=f):l=!1,null!==d.y&&(d.y<n&&(n=d.y),d.y>a&&(a=d.y)),"number"==typeof d.size&&isFinite(d.size)&&(u=!0,d.size<o&&(o=d.size),d.size>s&&(s=d.size))}e.xDomain=isFinite(i)?[i,r]:[0,Math.max(0,e.length-1)],e.yDomain=isFinite(n)?[n,a]:null,e.xMonotonic=l,e.sizeExtent=u?o===s?[o,o+1]:[o,s]:null}(e),e}function rawAccessors(e){var t={type:e.type,xField:e.xField,yField:e.yField},i=function readAt(i){var r=rawItemAt(e,i);return void 0===r&&(i<0||i>=e.length)?null:readGenericPoint(r,i,t)};return{pointAt:function pointAt(t){var r=i(t);if(r)return{index:t,xValue:r.xValue,y:r.y,raw:rawItemAt(e,t),base:0,top:null===r.y?0:r.y,name:r.name,size:r.size}},xValueAt:function xValueAt(e){var t=i(e);return t?t.xValue:void 0},yValueAt:function yValueAt(e){var t=i(e);return t?t.y:null},baseAt:function baseAt(){return 0},topAt:function topAt(e){var t=i(e);return t&&null!==t.y?t.y:0},sizeAt:function sizeAt(e){var t=i(e);return t?t.size:void 0}}}function gridAccessors(e){var t=e.xCategories.length,i=function valueAt(t){var i=e.values[t];return isNaNNumber(i)?null:i};return{pointAt:function pointAt(r){var n=t>0?r%t:r,a=t>0?(r-n)/t:0,o=i(r),s=e.yCategories[a];return{index:r,xValue:e.xCategories[n],y:o,raw:void 0,base:0,top:null===o?0:o,name:void 0===s?void 0:String(s)}},xValueAt:function xValueAt(i){return t>0?e.xCategories[i%t]:e.xCategories[i]},yValueAt:i,baseAt:function baseAt(){return 0},topAt:function topAt(e){var t=i(e);return null===t?0:t},sizeAt:function sizeAt(){}}}function createRing(e){var t=Math.max(1,Math.floor(e)||1);return{kind:"ring",capacity:t,start:0,length:0,x:new Float64Array(t),y:new Float64Array(t),xDomain:[0,1],yDomain:null,xMonotonic:!0,sizeExtent:null}}function ringSlot(e,t){return(e.start+t)%e.capacity}function ringXAt(e,t){return e.x[ringSlot(e,t)]}function ringYAt(e,t){return e.y[ringSlot(e,t)]}function ringAppend(e,t,i){var r,n=_createForOfIteratorHelper(t);try{for(n.s();!(r=n.n()).done;){var a=r.value,o=void 0;e.length>=e.capacity?(o=e.start,e.start=(e.start+1)%e.capacity):(o=(e.start+e.length)%e.capacity,e.length+=1);var s=a.x;e.x[o]=null!=s&&isFinite(s)?s:i,e.y[o]=null===a.y?NaN:a.y,i=e.x[o]+1}}catch(e){n.e(e)}finally{n.f()}}function chunkAt(e,t){if(t<0||t>=e.total)return null;var i=function chunkIndexOf(e,t){for(var i=0,r=e.sizes.length-1;i<r;){var n=i+r+1>>1;e.offsets[n]<=t?i=n:r=n-1}return i}(e,t),r=e.resident[i];return r?{columns:r,local:t-e.offsets[i]}:null}function requestChunk(e,t,i){if(!(t<0||t>=e.sizes.length))if(e.resident[t]||e.loading.has(t))touchLru(e,t);else{e.loading.add(t);var r=function settle(r){e.loading.delete(t),r&&(e.resident[t]=r,touchLru(e,t),function refreshChunkMeta(e,t){var i=e.resident[t];if(!i)return;var r=e.sizes[t];if(r){var n=i.x[0],a=i.x[r-1];isFinite(n)&&isFinite(a)&&(e.ranges[t]=[Math.min(n,a),Math.max(n,a)])}var o=e.ranges.filter(function(e){return!!e});o.length&&(e.xDomain=[Math.min.apply(Math,_toConsumableArray(o.map(function(e){return e[0]}))),Math.max.apply(Math,_toConsumableArray(o.map(function(e){return e[1]})))])}(e,t),function evictChunks(e){for(;e.lru.length>e.maxResident;){var t=e.lru.find(function(t){return!e.loading.has(t)});if(void 0===t)return;var i=e.lru.indexOf(t);e.lru.splice(i,1),e.resident[t]=null}}(e),i())};try{var n=e.load(t);n&&"function"==typeof n.then?n.then(function(e){return r(e)},function(){return r(null)}):r(n)}catch(e){r(null)}}}function chunkRangeForX(e,t,i){var r=e.sizes.length;if(!r)return{from:0,to:-1};for(var n=-1,a=-1,o=0;o<r;o++){var s=e.ranges[o];s&&(s[1]<t||s[0]>i||(n<0&&(n=o),a=o))}return n<0?{from:0,to:-1}:{from:Math.max(0,n-1),to:Math.min(r-1,a+1)}}function touchLru(e,t){var i=e.lru.indexOf(t);i>=0&&e.lru.splice(i,1),e.lru.push(t)}function chunkAccessors(e){var t=function yAt(t){var i=chunkAt(e,t);if(!i)return null;var r=i.columns.y[i.local];return Number.isNaN(r)?null:r};return{pointAt:function pointAt(i){var r=chunkAt(e,i);if(r){var n=t(i);return{index:i,xValue:r.columns.x[r.local],y:n,raw:void 0,base:0,top:null===n?0:n,name:void 0}}},xValueAt:function xValueAt(t){var i=chunkAt(e,t);return i?i.columns.x[i.local]:void 0},yValueAt:t,baseAt:function baseAt(){return 0},topAt:function topAt(e){var i=t(e);return null===i?0:i},sizeAt:function sizeAt(){}}}var s=_toConsumableArray(e),l={primary:"#0D6EFD",secondary:"#6C757D",success:"#198754",danger:"#DC3545",warning:"#FFC107",info:"#0DCAF0",light:"#F8F9FA",dark:"#212529",indigo:"#6610F2",purple:"#6F42C1",pink:"#D63384",orange:"#FD7E14",teal:"#20C997",cyan:"#0DCAF0",gray:{100:"#F8F9FA",200:"#E9ECEF",300:"#DEE2E6",400:"#CED4DA",500:"#ADB5BD",600:"#6C757D",700:"#495057",800:"#343A40",900:"#212529"},fontFamily:'system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif',radius:6},h=l,u={backgroundColor:"transparent",colorPalette:s,textColor:h.dark,subTextColor:h.secondary,axisLineColor:h.gray[300],axisLabelColor:h.gray[600],splitLineColor:h.gray[200],labelHaloColor:"rgba(255,255,255,0.85)",fontFamily:h.fontFamily,fontSize:12,legend:{textColor:h.gray[700],inactiveColor:h.gray[400]},tooltip:{background:"#ffffff",borderColor:h.gray[300],textColor:h.dark,shadowColor:"rgba(33,37,41,0.18)",fontSize:12,padding:10,radius:h.radius},crosshair:{lineColor:h.gray[500],labelBackground:h.gray[700],labelColor:"#ffffff"},brush:{fill:"rgba(13,110,253,0.16)",stroke:"rgba(13,110,253,0.8)"},selection:{stroke:h.primary,dimOpacity:.3}},c={backgroundColor:"transparent",colorPalette:_toConsumableArray(t),textColor:h.gray[200],subTextColor:h.gray[500],axisLineColor:h.gray[700],axisLabelColor:h.gray[400],splitLineColor:h.gray[800],labelHaloColor:"rgba(10,18,32,0.88)",fontFamily:h.fontFamily,fontSize:12,legend:{textColor:h.gray[300],inactiveColor:h.gray[700]},tooltip:{background:h.gray[800],borderColor:h.gray[700],textColor:h.gray[100],shadowColor:"rgba(0,0,0,0.5)",fontSize:12,padding:10,radius:h.radius},crosshair:{lineColor:h.gray[600],labelBackground:h.gray[300],labelColor:h.dark},brush:{fill:"rgba(77,148,255,0.2)",stroke:"rgba(77,148,255,0.85)"},selection:{stroke:"#4D94FF",dimOpacity:.32}},d=u,f=c;function resolveChartTheme(e){var t="dark"===e||"auto"===e&&(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).preferDark?c:u;return e&&"string"!=typeof e?_objectSpread2(_objectSpread2(_objectSpread2({},t),e),{},{legend:_objectSpread2(_objectSpread2({},t.legend),e.legend||{}),tooltip:_objectSpread2(_objectSpread2({},t.tooltip),e.tooltip||{}),crosshair:_objectSpread2(_objectSpread2({},t.crosshair),e.crosshair||{}),brush:_objectSpread2(_objectSpread2({},t.brush),e.brush||{}),selection:_objectSpread2(_objectSpread2({},t.selection),e.selection||{})}):t}function clamp$2(e,t,i){return e<t?t:e>i?i:e}function isFiniteNumber(e){return"number"==typeof e&&isFinite(e)}function extent(e){for(var t=1/0,i=-1/0,r=0;r<e.length;r++){var n=e[r];isFiniteNumber(n)&&(n<t&&(t=n),n>i&&(i=n))}if(t===1/0)return[0,1];if(t===i){var a=Math.abs(t)>1?.1*Math.abs(t):1;return[t-a,i+a]}return[t,i]}function niceStep(e,t){if(!(e>0&&t>0))return 1;var i=e/t,r=Math.pow(10,Math.floor(Math.log10(i))),n=i/r;return(n>=5?10:n>=2?5:n>=1?2:1)*r}function niceDomain(e,t){var i=_slicedToArray(e,2),r=i[0],n=i[1],a=niceStep(n-r,t);return[Math.floor(r/a)*a,Math.ceil(n/a)*a]}function round(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,i=Math.pow(10,t);return Math.round(e*i)/i}var p=1e3,v=6e4,m=36e5,g=24*m,b=30*g,k=365*g;function makeInterval(e,t,i,r,n){return{unit:e,ms:t*i,floor:function floor(e){var t=new Date(e);return r(t),t.getTime()},next:function next(e){var t=new Date(e);return n(t),t.getTime()}}}var S=[makeInterval("ms",1,1,function(){},function(e){return e.setUTCMilliseconds(e.getUTCMilliseconds()+1)}),makeInterval("ms",10,1,function(e){return e.setUTCMilliseconds(10*Math.floor(e.getUTCMilliseconds()/10))},function(e){return e.setUTCMilliseconds(e.getUTCMilliseconds()+10)}),makeInterval("ms",100,1,function(e){return e.setUTCMilliseconds(100*Math.floor(e.getUTCMilliseconds()/100))},function(e){return e.setUTCMilliseconds(e.getUTCMilliseconds()+100)}),makeInterval("s",1,p,function(e){return e.setUTCMilliseconds(0)},function(e){return e.setUTCSeconds(e.getUTCSeconds()+1)}),makeInterval("s",5,p,function(e){return e.setUTCSeconds(5*Math.floor(e.getUTCSeconds()/5),0)},function(e){return e.setUTCSeconds(e.getUTCSeconds()+5)}),makeInterval("s",15,p,function(e){return e.setUTCSeconds(15*Math.floor(e.getUTCSeconds()/15),0)},function(e){return e.setUTCSeconds(e.getUTCSeconds()+15)}),makeInterval("s",30,p,function(e){return e.setUTCSeconds(30*Math.floor(e.getUTCSeconds()/30),0)},function(e){return e.setUTCSeconds(e.getUTCSeconds()+30)}),makeInterval("m",1,v,function(e){return e.setUTCSeconds(0,0)},function(e){return e.setUTCMinutes(e.getUTCMinutes()+1)}),makeInterval("m",5,v,function(e){return e.setUTCMinutes(5*Math.floor(e.getUTCMinutes()/5),0,0)},function(e){return e.setUTCMinutes(e.getUTCMinutes()+5)}),makeInterval("m",15,v,function(e){return e.setUTCMinutes(15*Math.floor(e.getUTCMinutes()/15),0,0)},function(e){return e.setUTCMinutes(e.getUTCMinutes()+15)}),makeInterval("m",30,v,function(e){return e.setUTCMinutes(30*Math.floor(e.getUTCMinutes()/30),0,0)},function(e){return e.setUTCMinutes(e.getUTCMinutes()+30)}),makeInterval("h",1,m,function(e){return e.setUTCMinutes(0,0,0)},function(e){return e.setUTCHours(e.getUTCHours()+1)}),makeInterval("h",3,m,function(e){return e.setUTCHours(3*Math.floor(e.getUTCHours()/3),0,0,0)},function(e){return e.setUTCHours(e.getUTCHours()+3)}),makeInterval("h",6,m,function(e){return e.setUTCHours(6*Math.floor(e.getUTCHours()/6),0,0,0)},function(e){return e.setUTCHours(e.getUTCHours()+6)}),makeInterval("h",12,m,function(e){return e.setUTCHours(12*Math.floor(e.getUTCHours()/12),0,0,0)},function(e){return e.setUTCHours(e.getUTCHours()+12)}),makeInterval("d",1,g,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCDate(e.getUTCDate()+1)}),makeInterval("d",2,g,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCDate(e.getUTCDate()+2)}),makeInterval("d",7,g,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCDate(e.getUTCDate()+7)}),makeInterval("mo",1,b,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCMonth(e.getUTCMonth()+1)}),makeInterval("mo",3,b,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCMonth(e.getUTCMonth()+3)}),makeInterval("y",1,k,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCFullYear(e.getUTCFullYear()+1)})];function pad(e){return e<10?"0".concat(e):String(e)}var A=function(){function TimeScale(e,t){_classCallCheck(this,TimeScale),_defineProperty(this,"type","time");var i=Number(e[0]),r=Number(e[1]);this.domain=i===r?[i-g,r+g]:[Math.min(i,r),Math.max(i,r)],this.range=t}return _createClass(TimeScale,[{key:"map",value:function map(e){var t=toTimestamp(e),i=_slicedToArray(this.domain,2),r=i[0],n=i[1],a=_slicedToArray(this.range,2),o=a[0];return o+(t-r)/(n-r)*(a[1]-o)}},{key:"invert",value:function invert(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=_slicedToArray(this.range,2),a=n[0],o=n[1];return o===a?i:i+(e-a)/(o-a)*(r-i)}},{key:"pickInterval",value:function pickInterval(e){for(var t=(this.domain[1]-this.domain[0])/Math.max(1,e),i=S[0],r=1/0,n=0;n<S.length;n++){var a=Math.abs(Math.log(S[n].ms/t));a<r&&(r=a,i=S[n])}return i}},{key:"ticks",value:function ticks(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=this.pickInterval(e),i=[],r=t.floor(this.domain[0]);r<this.domain[0]&&(r=t.next(r));for(var n=0;r<=this.domain[1]&&n<1e3;n++){i.push(r);var a=t.next(r);if(a===r)break;r=a}return i}},{key:"bandwidth",value:function bandwidth(){return 0}},{key:"bandStart",value:function bandStart(e){return this.map(e)}},{key:"step",value:function step(){return this.pickInterval(5).ms}},{key:"isBand",value:function isBand(){return!1}},{key:"indexAt",value:function indexAt(e){return-1}},{key:"fractionOf",value:function fractionOf(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1];return r===i?0:(toTimestamp(e)-i)/(r-i)}},{key:"valueAtFraction",value:function valueAtFraction(e){var t=_slicedToArray(this.domain,2),i=t[0];return i+e*(t[1]-i)}},{key:"span",value:function span(){return this.domain[1]-this.domain[0]}},{key:"format",value:function format(e,t){return function formatTime(e,t,i){var r=new Date(e),n=pad(r.getUTCHours()),a=pad(r.getUTCMinutes()),o=pad(r.getUTCSeconds()),s=pad(r.getUTCMonth()+1),l=pad(r.getUTCDate()),h=r.getUTCFullYear(),u=i>3*k;switch(t){case"ms":return"".concat(n,":").concat(a,":").concat(o,".").concat(pad(r.getUTCMilliseconds()));case"s":return"".concat(n,":").concat(a,":").concat(o);case"m":return"".concat(n,":").concat(a);case"h":return"".concat(n,":00");case"d":return u?"".concat(h,"-").concat(s,"-").concat(l):"".concat(s,"-").concat(l);case"mo":return u?"".concat(h,"-").concat(s):"".concat(s,"-01");default:return"".concat(h)}}(toTimestamp(e),this.pickInterval(5).unit,this.span())}},{key:"clone",value:function clone(){return new TimeScale([this.domain[0],this.domain[1]],[this.range[0],this.range[1]])}}])}();function toTimestamp(e){if(e instanceof Date)return e.getTime();if("string"==typeof e){var t=Date.parse(e);if(!isNaN(t))return t}var i=Number(e);return isFinite(i)?i:NaN}var w=function(){function ExpressionError(e,t,i){var r,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"syntax";return _classCallCheck(this,ExpressionError),(r=_callSuper(this,ExpressionError,["[ice-chart] 表达式错误:".concat(e,"(位置 ").concat(t,")\n ").concat(i,"\n ").concat(" ".repeat(Math.max(0,t)),"^")])).name="ExpressionError",r.position=t,r.code=n,r}return _inherits(ExpressionError,_wrapNativeSuper(Error)),_createClass(ExpressionError)}(),M={pi:Math.PI,PI:Math.PI,e:Math.E,tau:2*Math.PI,TAU:2*Math.PI,inf:1/0,Infinity:1/0,nan:NaN},_={sin:1,cos:1,tan:1,asin:1,acos:1,atan:1,atan2:2,sinh:1,cosh:1,tanh:1,asinh:1,acosh:1,atanh:1,exp:1,ln:1,log:1,log2:1,log10:1,sqrt:1,cbrt:1,abs:1,sign:1,floor:1,ceil:1,round:1,trunc:1,min:2,max:2,pow:2,mod:2,hypot:2,clamp:3},C={min:Math.min,max:Math.max,pow:Math.pow,mod:function mod(e,t){return e%t},hypot:Math.hypot,clamp:function clamp(e,t,i){return Math.max(t,Math.min(i,e))},ln:Math.log,log:Math.log,log10:Math.log10,cbrt:Math.cbrt,trunc:Math.trunc,sign:Math.sign};var P=function(){return _createClass(function Parser(e){_classCallCheck(this,Parser),_defineProperty(this,"index",0),_defineProperty(this,"variables",new Set),this.source=e,this.tokens=function tokenize(e){for(var t=[],i=0,r=function isDigit(e){return e>="0"&&e<="9"},n=function isIdentStart(e){return/[A-Za-z_]/.test(e)},a=function isIdentPart(e){return/[A-Za-z0-9_]/.test(e)};i<e.length;){var o=e[i];if(" "!==o&&"\t"!==o&&"\n"!==o&&"\r"!==o)if(r(o)||"."===o&&r(e[i+1]||"")){for(var s=i;i<e.length&&(r(e[i])||"."===e[i]);)i++;if("e"===e[i]||"E"===e[i]){var l=i;if("+"!==e[++i]&&"-"!==e[i]||i++,r(e[i]||""))for(;i<e.length&&r(e[i]);)i++;else i=l}t.push({type:"num",value:e.slice(s,i),position:s})}else if(n(o)){for(var h=i;i<e.length&&a(e[i]);)i++;t.push({type:"ident",value:e.slice(h,i),position:h})}else if("+-*/%^".indexOf(o)>=0)t.push({type:"op",value:o,position:i}),i++;else if("("!==o)if(")"!==o){if(","!==o)throw new w("无法识别的字符「".concat(o,"」"),i,e,"unknown-character");t.push({type:"comma",value:o,position:i}),i++}else t.push({type:"rparen",value:o,position:i}),i++;else t.push({type:"lparen",value:o,position:i}),i++;else i++}return t.push({type:"end",value:"",position:e.length}),t}(e)},[{key:"parse",value:function parse(){if("end"===this.peek().type)throw new w("表达式是空的",0,this.source,"empty");var e=this.parseSum(),t=this.peek();if("end"!==t.type)throw new w("多余的内容「".concat(t.value,"」"),t.position,this.source);return e}},{key:"getVariables",value:function getVariables(){return Array.from(this.variables)}},{key:"peek",value:function peek(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.tokens[Math.min(this.index+e,this.tokens.length-1)]}},{key:"next",value:function next(){return this.tokens[this.index++]}},{key:"parseSum",value:function parseSum(){for(var e=this.parseProduct();;){var t=this.peek();if("op"!==t.type||"+"!==t.value&&"-"!==t.value)return e;this.next(),e={kind:"binary",op:t.value,left:e,right:this.parseProduct()}}}},{key:"parseProduct",value:function parseProduct(){for(var e=this.parseUnary();;){var t=this.peek();if("op"===t.type&&"*/%".indexOf(t.value)>=0)this.next(),e={kind:"binary",op:t.value,left:e,right:this.parseUnary()};else{if(!this.startsAtom(t)||!this.endsAtom(e))return e;e={kind:"binary",op:"*",left:e,right:this.parseUnary()}}}}},{key:"startsAtom",value:function startsAtom(e){return"num"===e.type||"ident"===e.type||"lparen"===e.type}},{key:"endsAtom",value:function endsAtom(e){return"num"===e.kind||"var"===e.kind&&void 0!==M[e.name]}},{key:"parseUnary",value:function parseUnary(){var e=this.peek();return"op"!==e.type||"-"!==e.value&&"+"!==e.value?this.parsePower():(this.next(),{kind:"unary",op:e.value,arg:this.parseUnary()})}},{key:"parsePower",value:function parsePower(){var e=this.parseAtom(),t=this.peek();return"op"===t.type&&"^"===t.value?(this.next(),{kind:"binary",op:"^",left:e,right:this.parseUnary()}):e}},{key:"parseAtom",value:function parseAtom(){var e=this.next();if("num"===e.type){var t=Number(e.value);if(!isFinite(t))throw new w("无法解析的数字「".concat(e.value,"」"),e.position,this.source);return{kind:"num",value:t}}if("lparen"===e.type){var i=this.parseSum(),r=this.peek();if("rparen"!==r.type)throw new w("缺少右括号",r.position,this.source);return this.next(),i}if("ident"===e.type){var n=e.value;if("lparen"===this.peek().type){var a=_[n];if(void 0===a)throw new w("未知函数「".concat(n,"」"),e.position,this.source,"unknown-function");this.next();for(var o=[this.parseSum()];"comma"===this.peek().type;)this.next(),o.push(this.parseSum());var s=this.peek();if("rparen"!==s.type)throw new w("函数「".concat(n,"」缺少右括号"),s.position,this.source);if(this.next(),o.length!==a)throw new w("函数「".concat(n,"」需要 ").concat(a," 个参数,收到 ").concat(o.length," 个"),e.position,this.source,"arity");return{kind:"call",name:n,args:o}}return void 0!==M[n]?{kind:"num",value:M[n]}:(this.variables.add(n),{kind:"var",name:n})}throw new w("end"===e.type?"表达式意外结束":"这里不该出现「".concat(e.value,"」"),e.position,this.source)}}])}();function compileNode(e){switch(e.kind){case"num":return function(){return e.value};case"var":return function(t){var i=t[e.name];return"number"==typeof i?i:NaN};case"unary":var t=compileNode(e.arg);return"-"===e.op?function(e){return-t(e)}:t;case"binary":var i=compileNode(e.left),r=compileNode(e.right);switch(e.op){case"+":return function(e){return i(e)+r(e)};case"-":return function(e){return i(e)-r(e)};case"*":return function(e){return i(e)*r(e)};case"/":return function(e){return i(e)/r(e)};case"%":return function(e){return i(e)%r(e)};case"^":return function(e){return Math.pow(i(e),r(e))};default:return function(){return NaN}}case"call":var n=e.name,a=C[n]||Math[n],o=e.args.map(compileNode);return a?function(e){return a.apply(void 0,_toConsumableArray(o.map(function(t){return t(e)})))}:function(){return NaN}}}var T=new Map;function compileExpression(e){var t=String(null==e?"":e),i=T.get(t);if(i)return i;var r=new P(t),n=compileNode(r.parse()),a={source:t,variables:r.getVariables(),evaluate:function evaluate(e){return n(e||{})}};return T.set(t,a),a}function evaluateExpression(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return compileExpression(e).evaluate(t)}function compileSampler(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=compileExpression(e),r=_objectSpread2({},t);return{setParams:function setParams(e){for(var t=0,i=Object.keys(e);t<i.length;t++){var n=i[t];r[n]=Number(e[n])}},evaluate:function evaluate(e,t){return r[e]=t,i.evaluate(r)}}}function quantile(e,t){return e.length?e[Math.min(e.length-1,Math.max(0,Math.round((e.length-1)*t)))]:NaN}function diagnoseExpression(e,t){var i=String(null==e?"":e),r=t.params||{},n=[];if(!i.trim())return n.push({code:"empty",severity:"error",message:"表达式是空的:请填写 ".concat(t.variable," 的公式,例如 ").concat("t"===t.variable?"sin(3*t)":"sin(x)/x")}),n;var a=[];try{a=compileExpression(i).variables}catch(e){return e instanceof w?(n.push({code:e.code,severity:"error",message:e.message,position:e.position}),n):(n.push({code:"syntax",severity:"error",message:String(e&&e.message?e.message:e)}),n)}var o,s=[t.variable].concat(_toConsumableArray(Object.keys(r))),l=a.filter(function(e){return e!==t.variable&&!(e in r)}),h=_createForOfIteratorHelper(l);try{for(h.s();!(o=h.n()).done;){var u=o.value;n.push({code:"unknown-variable",severity:"error",message:"未定义的变量「".concat(u,"」:可用的是 ").concat(s.join("、"),"。想当参数用请写进 series.params(会自动进 JSON 快照)。")})}}catch(e){h.e(e)}finally{h.f()}var c,d=new Set([].concat(_toConsumableArray(a),_toConsumableArray(t.additionalVariables||[]))),f=Object.keys(r).filter(function(e){return!d.has(e)}),p=_createForOfIteratorHelper(f);try{for(p.s();!(c=p.n()).done;){var v=c.value;n.push({code:"unused-parameter",severity:"warning",message:"参数「".concat(v,"」定义了但表达式没有用到,改公式或去掉它。")})}}catch(e){p.e(e)}finally{p.f()}var m=t.values;if(m&&m.length&&!n.some(function(e){return"error"===e.severity})){var g=m.filter(function(e){return"number"==typeof e&&isFinite(e)});if(g.length){var b=g.slice().sort(function(e,t){return e-t}),k=quantile(b,.02),S=quantile(b,.98);Math.abs(S-k)<1e-12&&n.push({code:"constant-value",severity:"warning",message:"输出恒为 ".concat(Number(S.toPrecision(6)),":函数与自变量无关(或恰好取到常数),画出来是一条水平线。")})}else n.push({code:"no-finite-values",severity:"error",message:"在当前区间内没有任何可绘制的值:检查是否对负数开方、对 0 取对数,或者分母整段为 0。"})}return n}function errorsOf(e){return e.filter(function(e){return"error"===e.severity})}function warningsOf(e){return e.filter(function(e){return"warning"===e.severity})}var I=1e7;function robustRange(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=e.filter(function(e){return"number"==typeof e&&isFinite(e)&&Math.abs(e)<I});if(!i.length)return[-1,1];var r=i.slice().sort(function(e,t){return e-t}),n=function at(e){return r[Math.min(r.length-1,Math.max(0,Math.round((r.length-1)*e)))]},a=n(.5),o=n(.75)-n(.25),s=r[0],l=r[r.length-1];if(o>0&&(s=Math.max(s,a-t*o),l=Math.min(l,a+t*o)),!(l>s)){var h=(l+s)/2,u=Math.max(1,.2*Math.abs(h));s=h-u,l=h+u}return[s,l]}function refineSegment(e,t,i,r,n,a,o){var s=(t+r)/2;if(isFinite(s)&&s!==t&&s!==r){var l=e.evaluate(s);if(e.isBreak(l))o.push(s,NaN);else e.adaptive&&a<e.maxDepth&&e.count<e.maxSamples&&!e.isBreak(i)&&!e.isBreak(n)&&e.deviation(i,l,n)>e.tolerance&&(e.count++,refineSegment(e,t,i,s,l,a+1,o),e.emit(s,l,o),refineSegment(e,s,l,r,n,a+1,o))}}function sampleFunctionCurve(e,t,i){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=Math.max(2,Math.round(r.base||240)),a=new Float64Array(n),o=new Float64Array(n),s=0;s<n;s++){var l=t+(i-t)*s/(n-1),h=e(l);a[s]=l,o[s]=isFinite(h)&&Math.abs(h)<I?h:NaN}for(var u=_slicedToArray(robustRange(Array.from(o)),2),c=u[0],d=u[1],f=Math.max(1e-9,d-c),p={tolerance:Math.max(1e-9,(void 0===r.tolerance?.0025:r.tolerance)*f),maxDepth:void 0===r.maxDepth?7:r.maxDepth,maxSamples:void 0===r.maxSamples?6e3:r.maxSamples,count:n,adaptive:!1!==r.adaptive,evaluate:function evaluate(t){return e(t)},isBreak:function isBreak(e){return!isFinite(e)||Math.abs(e)>I},deviation:function deviation(e,t,i){return Math.abs(t-(e+i)/2)},emit:function emit(e,t,i){i.push(e,t)}},v=[],m=0;m<n&&(v.push(a[m],isFinite(o[m])?o[m]:NaN),m!==n-1);m++)refineSegment(p,a[m],o[m],a[m+1],o[m+1],0,v);for(var g=[],b=0;b<v.length;b+=2)g.push([v[b],v[b+1]]);return function breakPoles(e,t){for(var i=20*Math.max(1e-9,t),r=[],n=0;n<e.length;n++){var a=e[n],o=r.length?r[r.length-1]:null;o&&isFinite(o[1])&&isFinite(a[1])&&o[1]*a[1]<0&&Math.abs(a[1]-o[1])>i&&r.push([(o[0]+a[0])/2,NaN]),r.push(a)}return r}(g,f)}function sampleParametricCurve(e,t,i,r){for(var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=Math.max(2,Math.round(n.base||360)),o=new Float64Array(a),s=new Float64Array(a),l=new Float64Array(a),h=0;h<a;h++){var u=i+(r-i)*h/(a-1);o[h]=u,s[h]=e(u),l[h]=t(u)}for(var c=_slicedToArray(robustRange(Array.from(s)),2),d=c[0],f=c[1],p=_slicedToArray(robustRange(Array.from(l)),2),v=p[0],m=p[1],g=Math.max(1e-9,Math.hypot(f-d,m-v)),b={tolerance:Math.max(1e-9,(void 0===n.tolerance?.0015:n.tolerance)*g),maxDepth:void 0===n.maxDepth?7:n.maxDepth,maxSamples:void 0===n.maxSamples?8e3:n.maxSamples,count:a,adaptive:!1!==n.adaptive,evaluate:function evaluate(i){return[e(i),t(i)]},isBreak:function isBreak(e){return!isFinite(e[0])||!isFinite(e[1])||Math.abs(e[0])>I||Math.abs(e[1])>I},deviation:function deviation(e,t,i){return function midDeviation(e,t,i,r,n,a){var o=i-e,s=r-t,l=o*o+s*s;if(0===l)return Math.hypot(n-e,a-t);var h=((n-e)*o+(a-t)*s)/l;return h=Math.max(0,Math.min(1,h)),Math.hypot(n-(e+h*o),a-(t+h*s))}(e[0],e[1],i[0],i[1],t[0],t[1])},emit:function emit(e,t,i){i.push(t[0],t[1])}},k=[],S=0;S<a;S++){var A=s[S],w=l[S],M=!isFinite(A)||!isFinite(w)||Math.abs(A)>I||Math.abs(w)>I;if(k.push(M?NaN:A,M?NaN:w),S===a-1)break;refineSegment(b,o[S],[s[S],l[S]],o[S+1],[s[S+1],l[S+1]],0,k)}for(var _=[],C=0;C<k.length;C+=2)_.push([k[C],k[C+1]]);return _}var N={top:12,right:16,bottom:12,left:12};function padDomain(e,t,i,r,n){var a=i&&void 0!==i.padding?Number(i.padding):.05;if(!isFinite(a)||a<=0)return[e,t];var o=t-e;if(!isFinite(o)||o<=0)return[e,t];var s=o*Math.min(.5,a);return[r?e:e-s,n?t:t+s]}var D={enter:{duration:520,delay:0,easing:"easeOutCubic",stagger:.35},update:{duration:420,delay:0,easing:"easeOutCubic",stagger:0},highlight:{duration:260,delay:0,easing:"springSnappy",stagger:0}};function normalizeAnimation(e){if(!1===e)return{enabled:!1,enter:!1,update:!1,highlight:!1};var t=e||{},i=!1!==t.enabled,r={duration:t.duration,easing:t.easing,stagger:t.stagger,delay:t.delay},n=function stage(e){if(!1===t[e])return!1;var i=_objectSpread2({},D[e]);if("enter"===e)for(var n=0,a=Object.keys(r);n<a.length;n++){var o=a[n];void 0!==r[o]&&(i[o]=r[o])}return t[e]&&"object"===_typeof(t[e])&&Object.assign(i,t[e]),i};return{enabled:i,enter:n("enter"),update:n("update"),highlight:n("highlight")}}function normalizeAnnotation(e){if(!e||"object"!==_typeof(e))return null;var t=function list(e){return Array.isArray(e)?e.filter(function(e){return e&&"object"===_typeof(e)}):[]},i=t(e.lines),r=t(e.points),n=t(e.areas);return i.length||r.length||n.length?{lines:i,points:r,areas:n}:null}function normalizeOption(e){var t,i,r,n,a,o,s,l,h,u,c,d,f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||!Array.isArray(e.series))throw new Error("[ice-chart] option.series 必须是数组。");var p=resolveChartTheme(e.theme,{preferDark:!!f.preferDark}),v={legend:_objectSpread2({show:e.series.length>1,position:"top",itemWidth:12,itemHeight:12,itemGap:16,selectable:!0},e.legend||{}),tooltip:_objectSpread2({show:!0,trigger:"axis"},e.tooltip||{}),crosshair:_objectSpread2({show:!0,type:"line",axis:"x",showAxisLabel:!0},e.crosshair||{}),grid:_objectSpread2({show:!0,x:!1,y:!0,lineWidth:1},e.grid||{}),interaction:{hover:_objectSpread2({enabled:!0,mode:"nearest-x",dimOthers:!1},(null===(t=e.interaction)||void 0===t?void 0:t.hover)||{}),select:_objectSpread2({enabled:!1,mode:"single",toggle:!0},(null===(i=e.interaction)||void 0===i?void 0:i.select)||{}),brush:!1!==(null===(r=e.interaction)||void 0===r?void 0:r.brush)&&_objectSpread2({enabled:!1,axes:"x",mode:"select"},(null===(n=e.interaction)||void 0===n?void 0:n.brush)||{}),zoom:!1!==(null===(a=e.interaction)||void 0===a?void 0:a.zoom)&&_objectSpread2({enabled:!0,axes:"x",wheel:!0,wheelFactor:1.2,mode:"data"},(null===(o=e.interaction)||void 0===o?void 0:o.zoom)||{}),pan:!1!==(null===(s=e.interaction)||void 0===s?void 0:s.pan)&&_objectSpread2({enabled:!1,axes:"xy"},(null===(l=e.interaction)||void 0===l?void 0:l.pan)||{}),keyboard:void 0===(null===(h=e.interaction)||void 0===h?void 0:h.keyboard)||e.interaction.keyboard},animation:normalizeAnimation(e.animation),margin:_objectSpread2(_objectSpread2({},N),e.margin||{})};v.series=e.series,v.title=e.title,v.xAxis=e.xAxis||{},v.yAxis=e.yAxis||{},v.dataZoom=e.dataZoom||null,v.theme=e.theme,v.aspect="equal"===e.aspect?"equal":"auto",v.polarGrid=e.polarGrid||null,v.annotation=normalizeAnnotation(e.annotation),v.tooltip=_objectSpread2({show:!1!==(null===(u=e.tooltip)||void 0===u?void 0:u.show)},v.tooltip),v.crosshair=_objectSpread2({show:!1!==(null===(c=e.crosshair)||void 0===c?void 0:c.show)},v.crosshair);for(var m=e.radar||null,g=e.graph||null,b=function buildSeries(e,t,i,r,n,a,o){for(var s=[],l={},h=function _loop(i){var h=e[i];if(!h||!h.type)throw new Error("[ice-chart] series[".concat(i,"] 缺少 type。"));var u=h.name;u||(u="series-".concat(i+1)),void 0!==l[u]?(l[u]+=1,u="".concat(u," (").concat(l[u],")")):l[u]=0;var c=h.id||"series-".concat(i),d=h.color||t.colorPalette[i%t.colorPalette.length];if(h.virtual){var f=o&&o.virtualColumns?o.virtualColumns:null,p=f?f.get(c):void 0,v={id:c,index:i,type:h.type,name:u,color:d,points:[],virtual:!0,hasExplicitX:!0,hidden:!1,axisIndex:0},m=p&&"raw"in p&&(void 0===h.data||p.raw.data===h.data)?p.raw:null,g=!m&&p&&void 0===h.data?p:null,b=function takeLean(){var t=_objectSpread2(_objectSpread2({},h),{},{data:void 0});return e[i]=t,t};if(m)return s.push(_objectSpread2(_objectSpread2({},v),{},{option:h,raw:m,pointCount:m.length},rawAccessors(m))),0;if(g&&"ring"in g){var k=g.ring;return s.push(_objectSpread2(_objectSpread2({},v),{},{option:h,ring:k,pointCount:k.length},function ringAccessors(e){var t=function yAt(t){if(t<0||t>=e.length)return null;var i=ringYAt(e,t);return Number.isNaN(i)?null:i};return{pointAt:function pointAt(i){var r=t(i);return{index:i,xValue:ringXAt(e,i),y:r,raw:void 0,base:0,top:null===r?0:r,name:void 0}},xValueAt:function xValueAt(t){return t<0||t>=e.length?void 0:ringXAt(e,t)},yValueAt:t,baseAt:function baseAt(){return 0},topAt:function topAt(e){var i=t(e);return null===i?0:i},sizeAt:function sizeAt(){}}}(k))),0}if(g&&"chunks"in g){var S=g.chunks;return s.push(_objectSpread2(_objectSpread2({},v),{},{option:h,chunks:S,pointCount:S.total},chunkAccessors(S))),0}if(g&&"grid"in g){var A=g.grid;return s.push(_objectSpread2(_objectSpread2({},v),{},{option:h,grid:A,pointCount:A.values.length},gridAccessors(A))),0}if(g&&"columns"in g){var w=g.columns;return s.push(_objectSpread2(_objectSpread2({},v),{},{option:h,columns:w,pointCount:w.y.length},columnAccessors(w))),0}if("heatmap"===h.type){var M=function buildVirtualGrid(e,t){var i=function fail(e){throw new Error("[ice-chart] series[".concat(t,"].virtual ").concat(e))},r=e.data,n=[],a=[],o=null,s=0,l=!1;if(r&&!Array.isArray(r)&&"object"===_typeof(r)&&void 0!==r.values){var h=r;Array.isArray(h.xCategories)&&n.push.apply(n,_toConsumableArray(h.xCategories)),Array.isArray(h.yCategories)&&a.push.apply(a,_toConsumableArray(h.yCategories));var u=n.length,c=a.length;u&&c||i("的矩阵需要非空的 xCategories / yCategories。");var d=u*c,f=Number(h.values.length)||0;f!==d&&i("的 values 长度(".concat(f,")应等于 ").concat(u," × ").concat(c," = ").concat(d,"。")),o=h.values instanceof Float64Array?h.values:Float64Array.from(h.values,function(e){return null==e?NaN:Number(e)}),s=d}else if(Array.isArray(r)){l=!0;for(var p=new Map,v=new Map,m=[],g=0;g<r.length;g++){var b=r[g];if(Array.isArray(b)&&!(b.length<3)){var k=p.get(b[0]);void 0===k&&(k=n.length,p.set(b[0],k),n.push(b[0]));var S=v.get(b[1]);void 0===S&&(S=a.length,v.set(b[1],S),a.push(b[1]));var A=toNumber(b[2]);null!==A&&(m.push({col:k,row:S,value:A}),s+=1)}}var w=n.length,M=a.length;w&&M||i("的矩阵是空的(没有可用的 [x类目, y类目, 值] 数据项)。"),o=new Float64Array(w*M).fill(NaN);for(var _=0,C=m;_<C.length;_++){var P=C[_];o[P.row*w+P.col]=P.value}}else i("需要 data(矩阵 { xCategories, yCategories, values } 或 [x类目, y类目, 值] 数组)。");var T=n.length,I=a.length;l&&s/Math.max(1,T*I)<O&&i("的矩阵太稀疏(".concat(s,"/").concat(T*I," 格有值):虚拟热力图按稠密矩阵存,")+"稀疏数据请用普通路径(去掉 virtual)。");for(var N=o,D=new Map,R=new Map,H=0;H<T;H++)D.set(n[H],H);for(var z=0;z<I;z++)R.set(a[z],z);for(var V=1/0,E=-1/0,B=0;B<N.length;B++){var L=N[B];Number.isNaN(L)||(L<V&&(V=L),L>E&&(E=L))}return{xCategories:n,yCategories:a,values:N,xIndex:D,yIndex:R,valueDomain:isFinite(V)?[V,E]:null}}(h,i);return f&&f.set(c,{grid:M}),s.push(_objectSpread2(_objectSpread2({},v),{},{option:b(),grid:M,pointCount:M.values.length},gridAccessors(M))),0}if(function isChunkedInput(e){return!!e&&!Array.isArray(e)&&"object"===_typeof(e)&&Array.isArray(e.sizes)&&"function"==typeof e.loadChunk}(h.data)){var _=function buildVirtualChunks(e,t){var i=function fail(e){throw new Error("[ice-chart] series[".concat(t,"].virtual ").concat(e))},r=e.sizes;r.length||i("的分块需要至少一块(sizes 为空)。");var n,a=_createForOfIteratorHelper(r);try{for(a.s();!(n=a.n()).done;){var o=n.value;(!isFinite(Number(o))||Number(o)<=0)&&i("的 sizes 必须是正数(收到 ".concat(JSON.stringify(o),")。"))}}catch(e){a.e(e)}finally{a.f()}"function"!=typeof e.rangeOf&&i("的分块需要 rangeOf(i) 声明每块的 x 范围(否则窗口定位要先把块 load 一遍)。");var s=e.yDomain;Array.isArray(s)&&2===s.length&&s.every(function(e){return isFinite(Number(e))})||i("的分块需要声明式 yDomain: [min, max](亿级数据不能为了自动缩放把块全加载一遍)。");return function createChunks(e){var t,i=e.sizes.map(function(e){return Math.max(0,Math.floor(e)||0)}),r=[],n=0,a=_createForOfIteratorHelper(i);try{for(a.s();!(t=a.n()).done;){var o=t.value;r.push(n),n+=o}}catch(e){a.e(e)}finally{a.f()}var s=i.map(function(t,i){return e.rangeOf(i)}),l=s.filter(function(e){return!!e});return{kind:"chunks",sizes:i,offsets:r,total:n,ranges:s,resident:i.map(function(){return null}),loading:new Set,maxResident:Math.max(1,Math.floor(e.maxResidentChunks||4)),lru:[],load:e.load,xDomain:l.length?[Math.min.apply(Math,_toConsumableArray(l.map(function(e){return e[0]}))),Math.max.apply(Math,_toConsumableArray(l.map(function(e){return e[1]})))]:[0,1],yDomain:e.yDomain,xMonotonic:!0,sizeExtent:null}}({sizes:r.map(function(e){return Number(e)}),load:function load(t){var n=e.loadChunk(t),a=function normalize(e){e&&"object"===_typeof(e)&&void 0!==e.x&&void 0!==e.y||i("的 loadChunk(".concat(t,") 必须返回 { x, y }。"));for(var n=void 0===r[t]?0:Number(r[t]),a=e.x instanceof Float64Array?e.x:Float64Array.from(e.x,function(e){return Number(e)}),o=new Float64Array(n),s=0;s<n;s++){var l=e.y[s];o[s]=null==l||""===l?NaN:Number(l)}return a.length!==n&&i("的 loadChunk(".concat(t,") 返回了 ").concat(a.length," 个 x,但 sizes[").concat(t,"] 是 ").concat(n,"。")),{x:a,y:o}};return n&&"function"==typeof n.then?n.then(a):a(n)},rangeOf:e.rangeOf,yDomain:[Number(s[0]),Number(s[1])],maxResidentChunks:e.maxResidentChunks})}(h.data,i);return f&&f.set(c,{chunks:_}),s.push(_objectSpread2(_objectSpread2({},v),{},{option:b(),chunks:_,pointCount:_.total},chunkAccessors(_))),0}if(function isColumnarVirtualType(e){return"scatter"===e||"line"===e||"area"===e||"heatmap"===e}(h.type)){var C=function buildVirtualColumns(e,t){var i=function fail(e){throw new Error("[ice-chart] series[".concat(t,"].virtual ").concat(e))};"scatter"!==e.type&&"line"!==e.type&&"area"!==e.type&&i("目前只支持散点 / 折线 / 面积(scatter / line / area),收到 type: '".concat(e.type,"'。"));e.stack&&i("不支持堆叠(stack)。");var r=e.data,n=0,a=null,o=null,s=null,l=null,h=null,u=null;if(r&&!Array.isArray(r)&&"object"===_typeof(r)&&void 0!==r.x){var c=r;n=Number(c.y.length)||0,Number(c.x.length)!==n&&i("的 x / y 长度不一致(".concat(c.x.length," vs ").concat(c.y.length,")。")),a=function readX(e){return c.x[e]},o=function readY(e){return c.y[e]},s=c.size?function(e){return c.size[e]}:null,l=c.x instanceof Float64Array?c.x:null,h=c.y instanceof Float64Array?c.y:null,u=c.size instanceof Float64Array?c.size:null}else Array.isArray(r)?(n=r.length,a=function readX(e){return Array.isArray(r[e])?r[e][0]:e},o=function readY(e){return Array.isArray(r[e])?r[e][1]:r[e]},s=function readSize(e){return Array.isArray(r[e])&&r[e].length>2?r[e][2]:void 0}):i("需要 data(列式 { x, y }、元组数组或数值数组)。");var d=l&&l.length===n?l:new Float64Array(n),f=h&&h.length===n?h:new Float64Array(n);a&&o||i("的数据无法解析。");if(l&&l.length===n)for(var p=0;p<n;p++)isFinite(d[p])||i("需要数值型 x(第 ".concat(p," 项是 ").concat(JSON.stringify(d[p]),")。"));else for(var v=0;v<n;v++){var m=Number(a(v));isFinite(m)||i("需要数值型 x(第 ".concat(v," 项是 ").concat(JSON.stringify(a(v)),")。")),d[v]=m}for(var g=!1,b=u&&u.length===n?u:new Float64Array(n).fill(NaN),k=0;k<n;k++){var S=s?s(k):void 0;if(null!=S&&""!==S){var A=Number(S);isFinite(A)&&(b[k]=A,g=!0)}var w=toNumber(o(k));f[k]=null===w?NaN:w}for(var M=1/0,_=-1/0,C=1/0,P=-1/0,T=1/0,I=-1/0,N=!0,D=-1/0,O=0;O<n;O++){var R=d[O];R<M&&(M=R),R>_&&(_=R),R<D&&(N=!1),D=R;var H=f[O];Number.isNaN(H)||(H<C&&(C=H),H>P&&(P=H));var z=b[O];Number.isNaN(z)||(z<T&&(T=z),z>I&&(I=z))}isFinite(M)||(M=0,_=1);return{kind:"columns",x:d,y:f,size:g?b:null,xDomain:[M,_],yDomain:isFinite(C)?[C,P]:null,xMonotonic:N,sizeExtent:g?T===I?[T,T+1]:[T,I]:null}}(h,i);return f&&f.set(c,{columns:C}),s.push(_objectSpread2(_objectSpread2({},v),{},{option:b(),columns:C,pointCount:C.y.length},columnAccessors(C))),0}var P=function buildVirtualRawPoints(e,t){for(var i=Array.isArray(e.data)?e.data:[],r=i.length,n={type:e.type,xField:e.xField,yField:e.yField},a=1/0,o=-1/0,s=1/0,l=-1/0,h=1/0,u=-1/0,c=!0,d=-1/0,f=!1,p=0;p<r;p++){var v=readGenericPoint(i[p],p,n),m=Number(v.xValue);isFinite(m)?(m<a&&(a=m),m>o&&(o=m),m<d&&(c=!1),d=m):c=!1,null!==v.y&&(v.y<s&&(s=v.y),v.y>l&&(l=v.y)),"number"==typeof v.size&&isFinite(v.size)&&(f=!0,v.size<h&&(h=v.size),v.size>u&&(u=v.size))}isFinite(a)||(a=0,o=Math.max(0,r-1));return{kind:"raw",data:i,start:0,length:r,capacity:0,type:e.type,xField:e.xField,yField:e.yField,xDomain:[a,o],yDomain:isFinite(s)?[s,l]:null,xMonotonic:c,sizeExtent:f?h===u?[h,h+1]:[h,u]:null}}(h);return f&&f.set(c,{raw:P}),s.push(_objectSpread2(_objectSpread2({},v),{},{option:h,raw:P,pointCount:P.length},rawAccessors(P))),0}var T=function buildPoints(e,t,i,r,n){var a=Array.isArray(e.data)?e.data:[];if(!Array.isArray(e.data)&&e.data&&"object"===_typeof(e.data))throw new Error("[ice-chart] series 的列式 data({ x, y })需要配 virtual: true(当前 type: '".concat(e.type,"')。"));var o=[],s=!1;if("function"===e.type||"parametric"===e.type)return function buildCurvePoints(e,t){var i=[],r=e.params||{},n="function"===e.type,a=void 0===e.polarExpression||null===e.polarExpression?"":String(e.polarExpression).trim(),o=!n&&""!==a,s=n?String(e.expression||""):o?a:String(e.xExpression||""),l=n||o?"":String(e.yExpression||""),h=null,u=null;try{h=compileExpression(s),n||o||(u=compileExpression(l))}catch(e){h=null,u=null}var c=n?[-10,10]:[0,2*Math.PI],d=Array.isArray(e.domain)&&e.domain.length>=2?e.domain:null,f=d?Number(d[0]):c[0],p=d?Number(d[1]):c[1];if(n&&t&&Array.isArray(t.xDomain)&&t.xDomain.length>=2){var v=Number(t.xDomain[0]),m=Number(t.xDomain[1]);isFinite(v)&&isFinite(m)&&m>v&&(f=v,p=m)}isFinite(f)&&isFinite(p)&&p!==f||(f=c[0],p=c[1]);for(var g=Number(e.samples),b=Math.max(24,Math.min(6e3,isFinite(g)&&g>0?Math.round(g):n?240:360)),k=_objectSpread2({},r),S=n?"x":"t",A=0;A<b;A++){var w=f+(p-f)*A/(b-1);k[S]=w;var M=w,_=NaN,C=NaN;h&&(n?_=h.evaluate(k):o?(M=(C=h.evaluate(k))*Math.cos(w),_=C*Math.sin(w)):u&&(M=h.evaluate(k),_=u.evaluate(k)));var P=isFinite(M)&&isFinite(_);i.push({index:A,xValue:w,y:P?_:null,raw:n?{x:w,y:_}:o?{t:w,x:M,y:_,r:C}:{t:w,x:M,y:_},base:0,top:P?_:0,name:n?s:o?"r = ".concat(s):"(".concat(s,", ").concat(l,")")})}return{points:i,hasExplicitX:!0}}(e,n);if("graph"===e.type&&r){for(var l=Array.isArray(r.nodes)?r.nodes:[],h=Array.isArray(r.links)?r.links:[],u=function indexOf(e){return"number"==typeof e?e:l.findIndex(function(t){return t.id===e||t.name===e})},c=0;c<l.length;c++){var d=l[c],f=toNumber(d.value);o.push({index:c,xValue:d.name,y:f,raw:d,base:0,top:null===f?0:f,name:d.name})}for(var p=0;p<h.length;p++){var v=h[p],m=u(v.source),g=u(v.target),b="".concat(m>=0?l[m].name:String(v.source)," → ").concat(g>=0?l[g].name:String(v.target)),k=toNumber(v.value);o.push({index:l.length+p,xValue:b,y:null===k?1:k,raw:{__graphLink:!0,source:v.source,target:v.target,value:v.value},base:0,top:null===k?1:k,name:b})}return{points:o,hasExplicitX:!0}}if("sankey"===e.type&&i){var S,A=Array.isArray(i.nodes)?i.nodes:[],w=Array.isArray(i.links)?i.links:[],M=new Array(A.length).fill(0),_=new Array(A.length).fill(0),C=function _indexOf(e){return"number"==typeof e?e:A.findIndex(function(t){return t.name===e})},P=_createForOfIteratorHelper(w);try{for(P.s();!(S=P.n()).done;){var T=S.value,I=C(T.source),N=C(T.target),D=Number(T.value)||0;I>=0&&(_[I]+=D),N>=0&&(M[N]+=D)}}catch(e){P.e(e)}finally{P.f()}for(var O=M.map(function(e,t){return Math.max(e,_[t])}),R=0;R<A.length;R++){var H=A[R];o.push({index:R,xValue:H.name,y:O[R],raw:H,base:0,top:O[R],name:H.name})}for(var z=0;z<w.length;z++){var V=w[z],E=C(V.source),B=C(V.target),L="".concat(E>=0?A[E].name:String(V.source)," → ").concat(B>=0?A[B].name:String(V.target));o.push({index:A.length+z,xValue:L,y:Number(V.value)||0,raw:{__sankeyLink:!0,source:V.source,target:V.target,value:V.value},base:0,top:Number(V.value)||0,name:L})}return{points:o,hasExplicitX:!0}}if("radar"===e.type&&t&&Array.isArray(t.indicators)){for(var j=0;j<t.indicators.length;j++){var W=t.indicators[j],X=a[j],U=X&&"object"===_typeof(X)&&!Array.isArray(X)&&void 0!==X.value?toNumber(X.value):toNumber(X);o.push({index:j,xValue:W.name,y:U,raw:X,base:0,top:null===U?0:U,name:W.name})}return{points:o,hasExplicitX:!0}}if("heatmap"===e.type){for(var G=0;G<a.length;G++){var K=a[G];if(!Array.isArray(K)||K.length<3)o.push({index:G,xValue:G,y:null,raw:K,base:0,top:0});else{var Y=toNumber(K[2]);s=!0,o.push({index:G,xValue:K[0],y:Y,raw:K,base:0,top:null===Y?0:Y,name:String(K[1])})}}return{points:o,hasExplicitX:s}}if("boxplot"===e.type){for(var q=0;q<a.length;q++){var $=a[q],Z=Array.isArray($)?$.map(function(e){return Number(e)}):null;if(Z&&Z.length){var J=5===Z.length?[Z[0],Z[1],Z[2],Z[3],Z[4]]:computeBoxplotSummary(Z);s=!0,o.push({index:q,xValue:q,y:J[2],raw:$,base:0,top:J[2],boxplot:J})}else o.push({index:q,xValue:q,y:null,raw:$,base:0,top:0})}return{points:o,hasExplicitX:s}}if("waterfall"===e.type){for(var Q=0;Q<a.length;Q++){var ee=a[Q],te=null,ie=void 0;if("number"==typeof ee)te=toNumber(ee);else if(ee&&"object"===_typeof(ee)&&!Array.isArray(ee)){var re=ee;te=toNumber(void 0===re.value?re.y:re.value),void 0!==re.name&&(ie=String(re.name))}else te=toNumber(ee);s=!0,o.push({index:Q,xValue:void 0===ie?Q:ie,y:te,raw:ee,base:0,top:null===te?0:te,name:ie})}return{points:o,hasExplicitX:s}}if("treemap"===e.type){var ne=[],ae=function visit(e,t){var i,r=_createForOfIteratorHelper(e.slice().sort(function(e,t){return treemapNodeValue(t)-treemapNodeValue(e)}));try{for(r.s();!(i=r.n()).done;){var n=i.value;ne.push({node:n,depth:t}),Array.isArray(n&&n.children)&&n.children.length&&ae(n.children,t+1)}}catch(e){r.e(e)}finally{r.f()}};Array.isArray(e.data)&&ae(e.data,0);for(var oe=0;oe<ne.length;oe++){var se=ne[oe].node,le=treemapNodeValue(se);o.push({index:oe,xValue:se&&void 0!==se.name?se.name:oe,y:le,raw:se,base:0,top:le,name:se&&void 0!==se.name?String(se.name):String(oe)})}return{points:o,hasExplicitX:!0}}for(var he=0;he<a.length;he++){var ue=a[he],ce=readGenericPoint(ue,he,e);ce.explicitX&&(s=!0),o.push({index:he,xValue:ce.xValue,y:ce.y,raw:ue,base:0,top:null===ce.y?0:ce.y,name:ce.name,size:ce.size})}return{points:o,hasExplicitX:s}}(h,r,n,a,o),I=T.points,N=T.hasExplicitX;if("pie"===h.type)for(var D=0;D<I.length;D++){var R=I[D].raw,H=R&&"object"===_typeof(R)&&!Array.isArray(R)?R.color:void 0;I[D].color=H||(0===D&&h.color?h.color:t.colorPalette[D%t.colorPalette.length])}var z=_objectSpread2(_objectSpread2({id:c,index:i,type:h.type,name:u,color:d,option:h,points:I,virtual:!1,pointCount:I.length},function arrayAccessors(e){return{pointAt:function pointAt(t){return e[t]},xValueAt:function xValueAt(t){return e[t].xValue},yValueAt:function yValueAt(t){return e[t].y},baseAt:function baseAt(t){return e[t].base},topAt:function topAt(t){return e[t].top},sizeAt:function sizeAt(t){return e[t].size}}}(I)),{},{hasExplicitX:N,hidden:!1,axisIndex:0});!function applyCurveDomain(e,t,i){if("function"!==t.type&&"parametric"!==t.type)return;for(var r=[],n=[],a=0,o=e.pointCount;a<o;a++){var s=e.pointAt(a).raw;s&&"object"===_typeof(s)&&("number"==typeof s.x&&n.push(s.x),"number"==typeof s.y&&r.push(s.y))}var l=r.filter(function(e){return isFinite(e)});l.length&&(e.domainValues=robustRange(l));if("parametric"===t.type){var h=n.filter(function(e){return isFinite(e)});h.length&&(e.domainXValues=[Math.min.apply(Math,_toConsumableArray(h)),Math.max.apply(Math,_toConsumableArray(h))])}var u=t.params||{},c=[];if("function"===t.type)c=diagnoseExpression(String(t.expression||""),{variable:"x",params:u,values:r});else if(void 0!==t.polarExpression&&null!==t.polarExpression&&""!==String(t.polarExpression).trim()){for(var d=[],f=0,p=e.pointCount;f<p;f++){var v=e.pointAt(f).raw;v&&"object"===_typeof(v)&&"number"==typeof v.r&&d.push(v.r)}c=diagnoseExpression(String(t.polarExpression),{variable:"t",params:u,values:d}).map(function(e){return _objectSpread2(_objectSpread2({},e),{},{message:"r(θ):".concat(e.message)})})}else{var m=String(t.xExpression||""),g=String(t.yExpression||""),b=expressionVariables(m),k=expressionVariables(g),S=function withPrefix(e,t){return e.map(function(e){return _objectSpread2(_objectSpread2({},e),{},{message:"".concat(t,":").concat(e.message)})})};c=[].concat(_toConsumableArray(S(diagnoseExpression(m,{variable:"t",params:u,values:n,additionalVariables:k}),"x(t)")),_toConsumableArray(S(diagnoseExpression(g,{variable:"t",params:u,values:r,additionalVariables:b}),"y(t)")))}if(c.length){e.expressionDiagnostics=c;var A=c.find(function(e){return"error"===e.severity});A&&(e.expressionError=A.message)}}(z,h),s.push(z)},u=0;u<e.length;u++)h(u);return s}(e.series,p,null===(d=v.legend)||void 0===d||d.selected,m,e.sankey||null,g,f),k=0,S=b;k<S.length;k++){var A=S[k];if("waterfall"===A.type){var w=A.option.waterfall,M=void 0!==w?w:e.waterfall;void 0!==M&&(A.waterfallOption=M)}}for(var _=_objectSpread2({},f.hiddenIds||{}),C=0,P=b;C<P.length;C++){var T,I=P[C];null!==(T=v.legend)&&void 0!==T&&T.selected&&!1===v.legend.selected[I.name]&&(_[I.id]=!0),I.hidden=!!_[I.id]||!1===I.option.show}var D=b.some(function(e){return"pie"===e.type})?"polar":b.some(function(e){return"radar"===e.type})?"radar":b.some(function(e){return"sankey"===e.type})?"sankey":b.some(function(e){return"funnel"===e.type})?"funnel":b.some(function(e){return"gauge"===e.type})?"gauge":b.some(function(e){return"liquid"===e.type})?"liquid":b.some(function(e){return"treemap"===e.type})?"treemap":b.some(function(e){return"graph"===e.type})?"graph":"cartesian",R="sankey"===D&&e.sankey||null,H="funnel"===D?e.funnel||{}:null,z="gauge"===D?e.gauge||{}:null,V="liquid"===D?e.liquid||{}:null,E="treemap"===D?e.treemap||{}:null,B="graph"===D?g:null,L=_objectSpread2({},f.hiddenSlices||{}),j=m?function buildRadarDomains(e,t){for(var i=[],r=Array.isArray(e.indicators)?e.indicators.length:0,n=0;n<r;n++){var a,o=e.indicators[n]||{name:String(n)},s=-1/0,l=_createForOfIteratorHelper(t);try{for(l.s();!(a=l.n()).done;){var h=a.value;if("radar"===h.type&&!h.hidden){var u=h.pointAt(n);u&&null!==u.y&&u.y>s&&(s=u.y)}}}catch(e){l.e(e)}finally{l.f()}isFinite(s)||(s=1);var c=isFiniteNumber(o.min)?o.min:0,d=isFiniteNumber(o.max)?o.max:s;i.push([c,d>c?d:c+1])}return i}(m,b):[];"cartesian"===D||e.tooltip&&void 0!==e.tooltip.trigger||(v.tooltip.trigger="item");var W=v.xAxis;"value"===W.type&&(W.type="linear");var X=Array.isArray(e.yAxis)?e.yAxis:[e.yAxis||{}];X.length||X.push({});var U,G=_createForOfIteratorHelper(X);try{for(G.s();!(U=G.n()).done;){var K=U.value;"value"===K.type&&(K.type="linear")}}catch(e){G.e(e)}finally{G.f()}for(var Y=0,q=b;Y<q.length;Y++){var $=q[Y],Z=Number($.option.yAxisIndex);$.axisIndex=isFinite(Z)?Math.max(0,Math.min(X.length-1,Math.floor(Z))):0}var J=function isHorizontalLayout(e,t){var i="category"===t.type||Array.isArray(t.data)&&t.data.length>0;return!!i&&!("category"===e.type||Array.isArray(e.data)&&e.data.length>0)}(W,X[0]);!J||e.tooltip&&void 0!==e.tooltip.trigger||(v.tooltip.trigger="item"),function applyAxisCategories(e,t){if(!e||!Array.isArray(e.data)||!e.data.length)return;var i,r=e.data,n=_createForOfIteratorHelper(t);try{for(n.s();!(i=n.n()).done;){var a=i.value;if(!a.virtual)for(var o=0,s=a.pointCount;o<s;o++){var l=a.pointAt(o);l.xValue===l.index&&(void 0!==r[l.index]&&(l.xValue=r[l.index],void 0===l.name&&(l.name=String(r[l.index]))))}}}catch(e){n.e(e)}finally{n.f()}}(J?X[0]:W,b);var Q,ee,te=J?W.type&&"category"!==W.type?W.type:"linear":function resolveXAxisType(e,t){if(e.type)return e.type;if(t.some(function(e){return"bar"===e.type||"heatmap"===e.type||"boxplot"===e.type||"waterfall"===e.type}))return"category";var i,r=[],n=_createForOfIteratorHelper(t);try{for(n.s();!(i=n.n()).done;)for(var a=i.value,o=0,s=a.pointCount;o<s&&(r.push(a.xValueAt(o)),!(r.length>2e3));o++);}catch(e){n.e(e)}finally{n.f()}if(r.some(function(e){return e instanceof Date}))return"time";if(r.some(function(e){return"number"==typeof e&&Math.abs(e)>1e11}))return"time";if(r.some(function(e){return"string"==typeof e&&!isFinite(Number(e))}))return"category";return"linear"}(W,b),ie=b.some(function(e){return!!(e.columns||e.ring||e.chunks)});if(ie&&("category"===te||J))throw new Error("[ice-chart] 虚拟(列存)系列只支持数值型 x 轴(xAxis.type 不要写 category)。");if(b.some(function(e){return e.grid})){if("category"!==te)throw new Error("[ice-chart] 虚拟(列存)热力图的 x 轴必须是类目轴(xAxis.type: 'category')。");var re=X[0]&&X[0].type;if(void 0!==re&&"category"!==re)throw new Error("[ice-chart] 虚拟(列存)热力图的 y 轴必须是类目轴(yAxis.type 不要写别的)。")}if(J){Q=buildYDomain(b,0,W,te),ee=[];var ne=function buildCategoryValues(e,t){if(Array.isArray(e.data)&&e.data.length)return e.data.slice();var i,r={},n=[],a=_createForOfIteratorHelper(t);try{for(a.s();!(i=a.n()).done;)for(var o=i.value,s=0,l=o.pointCount;s<l;s++){var h=o.pointAt(s),u=void 0===h.name?h.xValue:h.name,c=String(u);r[c]||(r[c]=!0,n.push(u))}}catch(e){a.e(e)}finally{a.f()}return n}(X[0],b);X[0]=_objectSpread2(_objectSpread2({},X[0]),{},{type:"category"}),X[0].__categories=ne}else{var ae=function buildXDomain(e,t,i){if("category"===e){var r=t.find(function(e){return e.grid});if(r&&r.grid)return{domain:r.grid.xCategories.slice(),categories:r.grid.xCategories.slice()};if(Array.isArray(i.data)&&i.data.length)return{domain:i.data.slice(),categories:i.data.slice()};var n,a={},o=[],s=_createForOfIteratorHelper(t);try{for(s.s();!(n=s.n()).done;)for(var l=n.value,h=0,u=l.pointCount;h<u;h++){var c=l.xValueAt(h),d=String(c);a[d]||(a[d]=!0,o.push(c))}}catch(e){s.e(e)}finally{s.f()}return{domain:o,categories:o}}var f,p=[],v=_createForOfIteratorHelper(t);try{for(v.s();!(f=v.n()).done;){var m=f.value,g=storeDomainOf(m);if(g)p.push(g.xDomain[0],g.xDomain[1]);else if(m.domainXValues&&m.domainXValues.length){var b,k=_createForOfIteratorHelper(m.domainXValues);try{for(k.s();!(b=k.n()).done;){var S=b.value;isFinite(S)&&p.push(S)}}catch(e){k.e(e)}finally{k.f()}}else for(var A=0,w=m.pointCount;A<w;A++){var M=m.xValueAt(A),_="time"===e?toTimestamp(M):Number(M);isFinite(_)&&p.push(_)}}}catch(e){v.e(e)}finally{v.f()}var C=_slicedToArray(extent(p),2),P=C[0],T=C[1],I=isFiniteNumber(i.min),N=isFiniteNumber(i.max);I&&(P=i.min);N&&(T=i.max);if(!1!==i.nice){var D=_slicedToArray(niceDomain([P,T],i.tickCount||5),2);P=D[0],T=D[1]}if("log"!==e){var O=_slicedToArray(padDomain(P,T,i,I,N),2);P=O[0],T=O[1]}return{domain:[P,T],categories:[]}}(te,b,W);Q=ae.domain,ee=ae.categories}var oe=function resolveXDomain(e,t,i){if(!i)return t;if("category"!==e)return[i[0],i[1]];var r=t.indexOf(i[0]),n=t.indexOf(i[1]);return r>=0&&n>=r?t.slice(r,n+1):t}(te,Q,f.xDomain);!function applyStacking(e){var t,i={},r=_createForOfIteratorHelper(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(!n.virtual)if(n.option.stack){var a="".concat(n.axisIndex,"::").concat(n.option.stack);(i[a]=i[a]||[]).push(n)}else for(var o=0,s=n.pointCount;o<s;o++){var l=n.pointAt(o);l.base=0,l.top=null===l.y?0:l.y}}}catch(e){r.e(e)}finally{r.f()}for(var h in i){var u,c={},d=_createForOfIteratorHelper(i[h]);try{for(d.s();!(u=d.n()).done;)for(var f=u.value,p=0,v=f.pointCount;p<v;p++){var m=f.pointAt(p),g=String(m.xValue),b=c[g]||0,k=null===m.y?0:m.y;m.base=b,m.top=b+k,c[g]=m.top}}catch(e){d.e(e)}finally{d.f()}}}(b),function applyWaterfall(e){var t,i=_createForOfIteratorHelper(e);try{for(i.s();!(t=i.n()).done;){var r=t.value;if("waterfall"===r.type&&!r.virtual)for(var n=0,a=0,o=r.pointCount;a<o;a++){var s=r.pointAt(a),l=s.raw,h=!(!l||"object"!==_typeof(l)||Array.isArray(l)||!l.total),u=s.y||0;h?(s.base=0,s.top=n):(s.base=n,s.top=n+u,n+=u)}}}catch(e){i.e(e)}finally{i.f()}}(b);var se={option:W,type:te,domain:oe,scale:null,index:0,position:"left"},le=b.some(function(e){return"heatmap"===e.type}),he=X.map(function(e,t){if(J&&0===t)return{option:e,type:"category",domain:e.__categories||[],scale:null,index:t,position:e.position||"left"};if(le&&(void 0===e.type||"category"===e.type)){for(var i={},r=[],n=0,a=b;n<a.length;n++){var o=a[n];if("heatmap"===o.type)if(o.grid){var s,l=_createForOfIteratorHelper(o.grid.yCategories);try{for(l.s();!(s=l.n()).done;){var h=s.value,u=String(h);i[u]||(i[u]=!0,r.push(h))}}catch(e){l.e(e)}finally{l.f()}}else for(var c=0,d=o.pointCount;c<d;c++){var p=o.pointAt(c),v=String(void 0===p.name?p.xValue:p.name);i[v]||(i[v]=!0,r.push(void 0===p.name?p.xValue:p.name))}}return{option:e,type:"category",domain:r,scale:null,index:t,position:e.position||(0===t?"left":"right")}}var m=e.type||"linear",g=f.yDomains?f.yDomains[t]:0===t?f.yDomain:null;return{option:e,type:m,domain:g||buildYDomain(b,t,e,m),scale:null,index:t,position:e.position||(0===t?"left":"right")}}),ue=he[0];return function applyEqualAspect(e,t,i,r){if("equal"!==e.aspect||"cartesian"!==t)return;if("category"===i.type)return;var n=r[0];if(!n||"category"===n.type)return;var a=Number(i.domain[0]),o=Number(i.domain[1]),s=Number(n.domain[0]),l=Number(n.domain[1]);if(![a,o,s,l].every(function(e){return isFinite(e)}))return;var h=Math.abs(o-a),u=Math.abs(l-s),c=Math.max(h,u);if(!(c>0))return;if(h<c){var d=(a+o)/2;i.domain=[d-c/2,d+c/2]}if(u<c){var f=(s+l)/2;n.domain=[f-c/2,f+c/2]}}(e,D,se,he),{labels:_objectSpread2({chart:"图表",sector:"扇区",value:"数值",ratio:"占比",indicator:"指标",coordinate:"坐标",liquid:"水位",slice:"切片"},e.labels||{}),kind:D,orientation:J?"horizontal":"vertical",radar:m,sankey:R,funnel:H,gauge:z,liquid:V,treemap:E,graph:B,radarDomains:j,option:v,theme:p,series:b,xAxis:se,yAxes:he,yAxis:ue,categories:ee,visibleSeries:b.filter(function(e){return!e.hidden}),hiddenIds:_,hiddenSlices:L}}var O=.25;function expressionVariables(e){try{return compileExpression(e).variables}catch(e){return[]}}function buildYDomain(e,t,i,r){var n,a=[],o=!1,s=_createForOfIteratorHelper(e);try{for(s.s();!(n=s.n()).done;){var l=n.value;if(!l.hidden&&l.axisIndex===t){"bar"!==l.type&&"area"!==l.type||(o=!0);var h=storeDomainOf(l);if(h)h.yDomain&&a.push(h.yDomain[0],h.yDomain[1]);else if(l.domainValues&&l.domainValues.length){var u=_slicedToArray(robustRange(l.domainValues),2),c=u[0],d=u[1];a.push(c,d)}else for(var f=0,p=l.pointCount;f<p;f++){var v=l.pointAt(f);null!==v.y&&a.push(v.y),v.boxplot&&a.push(v.boxplot[0],v.boxplot[4]),l.option.stack&&(a.push(v.base),a.push(v.top)),"waterfall"===l.type&&a.push(v.base,v.top)}}}}catch(e){s.e(e)}finally{s.f()}var m=_slicedToArray(extent(a),2),g=m[0],b=m[1];o&&(g=Math.min(g,0),b=Math.max(b,0));var k=isFiniteNumber(i.min),S=isFiniteNumber(i.max);if(k&&(g=i.min),S&&(b=i.max),!1!==i.nice&&"log"!==r){var A=_slicedToArray(niceDomain([g,b],i.tickCount||5),2);g=A[0],b=A[1]}if("log"!==r){var w=o&&!k&&Math.abs(g)<1e-12,M=o&&!S&&Math.abs(b)<1e-12,_=_slicedToArray(padDomain(g,b,i,k||w,S||M),2);g=_[0],b=_[1]}if("log"===r){var C=a.filter(function(e){return e>0});C.length?(g=Math.min.apply(Math,_toConsumableArray(C)),b=Math.max.apply(Math,_toConsumableArray(C))):(g=1,b=10),isFiniteNumber(i.min)&&i.min>0&&(g=i.min),isFiniteNumber(i.max)&&i.max>0&&(b=i.max)}return[round(g,10),round(b,10)]}function treemapNodeValue(e){if(!e)return 0;if(Array.isArray(e.children)&&e.children.length)return e.children.reduce(function(e,t){return e+treemapNodeValue(t)},0);var t=Number(e.value);return isFinite(t)&&t>0?t:0}function computeBoxplotSummary(e){var t=e.filter(function(e){return isFinite(e)}).sort(function(e,t){return e-t});if(!t.length)return[0,0,0,0,0];var i=function quantile(e){var i=(t.length-1)*e,r=Math.floor(i),n=Math.ceil(i);return r===n?t[r]:t[r]+(t[n]-t[r])*(i-r)};return[t[0],i(.25),i(.5),i(.75),t[t.length-1]]}function toSerializableOption(e){if(null==e)return e;if(Array.isArray(e))return e.map(toSerializableOption);if("function"!=typeof e){if("object"===_typeof(e)){var t={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var r=toSerializableOption(e[i]);void 0!==r&&(t[i]=r)}return t}return e}}function chartThemeToEnginePatch(e){var t=Array.isArray(e.colorPalette)&&e.colorPalette.length?e.colorPalette:["#0D6EFD"],i=function pick(e,i){return t[e]||t[0]||i};return{palette:t,chrome:{selection:{stroke:e.selection.stroke},handle:{fill:i(0,"#0D6EFD")},linkHook:{fill:i(1,"#198754")},slot:{fill:i(1,"#198754"),hoverFill:i(2,"#FFC107")},guide:{color:i(0,"#0D6EFD")},linkLabel:{background:e.tooltip.background,fill:e.tooltip.textColor},textSelection:{color:e.brush.fill},shadow:{sm:e.tooltip.shadowColor,md:e.tooltip.shadowColor,lg:e.tooltip.shadowColor}},base:{fontFamily:{base:e.fontFamily},fontSize:{md:e.fontSize}}}}function applyChartThemeToEngine(e,t){if(!e||"function"!=typeof e.setTheme)throw new Error("applyChartThemeToEngine(ice, theme) 需要一个 ICE 实例");var i=chartThemeToEnginePatch(t);return"function"==typeof e.setThemePatch?e.setThemePatch("ice-chart",i):e.setTheme(i),e}function formatNumberTick(e,t){if(!isFinite(e))return String(e);var i=Math.abs(e);if(0!==i&&(i>=1e9||i<1e-4))return e.toExponential(1);var r=0;t>0&&t<1?r=Math.min(6,Math.ceil(-Math.log10(t))):Number.isInteger(e)||(r=2);var n=e.toFixed(r),a=_slicedToArray((r>0?n.replace(/\.?0+$/,""):n).split("."),2),o=a[0],s=a[1],l=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");return s?"".concat(l,".").concat(s):l}function formatTick(e,t,i,r){if("function"==typeof r){var n=r(e,i);return null==n?"":String(n)}return"time"===t.type?t.format(e,i):"linear"===t.type||"log"===t.type?formatNumberTick(Number(e),function tickStep(e){for(var t=e.ticks(5),i=1/0,r=1;r<t.length;r++){var n=Math.abs(Number(t[r])-Number(t[r-1]));n>0&&n<i&&(i=n)}return isFinite(i)?i:0}(t)):String(e)}var R=function(){function LinearScale(e,t){_classCallCheck(this,LinearScale),_defineProperty(this,"type","linear"),this.domain=function normalize(e){var t=Number(e[0]),i=Number(e[1]);if(t===i){var r=Math.abs(t)>1?.1*Math.abs(t):1;return[t-r,i+r]}return[t,i]}(e),this.range=t}return _createClass(LinearScale,[{key:"map",value:function map(e){var t=Number(e);if(!isFinite(t))return NaN;var i=_slicedToArray(this.domain,2),r=i[0],n=i[1],a=_slicedToArray(this.range,2),o=a[0];return o+(t-r)/(n-r)*(a[1]-o)}},{key:"invert",value:function invert(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=_slicedToArray(this.range,2),a=n[0],o=n[1];return o===a?i:i+(e-a)/(o-a)*(r-i)}},{key:"ticks",value:function ticks(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=niceStep(r-i,e),a=[],o=Math.ceil(i/n)*n;o<=r+1e-6*n&&a.length<1e3;o+=n)a.push(round(o));return a}},{key:"bandwidth",value:function bandwidth(){return 0}},{key:"bandStart",value:function bandStart(e){return this.map(e)}},{key:"step",value:function step(){var e=this.ticks(5);return e.length>1?Math.abs(e[1]-e[0]):0}},{key:"isBand",value:function isBand(){return!1}},{key:"indexAt",value:function indexAt(e){return-1}},{key:"fractionOf",value:function fractionOf(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1];return r===i?0:(Number(e)-i)/(r-i)}},{key:"valueAtFraction",value:function valueAtFraction(e){var t=_slicedToArray(this.domain,2),i=t[0];return i+e*(t[1]-i)}},{key:"span",value:function span(){return this.domain[1]-this.domain[0]}},{key:"format",value:function format(e,t){for(var i=this.ticks(5),r=1/0,n=1;n<i.length;n++){var a=Math.abs(i[n]-i[n-1]);a>0&&a<r&&(r=a)}return formatNumberTick(Number(e),isFinite(r)?r:0)}},{key:"clone",value:function clone(){return new LinearScale([this.domain[0],this.domain[1]],[this.range[0],this.range[1]])}}])}();var H=function(){function BandScale(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};_classCallCheck(this,BandScale),_defineProperty(this,"type","category"),_defineProperty(this,"indexCache",null),_defineProperty(this,"indexCacheDomain",null),this.domain=e.length?e.slice():[""],this.range=t,this.paddingInner=void 0===i.paddingInner?.2:i.paddingInner,this.paddingOuter=void 0===i.paddingOuter?.1:i.paddingOuter,this._step=this.computeStep()}return _createClass(BandScale,[{key:"computeStep",value:function computeStep(){var e=Math.max(1,this.domain.length),t=_slicedToArray(this.range,2),i=t[0],r=t[1],n=Math.abs(r-i),a=e-this.paddingInner+2*this.paddingOuter;return n/Math.max(1e-4,a)}},{key:"indexOf",value:function indexOf(e){if(null!==e&&"object"===_typeof(e)){var t=this.domain.indexOf(e);if(-1!==t)return t}var i=this.indices().get(String(e));return void 0!==i?i:-1}},{key:"indices",value:function indices(){if(this.indexCache&&this.indexCacheDomain===this.domain)return this.indexCache;for(var e=new Map,t=0;t<this.domain.length;t++){var i=String(this.domain[t]);e.has(i)||e.set(i,t)}return this.indexCache=e,this.indexCacheDomain=this.domain,e}},{key:"map",value:function map(e){return this.bandStart(e)+this.bandwidth()/2}},{key:"bandStart",value:function bandStart(e,t){var i=void 0!==t&&t>=0?t:this.indexOf(e);return i<0?NaN:_slicedToArray(this.range,1)[0]+(this.range[1]>=this.range[0]?1:-1)*(this.paddingOuter*this._step+i*this._step)}},{key:"bandwidth",value:function bandwidth(){return this._step*(1-this.paddingInner)}},{key:"step",value:function step(){return this._step}},{key:"isBand",value:function isBand(){return!0}},{key:"ticks",value:function ticks(){return this.domain.slice()}},{key:"indexAt",value:function indexAt(e){for(var t=this.bandwidth(),i=this.range[1]>=this.range[0]?1:-1,r=0;r<this.domain.length;r++){var n=this.bandStart(void 0,r),a=n+i*t,o=Math.min(n,a),s=Math.max(n,a);if(e>=o&&e<=s)return r}return-1}},{key:"invert",value:function invert(e){var t=this.indexAt(e);if(t>=0)return this.domain[t];for(var i=0,r=1/0,n=0;n<this.domain.length;n++){var a=Math.abs(this.map(this.domain[n])-e);a<r&&(r=a,i=n)}return this.domain[i]}},{key:"nearestIndex",value:function nearestIndex(e){var t=this.indexAt(e);if(t>=0)return t;for(var i=0,r=1/0,n=0;n<this.domain.length;n++){var a=Math.abs(this.map(this.domain[n])-e);a<r&&(r=a,i=n)}return i}},{key:"fractionOf",value:function fractionOf(e){var t=this.indexOf(e);return t<0?0:this.domain.length<=1?.5:(t+.5)/this.domain.length}},{key:"valueAtFraction",value:function valueAtFraction(e){var t=this.domain.length;if(t){var i=Math.max(0,Math.min(t-1,Math.round(e*t-.5)));return this.domain[i]}}},{key:"span",value:function span(){return this.domain.length}},{key:"format",value:function format(e){return null==e?"":String(e)}},{key:"clone",value:function clone(){return new BandScale(this.domain.slice(),[this.range[0],this.range[1]],{paddingInner:this.paddingInner,paddingOuter:this.paddingOuter})}}])}(),z=function(){function LogScale(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};_classCallCheck(this,LogScale),_defineProperty(this,"type","log"),this.base=i.logBase&&i.logBase>1?i.logBase:10;var r=Math.max(Number.MIN_VALUE,Number(e[0])),n=Math.max(1.0001*r,Number(e[1]));this.domain=[r,n],this.range=t}return _createClass(LogScale,[{key:"log",value:function log(e){return Math.log(e)/Math.log(this.base)}},{key:"map",value:function map(e){var t=Number(e);if(!(t>0))return NaN;var i=_slicedToArray(this.domain,2),r=i[0],n=i[1],a=_slicedToArray(this.range,2),o=a[0],s=a[1],l=this.log(r),h=this.log(n);return o+(this.log(t)-l)/(h-l)*(s-o)}},{key:"invert",value:function invert(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=_slicedToArray(this.range,2),a=n[0],o=n[1];if(o===a)return i;var s=this.log(i),l=s+(e-a)/(o-a)*(this.log(r)-s);return Math.pow(this.base,l)}},{key:"ticks",value:function ticks(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=[],a=Math.floor(this.log(i)),o=Math.ceil(this.log(r)),s=o-a;if(s<=2*e)for(var l=a;l<=o;l++){var h=Math.pow(this.base,l);h>=.999999*i&&h<=1.000001*r&&n.push(h)}else for(var u=Math.max(1,Math.ceil(s/e)),c=a;c<=o;c+=u){var d=Math.pow(this.base,c);d>=.999999*i&&d<=1.000001*r&&n.push(d)}return n.length||n.push(i,r),n}},{key:"bandwidth",value:function bandwidth(){return 0}},{key:"bandStart",value:function bandStart(e){return this.map(e)}},{key:"step",value:function step(){var e=this.ticks(5);return e.length>1?Math.abs(e[1]-e[0]):0}},{key:"isBand",value:function isBand(){return!1}},{key:"indexAt",value:function indexAt(e){return-1}},{key:"fractionOf",value:function fractionOf(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=this.log(i),a=this.log(r);return a===n?0:(this.log(Math.max(Number.MIN_VALUE,Number(e)))-n)/(a-n)}},{key:"valueAtFraction",value:function valueAtFraction(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=this.log(i),a=this.log(r);return Math.pow(this.base,n+e*(a-n))}},{key:"span",value:function span(){return this.domain[1]-this.domain[0]}},{key:"format",value:function format(e,t){return formatNumberTick(Number(e),this.step())}},{key:"clone",value:function clone(){return new LogScale([this.domain[0],this.domain[1]],[this.range[0],this.range[1]],{logBase:this.base})}}])}();function createScale(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};switch(e){case"category":return new H(t,i,r);case"time":return new A(t,i,r);case"log":return new z(t,i,r);default:return new R(t,i)}}function measureTextWidth(e,t,i,r){if(!t)return 0;if(e&&"function"==typeof e.measureText)try{var n=e.font;e.font="".concat(i,"px ").concat(r);var a=e.measureText(t);if(e.font=n,a&&"number"==typeof a.width&&isFinite(a.width))return a.width}catch(e){}for(var o=0,s=0;s<t.length;s++){o+=t.charCodeAt(s)>11904?1:.55}return o*i}function computeLayout(e,t,i){for(var r=e.option.margin,n=createScale(e.xAxis.type,e.xAxis.domain,[0,Math.max(1,i.width)],{logBase:e.xAxis.option.logBase}),a=buildAxisLayout(e,"x",e.xAxis,n,t),o=e.yAxes.map(function(r){var n=createScale(r.type,r.domain,[Math.max(1,i.height),0],{logBase:r.option.logBase});return buildAxisLayout(e,"y",r,n,t)}),s=0,l=0,h=0;h<e.yAxes.length;h++){var u=e.yAxes[h],c=o[h];if(!1!==u.option.show&&"cartesian"===e.kind){var d=yAxisReserve(u,c);"right"===u.position?(c.offset=l,l+=d):(c.offset=s,s+=d)}else c.offset=0}var f=o[0],p=function buildTitleLayout(e){var t=e.option.title;if(!t||!t.text&&!t.subtext)return null;var i=e.theme,r={color:t.textStyle&&t.textStyle.color||i.textColor,fontSize:t.textStyle&&t.textStyle.fontSize||i.fontSize+4,fontWeight:t.textStyle&&t.textStyle.fontWeight||"bold"},n={color:t.subtextStyle&&t.subtextStyle.color||i.subTextColor,fontSize:t.subtextStyle&&t.subtextStyle.fontSize||i.fontSize},a="left"===t.left?"left":"right"===t.left?"right":"center";return{text:t.text||"",subtext:t.subtext||"",x:0,y:0,align:a,textStyle:r,subtextStyle:n}}(e),v=p?(p.text?1.5*p.textStyle.fontSize:0)+(p.subtext?1.4*p.subtextStyle.fontSize:0):0,m=function layoutLegend(e,t,i,r){var n=e.option.legend;if(!n||!1===n.show)return null;var a=[];if("polar"===e.kind||"funnel"===e.kind){var o,s=_createForOfIteratorHelper(e.series);try{for(s.s();!(o=s.n()).done;){var l=o.value;if("pie"===l.type||"funnel"===l.type)for(var h=0,u=l.pointCount;h<u;h++){var c=l.pointAt(h);a.push({seriesId:l.id,seriesIndex:l.index,dataIndex:c.index,name:c.name||"".concat(l.name," ").concat(c.index+1),color:c.color||l.color,hidden:!!e.hiddenSlices["".concat(l.id,"#").concat(c.index)],x:0,y:0,width:0,height:0})}}}catch(e){s.e(e)}finally{s.f()}}else{var d,f=_createForOfIteratorHelper(e.series);try{for(f.s();!(d=f.n()).done;){var p=d.value;a.push({seriesId:p.id,seriesIndex:p.index,name:p.name,color:p.color,hidden:!!p.hidden,x:0,y:0,width:0,height:0})}}catch(e){f.e(e)}finally{f.f()}}if(!a.length)return null;var v={position:n.position||"top",items:a},m=e.theme.fontSize,g=n.itemWidth||12,b=Math.max(n.itemHeight||12,1.4*m),k=n.itemGap||16,S=a.map(function(i){return{item:i,textWidth:measureTextWidth(t,i.name,m,e.theme.fontFamily)}}),A=b+4,w=e.option.margin;if("left"===v.position||"right"===v.position){for(var M=Math.max.apply(Math,_toConsumableArray(S.map(function(e){return e.textWidth})).concat([0])),_=S.length*A,C="left"===v.position?w.left:i.width-w.right-(g+6+M),P=Math.max(0,i.height-r-w.bottom),T=Math.max(r,r+(P-_)/2),I=0;I<S.length;I++){var N=S[I].item;N.x=C,N.y=T+I*A,N.width=g+6+S[I].textWidth,N.height=A}return v}var D,O=[],R=[],H=0,z=Math.max(40,i.width-w.left-w.right),V=_createForOfIteratorHelper(S);try{for(V.s();!(D=V.n()).done;){var E=D.value,B=g+6+E.textWidth;R.length&&H+k+B>z&&(O.push(R),R=[],H=0),H+=(R.length>1?k:0)+B,R.push(E)}}catch(e){V.e(e)}finally{V.f()}R.length&&O.push(R);for(var L="top"===v.position?r:i.height-w.bottom-O.length*A,j=0,W=O;j<W.length;j++){var X,U=W[j],G=U.reduce(function(e,t,i){return e+g+6+t.textWidth+(i>0?k:0)},0),K=(i.width-G)/2,Y=_createForOfIteratorHelper(U);try{for(Y.s();!(X=Y.n()).done;){var q=X.value;q.item.x=K,q.item.y=L,q.item.width=g+6+q.textWidth,q.item.height=A,K+=q.item.width+k}}catch(e){Y.e(e)}finally{Y.f()}L+=A}return v}(e,t,i,r.top+v),g=m?function legendSizeOf(e,t){var i=t.option.legend,r=t.theme.fontSize,n=i.itemWidth||12,a=Math.max(i.itemHeight||12,1.4*r)+4;if("left"===e.position||"right"===e.position){var o=e.items.map(function(e){return e.x}),s=e.items.map(function(e){return e.x+e.width}),l=o.length?Math.min.apply(Math,_toConsumableArray(o)):0,h=s.length?Math.max.apply(Math,_toConsumableArray(s)):0;return{width:Math.max(n+6,h-l),height:e.items.length*a}}var u,c=1,d=e.items.length?e.items[0].y:0,f=_createForOfIteratorHelper(e.items);try{for(f.s();!(u=f.n()).done;){var p=u.value;p.y>d&&(c+=1,d=p.y)}}catch(e){f.e(e)}finally{f.f()}return{width:0,height:c*a}}(m,e):{width:0,height:0},b=r.left,k=r.top,S=i.width-r.right,A=i.height-r.bottom;k+=v,m&&("top"===m.position?k+=g.height+8:"bottom"===m.position?A-=g.height+8:"left"===m.position?b+=g.width+8:S-=g.width+8),b+=s,S-=l,"cartesian"===e.kind&&!1!==e.xAxis.option.show&&(A-=a.labelHeight+4+6,e.xAxis.option.name&&(A-=a.nameHeight+6));var w=e.option.dataZoom&&e.option.dataZoom.slider,M=!("cartesian"!==e.kind||!e.option.dataZoom||w&&!1===w.show),_=Math.max(12,Number(w&&w.height)||26),C=null;if(M){var P=i.height-r.bottom,T=_+14;A+T>P&&(A-=A+T-P),C=A+14}var I={x:Math.round(Math.max(0,b)),y:Math.round(Math.max(0,k)),width:Math.max(1,Math.round(S-b)),height:Math.max(1,Math.round(A-k))};"cartesian"===e.kind&&function thinXAxisLabels(e,t,i,r,n){var a=e.ticks,o=e.labels,s=t.axisLength;if(!a||a.length<=2||!s||s<=0)return;for(var l=Math.max(1,Math.floor(a.length/64)),h=0,u=0;u<o.length;u+=l)if(o[u]){var c=measureTextWidth(i,o[u],r,n);c>h&&(h=c)}if(h<=0)return;var d=Math.max(h+10,64),f=s/(a.length-1||1);if(f>=d)return;for(var p=Math.max(1,Math.ceil(d/f)),v=new Set,m=0;m<a.length;m+=p)v.add(m);var g=a.length-1;if(g>0&&!v.has(g)){var b=g-g%p;(g-b)*f>=d||v.delete(b),v.add(g)}var k=h/2,S=Number(t.leftRoom)||0,A=Number(t.rightRoom)||0,w=Array.from(v).sort(function(e,t){return e-t});if(w.length){var M=w[0];M*f-k<-S&&v.delete(M);var _=w[w.length-1];_*f+k>s+A&&v.delete(_)}for(var C=0;C<o.length;C++)v.has(C)||(o[C]="")}(a,{axisLength:I.width,leftRoom:I.x,rightRoom:Math.max(0,i.width-I.x-I.width)},t,e.theme.fontSize,e.theme.fontFamily);var N=null;if("polar"===e.kind||"radar"===e.kind||"gauge"===e.kind||"liquid"===e.kind){var D,O=Math.min(I.width,I.height)/2,R=I.width/2,H=I.height/2,z="polar"===e.kind&&e.series.some(function(e){return"pie"===e.type&&!(e.option.label&&!1===e.option.label.show)})?Math.min(46,.26*O):6;D="gauge"===e.kind?Math.max(10,.94*Math.min(R-14,H-4)):"liquid"===e.kind?Math.max(10,Math.min(R,H)-3):Math.max(10,O*function polarRadiusRatio(e){if("radar"===e.kind){var t=Number(e.radar&&e.radar.radius);return isFinite(t)&&t>0?Math.max(.1,Math.min(1,t)):.72}var i,r=_createForOfIteratorHelper(e.series);try{for(r.s();!(i=r.n()).done;){var n=i.value;if("pie"===n.type){var a=Number(n.option.radius);if(isFinite(a)&&a>0)return Math.max(.1,Math.min(1,a))}}}catch(e){r.e(e)}finally{r.f()}return.92}(e)-z);var V=I.x+I.width/2,E=I.y+I.height/2;N={cx:V,cy:E,radius:D},I={x:Math.round(V-D),y:Math.round(E-D),width:Math.round(2*D),height:Math.round(2*D)}}if("cartesian"===e.kind&&"equal"===e.option.aspect){var B=Math.min(I.width,I.height);I={x:Math.round(I.x+(I.width-B)/2),y:Math.round(I.y+(I.height-B)/2),width:Math.round(B),height:Math.round(B)}}p&&(p.y=r.top);var L=M&&null!==C?{x:I.x,y:Math.round(C),width:I.width,height:Math.round(_)}:null;return{canvas:i,plot:I,titleRect:p?{x:p.x,y:p.y,width:0,height:v}:null,legendRect:m?legendBoundingRect(m):null,legend:m,title:p,polar:N,slider:L,xAxisLayout:a,yAxes:o,yAxisLayout:f,margin:r}}function yAxisReserve(e,t){var i=t.labelWidth+4+6;return e.option.name&&(i+=t.nameHeight+6),i}function buildAxisLayout(e,t,i,r,n){for(var a=i.option,o=e.theme.fontSize,s=e.theme.fontFamily,l=!1===a.show,h=r.ticks(a.tickCount||5),u=[],c=0,d=0;d<h.length;d++){var f=formatTick(h[d],r,d,a.formatter);u.push(f);var p=measureTextWidth(n,f,o,s);p>c&&(c=p)}var v=Math.abs(Number(a.labelRotate)||0),m=v*Math.PI/180,g=c*Math.sin(m)+1.4*o,b=a.name||"",k=b?measureTextWidth(n,b,o,s):0;return l?{ticks:h,labels:u,offset:0,labelWidth:0,labelHeight:0,nameWidth:0,nameHeight:0}:{ticks:h,labels:u,offset:0,labelWidth:"y"===t?c:0,labelHeight:"x"===t?v>0?g:1.4*o:0,nameWidth:"x"===t?k:0,nameHeight:b?1.4*o:0}}function legendBoundingRect(e){if(!e.items.length)return{x:0,y:0,width:0,height:0};var t,i=1/0,r=1/0,n=-1/0,a=-1/0,o=_createForOfIteratorHelper(e.items);try{for(o.s();!(t=o.n()).done;){var s=t.value;i=Math.min(i,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x+s.width),a=Math.max(a,s.y+s.height)}}catch(e){o.e(e)}finally{o.f()}return{x:i,y:r,width:n-i,height:a-r}}var V=function(){function ChartComponent(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ChartComponent),_defineProperty(e=_callSuper(this,ChartComponent,[_objectSpread2({origin:"top-left",fill:!1,stroke:!1,draggable:!1,transformable:!1,linkable:!1,interactive:!1},t)]),"loopRegistered",!1),e}return _inherits(ChartComponent,i),_createClass(ChartComponent,[{key:"keyboardEvtHandler",value:function keyboardEvtHandler(){}},{key:"containsLocalPoint",value:function containsLocalPoint(e,t){return e>=0&&t>=0&&e<=this.state.width&&t<=this.state.height}},{key:"unit",value:function unit(){var e=this.ice;return e?1/((e.viewport&&e.viewport.scale||1)*(e.dpr||1)):1}},{key:"snap",value:function snap(e){var t=this.ice;if(!t)return e;var i=(t.viewport&&t.viewport.scale||1)*(t.dpr||1);return Math.round(e*i)/i+.5/i}},{key:"markDirty",value:function markDirty(){return this.dirty=!0,this.ice&&(this.ice.dirty=!0),this}},{key:"keepAnimating",value:function keepAnimating(){if(!this.loopRegistered){this.loopRegistered=!0;var e=_objectSpread2(_objectSpread2({},this.props.animations||{}),{},{__tick:{from:0,to:1,duration:100,loop:!0}});this.props.animations=e,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),this.markDirty()}}},{key:"stopAnimating",value:function stopAnimating(){if(this.loopRegistered){this.loopRegistered=!1;var e=_objectSpread2({},this.props.animations||{});for(var t in e)e[t]&&(e[t].finished=!0);delete e.__tick,this.props.animations=e,this.ice&&this.ice.animationManager&&this.ice.animationManager.remove(this)}}},{key:"setFont",value:function setFont(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"normal";this.ctx.font="".concat(i," ").concat(e,"px ").concat(t)}}])}(),E="auto";function setMotionPreference(e){E=e}function getMotionPreference(){return E}function shouldAnimate(){return"instant"!==E&&("full"===E||!function prefersReducedMotion(){if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!1;try{return!!window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch(e){return!1}}())}var B=function(){function Axis(e){var t;return _classCallCheck(this,Axis),_defineProperty(t=_callSuper(this,Axis,[_objectSpread2({interactive:!1},e)]),"axisIndex",0),_defineProperty(t,"position","left"),_defineProperty(t,"axis",null),_defineProperty(t,"layout",null),_defineProperty(t,"theme",null),_defineProperty(t,"lastTicks",[]),_defineProperty(t,"morphFrom",[]),t.orientation=e.orientation,t.axisIndex=e.axisIndex||0,t.position=e.position||"left",t}return _inherits(Axis,V),_createClass(Axis,[{key:"edgeX",value:function edgeX(e){var t=this.layout.plot,i=e.offset||0;return"left"===this.position?t.x-i:t.x+t.width+i}},{key:"axisLayoutOf",value:function axisLayoutOf(e){return"x"===this.orientation?e.xAxisLayout:e.yAxes[this.axisIndex]||e.yAxisLayout}},{key:"tickEntries",value:function tickEntries(){var e=this.axis,t=this.layout;if(!e||!t||!e.scale)return null;for(var i=e.option||{},r=e.scale,n=t.plot,a=this.axisLayoutOf(t),o=a.ticks,s=a.labels||[],l=[],h=s.length===o.length,u=0;u<o.length;u++)if(!h||""!==s[u]){var c=r.map(o[u]),d="x"===this.orientation?n.x+c:n.y+c;if(isFinite(d)){var f=formatTick(o[u],r,u,i.formatter)||"";l.push({key:String(o[u]),pos:d,label:f,drawn:!!f})}}return l}},{key:"morphProgress",value:function morphProgress(){var e=Number(this.state.axisMorph);return isFinite(e)?Math.max(0,Math.min(1,e)):1}},{key:"renderedPositions",value:function renderedPositions(){var e,t=this,i=this.morphProgress(),r=new Map,n=_createForOfIteratorHelper(this.lastTicks);try{var a=function _loop(){var n=e.value,a=t.morphFrom.find(function(e){return e.key===n.key});r.set(n.key,a?a.pos+(n.pos-a.pos)*i:n.pos)};for(n.s();!(e=n.n()).done;)a()}catch(e){n.e(e)}finally{n.f()}return r}},{key:"syncTicks",value:function syncTicks(){var e=this,t=this.tickEntries();if(t&&!(t.length===this.lastTicks.length&&t.every(function(t,i){return t.key===e.lastTicks[i].key&&Math.abs(t.pos-e.lastTicks[i].pos)<.01}))){var i=0===this.lastTicks.length,r=this.renderedPositions();if(this.morphFrom=this.lastTicks.map(function(e){var t;return _objectSpread2(_objectSpread2({},e),{},{pos:null!==(t=r.get(e.key))&&void 0!==t?t:e.pos})}),this.lastTicks=t,this.setState({axisMorph:0}),i||!shouldAnimate())return this.setState({axisMorph:1}),void this.markDirty();var n=_objectSpread2({},this.props.animations||{});n.axisMorph={from:0,to:1,duration:240,easing:"easeOutCubic",startTime:void 0,finished:!1},this.props.animations=n,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),this.markDirty()}}},{key:"renderedTickPos",value:function renderedTickPos(e){var t=String(e),i=this.morphFrom.find(function(e){return e.key===t}),r=this.lastTicks.find(function(e){return e.key===t});return i&&r?i.pos+(r.pos-i.pos)*this.morphProgress():r?r.pos:i?i.pos:null}},{key:"morphing",value:function morphing(){return this.morphProgress()<1}},{key:"drawTick",value:function drawTick(e,t,i,r,n){if(!1!==n.showTick){var a=this.ctx;if(a.beginPath(),"x"===this.orientation)a.moveTo(e,t.y+t.height),a.lineTo(e,t.y+t.height+4*r);else{var o="left"===this.position?-1:1;a.moveTo(i,e),a.lineTo(i+4*o*r,e)}a.stroke()}}},{key:"drawTickLabel",value:function drawTickLabel(e,t,i,r,n,a){if(t){var o=this.ctx;if("x"!==this.orientation){var s="left"===this.position?-1:1;o.fillText(t,r+s*n,e)}else{var l=i.y+i.height+n;a.labelRotate?(o.save(),o.translate(e,l),o.rotate(Number(a.labelRotate)*Math.PI/180),o.textAlign="right",o.textBaseline="middle",o.fillText(t,0,0),o.restore()):o.fillText(t,e,l)}}}},{key:"doRender",value:function doRender(){if(this.axis&&this.layout&&this.theme){var e=this.axis.option;if(!1!==e.show)if(this.axis.scale){var t=this.layout.plot,i="x"===this.orientation?this.layout.xAxisLayout:this.layout.yAxes[this.axisIndex]||this.layout.yAxisLayout,r=this.ctx,n=this.theme.fontSize,a=this.unit(),o=10*a;r.beginPath(),r.save(),r.lineWidth=a,r.strokeStyle=this.theme.axisLineColor,r.fillStyle=this.theme.axisLabelColor,this.setFont(n,this.theme.fontFamily),r.textBaseline="x"===this.orientation?"top":"middle",r.textAlign="x"===this.orientation?"center":"left"===this.position?"right":"left";var s="x"===this.orientation?t.x:this.edgeX(i);if(!1!==e.showAxisLine){if(r.beginPath(),"x"===this.orientation){var l=this.snap(t.y+t.height);r.moveTo(t.x,l),r.lineTo(t.x+t.width,l)}else{var h=this.snap(s);r.moveTo(h,t.y),r.lineTo(h,t.y+t.height)}r.stroke()}var u,c="left"===this.position?-1:1,d=this.tickEntries()||[],f=this.morphProgress(),p=new Map,v=_createForOfIteratorHelper(this.morphFrom);try{for(v.s();!(u=v.n()).done;){var m=u.value;p.set(m.key,m.pos)}}catch(e){v.e(e)}finally{v.f()}var g=new Set(d.map(function(e){return e.key}));if(f<1){r.fillStyle=this.theme.axisLabelColor,r.globalAlpha=(1-f)*(1-f);var b,k=_createForOfIteratorHelper(this.morphFrom);try{for(k.s();!(b=k.n()).done;){var S=b.value;!g.has(S.key)&&S.drawn&&(this.drawTick(S.pos,t,s,a,e),this.drawTickLabel(S.pos,S.label,t,s,o,e))}}catch(e){k.e(e)}finally{k.f()}r.globalAlpha=1}var A,w=_createForOfIteratorHelper(d);try{for(w.s();!(A=w.n()).done;){var M=A.value,_=p.get(M.key),C=void 0===_?M.pos:_+(M.pos-_)*f;r.globalAlpha=void 0===_?Math.min(1,.15+.85*f):1,this.drawTick(C,t,s,a,e),M.drawn&&this.drawTickLabel(C,M.label,t,s,o,e)}}catch(e){w.e(e)}finally{w.f()}if(r.globalAlpha=1,e.name)if(this.setFont(n,this.theme.fontFamily),r.fillStyle=this.theme.subTextColor,"x"===this.orientation)if(r.textAlign="center",r.textBaseline="middle",this.layout.slider)r.textAlign="right",r.textBaseline="bottom",r.fillText(e.name,t.x+t.width,t.y+t.height-4*a);else{var P=t.y+t.height+o+i.labelHeight+6*a+.5*n;r.fillText(e.name,t.x+t.width/2,P)}else{var T=s+c*(i.labelWidth+o+i.nameHeight+4*a);r.save(),r.translate("left"===this.position?Math.max(.6*n,T):T,t.y+t.height/2),r.rotate(-Math.PI/2),r.textAlign="center",r.textBaseline="middle",r.fillText(e.name,0,0),r.restore()}r.restore()}}}}])}(),L=function(){function GridLines(e){var t;return _classCallCheck(this,GridLines),_defineProperty(t=_callSuper(this,GridLines,[_objectSpread2({interactive:!1},e)]),"xScale",null),_defineProperty(t,"yScale",null),_defineProperty(t,"horizontal",[]),_defineProperty(t,"xTicks",[]),_defineProperty(t,"plot",{x:0,y:0,width:0,height:0}),_defineProperty(t,"grid",{}),_defineProperty(t,"theme",null),_defineProperty(t,"axisX",null),_defineProperty(t,"axisYList",[]),t}return _inherits(GridLines,V),_createClass(GridLines,[{key:"syncTicks",value:function syncTicks(){if([this.axisX].concat(_toConsumableArray(this.axisYList)).filter(Boolean).some(function(e){return"function"==typeof e.morphing&&e.morphing()})){var e=_objectSpread2({},this.props.animations||{});e.axisMorph={from:0,to:1,duration:240,easing:"easeOutCubic",startTime:void 0,finished:!1},this.props.animations=e,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),this.markDirty()}}},{key:"yTickPos",value:function yTickPos(e,t,i){var r=void 0===e?null:this.axisYList[e];if(!r||"function"!=typeof r.renderedTickPos)return i;var n=r.renderedTickPos(t);return null==n?i:n}},{key:"xTickPos",value:function xTickPos(e,t){var i=this.axisX;if(!i||"function"!=typeof i.renderedTickPos)return t;var r=i.renderedTickPos(e);return null==r?t:r}},{key:"doRender",value:function doRender(){var e=this;if(this.theme&&this.xScale&&this.yScale&&!1!==this.grid.show){var t=this.plot,i=this.ctx;i.beginPath(),i.save(),i.strokeStyle=this.grid.color||this.theme.splitLineColor,i.lineWidth=(this.grid.lineWidth||1)*this.unit(),"function"==typeof i.setLineDash&&i.setLineDash((this.grid.lineDash||[]).map(function(t){return t*e.unit()}));var r=this.horizontal.length?this.horizontal:this.yScale?[{scale:this.yScale,ticks:this.yScale.ticks(5)}]:[];if(!1!==this.grid.y){i.beginPath();var n,a=_createForOfIteratorHelper(r);try{for(a.s();!(n=a.n()).done;){var o,s=n.value,l=_createForOfIteratorHelper(s.ticks);try{for(l.s();!(o=l.n()).done;){var h=o.value,u=t.y+s.scale.map(h);if(isFinite(u)){var c=this.snap(this.yTickPos(s.index,h,u));i.moveTo(t.x,c),i.lineTo(t.x+t.width,c)}}}catch(e){l.e(e)}finally{l.f()}}}catch(e){a.e(e)}finally{a.f()}i.stroke()}if(this.grid.x){i.beginPath();var d,f=_createForOfIteratorHelper(this.xTicks.length?this.xTicks:this.xScale.ticks(5));try{for(f.s();!(d=f.n()).done;){var p=d.value,v=t.x+this.xScale.map(p);if(isFinite(v)){var m=this.snap(this.xTickPos(p,v));i.moveTo(m,t.y),i.lineTo(m,t.y+t.height)}}}catch(e){f.e(e)}finally{f.f()}i.stroke()}i.restore()}}}])}(),j=[6,4];function resolveAxisValue(e,t,i,r){if(null==t||""===t)return{ok:!1,code:"annotation:invalid-value",message:"".concat(r," 标注缺少定位值。")};var n=e.scale;if(!n||"function"!=typeof n.map)return{ok:!1,code:"annotation:unsupported-scene",message:"当前场景没有可用于定位的坐标系。"};var a,o=n.domain||[],s=t;if("category"===e.type){var l=o.indexOf(s);if(l<0&&(l=o.findIndex(function(e){return String(e)===String(s)})),l<0){var h=Number(s);if(!(Number.isInteger(h)&&h>=0&&h<o.length))return{ok:!1,code:"annotation:unknown-category",message:"".concat(r," 轴没有类目「").concat(String(t),"」。")};l=h}s=o[l];var u=Number(n.map(s));return isFinite(u)?{ok:!0,pixel:i+u,inside:!0,label:String(s)}:{ok:!1,code:"annotation:unknown-category",message:"".concat(r," 轴定位不到「").concat(String(t),"」。")}}if("time"===e.type){if(a=toTimestamp(s),!isFinite(a))return{ok:!1,code:"annotation:invalid-value",message:"".concat(r," 标注的「").concat(String(t),"」不是合法时间。")}}else if(a=Number(s),!isFinite(a))return{ok:!1,code:"annotation:invalid-value",message:"".concat(r," 标注的「").concat(String(t),"」不是合法数值。")};var c=Number(n.map(a));if(!isFinite(c))return{ok:!1,code:"annotation:out-of-range",message:"".concat(r," 标注的「").concat(String(t),"」无法定位。")};var d=function domainRange(e){if(!e||!e.length)return[null,null];var t=e.map(function(e){return Number(e)});if(t.length&&t.every(function(e){return isFinite(e)}))return[Math.min.apply(Math,_toConsumableArray(t)),Math.max.apply(Math,_toConsumableArray(t))];return[0,e.length-1]}(o),f=_slicedToArray(d,2),p=f[0],v=f[1];return{ok:!0,pixel:i+c,inside:null===p||null===v||a>=p-1e-9&&a<=v+1e-9,label:String(t)}}function pickAxis(e,t,i){if("x"===t)return e.xAxis;var r=Number.isInteger(i)&&Number(i)>=0?Number(i):0;return e.yAxes[r]||e.yAxes[0]||e.xAxis}function positiveNumber(e,t){var i=Number(e);return isFinite(i)&&i>0?i:t}function textPosition(e,t){return"start"===e||"center"===e||"end"===e?e:t}function pointTextPosition(e){return"bottom"===e||"left"===e||"right"===e||"top"===e?e:"top"}function resolvedLineDash(e){return Array.isArray(e.lineDash)?e.lineDash.filter(function(e){return isFinite(Number(e))&&Number(e)>=0}).map(Number):!1===e.dashed?[]:j}function symbolOf(e){return"rect"===e||"diamond"===e||"triangle"===e?e:"circle"}function clamp$1(e,t,i){return Math.max(t,Math.min(i,e))}function plainText(e){return null==e?"":String(e)}function withAlpha(e,t){if("string"!=typeof e)return"rgba(0,0,0,".concat(t,")");if("#"===e.charAt(0)){var i=e.slice(1);if(3===i.length&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),6!==i.length)return e;var r=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),a=parseInt(i.slice(4,6),16);return"rgba(".concat(r,",").concat(n,",").concat(a,",").concat(t,")")}return 0===e.indexOf("rgb(")?e.replace("rgb(","rgba(").replace(")",",".concat(t,")")):e}function resolveAnnotation(e,t){var i={lines:[],points:[],areas:[]},r=[];if(!e||"object"!==_typeof(e))return{resolved:i,diagnostics:r};var n=Array.isArray(e.lines)?e.lines:[],a=Array.isArray(e.points)?e.points:[],o=Array.isArray(e.areas)?e.areas:[];if(!(n.length+a.length+o.length))return{resolved:i,diagnostics:r};if("cartesian"!==t.kind)return r.push({code:"annotation:unsupported-scene",severity:"warning",message:"标注需要直角坐标系(x / y 轴),当前场景没有,已跳过全部标注。",kind:"line",index:0}),{resolved:i,diagnostics:r};for(var s=t.theme,l=s.textColor,h=s.fontSize||12,u=0;u<o.length;u++){var c=o[u]||{},d="x"===c.axis?"x":"y",f="x"===d?"x":"y",p=pickAxis(t,d,c.axisIndex),v="x"===d?t.plot.x:t.plot.y,m="x"===d?t.plot.width:t.plot.height,g=resolveAxisValue(p,c.from,v,f),b=resolveAxisValue(p,c.to,v,f);if(g.ok&&b.ok){var k=v,S=v+m,A=clamp$1(g.pixel,k,S),w=clamp$1(b.pixel,k,S);Math.abs(w-A)<=0?r.push({code:"annotation:out-of-range",severity:"warning",message:"标注区间#".concat(u,":区间「").concat(plainText(c.from)," ~ ").concat(plainText(c.to),"」不在当前可视范围内,已跳过。"),kind:"area",index:u}):i.areas.push({kind:"area",index:u,axis:d,axisIndex:Number.isInteger(c.axisIndex)?Number(c.axisIndex):0,from:A,to:w,color:"string"==typeof c.color&&c.color?c.color:withAlpha(l,.1),text:plainText(c.text),textPosition:textPosition(c.textPosition,"center"),textColor:"string"==typeof c.textColor&&c.textColor?c.textColor:l,fontSize:positiveNumber(c.fontSize,h)})}else pushDiagnostic(r,g.ok?b:g,"area",u)}for(var M=0;M<n.length;M++){var _=n[M]||{},C="x"===_.axis?"x":"y",P="x"===C?"x":"y",T=pickAxis(t,C,_.axisIndex),I="x"===C?t.plot.x:t.plot.y,N=resolveAxisValue(T,_.value,I,P);if(N.ok)if(N.inside){var D="string"==typeof _.color&&_.color?_.color:l;i.lines.push({kind:"line",index:M,axis:C,axisIndex:Number.isInteger(_.axisIndex)?Number(_.axisIndex):0,pixel:N.pixel,text:plainText(_.text),color:D,lineWidth:positiveNumber(_.lineWidth,1),lineDash:resolvedLineDash(_),textPosition:textPosition(_.textPosition,"end"),textColor:"string"==typeof _.textColor&&_.textColor?_.textColor:D,fontSize:positiveNumber(_.fontSize,h)})}else pushDiagnostic(r,{ok:!1,code:"annotation:out-of-range",message:"".concat(P," 标注的「").concat(N.label,"」不在当前可视范围内,已跳过。")},"line",M);else pushDiagnostic(r,N,"line",M)}for(var O=0;O<a.length;O++){var R=a[O]||{},H=resolveAxisValue(t.xAxis,R.x,t.plot.x,"x"),z=resolveAxisValue(pickAxis(t,"y",R.axisIndex),R.y,t.plot.y,"y");if(H.ok&&z.ok&&H.inside&&z.inside){var V="string"==typeof R.color&&R.color?R.color:l;i.points.push({kind:"point",index:O,axisIndex:Number.isInteger(R.axisIndex)?Number(R.axisIndex):0,x:H.pixel,y:z.pixel,text:plainText(R.text),color:V,symbol:symbolOf(R.symbol),symbolSize:positiveNumber(R.symbolSize,8),textPosition:pointTextPosition(R.textPosition),textColor:"string"==typeof R.textColor&&R.textColor?R.textColor:V,fontSize:positiveNumber(R.fontSize,h)})}else{pushDiagnostic(r,H.ok?z.ok?H.inside?{ok:!1,code:"annotation:out-of-range",message:"y 标注的「".concat(z.label,"」不在当前可视范围内,已跳过。")}:{ok:!1,code:"annotation:out-of-range",message:"x 标注的「".concat(H.label,"」不在当前可视范围内,已跳过。")}:z:H,"point",O)}}return{resolved:i,diagnostics:r}}function pushDiagnostic(e,t,i,r){var n="line"===i?"标注线":"point"===i?"标注点":"标注区间";e.push({code:t.code,severity:"annotation:invalid-value"===t.code?"error":"warning",message:"".concat(n,"#").concat(r,":").concat(t.message),kind:i,index:r})}var W=function(){function Annotation(e){var t;return _classCallCheck(this,Annotation),_defineProperty(t=_callSuper(this,Annotation,[_objectSpread2({interactive:!1},e)]),"resolved",{lines:[],points:[],areas:[]}),_defineProperty(t,"diagnostics",[]),_defineProperty(t,"ink",[]),_defineProperty(t,"theme",null),_defineProperty(t,"option",null),_defineProperty(t,"__boxScratch",[0,0,0,0]),_defineProperty(t,"plot",{x:0,y:0,width:0,height:0}),_defineProperty(t,"xAxis",null),_defineProperty(t,"yAxes",[]),t}return _inherits(Annotation,V),_createClass(Annotation,[{key:"sync",value:function sync(e,t){this.option=e||null,this.theme=t.theme;var i=resolveAnnotation(e,t),r=i.resolved,n=i.diagnostics;this.resolved=r,this.diagnostics=n,this.markDirty()}},{key:"hasInk",get:function get(){return this.resolved.lines.length>0||this.resolved.points.length>0||this.resolved.areas.length>0}},{key:"__localBox",value:function __localBox(){var e=this.__boxScratch;return e[0]=0,e[1]=0,e[2]=this.state.width||0,e[3]=this.state.height||0,e}},{key:"doRender",value:function doRender(){if(this.theme&&this.hasInk){var e=this.plot,t=[];this.drawAreas(t,e),this.drawLines(t,e),this.drawPoints(t),this.ink=t}else this.ink=[]}},{key:"drawAreas",value:function drawAreas(e,t){var i,r=this,n=_createForOfIteratorHelper(this.resolved.areas);try{var a=function _loop(){var n=i.value,a=r.ctx;a.beginPath();var o=Math.min(n.from,n.to),s=Math.max(n.from,n.to),l="x"===n.axis?o:t.x,h="y"===n.axis?o:t.y,u="x"===n.axis?s-o:t.width,c="y"===n.axis?s-o:t.height;if(u<=0||c<=0)return 1;a.save(),a.fillStyle=n.color,a.fillRect(l,h,u,c),a.restore();var d=null;if(n.text){a.save(),r.setFont(n.fontSize,r.theme.fontFamily,"normal"),a.fillStyle=n.textColor;if("y"===n.axis){var f="start"===n.textPosition?"left":"end"===n.textPosition?"right":"center",p="start"===n.textPosition?t.x+6:"end"===n.textPosition?t.x+t.width-6:t.x+t.width/2;a.textAlign=f,a.textBaseline="middle";var v=(n.from+n.to)/2;r.strokeHalo(function(){return a.strokeText(n.text,p,v)}),a.fillText(n.text,p,v),d={kind:"area",index:n.index,x:"right"===f?p-r.textWidth(n.text,n.fontSize):"center"===f?p-r.textWidth(n.text,n.fontSize)/2:p,y:v-n.fontSize/2,width:r.textWidth(n.text,n.fontSize),height:n.fontSize,text:n.text}}else{var m=(n.from+n.to)/2;a.textAlign="center",a.textBaseline="top";var g=t.y+6;r.strokeHalo(function(){return a.strokeText(n.text,m,g)}),a.fillText(n.text,m,g),d={kind:"area",index:n.index,x:m-r.textWidth(n.text,n.fontSize)/2,y:g,width:r.textWidth(n.text,n.fontSize),height:n.fontSize,text:n.text}}a.restore()}e.push({kind:"area",index:n.index,x:l,y:h,width:u,height:c,text:n.text}),d&&e.push(d)};for(n.s();!(i=n.n()).done;)a()}catch(e){n.e(e)}finally{n.f()}}},{key:"drawLines",value:function drawLines(e,t){var i,r=this,n=_createForOfIteratorHelper(this.resolved.lines);try{for(n.s();!(i=n.n()).done;){var a=i.value,o=this.ctx,s="y"===a.axis,l=this.snap(a.pixel);o.save(),o.beginPath(),o.strokeStyle=a.color,o.lineWidth=a.lineWidth*this.unit(),"function"==typeof o.setLineDash&&o.setLineDash(a.lineDash.map(function(e){return e*r.unit()})),s?(o.moveTo(t.x,l),o.lineTo(t.x+t.width,l)):(o.moveTo(l,t.y),o.lineTo(l,t.y+t.height)),o.stroke(),o.restore();var h=s?{kind:"line",index:a.index,x:t.x,y:a.pixel-1,width:t.width,height:2,text:a.text}:{kind:"line",index:a.index,x:a.pixel-1,y:t.y,width:2,height:t.height,text:a.text};e.push(h),a.text&&e.push(this.drawLineText(a,t,s))}}catch(e){n.e(e)}finally{n.f()}}},{key:"drawLineText",value:function drawLineText(e,t,i){var r=this.ctx;r.save(),this.setFont(e.fontSize,this.theme.fontFamily,"normal"),r.fillStyle=e.textColor;var n,a=this.textWidth(e.text,e.fontSize);if(i){var o="start"===e.textPosition?"left":"end"===e.textPosition?"right":"center",s="start"===e.textPosition?t.x+6:"end"===e.textPosition?t.x+t.width-6:t.x+t.width/2,l=e.pixel-e.fontSize-4<t.y,h=l?e.pixel+4:e.pixel-4;r.textAlign=o,r.textBaseline=l?"top":"bottom",this.strokeHalo(function(){return r.strokeText(e.text,s,h)}),r.fillText(e.text,s,h);var u="right"===o?s-a:"center"===o?s-a/2:s;n={kind:"line",index:e.index,x:u,y:l?h:h-e.fontSize,width:a,height:e.fontSize,text:e.text}}else{var c=e.pixel+4+a>t.x+t.width,d=c?e.pixel-4:e.pixel+4,f=t.y+6;r.textAlign=c?"right":"left",r.textBaseline="top",this.strokeHalo(function(){return r.strokeText(e.text,d,f)}),r.fillText(e.text,d,f),n={kind:"line",index:e.index,x:c?d-a:d,y:f,width:a,height:e.fontSize,text:e.text}}return r.restore(),n}},{key:"drawPoints",value:function drawPoints(e){var t,i=_createForOfIteratorHelper(this.resolved.points);try{for(i.s();!(t=i.n()).done;){var r=t.value,n=this.ctx,a=r.symbolSize/2;n.save(),n.beginPath(),n.fillStyle=r.color,"circle"===r.symbol?n.arc(r.x,r.y,a,0,2*Math.PI):"rect"===r.symbol?n.rect(r.x-a,r.y-a,r.symbolSize,r.symbolSize):"diamond"===r.symbol?(n.moveTo(r.x,r.y-a),n.lineTo(r.x+a,r.y),n.lineTo(r.x,r.y+a),n.lineTo(r.x-a,r.y),n.closePath()):(n.moveTo(r.x,r.y-a),n.lineTo(r.x+a,r.y+a),n.lineTo(r.x-a,r.y+a),n.closePath()),n.fill(),n.restore(),e.push({kind:"point",index:r.index,x:r.x-a,y:r.y-a,width:r.symbolSize,height:r.symbolSize,text:r.text}),r.text&&e.push(this.drawPointText(r))}}catch(e){i.e(e)}finally{i.f()}}},{key:"drawPointText",value:function drawPointText(e){var t=this.ctx,i=e.symbolSize/2;t.save(),this.setFont(e.fontSize,this.theme.fontFamily,"normal"),t.fillStyle=e.textColor;var r=this.textWidth(e.text,e.fontSize),n=e.x,a=e.y,o="center",s="bottom";"top"===e.textPosition?(o="center",s="bottom",a=e.y-i-3):"bottom"===e.textPosition?(o="center",s="top",a=e.y+i+3):"left"===e.textPosition?(o="right",s="middle",n=e.x-i-3):(o="left",s="middle",n=e.x+i+3),t.textAlign=o,t.textBaseline=s,this.strokeHalo(function(){return t.strokeText(e.text,n,a)}),t.fillText(e.text,n,a),t.restore();var l="right"===o?n-r:"center"===o?n-r/2:n,h=e.fontSize,u="bottom"===s?a-h:"middle"===s?a-h/2:a;return{kind:"point",index:e.index,x:l,y:u,width:r,height:h,text:e.text}}},{key:"strokeHalo",value:function strokeHalo(e){var t=this.ctx,i=this.theme?this.theme.labelHaloColor:null;if(i){var r=t.lineWidth,n=t.lineJoin,a=t.strokeStyle;t.lineWidth=3*this.unit(),t.lineJoin="round",t.strokeStyle=i,e(),t.lineWidth=r,t.lineJoin=n,t.strokeStyle=a}}},{key:"textWidth",value:function textWidth(e,t){return measureTextWidth(this.ctx,e,t,this.theme?this.theme.fontFamily:"sans-serif")}}])}(),X=function(){function PlotArea(e){var t;return _classCallCheck(this,PlotArea),_defineProperty(t=_callSuper(this,PlotArea,[_objectSpread2({interactive:!0},e)]),"background",null),_defineProperty(t,"borderColor",null),t}return _inherits(PlotArea,V),_createClass(PlotArea,[{key:"setBackground",value:function setBackground(e){return this.background=e,this.markDirty()}},{key:"doRender",value:function doRender(){this.ctx.beginPath();var e=this.state,t=e.width,i=e.height;if(this.background&&(this.ctx.fillStyle=this.background,this.ctx.fillRect(0,0,t,i)),this.borderColor){this.ctx.strokeStyle=this.borderColor,this.ctx.lineWidth=this.unit();var r=this.unit()/2;this.ctx.strokeRect(r,r,t-this.unit(),i-this.unit())}}}])}(),U=function(){function Legend(e){var t;return _classCallCheck(this,Legend),_defineProperty(t=_callSuper(this,Legend,[_objectSpread2({interactive:!0},e)]),"layout",null),_defineProperty(t,"theme",null),_defineProperty(t,"selectable",!0),_defineProperty(t,"hoverIndex",-1),t}return _inherits(Legend,V),_createClass(Legend,[{key:"items",get:function get(){return this.layout&&this.layout.legend?this.layout.legend.items:[]}},{key:"hitItem",value:function hitItem(e,t){for(var i=this.items,r=0;r<i.length;r++){var n=i[r];if(e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)return r}return-1}},{key:"containsLocalPoint",value:function containsLocalPoint(e,t){return this.selectable&&this.hitItem(e,t)>=0}},{key:"doRender",value:function doRender(){if(this.theme&&this.layout&&this.layout.legend){var e=this.ctx,t=this.layout.legend.items;this.layout.legend,e.beginPath(),e.save();for(var i=0;i<t.length;i++){var r=t[i],n=r.y+r.height/2;e.globalAlpha=r.hidden?.45:1,e.fillStyle=r.color,roundRect(e,r.x,n-6,12,12,Math.min(3,6)),e.fill(),this.setFont(this.theme.fontSize,this.theme.fontFamily),e.textAlign="left",e.textBaseline="middle",e.fillStyle=r.hidden?this.theme.legend.inactiveColor:this.theme.legend.textColor,e.fillText(r.name,r.x+12+6,n),this.hoverIndex===i&&(e.globalAlpha=1,e.strokeStyle=this.theme.axisLineColor,e.lineWidth=this.unit(),roundRect(e,r.x-4,r.y+1,r.width+8,r.height-2,4),e.stroke())}e.restore()}}}])}();function roundRect(e,t,i,r,n,a){var o=Math.max(0,Math.min(a,r/2,n/2));e.beginPath(),o<=0?e.rect(t,i,r,n):(e.moveTo(t+o,i),e.lineTo(t+r-o,i),e.arcTo(t+r,i,t+r,i+o,o),e.lineTo(t+r,i+n-o),e.arcTo(t+r,i+n,t+r-o,i+n,o),e.lineTo(t+o,i+n),e.arcTo(t,i+n,t,i+n-o,o),e.lineTo(t,i+o),e.arcTo(t,i,t+o,i,o),e.closePath())}var G=function(){function Title(e){var t;return _classCallCheck(this,Title),_defineProperty(t=_callSuper(this,Title,[_objectSpread2({interactive:!1},e)]),"layout",null),_defineProperty(t,"theme",null),t}return _inherits(Title,V),_createClass(Title,[{key:"doRender",value:function doRender(){var e=this.layout&&this.layout.title;if(e&&this.theme&&this.layout){var t=this.layout.canvas,i=this.ctx,r="left"===e.align?0:"right"===e.align?t.width:t.width/2,n=e.y;i.save(),i.textAlign=e.align,i.textBaseline="top",e.text&&(this.setFont(e.textStyle.fontSize,this.theme.fontFamily,e.textStyle.fontWeight),i.fillStyle=e.textStyle.color,i.fillText(e.text,r,n),n+=1.5*e.textStyle.fontSize),e.subtext&&(this.setFont(e.subtextStyle.fontSize,this.theme.fontFamily),i.fillStyle=e.subtextStyle.color,i.fillText(e.subtext,r,n)),i.restore()}}}])}(),K=function(){function Tooltip(e){var t;return _classCallCheck(this,Tooltip),_defineProperty(t=_callSuper(this,Tooltip,[_objectSpread2({interactive:!1},e)]),"theme",null),_defineProperty(t,"option",{}),_defineProperty(t,"layout",null),_defineProperty(t,"content",null),_defineProperty(t,"anchor",[0,0]),_defineProperty(t,"follow",!0),_defineProperty(t,"lastRect",null),_defineProperty(t,"pendingClear",!1),t}return _inherits(Tooltip,V),_createClass(Tooltip,[{key:"show",value:function show(e,t){var i=!this.content||this.pendingClear||this.currentOpacity()<.999;return this.content=e,this.anchor=t,this.pendingClear=!1,i&&this.playFade(!0),this.markDirty()}},{key:"hide",value:function hide(){return this.content?shouldAnimate()?(this.pendingClear=!0,this.playFade(!1),this.markDirty()):(this.content=null,this.lastRect=null,this.markDirty()):this}},{key:"panelOpacity",value:function panelOpacity(){var e=Number(this.state.panelOpacity);return isFinite(e)?Math.max(0,Math.min(1,e)):1}},{key:"currentOpacity",value:function currentOpacity(){var e=Number(this.state.panelOpacity);return isFinite(e)?Math.max(0,Math.min(1,e)):0}},{key:"playFade",value:function playFade(e){if(!shouldAnimate())return this.setState({panelOpacity:e?1:0,slideY:0}),void(e||(this.content=null,this.lastRect=null));var t=_objectSpread2({},this.props.animations||{});t.panelOpacity={from:this.currentOpacity(),to:e?1:0,duration:e?140:110,easing:e?"easeOutCubic":"easeInQuad",startTime:void 0,finished:!1},e&&(t.slideY={from:6,to:0,duration:180,easing:"easeOutCubic",startTime:void 0,finished:!1},this.state.slideY=6),this.props.animations=t,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),this.markDirty()}},{key:"doRender",value:function doRender(){if(this.lastRect=null,this.content&&this.theme&&this.layout){var e=this.panelOpacity();if(this.pendingClear&&e<=.02)return this.content=null,void(this.pendingClear=!1);var t,i=this.theme,r=this.option,n=i.tooltip,a=r.fontSize||n.fontSize,o=i.fontFamily,s=n.padding,l=1.6*a,h=this.content.rows,u=this.content.title?measureTextWidth(this.ctx,this.content.title,a,o):0,c=0,d=_createForOfIteratorHelper(h);try{for(d.s();!(t=d.n()).done;){var f=t.value,p=16+measureTextWidth(this.ctx,f.name,a,o)+16+measureTextWidth(this.ctx,f.value,a,o);p>c&&(c=p)}}catch(e){d.e(e)}finally{d.f()}var v=Math.max(u,c)+2*s,m=2*s+(this.content.title?l:0)+h.length*l,g=r.offset||[14,14],b=this.layout.canvas,k=this.layout.plot,S=this.anchor[0]+g[0],A=this.anchor[1]+g[1];S+v>b.width&&(S=this.anchor[0]-g[0]-v),S=v<=k.width-4?Math.max(k.x+2,Math.min(S,k.x+k.width-v-2)):Math.max(2,Math.min(S,Math.max(2,b.width-v-2))),A+m>b.height&&(A=this.anchor[1]-g[1]-m);var w=k.y+k.height-(a+8)/2;if(A+m>w){var M=this.anchor[1]-g[1]-m;A=M>=k.y+2?M:Math.max(k.y+2,w-m)}A=Math.max(2,Math.min(A,Math.max(2,b.height-m-2))),this.lastRect={x:S,y:A,width:v,height:m};var _=this.ctx,C=this.unit();_.beginPath(),_.save(),_.globalAlpha=e,A+=Number(this.state.slideY)||0,_.shadowColor=n.shadowColor,_.shadowBlur=10*C,_.shadowOffsetY=2*C,_.fillStyle=r.backgroundColor||n.background,roundRect(_,S,A,v,m,n.radius),_.fill(),_.shadowColor="transparent",_.shadowBlur=0,_.shadowOffsetY=0,_.strokeStyle=r.borderColor||n.borderColor,_.lineWidth=C,roundRect(_,S+C/2,A+C/2,v-C,m-C,n.radius),_.stroke(),_.fillStyle=r.textColor||n.textColor,_.textAlign="left",_.textBaseline="middle";var P=A+s+l/2;this.content.title&&(this.setFont(a,o,"bold"),_.fillText(this.content.title,S+s,P),P+=l);var T,I=_createForOfIteratorHelper(h);try{for(I.s();!(T=I.n()).done;){var N=T.value,D=P+l/2-l/2+l/2;this.setFont(a,o),_.fillStyle=N.color,roundRect(_,S+s,D-4,8,8,2),_.fill(),_.fillStyle=r.textColor||n.textColor,_.fillText(N.name,S+s+8+8,D),_.textAlign="right",_.fillText(N.value,S+v-s,D),_.textAlign="left",P+=l}}catch(e){I.e(e)}finally{I.f()}_.restore()}}}])}();var Y=function(){function Crosshair(e){var t;return _classCallCheck(this,Crosshair),_defineProperty(t=_callSuper(this,Crosshair,[_objectSpread2({interactive:!1},e)]),"layout",null),_defineProperty(t,"theme",null),_defineProperty(t,"option",{}),_defineProperty(t,"pixelX",null),_defineProperty(t,"pixelY",null),_defineProperty(t,"xLabel",""),_defineProperty(t,"yLabel",""),_defineProperty(t,"lastChipRects",[]),_defineProperty(t,"followDuration",90),t}return _inherits(Crosshair,V),_createClass(Crosshair,[{key:"show",value:function show(e,t,i,r){var n=null!==this.pixelX&&null!==e&&Math.abs(this.pixelX-e)<.5&&(this.pixelY===t||null!==this.pixelY&&null!==t&&Math.abs(this.pixelY-t)<.5);return this.pixelX=e,this.pixelY=t,this.xLabel=i,this.yLabel=r,n||this.animateAxis(e,t),this.markDirty()}},{key:"drawnX",value:function drawnX(){var e=Number(this.state.axisX);return null===this.pixelX?null:isFinite(e)?e:this.pixelX}},{key:"drawnY",value:function drawnY(){var e=Number(this.state.axisY);return null===this.pixelY?null:isFinite(e)?e:this.pixelY}},{key:"animateAxis",value:function animateAxis(e,t){if(!shouldAnimate()||null===e||this.followDuration<=0)this.setState({axisX:e,axisY:t});else{var i=this.drawnX(),r=this.drawnY();if(null!==i){var n=function crosshairGlideDuration(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;if(!isFinite(t)||t<=0)return 0;var r=Math.abs(e);return!isFinite(r)||r<=0?0:Math.max(16,Math.min(t,r/i))}(Math.abs(e-i),this.followDuration);if(n<=0)this.setState({axisX:e,axisY:t});else{var a=_objectSpread2({},this.props.animations||{});a.axisX={from:i,to:e,duration:n,easing:"easeOutCubic",startTime:void 0,finished:!1},null!==r&&null!==t&&(a.axisY={from:r,to:t,duration:n,easing:"easeOutCubic",startTime:void 0,finished:!1}),this.props.animations=a,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this)}}else this.setState({axisX:e,axisY:t})}}},{key:"hide",value:function hide(){return null===this.pixelX&&null===this.pixelY?this:(this.pixelX=null,this.pixelY=null,this.stopAxisAnimation(),this.markDirty())}},{key:"stopAxisAnimation",value:function stopAxisAnimation(){var e=this.props.animations;if(e)for(var t in e)e[t]&&(e[t].finished=!0);this.ice&&this.ice.animationManager&&this.ice.animationManager.remove(this),this.state.axisX=null,this.state.axisY=null}},{key:"doRender",value:function doRender(){if(this.lastChipRects=[],this.layout&&this.theme&&!1!==this.option.show&&"none"!==this.option.type&&(null!==this.pixelX||null!==this.pixelY)){var e=this.layout.plot,t=this.ctx,i=this.unit(),r=this.option.axis||"x";if(t.beginPath(),t.save(),t.strokeStyle=this.option.lineColor||this.theme.crosshair.lineColor,t.lineWidth=i,"function"==typeof t.setLineDash&&t.setLineDash([3*i,3*i]),t.beginPath(),null!==this.pixelX&&"y"!==r){var n=this.snap(this.drawnX());t.moveTo(n,e.y),t.lineTo(n,e.y+e.height)}if(null!==this.pixelY&&("y"===r||"xy"===r)){var a=this.snap(this.drawnY());t.moveTo(e.x,a),t.lineTo(e.x+e.width,a)}t.stroke(),"function"==typeof t.setLineDash&&t.setLineDash([]),!1!==this.option.showAxisLabel&&(this.setFont(this.theme.fontSize,this.theme.fontFamily),t.textAlign="center",t.textBaseline="middle",null!==this.pixelX&&this.xLabel&&"y"!==r&&this.drawChip(this.snap(this.drawnX()),e.y+e.height,this.xLabel),null===this.pixelY||!this.yLabel||"y"!==r&&"xy"!==r||this.drawChip(e.x,this.snap(this.drawnY()),this.yLabel)),t.restore()}}},{key:"drawChip",value:function drawChip(e,t,i){var r=this.ctx,n=this.theme,a=r.measureText(i).width+12,o=n.fontSize+6;r.fillStyle=n.crosshair.labelBackground,this.lastChipRects.push({x:e-a/2,y:t-o/2,width:a,height:o}),r.fillRect(e-a/2,t-o/2,a,o),r.fillStyle=n.crosshair.labelColor,r.fillText(i,e,t)}}])}(),q=function(){function Highlight(e){var t;return _classCallCheck(this,Highlight),_defineProperty(t=_callSuper(this,Highlight,[_objectSpread2({interactive:!1},e)]),"theme",null),_defineProperty(t,"hoverItems",[]),_defineProperty(t,"selectionItems",[]),t}return _inherits(Highlight,V),_createClass(Highlight,[{key:"setHover",value:function setHover(e){return this.hoverItems=e,this.markDirty()}},{key:"setSelection",value:function setSelection(e){return this.selectionItems=e,this.markDirty()}},{key:"doRender",value:function doRender(){if(this.theme){var e=this.ctx,t=this.unit();e.beginPath(),e.save();var i,r=_createForOfIteratorHelper(this.hoverItems);try{for(r.s();!(i=r.n()).done;){var n=i.value;if("rect"===n.shape){var a=n.width||0,o=n.height||0;if(a<=0||o<=0)continue;e.strokeStyle=n.color,e.lineWidth=Math.max(t,1.5*t),roundRect(e,n.x-a/2,n.y-o/2,a,o,Math.min(4,a/2,o/2)),e.stroke()}else{var s=Math.max(3,n.size/2+3);e.beginPath(),e.arc(n.x,n.y,s,0,2*Math.PI),e.fillStyle="rgba(255,255,255,0.55)",e.fill(),e.beginPath(),e.arc(n.x,n.y,s,0,2*Math.PI),e.strokeStyle=n.color,e.lineWidth=Math.max(t,1.5*t),e.stroke()}}}catch(e){r.e(e)}finally{r.f()}var l,h=_createForOfIteratorHelper(this.selectionItems);try{for(h.s();!(l=h.n()).done;){var u=l.value;if(e.strokeStyle=this.theme.selection.stroke,e.lineWidth=Math.max(t,1.5*t),"rect"===u.shape){var c=u.width||0,d=u.height||0;if(c<=0||d<=0)continue;roundRect(e,u.x-c/2-2,u.y-d/2-2,c+4,d+4,5),e.stroke()}else{var f=Math.max(3,u.size/2+3);e.beginPath(),e.arc(u.x,u.y,f,0,2*Math.PI),e.stroke()}}}catch(e){h.e(e)}finally{h.f()}e.restore()}}}])}(),$=function(){function Brush(e){var t;return _classCallCheck(this,Brush),_defineProperty(t=_callSuper(this,Brush,[_objectSpread2({interactive:!1},e)]),"theme",null),_defineProperty(t,"rect",null),_defineProperty(t,"color",null),t}return _inherits(Brush,V),_createClass(Brush,[{key:"setRect",value:function setRect(e){return this.rect=e,e?this.keepAnimating():this.stopAnimating(),this.markDirty()}},{key:"doRender",value:function doRender(){if(this.rect&&this.theme){var e=this.ctx,t=this.color||this.theme.brush,i=this.unit();if(e.beginPath(),e.save(),e.fillStyle=t.fill,e.fillRect(this.rect.x,this.rect.y,this.rect.width,this.rect.height),e.strokeStyle=t.stroke,e.lineWidth=i,"function"==typeof e.setLineDash){var r=[5*i,4*i],n=r[0]+r[1]||1;e.setLineDash(r),"number"==typeof e.lineDashOffset&&(e.lineDashOffset=-Date.now()/1e3*26%n)}e.strokeRect(this.rect.x,this.rect.y,this.rect.width,this.rect.height),"function"==typeof e.setLineDash&&e.setLineDash([]),e.restore()}}}])}(),Z=function(){function RadarGrid(e){var t;return _classCallCheck(this,RadarGrid),_defineProperty(t=_callSuper(this,RadarGrid,[_objectSpread2({interactive:!1},e)]),"coord",null),_defineProperty(t,"theme",null),_defineProperty(t,"layout",null),t}return _inherits(RadarGrid,V),_createClass(RadarGrid,[{key:"doRender",value:function doRender(){var e=this.coord,t=this.theme;if(e&&t){var i=this.ctx,r=this.unit(),n=e.indicators.length;if(n){var a=e.polar.cx,o=e.polar.cy,s=e.polar.radius,l=function angleOf(e){return-Math.PI/2+e/n*Math.PI*2};this.layout,i.beginPath(),i.save(),i.lineWidth=r,i.strokeStyle=t.splitLineColor;for(var h=1;h<=e.splitNumber;h++){var u=s*h/e.splitNumber;if(i.beginPath(),"circle"===e.shape)i.arc(a,o,u,0,2*Math.PI);else{for(var c=0;c<n;c++){var d=l(c),f=a+Math.cos(d)*u,p=o+Math.sin(d)*u;0===c?i.moveTo(f,p):i.lineTo(f,p)}i.closePath()}i.stroke()}i.beginPath();for(var v=0;v<n;v++){var m=l(v);i.moveTo(a,o),i.lineTo(a+Math.cos(m)*s,o+Math.sin(m)*s)}i.stroke(),this.setFont(t.fontSize,t.fontFamily),i.fillStyle=t.subTextColor,i.textBaseline="middle";for(var g=0;g<n;g++){var b=l(g),k=a+Math.cos(b)*(s+10*r),S=o+Math.sin(b)*(s+10*r),A=Math.cos(b);i.textAlign=Math.abs(A)<.2?"center":A>0?"left":"right",i.fillText(e.indicators[g].name,k,S)}i.restore()}}}}])}(),J=function(){function PolarGrid(e){var t;return _classCallCheck(this,PolarGrid),_defineProperty(t=_callSuper(this,PolarGrid,[_objectSpread2({interactive:!1},e)]),"coord",null),_defineProperty(t,"theme",null),_defineProperty(t,"layout",null),t}return _inherits(PolarGrid,V),_createClass(PolarGrid,[{key:"geometry",value:function geometry(){var e=this.coord;if(!e)return null;var t=e.plot,i=t.x+e.xScale.map(0),r=t.y+e.yScale.map(0);if(!isFinite(i)||!isFinite(r))return null;var n=Math.min(Math.abs(i-t.x),Math.abs(t.x+t.width-i),Math.abs(r-t.y),Math.abs(t.y+t.height-r));if(!(n>1))return null;var a=e.xScale.map(1)-e.xScale.map(0);return{cx:i,cy:r,radiusPx:n,rMax:Math.abs(a)>1e-9?n/Math.abs(a):0}}},{key:"doRender",value:function doRender(){var e=this.coord,t=this.theme;if(e&&t&&!1!==e.options.show){var i=this.geometry();if(i){var r=i.cx,n=i.cy,a=i.radiusPx,o=i.rMax,s=e.options,l=Math.max(1,Math.min(12,Number(s.splitNumber)||4)),h=Math.max(4,Math.min(36,Number(s.spokeCount)||12)),u=(Number(s.startAngle)||0)*Math.PI/180,c=this.unit(),d=this.ctx;d.beginPath(),d.save(),d.lineWidth=c,d.strokeStyle=t.splitLineColor;for(var f=1;f<=l;f++)d.beginPath(),d.arc(r,n,a*f/l,0,2*Math.PI),d.stroke();d.beginPath();for(var p=0;p<h;p++){var v=u+p/h*Math.PI*2;d.moveTo(r,n),d.lineTo(r+Math.cos(v)*a,n+Math.sin(v)*a)}if(d.stroke(),!1!==s.showLabels&&o>0){var m=u+Math.PI/4,g=Math.cos(m),b=Math.sin(m);this.setFont(t.fontSize,t.fontFamily),d.fillStyle=t.subTextColor,d.textBaseline="middle";for(var k=1;k<=l;k++){var S=o*k/l,A=r+g*(a*k/l),w=n+b*(a*k/l);d.textAlign=g>=0?"left":"right";var M=Math.abs(S)>=1?String(Number(S.toPrecision(3))):String(Number(S.toPrecision(2)));d.strokeStyle="transparent"===t.backgroundColor?"#ffffff":t.backgroundColor,d.lineWidth=3*c,d.strokeText(M,A+3*g*c,w+3*b*c),d.fillText(M,A+3*g*c,w+3*b*c),d.strokeStyle=t.splitLineColor,d.lineWidth=c}}d.restore()}}}}])}(),Q=function(){function DataZoomSlider(e){var t;return _classCallCheck(this,DataZoomSlider),_defineProperty(t=_callSuper(this,DataZoomSlider,[_objectSpread2({interactive:!0},e)]),"theme",null),_defineProperty(t,"start",0),_defineProperty(t,"end",1),_defineProperty(t,"activePart",null),_defineProperty(t,"handleWidth",12),t}return _inherits(DataZoomSlider,V),_createClass(DataZoomSlider,[{key:"setWindow",value:function setWindow(e,t){var i=clamp$2(e,0,1),r=clamp$2(t,0,1);return Math.abs(i-this.start)<1e-6&&Math.abs(r-this.end)<1e-6?this:(this.start=i,this.end=r,this.markDirty())}},{key:"setActive",value:function setActive(e){return this.activePart===e?this:(this.activePart=e,this.markDirty())}},{key:"hitPart",value:function hitPart(e,t){var i=this.state,r=i.width,n=i.height;if(e<0||e>r||t<0||t>n)return null;var a=this.start*r,o=this.end*r,s=this.handleWidth/2;return Math.abs(e-a)<=s?"start":Math.abs(e-o)<=s?"end":e>a&&e<o?"window":"track"}},{key:"fractionAt",value:function fractionAt(e){return clamp$2(e/(this.state.width||1),0,1)}},{key:"doRender",value:function doRender(){if(this.theme){var e=this.ctx,t=this.state,i=t.width,r=t.height,n=this.unit(),a=Math.max(4,Math.round(.34*r)),o=(r-a)/2,s=this.start*i,l=this.end*i,h=this.theme.colorPalette[0],u=this.handleWidth;e.beginPath(),e.save(),e.fillStyle=this.theme.splitLineColor,roundRect(e,0,o,i,a,a/2),e.fill(),e.fillStyle=h,e.globalAlpha=.85,roundRect(e,s,o,Math.max(2,l-s),a,a/2),e.fill(),e.globalAlpha=1;for(var c=0,d=[[s,"start"],[l,"end"]];c<d.length;c++){var f=_slicedToArray(d[c],2),p=f[0],v=f[1],m=clamp$2(p-u/2,0,Math.max(0,i-u));e.fillStyle="#ffffff",e.strokeStyle=this.activePart===v?h:this.theme.axisLineColor,e.lineWidth=(this.activePart===v?2:1)*n,roundRect(e,m,1,u,r-2,3),e.fill(),e.stroke(),e.beginPath(),e.moveTo(m+u/2-2,o-3),e.lineTo(m+u/2-2,o+a+3),e.moveTo(m+u/2+2,o-3),e.lineTo(m+u/2+2,o+a+3),e.strokeStyle=this.theme.subTextColor,e.lineWidth=n,e.stroke()}e.restore()}}}])}(),ee=function(){function SeriesBase(e,t){var i;return _classCallCheck(this,SeriesBase),_defineProperty(i=_callSuper(this,SeriesBase,[_objectSpread2({interactive:!0},t)]),"chartTheme",null),_defineProperty(i,"hiddenSlices",[]),_defineProperty(i,"coord",null),_defineProperty(i,"barSlot",{index:0,count:1}),_defineProperty(i,"pixels",new Float64Array(0)),_defineProperty(i,"effective",new Float64Array(0)),_defineProperty(i,"fromEffective",null),_defineProperty(i,"renderIndices",null),_defineProperty(i,"xMonotonic",!0),_defineProperty(i,"sizeExtent",[0,1]),_defineProperty(i,"itemProgress",new Float64Array(0)),_defineProperty(i,"stagger",0),_defineProperty(i,"animationKind","enter"),_defineProperty(i,"hoverIndex",null),_defineProperty(i,"cacheKey",""),_defineProperty(i,"supportsSampling",!0),_defineProperty(i,"clipToBox",!1),_defineProperty(i,"localBoxScratch",[0,0,0,0]),i.series=e,i}return _inherits(SeriesBase,V),_createClass(SeriesBase,[{key:"__localBox",value:function __localBox(){var e=this.paintPad(),t=this.localBoxScratch;return t[0]=-e,t[1]=-e,t[2]=(this.state.width||0)+e,t[3]=(this.state.height||0)+e,t}},{key:"paintPad",value:function paintPad(){var e=this.series.option,t=!1===e.showSymbol?0:this.maxSymbolSize()/2+4;return Math.max(t,(e.lineWidth||2)+4,6)}},{key:"symbolSizeAt",value:function symbolSizeAt(e){var t=this.series.option,i=t.symbolSize;if("function"==typeof i){var r=this.series.yValueAt(e),n=NaN;try{var a=this.series.virtual?null:this.series.pointAt(e);n=Number(i(r,{dataIndex:e,data:a?a.raw:void 0,seriesName:this.series.name}))}catch(e){n=NaN}return isFinite(n)&&n>0?n:8}var o=this.series.sizeAt(e);if("number"==typeof o&&isFinite(o)){var s=Array.isArray(t.symbolSizeRange)?t.symbolSizeRange:[8,40],l=_slicedToArray(this.sizeExtent,2),h=l[0],u=l[1],c=u>h?(o-h)/(u-h):.5;return s[0]+(s[1]-s[0])*Math.max(0,Math.min(1,c))}var d=Number(i);return isFinite(d)&&d>0?d:8}},{key:"maxSymbolSize",value:function maxSymbolSize(){var e=this.series.option;if("function"==typeof e.symbolSize||this.hasPointSize()){var t=Array.isArray(e.symbolSizeRange)?e.symbolSizeRange:[8,40];return Math.max(8,Number(t[1])||40)}var i=Number(e.symbolSize);return isFinite(i)&&i>0?i:8}},{key:"hasPointSize",value:function hasPointSize(){var e=storeDomainOf(this.series);if(this.series.virtual)return!(!e||!e.sizeExtent);for(var t=this.series,i=0,r=t.pointCount;i<r;i++)if("number"==typeof t.sizeAt(i))return!0;return!1}},{key:"setCoord",value:function setCoord(e){return this.coord=e,this.cacheKey="",this.series.virtual&&this.syncVirtualMeta(),this.markDirty()}},{key:"setHiddenSlices",value:function setHiddenSlices(e){return this.hiddenSlices=e||[],this.markDirty()}},{key:"setAnimationStage",value:function setAnimationStage(e){return this.stagger=e&&isFinite(Number(e.stagger))?Math.max(0,Math.min(.95,Number(e.stagger))):0,this.animationKind=e&&"update"===e.kind?"update":"enter",this}},{key:"isEntering",value:function isEntering(){return"enter"===this.animationKind&&this.progress()<1}},{key:"progressFor",value:function progressFor(e,t){var i=this.progress();if(i>=1)return 1;if(this.stagger<=0||t<=1)return i;var r=1/(1+this.stagger),n=(i-e/(t-1)*this.stagger*r)/r;return n<=0?0:n>=1?1:n}},{key:"computeItemProgress",value:function computeItemProgress(){var e=this.series.pointCount;this.itemProgress.length!==e&&(this.itemProgress=new Float64Array(e));for(var t=0;t<e;t++)this.itemProgress[t]=this.progressFor(t,e)}},{key:"getAnimationState",value:function getAnimationState(){return this.computeItemProgress(),{progress:this.progress(),kind:this.animationKind,stagger:this.stagger,itemProgress:Array.from(this.itemProgress)}}},{key:"setHoverIndex",value:function setHoverIndex(e){var t=void 0===e?null:e;if(this.hoverIndex!==t){var i=null!==this.hoverIndex;this.hoverIndex=t;var r=this.highlightT(),n=null===t?0:1;if(!shouldAnimate())return this.setState({highlightT:n}),void this.markDirty();var a=_objectSpread2({},this.props.animations||{});a.highlightT={from:r,to:n,duration:null===t?180:260,easing:null===t?"easeOutCubic":"springSnappy",startTime:void 0,finished:!1},this.props.animations=a,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),i||null===t||this.markDirty()}}},{key:"highlightT",value:function highlightT(){var e=Number(this.state.highlightT);return isFinite(e)?Math.max(0,Math.min(1.2,e)):0}},{key:"hoverBoost",value:function hoverBoost(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.12,i=arguments.length>2?arguments[2]:void 0;return this.hoverIndex!==e?1:1+t*(void 0===i?this.highlightT():Math.max(0,Math.min(1,i)))}},{key:"hoverAlpha",value:function hoverAlpha(e){return this.hoverIndex!==e?0:Math.max(0,Math.min(1,this.highlightT()))}},{key:"drawHoverOverlay",value:function drawHoverOverlay(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.hoverAlpha(e);if(!(r<=.01||t.width<=0||t.height<=0)){var n=this.ctx,a=this.unit(),o=Number(i.radius)||0;n.save(),n.globalAlpha=r,"none"!==i.fill&&(roundRect(n,t.x,t.y,t.width,t.height,o),n.fillStyle=i.fill||"rgba(255,255,255,0.16)",n.fill()),roundRect(n,t.x,t.y,t.width,t.height,o),n.strokeStyle=i.stroke||"rgba(255,255,255,0.95)",n.lineWidth=Math.max(a,(i.lineWidth||2)*a),n.stroke(),n.restore()}}},{key:"buildSeriesKey",value:function buildSeriesKey(e){return[].concat(_toConsumableArray(e),[this.coordKey(),this.progress(),this.animationKind,this.stagger]).join("|")}},{key:"coordKey",value:function coordKey(){var e=this.coord;if(!e)return"-";var t=[];e.plot&&t.push("p".concat(e.plot.x,",").concat(e.plot.y,",").concat(e.plot.width,",").concat(e.plot.height));for(var i=0,r=["xScale","yScale"];i<r.length;i++){var n=r[i],a=e[n],o=a&&a.domain;o&&o.length&&t.push("".concat(n,"[").concat(o.length,"]:").concat(String(o[0]),"~").concat(String(o[o.length-1])))}return t.join(";")}},{key:"updateSeries",value:function updateSeries(e,t){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]||(this.fromEffective=t&&this.effective.length===2*e.pointCount?new Float64Array(this.effective):null),this.series=e,this.cacheKey="",e.virtual&&this.syncVirtualMeta(),this.markDirty()}},{key:"pixelAt",value:function pixelAt(e){if(this.series.virtual)return this.virtualPixelAt(e);this.rebuildPixels();var t=this.pixels[2*e],i=this.pixels[2*e+1];return isFinite(t)&&isFinite(i)?[t,i]:null}},{key:"barRectAt",value:function barRectAt(e){return null}},{key:"containsLocalPoint",value:function containsLocalPoint(e,t){return this.hitTestIndex(e,t)>=0}},{key:"progress",value:function progress(){var e=Number(this.state.progress);return isFinite(e)?Math.max(0,Math.min(1,e)):1}},{key:"computeEffective",value:function computeEffective(){var e=this.series,t=e.pointCount;this.effective.length!==2*t&&(this.effective=new Float64Array(2*t),this.fromEffective=null),this.computeItemProgress();for(var i=this.progress(),r=0;r<t;r++){var n=this.itemProgress[r];if(null!==this.series.yValueAt(r)){var a=e.topAt(r);if(null!=a){var o=e.baseAt(r),s=isFinite(o)?o:0,l=0,h=0;if(this.fromEffective){var u=this.fromEffective[2*r],c=this.fromEffective[2*r+1];isFinite(u)&&(l=u),isFinite(c)&&(h=c)}this.effective[2*r]=n>=1?s:l+(s-l)*n,this.effective[2*r+1]=n>=1?a:h+(a-h)*n}else this.effective[2*r]=NaN,this.effective[2*r+1]=NaN}else this.effective[2*r]=NaN,this.effective[2*r+1]=NaN}i>=1&&(this.fromEffective=null)}},{key:"rebuildPixels",value:function rebuildPixels(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.series.virtual||this.series.raw){var t=this.coord;if(t){var i=this.buildCacheKey(t);if(e||i!==this.cacheKey){var r=t.xScale.domain,n=t.yScale.domain,a=this.__incrementalXDomain,o=this.__incrementalYDomain,s=function numericPair(e){return Array.isArray(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]&&isFinite(e[0])&&isFinite(e[1])};if(!e&&s(r)&&s(n)&&s(a)&&s(o)&&r[1]-r[0]===a[1]-a[0]&&n[0]===o[0]&&n[1]===o[1]&&this.pixels.length===2*this.series.pointCount){for(var l=(a[0]-r[0])/(r[1]-r[0])*t.plot.width,h=0;h<this.pixels.length;h+=2)this.pixels[h]+=l;return this.__incrementalXDomain=[r[0],r[1]],void(this.cacheKey=i)}this.computeEffective();var u=this.series,c=u.pointCount;this.pixels.length!==2*c&&(this.pixels=new Float64Array(2*c));for(var d=t.xScale,f=t.yScale,p=!0,v=-1/0,m=0;m<c;m++){var g=d.map(u.xValueAt(m)),b=this.effective[2*m+1],k=isFinite(b)?f.map(b):NaN;this.pixels[2*m]=g,this.pixels[2*m+1]=k,isFinite(g)&&(g<v&&(p=!1),v=g)}this.xMonotonic=p,this.sizeExtent=function computeSizeExtent(e){for(var t=1/0,i=-1/0,r=0,n=e.pointCount;r<n;r++){var a=e.sizeAt(r);"number"==typeof a&&isFinite(a)&&(a<t&&(t=a),a>i&&(i=a))}return isFinite(t)?t===i?[t,t+1]:[t,i]:[0,1]}(u),this.renderIndices=this.buildRenderIndices(c,t.plot.width),this.__incrementalXDomain=Array.isArray(r)&&2===r.length?[r[0],r[1]]:null,this.__incrementalYDomain=Array.isArray(n)&&2===n.length?[n[0],n[1]]:null,this.cacheKey=i}}else this.pixels=new Float64Array(0)}else this.syncVirtualMeta()}},{key:"syncVirtualMeta",value:function syncVirtualMeta(){this.pixels.length&&(this.pixels=new Float64Array(0));var e=storeDomainOf(this.series);this.xMonotonic=!(!e||!e.xMonotonic),this.renderIndices=null,e&&e.sizeExtent&&(this.sizeExtent=e.sizeExtent)}},{key:"virtualLowerBound",value:function virtualLowerBound(e){for(var t=this.series,i=0,r=t.pointCount;i<r;){var n=i+r>>1;Number(t.xValueAt(n))<e?i=n+1:r=n}return i}},{key:"virtualUpperBound",value:function virtualUpperBound(e){for(var t=this.series,i=0,r=t.pointCount;i<r;){var n=i+r>>1;Number(t.xValueAt(n))<=e?i=n+1:r=n}return i}},{key:"virtualVisibleWindow",value:function virtualVisibleWindow(e){var t=this.coord,i=this.series.pointCount;if(!t||!i)return{i0:0,i1:-1};if(this.series.chunks)return this.chunkWindow(this.series.chunks,t,e);if(!this.xMonotonic)return{i0:0,i1:i-1};var r=t.xScale.invert(-e),n=t.xScale.invert(t.plot.width+e),a=this.virtualLowerBound(Math.min(r,n)),o=this.virtualUpperBound(Math.max(r,n));return{i0:Math.max(0,a-1),i1:Math.min(i-1,o)}}},{key:"chunkWindow",value:function chunkWindow(e,t,i){var r=this,n=t.xScale.invert(-i),a=t.xScale.invert(t.plot.width+i),o=chunkRangeForX(e,Math.min(n,a),Math.max(n,a)),s=o.from,l=o.to;if(l<s)return{i0:0,i1:-1};var h,u=_createForOfIteratorHelper(function pickChunksForWindow(e,t,i){var r=t-e+1;if(r<=0)return[];var n=Math.max(1,Math.min(Math.max(1,i),r));if(r===n){for(var a=[],o=e;o<=t;o++)a.push(o);return a}for(var s=[],l=0;l<n;l++){var h=e+Math.round(l*(r-1)/(n-1));s[s.length-1]!==h&&s.push(h)}return s}(s,l,e.maxResident));try{for(u.s();!(h=u.n()).done;){requestChunk(e,h.value,function(){return r.markDirty()})}}catch(e){u.e(e)}finally{u.f()}var c=e.offsets[s],d=e.offsets[l]+e.sizes[l]-1;return{i0:c,i1:Math.min(e.total-1,d)}}},{key:"virtualPixelAt",value:function virtualPixelAt(e){var t=this.coord,i=this.series;if(!t||e<0||e>=i.pointCount)return null;var r=i.yValueAt(e);if(null===r)return null;var n=t.xScale.map(i.xValueAt(e)),a=t.yScale.map(r);return isFinite(n)&&isFinite(a)?[n,a]:null}},{key:"virtualNearestIndexAtX",value:function virtualNearestIndexAtX(e){var t=this.coord,i=this.series,r=i.pointCount;if(!t||!r)return-1;var n=function pixelX(e){return t.xScale.map(i.xValueAt(e))},a=i.chunks;if(a){for(var o=Number(t.xScale.invert(e)),s=chunkRangeForX(a,o,o),l=s.from,h=s.to,u=-1,c=1/0,d=Math.max(0,l);d<=h&&d<a.sizes.length;d++)if(a.resident[d]){for(var f=a.offsets[d],p=Math.min(a.total-1,f+a.sizes[d]-1),v=f,m=p;v<m;){var g=v+m>>1,b=n(g);!isFinite(b)||b<e?v=g+1:m=g}for(var k=0,S=[v-1,v,v+1];k<S.length;k++){var A=S[k];if(!(A<f||A>p)){var w=n(A);if(isFinite(w)){var M=Math.abs(w-e);M<c&&(c=M,u=A)}}}}return u}if(!this.xMonotonic){for(var _=-1,C=1/0,P=0;P<r;P++){var T=n(P);if(isFinite(T)){var I=Math.abs(T-e);I<C&&(C=I,_=P)}}return _}for(var N=0,D=r-1;N<D;){var O=N+D>>1,R=n(O);!isFinite(R)||R<e?N=O+1:D=O}for(var H=-1,z=1/0,V=0,E=[N,N-1];V<E.length;V++){var B=E[V];if(!(B<0||B>=r)){var L=n(B);if(isFinite(L)){var j=Math.abs(L-e);j<z&&(z=j,H=B)}}}return H}},{key:"paintInto",value:function paintInto(e){if(!this.series.virtual)return!1;var t=this.ctx;this.ctx=e;try{return this.doRender(),!0}finally{this.ctx=t}}},{key:"virtualIndexRange",value:function virtualIndexRange(e,t){var i=this.coord,r=this.series,n=r.pointCount;if(!i||!n||!r.virtual)return{from:0,to:-1};var a=function inverted(e){return Number(i.xScale.invert(e))},o=a(Math.min(e,t)),s=a(Math.max(e,t));return isFinite(o)&&isFinite(s)?{from:this.virtualLowerBound(o),to:this.virtualUpperBound(s)-1}:{from:0,to:n-1}}},{key:"buildRenderIndices",value:function buildRenderIndices(e,t){if(!this.supportsSampling||!this.xMonotonic)return null;var i=this.series.option;if("none"===i.sampling)return null;if(!i.sampling&&e<=Math.max(2e3,3*t))return null;var r=Math.max(64,Math.min(e,Math.floor(2*t)));return e<=r+2?null:function lttbIndices(e,t,i){if(i>=t||i<=2){for(var r=[],n=0;n<t;n++)r.push(n);return r}for(var a=[0],o=(t-2)/(i-2),s=0,l=0;l<i-2;l++){var h=Math.floor((l+1)*o)+1,u=Math.floor((l+2)*o)+1;u>t&&(u=t);for(var c=0,d=0,f=0;h<u;h++){var p=e[2*h+1];isFinite(p)&&(c+=e[2*h],d+=p,f++)}f?(c/=f,d/=f):(c=e[2*(t-1)],d=e[2*(t-1)+1],isFinite(d)||(d=e[2*s+1],c=e[2*s]));for(var v=Math.floor(l*o)+1,m=Math.min(Math.floor((l+1)*o)+1,t-1),g=e[2*s],b=e[2*s+1],k=-1,S=v,A=v;A<m;A++){var w=e[2*A+1];if(isFinite(w)){var M=e[2*A],_=Math.abs((g-c)*(w-b)-(g-M)*(d-b));_>k&&(k=_,S=A)}}a.push(S),s=S}return a.push(t-1),a}(this.pixels,e,r)}},{key:"renderCount",value:function renderCount(){return this.renderIndices?this.renderIndices.length:this.pixels.length/2}},{key:"renderIndexAt",value:function renderIndexAt(e){return this.renderIndices?this.renderIndices[e]:e}},{key:"nearestIndexAtX",value:function nearestIndexAtX(e){var t=this;if(this.rebuildPixels(),this.series.virtual)return this.virtualNearestIndexAtX(e);var i=this.pixels.length/2;if(!i)return-1;if(!this.xMonotonic){for(var r=-1,n=1/0,a=0;a<i;a++){var o=this.pixels[2*a];if(isFinite(o)){var s=Math.abs(o-e);s<n&&(n=s,r=a)}}return r}for(var l=0,h=i-1;l<h;){var u=l+h>>1,c=this.pixels[2*u];!isFinite(c)||c<e?l=u+1:h=u}var d,f=[l,l-1].filter(function(e){return e>=0&&e<i&&isFinite(t.pixels[2*e])}),p=-1,v=1/0,m=_createForOfIteratorHelper(f);try{for(m.s();!(d=m.n()).done;){var g=d.value,b=Math.abs(this.pixels[2*g]-e);b<v&&(v=b,p=g)}}catch(e){m.e(e)}finally{m.f()}return p}},{key:"buildCacheKey",value:function buildCacheKey(e){var t=e.xScale.domain,i=e.yScale.domain;return[this.series.pointCount,this.progress(),e.plot.width,e.plot.height,String(t[0]),String(t[t.length-1]),String(i[0]),String(i[1]),this.series.pointCount?String(this.series.xValueAt(0)):""].join("|")}},{key:"eachSegment",value:function eachSegment(e){for(var t=this.pixels.length/2,i=0;i<t-1;i++){var r=this.pixels[2*i],n=this.pixels[2*i+1],a=this.pixels[2*(i+1)],o=this.pixels[2*(i+1)+1];isFinite(r)&&isFinite(n)&&isFinite(a)&&isFinite(o)&&e(r,n,a,o,i)}}},{key:"pointColor",value:function pointColor(e){return this.series.option.color||this.series.color}},{key:"lineWidthDevice",value:function lineWidthDevice(){var e=this.series.option.lineWidth;return isFinite(e)?e:2}},{key:"opacity",value:function opacity(){var e=Number(this.series.option.opacity);return isFinite(e)?Math.max(0,Math.min(1,e)):1}},{key:"beginDraw",value:function beginDraw(){this.ctx.beginPath(),this.ctx.save(),this.clipToBox&&(this.ctx.beginPath(),this.ctx.rect(0,0,this.state.width,this.state.height),this.ctx.clip()),this.ctx.lineJoin="round",this.ctx.lineCap="round",this.ctx.globalAlpha=this.opacity()}},{key:"endDraw",value:function endDraw(){this.ctx.restore()}},{key:"drawSymbol",value:function drawSymbol(e,t,i,r,n,a){var o=this.ctx,s=this.unit();o.beginPath(),"rect"===i?o.rect(e-r/2,t-r/2,r,r):o.arc(e,t,Math.max(1,r/2),0,2*Math.PI),n&&(o.fillStyle=n,o.fill()),a&&(o.strokeStyle=a,o.lineWidth=s,o.stroke())}},{key:"pointByIndex",value:function pointByIndex(e){return this.series.pointAt(e)||null}}])}();var te=function(){function LineSeries(){var e;_classCallCheck(this,LineSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,LineSeries,[].concat(i)),"seriesType","line"),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"fillArea",!1),e}return _inherits(LineSeries,ee),_createClass(LineSeries,[{key:"doRender",value:function doRender(){this.rebuildPixels();var e=this.renderSequence(),t=e.pts,i=e.indices;if(t.length){var r=this.series.option,n=this.pointColor(0),a=this.unit(),o=this.lineWidthDevice()*a,s=r.symbol||"circle",l=!0===r.showSymbol||"scatter"===this.seriesType,h=this.ctx;if(this.beginDraw(),this.fillArea&&this.drawArea(n,t,i),h.beginPath(),h.strokeStyle=n,h.lineWidth=o,"function"==typeof h.setLineDash&&Array.isArray(r.lineDash)&&h.setLineDash(r.lineDash.map(function(e){return e*a})),r.smooth?this.drawSmoothLine(t,"number"==typeof r.smooth?r.smooth:.5):this.drawStraightLine(t),h.stroke(),"function"==typeof h.setLineDash&&h.setLineDash([]),l&&"none"!==s)for(var u=r.symbolFill||n,c=r.symbolStroke||"#ffffff",d=0;d<t.length;d++){var f=t[d];f&&this.drawSymbol(f[0],f[1],s,this.symbolSizeAt(i[d]),u,c)}this.endDraw()}}},{key:"renderSequence",value:function renderSequence(){if(this.rebuildPixels(),this.series.virtual)return this.virtualRenderSequence();var e=[],t=[],i=this.renderCount();this.isEntering()&&(i=Math.max(1,Math.ceil(i*this.progress())));for(var r=0;r<i;r++){var n=this.renderIndexAt(r),a=this.pixels[2*n],o=this.pixels[2*n+1];isFinite(a)&&isFinite(o)?(e.push([a,o]),t.push(n)):e.length&&null!==e[e.length-1]&&(e.push(null),t.push(-1))}return{pts:e,indices:t}}},{key:"renderPoints",value:function renderPoints(){return this.renderSequence().pts.filter(function(e){return!!e})}},{key:"revealedPointCount",value:function revealedPointCount(){return this.rebuildPixels(),this.renderPoints().length}},{key:"virtualRenderSequence",value:function virtualRenderSequence(){var e=this,t=this.coord,i=this.series,r=i.pointCount,n={pts:[],indices:[]};if(!t||!r)return n;var a=this.virtualVisibleWindow(this.maxSymbolSize()),o=a.i0,s=a.i1;if(s<o)return n;var l=s-o+1,h=t.plot.width,u=this.isEntering()?Math.max(0,Math.ceil(l*this.progress())):l;if(u<=0)return n;var c=Math.min(s,o+u-1),d=l>4096?Math.max(1,Math.floor(l/(8*h))):1,f=[],p=[],v=function pushBreak(){f.length&&null!==f[f.length-1]&&(f.push(null),p.push(-1))};if(1===d){for(var m=o;m<=c;m++){var g=this.virtualPixelAt(m);g?(f.push(g),p.push(m)):v()}return{pts:f,indices:p}}for(var b=NaN,k=-1,S=-1,A=-1,w=-1,M=1/0,_=-1/0,C=function flush(){if(!(k<0)){for(var t=[],i=0,r=[k,A,w,S];i<r.length;i++){var n=r[i];n<0||t.indexOf(n)>=0||t.push(n)}t.sort(function(e,t){return e-t});for(var a=0,o=t;a<o.length;a++){var s=o[a],l=e.virtualPixelAt(s);l&&(f.push(l),p.push(s))}k=-1}},P=o;P<=c;P+=d){var T=i.yValueAt(P);if(null!==T){var I=t.xScale.map(i.xValueAt(P)),N=t.yScale.map(T);if(isFinite(I)&&isFinite(N)){var D=Math.floor(I);D===b?(S=P,N<M&&(M=N,A=P),N>_&&(_=N,w=P)):(C(),b=D,k=P,S=P,A=P,w=P,M=N,_=N)}}else C(),v(),b=NaN}return C(),{pts:f,indices:p}}},{key:"drawStraightLine",value:function drawStraightLine(e){var t,i=this.ctx,r=!1,n=_createForOfIteratorHelper(e);try{for(n.s();!(t=n.n()).done;){var a=t.value;a?r?i.lineTo(a[0],a[1]):(i.moveTo(a[0],a[1]),r=!0):r=!1}}catch(e){n.e(e)}finally{n.f()}}},{key:"drawSmoothLine",value:function drawSmoothLine(e,t){var i,r=this.ctx,n=Math.max(.05,Math.min(1,t))/3,a=[],o=function flush(){if(1===a.length)r.moveTo(a[0][0],a[0][1]);else if(a.length>1){r.moveTo(a[0][0],a[0][1]);for(var e=0;e<a.length-1;e++){var t=e>0?a[e-1]:a[e],i=a[e],o=a[e+1],s=e+2<a.length?a[e+2]:o,l=i[0]+(o[0]-t[0])*n,h=i[1]+(o[1]-t[1])*n,u=o[0]-(s[0]-i[0])*n,c=o[1]-(s[1]-i[1])*n;r.bezierCurveTo(l,h,u,c,o[0],o[1])}}a=[]},s=_createForOfIteratorHelper(e);try{for(s.s();!(i=s.n()).done;){var l=i.value;l?a.push(l):o()}}catch(e){s.e(e)}finally{s.f()}o()}},{key:"drawArea",value:function drawArea(e,t,i){var r=this.coord;if(r){var n=this.ctx,a=Number(this.series.option.areaOpacity),o=isFinite(a)?Math.max(0,Math.min(1,a)):.28,s=n.createLinearGradient?n.createLinearGradient(0,0,0,r.plot.height):null;s?(s.addColorStop(0,hexToRgba(e,o)),s.addColorStop(1,hexToRgba(e,.02)),n.fillStyle=s):n.fillStyle=hexToRgba(e,o);for(var l=0;l<t.length;)if(t[l]){for(var h=l;h<t.length&&t[h];)h+=1;if(h-l>=2){n.beginPath(),n.moveTo(t[l][0],this.baselineYForIndex(i[l]));for(var u=l;u<h;u++)n.lineTo(t[u][0],t[u][1]);for(var c=h-1;c>=l;c--)n.lineTo(t[c][0],this.baselineYForIndex(i[c]));n.closePath(),n.fill()}l=h}else l+=1}}},{key:"baselineYForIndex",value:function baselineYForIndex(e){var t=this.coord;if(!t)return 0;if(this.series.virtual){var i=t.yScale.map(0);return isFinite(i)?i:t.plot.height}var r=this.effective[2*e];return isFinite(r)?t.yScale.map(r):t.plot.height}},{key:"hitTestIndex",value:function hitTestIndex(e,t){if(this.series.virtual)return this.hitTestVirtual(e,t);this.rebuildPixels();var i=this.pixels.length/2;if(!i)return-1;var r=this.series.option,n=r.hitRadius?Number(r.hitRadius):Math.max(8,this.maxSymbolSize()/2+4);if(i>1024&&this.xMonotonic){var a=this.nearestIndexAtX(e);if(a<0)return-1;for(var o=-1,s=n*n,l=Math.max(0,a-2),h=Math.min(i-1,a+2),u=l;u<=h;u++){var c=this.pixels[2*u],d=this.pixels[2*u+1];if(isFinite(c)&&isFinite(d)){var f=c-e,p=d-t,v=f*f+p*p;v<=s&&(s=v,o=u)}}if(o>=0)return o;for(var m=Math.max(4,this.lineWidthDevice()+4),g=Math.max(0,a-1);g<=Math.min(i-2,a);g++){if(distanceToSegment(e,t,this.pixels[2*g],this.pixels[2*g+1],this.pixels[2*(g+1)],this.pixels[2*(g+1)+1])<=m)return Math.abs(e-this.pixels[2*g])<=Math.abs(e-this.pixels[2*(g+1)])?g:g+1}return-1}for(var b=-1,k=n*n,S=0;S<i;S++){var A=this.pixels[2*S],w=this.pixels[2*S+1];if(isFinite(A)&&isFinite(w)){var M=A-e,_=w-t,C=M*M+_*_;C<=k&&(k=C,b=S)}}if(b>=0)return b;var P=Math.max(4,this.lineWidthDevice()+4),T=-1;return this.eachSegment(function(i,r,n,a,o){T>=0||distanceToSegment(e,t,i,r,n,a)<=P&&(T=Math.abs(e-i)<=Math.abs(e-n)?o:o+1)}),T}},{key:"hitTestVirtual",value:function hitTestVirtual(e,t){this.rebuildPixels();var i=this.series.pointCount;if(!i)return-1;var r=this.series.option,n=r.hitRadius?Number(r.hitRadius):Math.max(8,this.maxSymbolSize()/2+4),a=this.nearestIndexAtX(e);if(a<0)return-1;for(var o=-1,s=n*n,l=Math.max(0,a-2);l<=Math.min(i-1,a+2);l++){var h=this.virtualPixelAt(l);if(h){var u=h[0]-e,c=h[1]-t,d=u*u+c*c;d<=s&&(s=d,o=l)}}if(o>=0)return o;for(var f=Math.max(4,this.lineWidthDevice()+4),p=Math.max(0,a-1);p<=Math.min(i-2,a);p++){var v=this.virtualPixelAt(p),m=this.virtualPixelAt(p+1);if(v&&m&&distanceToSegment(e,t,v[0],v[1],m[0],m[1])<=f)return Math.abs(e-v[0])<=Math.abs(e-m[0])?p:p+1}return-1}}])}();function distanceToSegment(e,t,i,r,n,a){var o=n-i,s=a-r,l=o*o+s*s;if(0===l)return Math.hypot(e-i,t-r);var h=((e-i)*o+(t-r)*s)/l;return h=Math.max(0,Math.min(1,h)),Math.hypot(e-(i+h*o),t-(r+h*s))}function hexToRgba(e,t){if(!e)return"rgba(0,0,0,".concat(t,")");if(0===e.indexOf("rgba"))return e;if(0===e.indexOf("rgb("))return e.replace("rgb(","rgba(").replace(")",",".concat(t,")"));var i=e.replace("#","");if(3===i.length&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),6!==i.length)return e;var r=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),a=parseInt(i.slice(4,6),16);return"rgba(".concat(r,",").concat(n,",").concat(a,",").concat(t,")")}var ie=function(){function BarSeries(){var e;_classCallCheck(this,BarSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,BarSeries,[].concat(i)),"seriesType","bar"),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"barCacheKey",""),e}return _inherits(BarSeries,ee),_createClass(BarSeries,[{key:"isHorizontal",value:function isHorizontal(){var e=this.coord;return!!e&&e.yScale.isBand()&&!e.xScale.isBand()}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.coord,t=this.series.pointCount;if(e){var i=this.buildSeriesKey([t,e.plot.width,e.plot.height,this.isHorizontal()?"h":"v",String(e.yScale.domain.join(","))]);if(i!==this.barCacheKey||this.pixels.length!==2*t){this.barCacheKey=i,this.computeEffective(),this.pixels.length!==2*t&&(this.pixels=new Float64Array(2*t));for(var r=0;r<t;r++){var n=this.barRectAt(r);n?(this.pixels[2*r]=n.x+n.width/2,this.pixels[2*r+1]=n.y+n.height/2):(this.pixels[2*r]=NaN,this.pixels[2*r+1]=NaN)}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"barRectAt",value:function barRectAt(e){var t=this.coord,i=this.series.pointAt(e);if(!t||!i)return null;this.effective.length!==2*this.series.pointCount&&this.computeEffective();var r=this.effective[2*e+1],n=this.effective[2*e];if(!isFinite(r))return null;if(this.isHorizontal()){var a=t.yScale.bandStart(i.xValue);if(!isFinite(a))return null;var o=t.yScale.bandwidth()||.6*t.yScale.step(),s=o/Math.max(1,this.barSlot.count),l=this.resolveBarWidth(o,s),h=t.yScale.range[1]>=t.yScale.range[0]?1:-1,u=a+h*(s*this.barSlot.index+(s-l)/2),c=h>0?u:u-l,d=t.xScale.map(n),f=t.xScale.map(r);return isFinite(d)&&isFinite(f)?{x:Math.min(d,f),y:c,width:Math.abs(f-d),height:l}:null}var p=t.xScale.bandStart(i.xValue);if(!isFinite(p))return null;var v=t.xScale.bandwidth()||.6*t.xScale.step(),m=v/Math.max(1,this.barSlot.count),g=this.resolveBarWidth(v,m),b=p+m*this.barSlot.index+(m-g)/2,k=t.yScale.map(n),S=t.yScale.map(r);return isFinite(k)&&isFinite(S)?{x:b,y:Math.min(k,S),width:g,height:Math.abs(S-k)}:null}},{key:"resolveBarWidth",value:function resolveBarWidth(e,t){var i=this.series.option,r=Number(i.barWidth);return!isFinite(r)||r<=0?Math.max(1,t*(1-(isFinite(Number(i.barGap))?Number(i.barGap):.2))):r<=1?Math.max(1,e*r):Math.max(1,r*this.unit())}},{key:"barColorAt",value:function barColorAt(e){var t=this.series.pointAt(e),i=t&&t.raw;return(i&&"object"===_typeof(i)&&!Array.isArray(i)?i.color:void 0)||this.pointColor(e)}},{key:"barDrawRectAt",value:function barDrawRectAt(e,t){var i=this.barRectAt(e),r=this.coord;if(!i||!r)return i;var n=this.hoverBoost(e,.08,t)-1;if(n<=0)return i;var a=this.effective[2*e];if(this.isHorizontal()){var o=i.width*n;return i.x+i.width/2>=r.xScale.map(a)?{x:i.x,y:i.y,width:i.width+o,height:i.height}:{x:i.x-o,y:i.y,width:i.width+o,height:i.height}}var s=i.height*n;return i.y+i.height/2<=r.yScale.map(a)?{x:i.x,y:i.y-s,width:i.width,height:i.height+s}:{x:i.x,y:i.y,width:i.width,height:i.height+s}}},{key:"doRender",value:function doRender(){if(this.rebuildPixels(),this.coord){var e=Number(this.series.option.barRadius),t=this.ctx;this.beginDraw();for(var i=0;i<this.series.pointCount;i++){var r=this.barDrawRectAt(i);if(r&&!(r.height<=0)){var n=this.barColorAt(i),a=r;if(t.beginPath(),roundRect(t,a.x,a.y,a.width,a.height,isFinite(e)?e:0),t.createLinearGradient){var o=this.isHorizontal()?t.createLinearGradient(a.x,0,a.x+a.width,0):t.createLinearGradient(0,a.y,0,a.y+a.height);o.addColorStop(0,hexToRgba(n,.95)),o.addColorStop(1,hexToRgba(n,.7)),t.fillStyle=o}else t.fillStyle=n;t.fill()}}this.endDraw()}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();for(var i=this.series.pointCount,r=0;r<i;r++){var n=this.barRectAt(r);if(n&&(e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height))return r}return-1}}])}(),re=function(){function AreaSeries(e,t){var i;return _classCallCheck(this,AreaSeries),_defineProperty(i=_callSuper(this,AreaSeries,[e,t]),"seriesType","area"),i.fillArea=!0,i}return _inherits(AreaSeries,te),_createClass(AreaSeries)}(),ne=function(){function ScatterSeries(){var e;_classCallCheck(this,ScatterSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,ScatterSeries,[].concat(i)),"seriesType","scatter"),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"clipToBox",!0),e}return _inherits(ScatterSeries,ee),_createClass(ScatterSeries,[{key:"symbolStyle",value:function symbolStyle(){var e=this.series.option,t=this.pointColor(0);return{shape:e.symbol||"circle",fill:e.symbolFill||t,stroke:e.symbolStroke||"#ffffff"}}},{key:"doRender",value:function doRender(){if(this.series.virtual)this.renderVirtual();else{this.rebuildPixels();var e=this.pixels.length/2;if(e){var t=0,i=e-1;if(this.xMonotonic&&e>2048){var r=this.__localBox(),n=this.maxSymbolSize();t=this.__lowerBoundX(r[0]-n),i=this.__upperBoundX(r[2]+n)}if(i<t)return this.beginDraw(),void this.endDraw();var a=i-t+1,o=this.coord?this.coord.plot.width:960,s=this.xMonotonic&&a>4096?Math.max(1,Math.floor(a/(2*o))):1,l=this.symbolStyle(),h=l.shape,u=l.fill,c=l.stroke;this.beginDraw();var d=this.isEntering();this.computeItemProgress();for(var f=t;f<=i;f+=s){var p=this.pixels[2*f],v=this.pixels[2*f+1];if(isFinite(p)&&isFinite(v)){var m=d?this.itemProgress[f]:1;if(!(m<=0)){var g=this.symbolSizeAt(f)*(d?.2+.8*m:1)*this.hoverBoost(f,.18);d&&m<1&&(this.ctx.globalAlpha=.25+.75*m),this.drawSymbol(p,v,h,g,u,c),d&&m<1&&(this.ctx.globalAlpha=1)}}}this.endDraw()}}}},{key:"renderVirtual",value:function renderVirtual(){var e=this.coord,t=this.series;if(e&&t.pointCount){this.rebuildPixels();var i=e.plot.width,r=this.virtualVisibleWindow(this.maxSymbolSize()),n=r.i0,a=r.i1;if(!(a<n)){var o=a-n+1,s=this.xMonotonic&&o>4096?Math.max(1,Math.floor(o/(2*i))):1,l=this.symbolStyle(),h=l.shape,u=l.fill,c=l.stroke,d=this.isEntering(),f=d?this.progress():1;if(!(d&&f<=0)){this.beginDraw();for(var p=n;p<=a;p+=s){var v=t.yValueAt(p);if(null!==v){var m=e.xScale.map(t.xValueAt(p)),g=e.yScale.map(v);if(isFinite(m)&&isFinite(g)){var b=this.symbolSizeAt(p)*(d?.2+.8*f:1)*this.hoverBoost(p,.18);d&&f<1&&(this.ctx.globalAlpha=.25+.75*f),this.drawSymbol(m,g,h,b,u,c),d&&f<1&&(this.ctx.globalAlpha=1)}}}this.endDraw()}}}}},{key:"__lowerBoundX",value:function __lowerBoundX(e){for(var t=0,i=this.pixels.length/2;t<i;){var r=t+i>>1;this.pixels[2*r]<e?t=r+1:i=r}return Math.max(0,t-1)}},{key:"__upperBoundX",value:function __upperBoundX(e){for(var t=this.pixels.length/2,i=0,r=t;i<r;){var n=i+r>>1;this.pixels[2*n]<=e?i=n+1:r=n}return Math.min(t-1,i)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){if(this.series.virtual)return this.hitTestVirtual(e,t);this.rebuildPixels();var i=this.series.option,r=i.hitRadius?Number(i.hitRadius):this.maxSymbolSize()/2+4,n=r*r,a=-1,o=n,s=this.pixels.length/2;if(s>1024&&this.xMonotonic){var l=this.nearestIndexAtX(e);if(l<0)return-1;for(var h=-1,u=n,c=Math.max(0,l-3);c<=Math.min(s-1,l+3);c++){var d=this.pixels[2*c]-e,f=this.pixels[2*c+1]-t,p=d*d+f*f;p<=u&&(u=p,h=c)}return h}for(var v=0;v<s;v++){var m=this.pixels[2*v],g=this.pixels[2*v+1];if(isFinite(m)&&isFinite(g)){var b=m-e,k=g-t,S=b*b+k*k;S<=o&&(o=S,a=v)}}return a}},{key:"hitTestVirtual",value:function hitTestVirtual(e,t){this.rebuildPixels();var i=this.series.pointCount;if(!i)return-1;var r=this.series.option,n=r.hitRadius?Number(r.hitRadius):this.maxSymbolSize()/2+4,a=n*n,o=this.nearestIndexAtX(e);if(o<0)return-1;for(var s=-1,l=a,h=Math.max(0,o-3);h<=Math.min(i-1,o+3);h++){var u=this.virtualPixelAt(h);if(u){var c=u[0]-e,d=u[1]-t,f=c*c+d*d;f<=l&&(l=f,s=h)}}return s}}])}(),ae=2*Math.PI;function normalizeAngle(e){return(e%ae+ae)%ae}function shortestAngleDelta(e,t){var i=normalizeAngle(t-e);return i>Math.PI&&(i-=ae),i}var oe=function(){function PieSeries(){var e;_classCallCheck(this,PieSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,PieSeries,[].concat(i)),"seriesType","pie"),_defineProperty(e,"polar",null),_defineProperty(e,"slices",new Float64Array(0)),_defineProperty(e,"pieCacheKey",""),_defineProperty(e,"sliceFrom",null),e}return _inherits(PieSeries,ee),_createClass(PieSeries,[{key:"setCoord",value:function setCoord(e){return this.polar=e||null,this.pieCacheKey="",this.markDirty()}},{key:"setHiddenSlices",value:function setHiddenSlices(e){return e.join(",")!==this.hiddenSlices.join(",")&&this.slices.length&&(this.sliceFrom=new Float64Array(this.slices)),_superPropGet(PieSeries,"setHiddenSlices",this,3)([e]),this.pieCacheKey="",this}},{key:"paintPad",value:function paintPad(){var e=this.series.option.label;return e&&!1===e.show?4:48}},{key:"localCenter",value:function localCenter(){var e=this.polar;return[e.polar.cx-e.plot.x,e.polar.cy-e.plot.y]}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.polar,t=this.series;if(!e)return this.pixels=new Float64Array(0),void(this.slices=new Float64Array(0));var i=this.series.option,r=[t.pointCount,i.startAngle,i.clockwise,i.roseType,i.radius,i.innerRadius,e.polar.radius,e.plot.width,this.hiddenSlices.join(","),this.progress(),t.pointCount?String(t.pointAt(0).y):""].join("|");if(r!==this.pieCacheKey){this.pieCacheKey=r;var n=t.pointCount;this.pixels.length!==2*n&&(this.pixels=new Float64Array(2*n)),this.slices.length!==4*n&&(this.slices=new Float64Array(4*n));for(var a=_slicedToArray(this.localCenter(),2),o=a[0],s=a[1],l=e.polar.radius,h=0,u=0,c=0;c<n;c++)if(!(this.hiddenSlices.indexOf(c)>=0)){var d=t.pointAt(c).y||0;d>0&&(h+=d),d>u&&(u=d)}this.computeItemProgress();for(var f=!1===i.clockwise?-1:1,p=-(void 0===i.startAngle?90:Number(i.startAngle))*Math.PI/180,v=Math.max(0,Math.min(.95,Number(i.innerRadius)||0)),m=i.roseType,g=0;g<n;g++){var b=this.hiddenSlices.indexOf(g)>=0,k=b?0:t.pointAt(g).y||0,S=p,A=p+f*(h>0?k/h*ae*(b?0:this.itemProgress[g]):0);p=A;var w=l;m&&u>0&&(w="area"===m?l*Math.sqrt(Math.max(0,k)/u):l*(Math.max(0,k)/u),w=Math.max(3,w));var M=l*v;this.slices[4*g]=S,this.slices[4*g+1]=A,this.slices[4*g+2]=M,this.slices[4*g+3]=w}this.blendSliceMorph(this.isEntering());for(var _=0;_<n;_++)this.writeCentroid(_,o,s)}}},{key:"blendSliceMorph",value:function blendSliceMorph(e){var t=this.sliceFrom;if(!(!t||e||t.length<this.slices.length)){var i=Math.max(0,Math.min(1,this.progress()));if(i>=1)this.sliceFrom=null;else for(var r=0;r<this.slices.length/4;r++){var n=t[4*r],a=this.slices[4*r],o=n+shortestAngleDelta(n,a)*i,s=t[4*r+1]-n,l=this.slices[4*r+1]-a;this.slices[4*r]=o,this.slices[4*r+1]=o+s+(l-s)*i;for(var h=0,u=[2,3];h<u.length;h++){var c=u[h],d=t[4*r+c];this.slices[4*r+c]=d+(this.slices[4*r+c]-d)*i}}}}},{key:"writeCentroid",value:function writeCentroid(e,t,i){var r=this.slices[4*e],n=this.slices[4*e+1],a=this.slices[4*e+2],o=this.slices[4*e+3];if(Math.abs(n-r)<=1e-9)return this.pixels[2*e]=NaN,void(this.pixels[2*e+1]=NaN);var s=(r+n)/2,l=a+.6*(o-a);this.pixels[2*e]=t+Math.cos(s)*l,this.pixels[2*e+1]=i+Math.sin(s)*l}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.polar;if(!i)return-1;this.rebuildPixels();var r=_slicedToArray(this.localCenter(),2),n=e-r[0],a=t-r[1],o=Math.hypot(n,a);if(o>i.polar.radius+4)return-1;for(var s=this.series.pointCount,l=Math.atan2(a,n),h=0;h<s;h++){var u=this.slices[4*h],c=this.slices[4*h+1],d=this.slices[4*h+2],f=this.slices[4*h+3],p=Math.abs(c-u);if(!(p<=1e-9))if(!(o<d-1))if(normalizeAngle(c>u?l-u:u-l)<=p+1e-9&&o<=f+4)return h}return-1}},{key:"doRender",value:function doRender(){var e=this,t=this.polar;if(t){this.rebuildPixels();for(var i=this.ctx,r=_slicedToArray(this.localCenter(),2),n=r[0],a=r[1],o=this.unit(),s=!1===this.series.option.clockwise?-1:1,l=this.series.pointCount,h=this.series.option.label,u=!(h&&!1===h.show)&&l>0&&l<=16,c=h&&"inside"===h.position,d=0,f=0;f<l;f++)if(!(this.hiddenSlices.indexOf(f)>=0)){var p=this.series.pointAt(f).y||0;p>0&&(d+=p)}this.beginDraw();for(var v=0;v<l;v++){var m=this.slices[4*v],g=this.slices[4*v+1],b=this.slices[4*v+2],k=this.slices[4*v+3];if(!(Math.abs(g-m)<=1e-9)){var S=this.series.pointAt(v).color||this.series.color,A=this.hoverBoost(v,1),w=A>1?7*(A-1)*this.unit():0,M=(m+g)/2,_=Math.cos(M)*w,C=Math.sin(M)*w;i.beginPath(),b>0?(i.arc(n+_,a+C,k,m,g,s<0),i.arc(n+_,a+C,b,g,m,s>0)):(i.moveTo(n+_,a+C),i.arc(n+_,a+C,k,m,g,s<0)),i.closePath(),i.fillStyle=S,i.fill(),l>1&&(i.strokeStyle="rgba(255,255,255,0.85)",i.lineWidth=o,i.stroke())}}if(u){this.setFont(this.fontSize(),this.fontFamily());for(var P=NaN,T=0,I=[],N=0;N<l;N++){var D=this.slices[4*N],O=this.slices[4*N+1],R=this.slices[4*N+2],H=this.slices[4*N+3];if(!(Math.abs(O-D)<=1e-9)){var z=this.series.pointAt(N),V=z.y||0,E=t.polar.radius,B=d>0?V/d*100:0,L={name:z.name||"".concat(this.series.name," ").concat(N+1),value:z.y,percent:B,dataIndex:N,seriesId:this.series.id,seriesName:this.series.name,color:z.color||this.series.color},j=h&&"function"==typeof h.formatter?String(h.formatter(L)):"".concat(L.name," ").concat(B.toFixed(1),"%"),W=(D+O)/2;if(c){if(isFinite(P))T=Math.abs(Math.atan2(Math.sin(W-P),Math.cos(W-P)))<.42?Math.min(3,T+1):0;else T=0;P=W;var X=R+.62*(H-R)+T*(this.fontSize()+4),U=Math.abs(O-D)*X;if(measureTextWidth(this.ctx,j,this.fontSize(),this.fontFamily())<=U+6){i.textAlign="center",i.textBaseline="middle",i.fillStyle="#ffffff",i.fillText(j,n+Math.cos(W)*X,a+Math.sin(W)*X);continue}}var G=E+8,K=E+26,Y=Math.cos(W)>=0;I.push({x1:n+Math.cos(W)*H,y1:a+Math.sin(W)*H,x2:n+Math.cos(W)*G,y2:a+Math.sin(W)*G,x3:n+Math.cos(W)*K+(Y?8:-8),y3:a+Math.sin(W)*K,text:j,right:Y})}}for(var q=1.45*this.fontSize(),$=function _loop(){for(var r=J[Z],n=I.filter(function(e){return e.right===r}).sort(function(e,t){return e.y3-t.y3}),s=1;s<n.length;s++)n[s].y3-n[s-1].y3<q&&(n[s].y3=n[s-1].y3+q);if(n.length){var l=n[n.length-1].y3-(a+t.polar.radius+2*q);if(l>0){var h,u=_createForOfIteratorHelper(n);try{for(u.s();!(h=u.n()).done;){h.value.y3-=l}}catch(e){u.e(e)}finally{u.f()}}}var c,d=_createForOfIteratorHelper(n);try{for(d.s();!(c=d.n()).done;){var f=c.value;i.strokeStyle="rgba(148,163,184,0.9)",i.lineWidth=o,i.beginPath(),i.moveTo(f.x1,f.y1),i.lineTo(f.x2,f.y2),i.lineTo(f.x2,f.y3),i.lineTo(f.x3,f.y3),i.stroke(),i.textAlign=f.right?"left":"right",i.textBaseline="middle",i.fillStyle=e.chartTheme&&e.chartTheme.axisLabelColor||"#475569",i.fillText(f.text,f.x3+(f.right?4:-4)*o,f.y3)}}catch(e){d.e(e)}finally{d.f()}},Z=0,J=[!0,!1];Z<J.length;Z++)$()}this.endDraw()}}},{key:"fontSize",value:function fontSize(){return this.chartTheme&&this.chartTheme.fontSize||12}},{key:"fontFamily",value:function fontFamily(){return this.chartTheme&&this.chartTheme.fontFamily||"Arial"}}])}(),se=function(){function RadarSeries(){var e;_classCallCheck(this,RadarSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,RadarSeries,[].concat(i)),"seriesType","radar"),_defineProperty(e,"radar",null),_defineProperty(e,"radarCacheKey",""),e}return _inherits(RadarSeries,ee),_createClass(RadarSeries,[{key:"setCoord",value:function setCoord(e){return this.radar=e||null,this.radarCacheKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 14}},{key:"localCenter",value:function localCenter(){var e=this.radar;return[e.polar.cx-e.plot.x,e.polar.cy-e.plot.y]}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.radar,t=this.series,i=t.pointCount;if(e){var r=[i,e.polar.radius,e.plot.width,this.progress(),e.domains.map(function(e){return e.join(":")}).join("|")].join("::");if(r!==this.radarCacheKey||this.pixels.length!==2*i){this.radarCacheKey=r,this.pixels.length!==2*i&&(this.pixels=new Float64Array(2*i));for(var n=_slicedToArray(this.localCenter(),2),a=n[0],o=n[1],s=this.progress(),l=0;l<i;l++){var h=-Math.PI/2+l/Math.max(1,i)*Math.PI*2,u=e.domains[l]||[0,1],c=t.pointAt(l).y,d=null==c?u[0]:c,f=u[1]-u[0],p=f>0?(d-u[0])/f:0;p=Math.max(0,Math.min(1,p)),p*=s;var v=e.polar.radius*p;this.pixels[2*l]=a+Math.cos(h)*v,this.pixels[2*l+1]=o+Math.sin(h)*v}}}else this.pixels=new Float64Array(0)}},{key:"doRender",value:function doRender(){if(this.radar){this.rebuildPixels();var e=this.pixels.length/2;if(e){var t=this.ctx,i=this.pointColor(0),r=this.unit(),n=_slicedToArray(this.localCenter(),2);n[0],n[1],this.beginDraw(),t.beginPath();for(var a=0;a<e;a++){var o=this.pixels[2*a],s=this.pixels[2*a+1];0===a?t.moveTo(o,s):t.lineTo(o,s)}t.closePath(),t.fillStyle=hexToRgba(i,.22),t.fill(),t.strokeStyle=i,t.lineWidth=this.lineWidthDevice()*r,t.stroke();for(var l=0;l<e;l++){var h=this.hoverBoost(l,.3);this.drawSymbol(this.pixels[2*l],this.pixels[2*l+1],"circle",this.symbolSizeAt(l)*h,i,"#ffffff")}this.endDraw()}}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();var i=this.pixels.length/2;if(!i)return-1;for(var r=this.series.option,n=r.hitRadius?Number(r.hitRadius):24,a=-1,o=n*n,s=0;s<i;s++){var l=this.pixels[2*s]-e,h=this.pixels[2*s+1]-t,u=l*l+h*h;u<=o&&(o=u,a=s)}if(a>=0)return a;if(this.containsPointInPolygon(e,t)){var c=_slicedToArray(this.localCenter(),2),d=c[0],f=c[1],p=Math.atan2(t-f,e-d),v=2*Math.PI/i,m=((p+Math.PI/2)%(2*Math.PI)+2*Math.PI)%(2*Math.PI);return Math.round(m/v)%i}return-1}},{key:"containsPointInPolygon",value:function containsPointInPolygon(e,t){for(var i=this.pixels.length/2,r=!1,n=0,a=i-1;n<i;a=n++){var o=this.pixels[2*n],s=this.pixels[2*n+1],l=this.pixels[2*a],h=this.pixels[2*a+1];s>t!=h>t&&e<(l-o)*(t-s)/(h-s)+o&&(r=!r)}return r}}])}(),le=function(){function HeatmapSeries(){var e;_classCallCheck(this,HeatmapSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,HeatmapSeries,[].concat(i)),"seriesType","heatmap"),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"heatCacheKey",""),_defineProperty(e,"gridKey",""),_defineProperty(e,"gridX",new Float64Array(0)),_defineProperty(e,"gridY",new Float64Array(0)),_defineProperty(e,"gridCellW",1),_defineProperty(e,"gridCellH",1),_defineProperty(e,"gridVisibleCols",[]),_defineProperty(e,"gridVisibleRows",[]),_defineProperty(e,"gridBlocks",new Float64Array(0)),_defineProperty(e,"gridBlockCols",0),_defineProperty(e,"gridBlockRows",0),_defineProperty(e,"gridBlockPx",0),e}return _inherits(HeatmapSeries,ee),_createClass(HeatmapSeries,[{key:"rebuildPixels",value:function rebuildPixels(){var e=this.coord,t=this.series.pointCount;if(e){var i=this.buildSeriesKey([t,e.plot.width,e.plot.height,String(e.yScale.domain.join(","))]);if(i!==this.heatCacheKey||this.pixels.length!==2*t){this.heatCacheKey=i,this.pixels.length!==2*t&&(this.pixels=new Float64Array(2*t));for(var r=0;r<t;r++){var n=this.cellRectAt(r);n?(this.pixels[2*r]=n.x+n.width/2,this.pixels[2*r+1]=n.y+n.height/2):(this.pixels[2*r]=NaN,this.pixels[2*r+1]=NaN)}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"valueRange",value:function valueRange(){var e=this.series.grid;if(e)return e.valueDomain||[0,1];for(var t=1/0,i=-1/0,r=0,n=this.series.pointCount;r<n;r++){var a=this.series.pointAt(r).y;null!==a&&isFinite(a)&&(a<t&&(t=a),a>i&&(i=a))}return isFinite(t)&&isFinite(i)?t===i?[t,t+1]:[t,i]:[0,1]}},{key:"heatColors",value:function heatColors(){var e=this.series.option.heatmap||{};return{from:e.minColor||"#EFF6FF",to:e.maxColor||this.series.color}}},{key:"cellRectAt",value:function cellRectAt(e){if(this.series.grid)return this.virtualCellRect(e);var t=this.coord,i=this.series.pointAt(e);if(!t||!i)return null;var r=t.xScale.bandStart(i.xValue,void 0),n=void 0===i.name?i.index:i.name,a=t.yScale.bandStart(n,void 0);if(!isFinite(r)||!isFinite(a))return null;var o=t.xScale.bandwidth()||.8*t.xScale.step(),s=t.yScale.bandwidth()||.8*t.yScale.step(),l=t.xScale.range[1]>=t.xScale.range[0]?1:-1,h=t.yScale.range[1]>=t.yScale.range[0]?1:-1,u=Math.max(1,o),c=Math.max(1,s);return{x:l>0?r:r-u,y:h>0?a:a-c,width:u,height:c}}},{key:"doRender",value:function doRender(){var e=this.coord;if(e)if(this.series.grid)this.renderVirtual();else{var t=this.ctx,i=_slicedToArray(this.valueRange(),2),r=i[0],n=i[1],a=this.heatColors(),o=a.from,s=a.to,l=this.isEntering();this.computeItemProgress();var h=e.xScale.domain.length||1;this.beginDraw();for(var u=0;u<this.series.pointCount;u++){var c=this.series.pointAt(u),d=this.cellRectAt(u);if(d){var f=null===c.y?0:(c.y-r)/(n-r||1),p=1;if(l){var v=(u%h+Math.floor(u/h))%Math.max(1,h)/Math.max(1,h),m=this.progress();if((p=Math.max(0,Math.min(1,(m-v*(this.stagger||.35))/Math.max(.05,1-v*(this.stagger||.35)))))<=0)continue;t.globalAlpha=p}t.fillStyle=mixColors(o,s,Math.max(0,Math.min(1,f))),t.fillRect(d.x,d.y,d.width,d.height),l&&(t.globalAlpha=1)}}null!==this.hoverIndex&&this.drawHoverOverlay(this.hoverIndex,this.cellRectAt(this.hoverIndex),{radius:0}),this.endDraw()}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){if(this.series.grid)return this.hitTestGrid(e,t);for(var i=0;i<this.series.pointCount;i++){var r=this.cellRectAt(i);if(r&&(e>=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height))return i}return-1}},{key:"paintPad",value:function paintPad(){return 4}},{key:"syncGrid",value:function syncGrid(){var e=this.coord,t=this.series.grid;if(e&&t){var i=t.xCategories.length,r=t.yCategories.length,n=function axisKey(e){return"".concat(e.domain.length,":").concat(String(e.domain[0]),"~").concat(String(e.domain[e.domain.length-1]))},a=[this.series.pointCount,e.plot.width.toFixed(2),e.plot.height.toFixed(2),n(e.xScale),n(e.yScale)].join("|");if(a!==this.gridKey){this.gridKey=a;for(var o=e.xScale.range[1]>=e.xScale.range[0]?1:-1,s=e.yScale.range[1]>=e.yScale.range[0]?1:-1,l=Math.max(.01,e.xScale.bandwidth()||.8*e.xScale.step()),h=Math.max(.01,e.yScale.bandwidth()||.8*e.yScale.step()),u=new Float64Array(i),c=new Float64Array(r),d=0;d<i;d++){var f=e.xScale.bandStart(t.xCategories[d],void 0);u[d]=o>0?f:f-l}for(var p=0;p<r;p++){var v=e.yScale.bandStart(t.yCategories[p],void 0);c[p]=s>0?v:v-h}this.gridX=u,this.gridY=c,this.gridCellW=l,this.gridCellH=h;for(var m=e.plot.width,g=e.plot.height,b=[],k=[],S=0;S<i;S++)!isFinite(u[S])||u[S]+l<-1||u[S]>m+1||b.push(S);for(var A=0;A<r;A++)!isFinite(c[A])||c[A]+h<-1||c[A]>g+1||k.push(A);this.gridVisibleCols=b,this.gridVisibleRows=k;var w=b.length*k.length,M=w<=HeatmapSeries.MAX_DIRECT_CELLS?0:Math.max(1,Math.ceil(Math.sqrt(w/HeatmapSeries.MAX_BLOCKS)));if(this.gridBlockPx=M,0===M)return this.gridBlocks=new Float64Array(0),this.gridBlockCols=0,void(this.gridBlockRows=0);for(var _=Math.max(1,Math.ceil(m/M)),C=Math.max(1,Math.ceil(g/M)),P=new Float64Array(_*C).fill(NaN),T=t.values,I=0,N=k;I<N.length;I++){var D,O=N[I],R=O*i,H=Math.min(C-1,Math.max(0,Math.floor((c[O]+h/2)/M))),z=_createForOfIteratorHelper(b);try{for(z.s();!(D=z.n()).done;){var V=D.value,E=T[R+V];if(!Number.isNaN(E)){var B=H*_+Math.min(_-1,Math.max(0,Math.floor((u[V]+l/2)/M))),L=P[B];(Number.isNaN(L)||E>L)&&(P[B]=E)}}}catch(e){z.e(e)}finally{z.f()}}this.gridBlocks=P,this.gridBlockCols=_,this.gridBlockRows=C}}}},{key:"virtualCellRect",value:function virtualCellRect(e){var t=this.series.grid;if(!this.coord||!t)return null;this.syncGrid();var i=t.xCategories.length,r=i>0?e%i:0,n=i>0?(e-r)/i:0,a=this.gridX[r],o=this.gridY[n];return isFinite(a)&&isFinite(o)?{x:a,y:o,width:Math.max(1,this.gridCellW),height:Math.max(1,this.gridCellH)}:null}},{key:"virtualPixelAt",value:function virtualPixelAt(e){var t=this.virtualCellRect(e);return t?[t.x+t.width/2,t.y+t.height/2]:null}},{key:"hitTestGrid",value:function hitTestGrid(e,t){var i=this.coord,r=this.series.grid;if(!i||!r)return-1;var n=this.state,a=n.width,o=n.height;if(e<0||t<0||e>a||t>o)return-1;var s=r.xIndex.get(String(i.xScale.invert(e))),l=r.yIndex.get(String(i.yScale.invert(t)));if(void 0===s||void 0===l)return-1;var h=l*r.xCategories.length+s;return Number.isNaN(r.values[h])?-1:h}},{key:"nearestIndexAtX",value:function nearestIndexAtX(e){var t=this.series.grid,i=this.coord;if(!t||!i)return _superPropGet(HeatmapSeries,"nearestIndexAtX",this,3)([e]);var r=i.xScale,n="function"==typeof r.nearestIndex?r.nearestIndex(e):-1;if(n<0)return-1;var a=t.xIndex.get(String(i.xScale.domain[n]));if(void 0===a)return-1;for(var o=t.xCategories.length,s=0;s<t.yCategories.length;s++){var l=s*o+a;if(!Number.isNaN(t.values[l]))return l}return-1}},{key:"renderVirtual",value:function renderVirtual(){var e=this.coord,t=this.series.grid;if(e&&t){this.syncGrid();var i=this.ctx,r=_slicedToArray(this.valueRange(),2),n=r[0],a=r[1],o=this.heatColors(),s=o.from,l=o.to,h=function ratioAt(e){var t=a-n?(e-n)/(a-n):0;return Math.max(0,Math.min(1,t))},u=t.xCategories.length,c=t.values,d=Math.max(1,this.gridCellW),f=Math.max(1,this.gridCellH);if(this.beginDraw(),0===this.gridBlockPx){var p,v=_createForOfIteratorHelper(this.gridVisibleRows);try{for(v.s();!(p=v.n()).done;){var m,g=p.value,b=this.gridY[g],k=g*u,S=_createForOfIteratorHelper(this.gridVisibleCols);try{for(S.s();!(m=S.n()).done;){var A=m.value,w=c[k+A];Number.isNaN(w)||(i.fillStyle=mixColors(s,l,h(w)),i.fillRect(this.gridX[A],b,d,f))}}catch(e){S.e(e)}finally{S.f()}}}catch(e){v.e(e)}finally{v.f()}}else for(var M=this.gridBlockPx,_=0;_<this.gridBlockRows;_++)for(var C=0;C<this.gridBlockCols;C++){var P=this.gridBlocks[_*this.gridBlockCols+C];Number.isNaN(P)||(i.fillStyle=mixColors(s,l,h(P)),i.fillRect(C*M,_*M,M,M))}if(null!==this.hoverIndex){var T=this.cellRectAt(this.hoverIndex);T&&this.drawHoverOverlay(this.hoverIndex,T,{radius:0})}this.endDraw()}}}])}();function mixColors(e,t,i){var r=parseHex$1(e),n=parseHex$1(t);if(!r||!n)return t;var a=Math.round(r[0]+(n[0]-r[0])*i),o=Math.round(r[1]+(n[1]-r[1])*i),s=Math.round(r[2]+(n[2]-r[2])*i);return"rgb(".concat(a,",").concat(o,",").concat(s,")")}function parseHex$1(e){if("string"!=typeof e)return null;var t=e.trim();if(0===t.indexOf("#"))return 3===(t=t.slice(1)).length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6!==t.length?null:[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)];var i=t.match(/rgba?\(([^)]+)\)/);if(i){var r=i[1].split(",").map(function(e){return parseFloat(e)});return[r[0]||0,r[1]||0,r[2]||0]}return null}function layoutSankey(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{nodes:[],links:[]},n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:s,a=e.length;if(!a)return{nodes:[],links:[]};var o,l=Math.max(2,Number(r.nodeWidth)||16),h=Math.max(0,Number(r.nodePadding)||10),u=Math.max(0,void 0===Number(r.iterations)?6:Number(r.iterations)),c=function indexOf(t){return"number"==typeof t?t>=0&&t<a?t:-1:e.findIndex(function(e){return e.name===t})},d=t.map(function(e,t){return{id:t,source:c(e.source),target:c(e.target),value:Math.max(0,Number(e.value)||0),color:e.color}}).filter(function(e){return e.source>=0&&e.target>=0&&e.value>0}),f=e.map(function(){return[]}),p=e.map(function(){return[]}),v=new Array(a).fill(0),m=_createForOfIteratorHelper(d);try{for(m.s();!(o=m.n()).done;){var g=o.value;f[g.source].push(g.target),p[g.target].push(g.source),v[g.target]++}}catch(e){m.e(e)}finally{m.f()}for(var b=new Array(a).fill(0),k=[],S=0;S<a;S++)0===v[S]&&k.push(S);for(;k.length;){var A,w=k.shift(),M=_createForOfIteratorHelper(f[w]);try{for(M.s();!(A=M.n()).done;){var _=A.value;b[_]=Math.max(b[_],b[w]+1),0===--v[_]&&k.push(_)}}catch(e){M.e(e)}finally{M.f()}}for(var C=0;C<a;C++)void 0!==e[C].depth&&(b[C]=Math.max(0,Number(e[C].depth)||0));var P,T=Math.max.apply(Math,[1].concat(_toConsumableArray(b))),I=function columnX(e){return i.x+e*(i.width-l)/T},N=new Array(a).fill(0),D=new Array(a).fill(0),O=_createForOfIteratorHelper(d);try{for(O.s();!(P=O.n()).done;){var R=P.value;D[R.source]+=R.value,N[R.target]+=R.value}}catch(e){O.e(e)}finally{O.f()}for(var H=new Array(a).fill(0).map(function(e,t){return Math.max(N[t],D[t])}),z=new Array(T+1).fill(0),V=0;V<a;V++){z[b[V]]+=H[V]}for(var E=new Array(T+1).fill(0),B=0;B<a;B++)E[b[B]]++;var L,j=z.map(function(e,t){var r=i.height-h*Math.max(0,E[t]-1);return e>0?Math.max(1,r)/e:1}),W=e.map(function(e,t){var r=Math.max(2,H[t]*j[b[t]]);return{id:t,name:e.name,depth:b[t],x:I(b[t]),y:i.y,width:l,height:r,value:H[t],color:e.color||n[t%n.length]}}),X=new Array(T+1).fill(0).map(function(){return[]}),U=_createForOfIteratorHelper(W);try{for(U.s();!(L=U.n()).done;){var G=L.value;X[G.depth].push(G.id)}}catch(e){U.e(e)}finally{U.f()}var K,Y=_createForOfIteratorHelper(X);try{for(Y.s();!(K=Y.n()).done;){var q,$=K.value,Z=i.y,J=_createForOfIteratorHelper($);try{for(J.s();!(q=J.n()).done;){var Q=q.value;W[Q].y=Z,Z+=W[Q].height+h}}catch(e){J.e(e)}finally{J.f()}}}catch(e){Y.e(e)}finally{Y.f()}for(var ee=0;ee<u;ee++){var te,ie=_createForOfIteratorHelper(W);try{for(ie.s();!(te=ie.n()).done;){var re,ne=te.value,ae=[],oe=_createForOfIteratorHelper(d);try{for(oe.s();!(re=oe.n()).done;){var se=re.value;se.source===ne.id?ae.push({id:se.target,weight:se.value}):se.target===ne.id&&ae.push({id:se.source,weight:se.value})}}catch(e){oe.e(e)}finally{oe.f()}if(ae.length){for(var le=0,he=0,ue=0,ce=ae;ue<ce.length;ue++){var de=ce[ue],fe=W[de.id];he+=(fe.y+fe.height/2)*de.weight,le+=de.weight}var pe=le>0?he/le:ne.y+ne.height/2;ne.y=pe-ne.height/2}}}catch(e){ie.e(e)}finally{ie.f()}var ve,ye=_createForOfIteratorHelper(X);try{for(ye.s();!(ve=ye.n()).done;){var me=ve.value;me.sort(function(e,t){return W[e].y-W[t].y});var xe,ge=i.y,be=_createForOfIteratorHelper(me);try{for(be.s();!(xe=be.n()).done;){var ke=xe.value;W[ke].y=ge,ge+=W[ke].height+h}}catch(e){be.e(e)}finally{be.f()}}}catch(e){ye.e(e)}finally{ye.f()}}var Se,Ae=_createForOfIteratorHelper(X);try{for(Ae.s();!(Se=Ae.n()).done;){var we=Se.value,Me=we.length?W[we[we.length-1]].y+W[we[we.length-1]].height-(i.y+i.height):0;if(Me>0){var _e,Ce=_createForOfIteratorHelper(we);try{for(Ce.s();!(_e=Ce.n()).done;){var Pe=_e.value;W[Pe].y=Math.max(i.y,W[Pe].y-Me)}}catch(e){Ce.e(e)}finally{Ce.f()}}}}catch(e){Ae.e(e)}finally{Ae.f()}var Te,Fe=new Array(a).fill(0),Ie=new Array(a).fill(0),Ne=[],De=_createForOfIteratorHelper(d.slice().sort(function(e,t){return e.source-t.source||e.target-t.target}));try{for(De.s();!(Te=De.n()).done;){var Oe=Te.value,Re=W[Oe.source],He=W[Oe.target],ze=Re.value>0?Re.height/Re.value:0,Ve=He.value>0?He.height/He.value:0,Ee=Math.max(1,Oe.value*Math.min(ze,Ve)),Be=Re.y+Fe[Oe.source],Le=He.y+Ie[Oe.target];Fe[Oe.source]+=Ee,Ie[Oe.target]+=Ee,Ne.push({id:Oe.id,source:Oe.source,target:Oe.target,value:Oe.value,width:Ee,sy:Be,ty:Le,color:Oe.color||Re.color})}}catch(e){De.e(e)}finally{De.f()}return{nodes:W,links:Ne}}function sampleLinkPath(e,t,i){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:16,a=[],o=e.sy+e.width/2-r,s=e.ty+e.width/2-r,l=t+.5*(i-t),h=i-.5*(i-t),u=0;u<=n;u++){var c=u/n,d=1-c,f=d*d*d*t+3*d*d*c*l+3*d*c*c*h+c*c*c*i,p=d*d*d*o+3*d*d*c*o+3*d*c*c*s+c*c*c*s;a.push([f,p])}return a}_defineProperty(le,"MAX_DIRECT_CELLS",2e4),_defineProperty(le,"MAX_BLOCKS",2e4);var he=function(){function SankeySeries(){var e;_classCallCheck(this,SankeySeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,SankeySeries,[].concat(i)),"seriesType","sankey"),_defineProperty(e,"sankey",null),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"sankeyCacheKey",""),e}return _inherits(SankeySeries,ee),_createClass(SankeySeries,[{key:"setCoord",value:function setCoord(e){return this.sankey=e||null,this.sankeyCacheKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 24}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.sankey;if(e){var t=e.layout,i=t.nodes,r=t.links,n=i.length+r.length,a=[e.plot.x,e.plot.y],o=a[0],s=a[1],l=this.buildSeriesKey([n,o,s,e.plot.width,e.plot.height,i.length,r.length]);if(l!==this.sankeyCacheKey||this.pixels.length!==2*n){this.sankeyCacheKey=l,this.pixels=new Float64Array(2*n);var h,u=_createForOfIteratorHelper(i);try{for(u.s();!(h=u.n()).done;){var c=h.value;this.pixels[2*c.id]=c.x-o+c.width/2,this.pixels[2*c.id+1]=c.y-s+c.height/2}}catch(e){u.e(e)}finally{u.f()}var d,f=_createForOfIteratorHelper(r);try{for(f.s();!(d=f.n()).done;){var p=d.value,v=i[p.source],m=i[p.target];if(v&&m){var g=i.length+p.id;this.pixels[2*g]=(v.x+v.width+m.x)/2-o,this.pixels[2*g+1]=(p.sy+p.ty)/2+p.width/2-s}}}catch(e){f.e(e)}finally{f.f()}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"doRender",value:function doRender(){var e=this.sankey;if(e){var t=e.layout,i=t.nodes,r=t.links,n=this.ctx,a=e.plot,o=this.unit();this.beginDraw();var s=e.options.flow;s?this.keepAnimating():this.stopAnimating();var l=Number(e.options.linkOpacity);n.globalAlpha=isFinite(l)?Math.max(0,Math.min(1,l)):.42;var h,u=_createForOfIteratorHelper(r);try{for(u.s();!(h=u.n()).done;){var c=h.value,d=i[c.source],f=i[c.target];if(d&&f){var p=d.x-a.x+d.width,v=f.x-a.x,m=c.sy-a.y,g=c.ty-a.y,b=p+.5*(v-p),k=v-.5*(v-p);if(n.beginPath(),n.moveTo(p,m),n.bezierCurveTo(b,m,k,g,v,g),n.lineTo(v,g+c.width),n.bezierCurveTo(k,g+c.width,b,m+c.width,p,m+c.width),n.closePath(),n.fillStyle=c.color,n.fill(),s){var S=Number(e.options.flowSpeed)||40;if(n.save(),n.globalAlpha=.9,n.beginPath(),n.moveTo(p,(m+g)/2),n.bezierCurveTo(b,(m+g)/2,k,(m+g)/2,v,(m+g)/2),n.strokeStyle="#ffffff",n.lineWidth=Math.max(o,Math.min(5*o,.28*c.width)),"function"==typeof n.setLineDash){var A=[6*o,10*o];n.setLineDash(A),"number"==typeof n.lineDashOffset&&(n.lineDashOffset=-Date.now()/1e3*S%(A[0]+A[1]))}n.stroke(),"function"==typeof n.setLineDash&&n.setLineDash([]),n.restore()}}}}catch(e){u.e(e)}finally{u.f()}n.globalAlpha=1;var w,M=_createForOfIteratorHelper(i);try{for(M.s();!(w=M.n()).done;){var _=w.value;n.beginPath();var C=_.x-a.x,P=_.y-a.y,T=Math.min(3,_.width/2);n.moveTo(C+T,P),n.lineTo(C+_.width-T,P),n.arcTo(C+_.width,P,C+_.width,P+T,T),n.lineTo(C+_.width,P+_.height-T),n.arcTo(C+_.width,P+_.height,C+_.width-T,P+_.height,T),n.lineTo(C+T,P+_.height),n.arcTo(C,P+_.height,C,P+_.height-T,T),n.lineTo(C,P+T),n.arcTo(C,P,C+T,P,T),n.closePath(),n.fillStyle=_.color,n.fill(),n.strokeStyle="rgba(255,255,255,0.75)",n.lineWidth=o,n.stroke()}}catch(e){M.e(e)}finally{M.f()}if(!e.options.label||!1!==e.options.label.show){var I=this.chartTheme;if(I){this.setFont(I.fontSize,I.fontFamily),n.fillStyle=I.textColor,n.textBaseline="middle";var N,D=Math.max.apply(Math,_toConsumableArray(i.map(function(e){return e.depth})).concat([0])),O=_createForOfIteratorHelper(i);try{for(O.s();!(N=O.n()).done;){var R=N.value,H=R.x-a.x,z=R.y-a.y+R.height/2;R.depth>=D?(n.textAlign="right",this.fillLabelWithHalo(R.name,H-6*o,z)):(n.textAlign="left",this.fillLabelWithHalo(R.name,H+R.width+6*o,z))}}catch(e){O.e(e)}finally{O.f()}}}this.endDraw()}}},{key:"fillLabelWithHalo",value:function fillLabelWithHalo(e,t,i){var r=this.ctx,n=this.chartTheme;r.lineWidth=3*this.unit(),r.strokeStyle=n&&n.labelHaloColor||"rgba(255,255,255,0.85)",r.lineJoin="round",r.strokeText(e,t,i),r.fillStyle=n&&n.textColor||"#212529",r.fillText(e,t,i)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.sankey;if(!i)return-1;var r,n=i.layout,a=n.nodes,o=n.links,s=i.plot,l=_createForOfIteratorHelper(a);try{for(l.s();!(r=l.n()).done;){var h=r.value,u=h.x-s.x,c=h.y-s.y;if(e>=u-2&&e<=u+h.width+2&&t>=c-2&&t<=c+h.height+2)return h.id}}catch(e){l.e(e)}finally{l.f()}var d,f=_createForOfIteratorHelper(o);try{for(f.s();!(d=f.n()).done;){var p=d.value,v=a[p.source],m=a[p.target];if(v&&m)for(var g=sampleLinkPath(p,v.x-s.x+v.width,m.x-s.x,s.y,12),b=1;b<g.length;b++){if(distanceToSegment(e,t,g[b-1][0],g[b-1][1],g[b][0],g[b][1])<=6)return a.length+p.id}}}catch(e){f.e(e)}finally{f.f()}return-1}}])}(),ue=function(){function FunnelSeries(){var e;_classCallCheck(this,FunnelSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,FunnelSeries,[].concat(i)),"seriesType","funnel"),_defineProperty(e,"funnel",null),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"stageGeom",[]),_defineProperty(e,"stageRects",[]),_defineProperty(e,"funnelKey",""),_defineProperty(e,"stageFrom",null),e}return _inherits(FunnelSeries,ee),_createClass(FunnelSeries,[{key:"setHiddenSlices",value:function setHiddenSlices(e){return e.join(",")!==this.hiddenSlices.join(",")&&this.stageGeom.length&&(this.stageFrom=this.stageGeom.map(function(e){return e?_objectSpread2({},e):null})),_superPropGet(FunnelSeries,"setHiddenSlices",this,3)([e]),this.funnelKey="",this}},{key:"setCoord",value:function setCoord(e){return this.funnel=e||null,this.funnelKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 12}},{key:"highlightRectAt",value:function highlightRectAt(e){return this.rebuildPixels(),this.stageRects[e]||null}},{key:"widthAt",value:function widthAt(e,t){var i=e.y1-e.y0||1,r=Math.max(0,Math.min(1,(t-e.y0)/i));return e.topWidth+(e.bottomWidth-e.topWidth)*r}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.funnel,t=this.series,i=t.pointCount;if(!e||!i)return this.pixels=new Float64Array(0),this.stageGeom=[],void(this.stageRects=[]);var r=e.options||{},n=this.buildSeriesKey([i,e.plot.width,e.plot.height,r.sort,r.minSize,r.trapezoid,this.hiddenSlices.join(",")]);if(n!==this.funnelKey||this.pixels.length!==2*i){this.funnelKey=n,this.pixels.length!==2*i&&(this.pixels=new Float64Array(2*i)),this.stageGeom=new Array(i).fill(null),this.stageRects=new Array(i).fill(null);for(var a=[],o=0;o<i;o++)this.hiddenSlices.indexOf(o)>=0||null!==t.pointAt(o).y&&a.push(o);var s=r.sort||"descending";if("none"!==s&&a.sort(function(e,i){return"ascending"===s?(t.pointAt(e).y||0)-(t.pointAt(i).y||0):(t.pointAt(i).y||0)-(t.pointAt(e).y||0)}),a.length){for(var l=Math.max(0,Number(r.gap)||2),h=Math.max(4,(e.plot.height-l*(a.length-1))/a.length),u=Math.max.apply(Math,_toConsumableArray(a.map(function(e){return t.pointAt(e).y||0})).concat([0])),c=Math.max(0,Math.min(1,void 0===r.minSize?.12:Number(r.minSize))),d=e.plot.width,f=e.plot.width/2,p=this.isEntering()?Math.max(0,Math.min(1,this.progress())):1,v=.72*d,m=a.map(function(e){var i=t.pointAt(e).y||0,r=u>0?i/u:1,n=Math.max(d*c,d*Math.max(0,Math.min(1,r)));return v+(n-v)*p}),g=!1!==r.trapezoid,b=0;b<a.length;b++){var k=a[b],S=b*(h+l),A=S+h,w=m[b],M=g&&b+1<m.length?m[b+1]:m[b],_={y0:S,y1:A,topWidth:w,bottomWidth:M,cx:f};this.stageGeom[k]=_;var C=Math.max(w,M)/2;this.stageRects[k]={x:f-C,y:S,width:2*C,height:A-S},this.pixels[2*k]=f,this.pixels[2*k+1]=(S+A)/2}this.blendStageMorph(),this.xMonotonic=!1,this.renderIndices=null}}}},{key:"blendStageMorph",value:function blendStageMorph(){var e=this.stageFrom;if(e&&!this.isEntering()){var t=Math.max(0,Math.min(1,this.progress()));if(t>=1)this.stageFrom=null;else for(var i=0;i<this.stageGeom.length;i++){var r=this.stageGeom[i],n=e[i];if(r&&n){var a=function lerp(e,i){return e+(i-e)*t};r.y0=a(n.y0,r.y0),r.y1=a(n.y1,r.y1),r.topWidth=a(n.topWidth,r.topWidth),r.bottomWidth=a(n.bottomWidth,r.bottomWidth);var o=Math.max(r.topWidth,r.bottomWidth)/2;this.stageRects[i]={x:r.cx-o,y:r.y0,width:2*o,height:r.y1-r.y0},this.pixels[2*i]=r.cx,this.pixels[2*i+1]=(r.y0+r.y1)/2}}}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();for(var i=0;i<this.stageGeom.length;i++){var r=this.stageGeom[i];if(r&&!(t<r.y0-1||t>r.y1+1)){var n=this.widthAt(r,t)/2*this.hoverBoost(i,.06)+1;if(Math.abs(e-r.cx)<=n)return i}}return-1}},{key:"doRender",value:function doRender(){var e=this.funnel;if(e&&this.chartTheme){this.rebuildPixels();for(var t=this.ctx,i=this.unit(),r=this.chartTheme,n=(e.options||{}).labelPosition||"inside",a=0,o=0;o<this.stageGeom.length;o++)this.stageGeom[o]&&a++;for(var s=0,l=0;l<this.series.pointCount;l++)this.stageGeom[l]&&(s+=this.series.pointAt(l).y||0);this.beginDraw();for(var h=0;h<this.stageGeom.length;h++){var u=this.stageGeom[h];if(u){var c=this.series.pointAt(h).color||this.series.color,d=this.hoverBoost(h,.06),f=u.topWidth*d,p=u.bottomWidth*d;t.beginPath(),t.moveTo(u.cx-f/2,u.y0),t.lineTo(u.cx+f/2,u.y0),t.lineTo(u.cx+p/2,u.y1),t.lineTo(u.cx-p/2,u.y1),t.closePath();var v=t.createLinearGradient(0,u.y0,0,u.y1);v.addColorStop(0,hexToRgba(c,.95)),v.addColorStop(1,hexToRgba(c,.75)),t.fillStyle=v,t.fill(),t.strokeStyle="rgba(255,255,255,0.7)",t.lineWidth=i,t.stroke()}}this.setFont(r.fontSize,r.fontFamily),t.textBaseline="middle";for(var m=0;m<this.stageGeom.length;m++){var g=this.stageGeom[m];if(g){var b=this.series.pointAt(m),k=b.y||0,S=s>0?k/s*100:0,A="".concat(b.name||b.xValue," ").concat(k).concat(a>1?" ".concat(S.toFixed(1),"%"):""),w=(g.y0+g.y1)/2,M=this.widthAt(g,w);if("right"!==n)measureTextWidth(t,A,r.fontSize,r.fontFamily)+12>M?(t.textAlign="left",t.fillStyle=r.textColor,t.fillText(A,g.cx+Math.max(g.topWidth,g.bottomWidth)/2+8*i,w)):(t.textAlign="center",t.fillStyle="#ffffff",t.fillText(A,g.cx,w));else t.textAlign="left",t.fillStyle=r.textColor,t.fillText(A,g.cx+Math.max(g.topWidth,g.bottomWidth)/2+8*i,w)}}this.endDraw()}}}])}(),ce=2*Math.PI,de=Math.PI/180,fe=function(){function GaugeSeries(){var e;_classCallCheck(this,GaugeSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,GaugeSeries,[].concat(i)),"seriesType","gauge"),_defineProperty(e,"gauge",null),_defineProperty(e,"gaugeKey",""),_defineProperty(e,"fromValue",null),e}return _inherits(GaugeSeries,ee),_createClass(GaugeSeries,[{key:"setCoord",value:function setCoord(e){return this.gauge=e||null,this.gaugeKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 8}},{key:"updateSeries",value:function updateSeries(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t&&this.gauge&&(this.fromValue=this.renderedValue()),_superPropGet(GaugeSeries,"updateSeries",this,3)([e,t,i])}},{key:"renderedValue",value:function renderedValue(){var e=this.range().min,t=this.series.pointCount&&Number(this.series.pointAt(0).y)||0,i=Math.max(0,Math.min(1,this.progress())),r=null===this.fromValue?e:this.fromValue;return r+(t-r)*i}},{key:"angles",value:function angles(){for(var e=this.gauge&&this.gauge.options||{},t=void 0===e.startAngle?225:Number(e.startAngle),i=void 0===e.endAngle?-45:Number(e.endAngle),r=-t*de,n=-i*de;n<=r;)n+=ce;return{a0:r,a1:n,sweep:n-r}}},{key:"range",value:function range(){var e=this.gauge&&this.gauge.options||{},t=isFinite(Number(e.min))?Number(e.min):0,i=isFinite(Number(e.max))?Number(e.max):100;return{min:t,max:i>t?i:t+1}}},{key:"angleFor",value:function angleFor(e){var t=this.angles(),i=t.a0,r=t.sweep,n=this.range(),a=n.min,o=n.max;return i+Math.max(0,Math.min(1,(e-a)/(o-a)))*r}},{key:"localCenter",value:function localCenter(){var e=this.gauge;return[e.polar.cx-e.plot.x,e.polar.cy-e.plot.y]}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.gauge;if(e){var t=e.options||{},i=this.series.pointCount&&Number(this.series.pointAt(0).y)||0,r=this.buildSeriesKey([e.polar.radius,t.startAngle,t.endAngle,t.min,t.max,i]);if(r!==this.gaugeKey||2!==this.pixels.length){this.gaugeKey=r,2!==this.pixels.length&&(this.pixels=new Float64Array(2));var n=_slicedToArray(this.localCenter(),2),a=n[0],o=n[1],s=Number(t.pointer&&t.pointer.length||.72)*e.polar.radius,l=this.angleFor(i);this.pixels[0]=a+Math.cos(l)*s,this.pixels[1]=o+Math.sin(l)*s,this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.gauge;if(!i||!this.series.pointCount)return-1;var r=_slicedToArray(this.localCenter(),2),n=r[0],a=r[1];return Math.hypot(e-n,t-a)<=i.polar.radius+12?0:-1}},{key:"doRender",value:function doRender(){var e=this.gauge;if(e&&this.chartTheme){this.rebuildPixels();var t=this.ctx,i=this.chartTheme,r=e.options||{},n=this.unit(),a=_slicedToArray(this.localCenter(),2),o=a[0],s=a[1],l=e.polar.radius,h=this.angles(),u=h.a0,c=h.sweep,d=this.range(),f=d.min,p=d.max,v=Math.max(2,Number(r.lineWidth)||14),m=this.renderedValue();this.beginDraw();for(var g=r.axisLineColor&&r.axisLineColor.length?r.axisLineColor:[[1,i.colorPalette[0]]],b=0,k=0;k<g.length;k++){var S=_slicedToArray(g[k],2),A=S[0],w=S[1],M=b,_=Math.max(b,Math.min(1,Number(A)));b=_,_<=M||(t.beginPath(),t.arc(o,s,l,u+M*c,u+_*c),t.strokeStyle=w,t.lineWidth=v,t.lineCap="butt",t.stroke())}var C=Math.max(1,Number(r.splitNumber)||5);this.setFont(.85*i.fontSize,i.fontFamily),t.fillStyle=i.subTextColor,t.textBaseline="middle",t.textAlign="center";for(var P=0;P<=C;P++){var T=P/C,I=u+T*c,N=l-v-2*n,D=l-v-8*n;t.beginPath(),t.moveTo(o+Math.cos(I)*N,s+Math.sin(I)*N),t.lineTo(o+Math.cos(I)*D,s+Math.sin(I)*D),t.strokeStyle=i.axisLineColor,t.lineWidth=n,t.stroke();var O=l-v-20*n;t.fillText(String(Math.round(f+T*(p-f))),o+Math.cos(I)*O,s+Math.sin(I)*O)}var R=r.pointer||{};if(!1!==R.show){var H=Math.max(.1,Number(R.length)||.72)*l,z=Math.max(1,Number(R.width)||5)*n,V=this.angleFor(m),E=o+Math.cos(V)*H,B=s+Math.sin(V)*H,L=o+Math.cos(V+Math.PI/2)*z,j=s+Math.sin(V+Math.PI/2)*z,W=o+Math.cos(V-Math.PI/2)*z,X=s+Math.sin(V-Math.PI/2)*z;t.beginPath(),t.moveTo(E,B),t.lineTo(L,j),t.lineTo(W,X),t.closePath(),t.fillStyle=i.textColor,t.fill(),t.beginPath(),t.arc(o,s,1.6*z,0,ce),t.fillStyle=i.textColor,t.fill(),t.beginPath(),t.arc(o,s,.7*z,0,ce),t.fillStyle="#ffffff",t.fill()}var U=r.detail||{},G=U.formatter?String(U.formatter(m)):"".concat(Math.round(100*m)/100),K=Math.max(0,360-this.angles().sweep/de)>20;if(!1!==U.show){var Y=Number(U.fontSize)||Math.max(16,Math.round(.26*l));this.setFont(Y,i.fontFamily,"bold"),t.textAlign="center",t.textBaseline="middle",t.fillStyle=i.textColor,t.fillText(G,o,s+l*(K?.78:.42))}var q=r.title||{},$=this.series.pointAt(0),Z=$&&($.name||void 0!==$.xValue)?$.name||String($.xValue):"";if(!1!==q.show&&Z){var J=Number(q.fontSize)||i.fontSize;this.setFont(J,i.fontFamily),measureTextWidth(t,Z,J,i.fontFamily),t.textAlign="center",t.textBaseline="middle",t.fillStyle=i.subTextColor,t.fillText(Z,o,s+l*(K?.6:.68))}this.endDraw()}}}])}(),pe=function(){function BoxplotSeries(){var e;_classCallCheck(this,BoxplotSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,BoxplotSeries,[].concat(i)),"seriesType","boxplot"),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"boxCacheKey",""),e}return _inherits(BoxplotSeries,ee),_createClass(BoxplotSeries,[{key:"boxWidthAt",value:function boxWidthAt(e){var t=Number(this.series.option.barWidth);return!isFinite(t)||t<=0?Math.max(4,.5*e):t<=1?Math.max(4,e*t):Math.max(4,t*this.unit())}},{key:"boxRectAt",value:function boxRectAt(e){var t=this.coord,i=this.series.pointAt(e);if(!t||!i||!i.boxplot)return null;var r=t.xScale.map(i.xValue);if(!isFinite(r))return null;var n=t.xScale.bandwidth()||.5*t.xScale.step(),a=this.boxWidthAt(n),o=_slicedToArray(i.boxplot,4),s=o[1],l=o[3],h=_slicedToArray(i.boxplot,5),u=h[0],c=h[4],d=t.yScale.map(s),f=t.yScale.map(l),p=t.yScale.map(u),v=t.yScale.map(c);return isFinite(d)&&isFinite(f)&&isFinite(p)&&isFinite(v)?{x:r-a/2,y:Math.min(d,f),width:a,height:Math.max(Math.abs(f-d),this.unit())}:null}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.coord,t=this.series.pointCount;if(e){var i=this.buildSeriesKey([t,e.plot.width,e.plot.height,String(e.xScale.domain.join(","))]);if(i!==this.boxCacheKey||this.pixels.length!==2*t){this.boxCacheKey=i,this.pixels.length!==2*t&&(this.pixels=new Float64Array(2*t));for(var r=0;r<t;r++){var n=this.boxRectAt(r),a=this.series.pointAt(r);n&&a&&a.boxplot?(this.pixels[2*r]=n.x+n.width/2,this.pixels[2*r+1]=e.yScale.map(a.boxplot[2])):(this.pixels[2*r]=NaN,this.pixels[2*r+1]=NaN)}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();var i=this.coord;if(!i)return-1;for(var r=0;r<this.series.pointCount;r++){var n=this.series.pointAt(r),a=this.boxRectAt(r);if(n&&n.boxplot&&a){var o=a.x+a.width/2;if(!(Math.abs(e-o)>a.width/2+1)){var s=i.yScale.map(n.boxplot[0]),l=i.yScale.map(n.boxplot[4]),h=Math.min(s,l),u=Math.max(s,l);if(t>=h-2&&t<=u+2)return r}}}return-1}},{key:"doRender",value:function doRender(){var e=this,t=this.coord;if(t&&this.chartTheme){this.rebuildPixels();var i=this.ctx;this.chartTheme;var r=this.unit(),n=this.pointColor(0),a=this.isEntering();this.computeItemProgress(),this.beginDraw();for(var o=function _loop(){var o=e.series.pointAt(s),l=e.boxRectAt(s);if(!o||!o.boxplot||!l)return 0;var h=_slicedToArray(o.boxplot,5),u=h[0],c=h[1],d=h[2],f=h[3],p=h[4],v=l.x+l.width/2,m=t.yScale.map(d),g=a?e.itemProgress[s]:1;if(g<=0)return 0;var b=function lerp(e){return m+(e-m)*g},k=b(t.yScale.map(u)),S=b(t.yScale.map(p)),A=b(t.yScale.map(f)),w=b(t.yScale.map(c)),M={x:l.x,y:Math.min(A,w),width:l.width,height:Math.max(Math.abs(w-A),e.unit())};i.beginPath(),i.moveTo(v,S),i.lineTo(v,M.y),i.moveTo(v,M.y+M.height),i.lineTo(v,k),i.strokeStyle=n,i.lineWidth=r,i.stroke(),i.beginPath(),i.moveTo(v-l.width/4,S),i.lineTo(v+l.width/4,S),i.moveTo(v-l.width/4,k),i.lineTo(v+l.width/4,k),i.stroke(),i.beginPath(),i.rect(M.x,M.y,M.width,M.height),i.fillStyle=function hexWithAlpha(e,t){if(!e)return"rgba(0,0,0,".concat(t,")");var i=e.replace("#","");3===i.length&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]);if(6!==i.length)return e;var r=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),a=parseInt(i.slice(4,6),16);return"rgba(".concat(r,",").concat(n,",").concat(a,",").concat(t,")")}(n,.28),i.fill(),i.strokeStyle=n,i.lineWidth=r,i.stroke(),i.beginPath(),i.moveTo(M.x,m),i.lineTo(M.x+M.width,m),i.lineWidth=Math.max(r,2*r),i.stroke(),e.drawHoverOverlay(s,M,{radius:1})},s=0;s<this.series.pointCount;s++)o();this.endDraw()}}}])}();var ve=function(){function WaterfallSeries(){var e;_classCallCheck(this,WaterfallSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,WaterfallSeries,[].concat(i)),"seriesType","waterfall"),e}return _inherits(WaterfallSeries,ie),_createClass(WaterfallSeries,[{key:"isTotalItem",value:function isTotalItem(e){var t=this.series.pointAt(e),i=t&&t.raw;return!(!i||"object"!==_typeof(i)||Array.isArray(i)||!i.total)}},{key:"isIncrease",value:function isIncrease(e){var t=this.series.pointAt(e);return!t||(t.y||0)>=0}},{key:"barColorAt",value:function barColorAt(e){var t=waterfallOptionOf(this.series),i=this.chartTheme,r=i&&i.colorPalette||s;return this.isTotalItem(e)?t.totalColor||r[0]:this.isIncrease(e)?t.increaseColor||r[1]:t.decreaseColor||r[2]}},{key:"doRender",value:function doRender(){if(_superPropGet(WaterfallSeries,"doRender",this,3)([]),!1!==waterfallOptionOf(this.series).connector){var e=this.coord;if(e){var t=this.ctx,i=this.unit(),r=this.chartTheme,n=e.yScale.isBand&&e.yScale.isBand();t.save(),t.strokeStyle=r&&r.subTextColor||"#6C757D",t.lineWidth=i,"function"==typeof t.setLineDash&&t.setLineDash([4*i,3*i]),t.beginPath();for(var a=0;a<this.series.pointCount-1;a++){var o=this.barRectAt(a),s=this.barRectAt(a+1);if(o&&s)if(n){var l=Math.max(o.x+o.width,s.x+s.width),h=o.y+o.height/2,u=s.y+s.height/2;t.moveTo(l,h),t.lineTo(l,u)}else{var c=Math.min(o.y,s.y),d=o.x+o.width/2,f=s.x+s.width/2;t.moveTo(d,c),t.lineTo(f,c)}}t.stroke(),"function"==typeof t.setLineDash&&t.setLineDash([]),t.restore()}}}}])}();function waterfallOptionOf(e){return e&&e.waterfallOption?e.waterfallOption:e&&e.option&&e.option.waterfall||{}}var ye=function(){function TreemapSeries(){var e;_classCallCheck(this,TreemapSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,TreemapSeries,[].concat(i)),"seriesType","treemap"),_defineProperty(e,"treemap",null),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"treemapKey",""),_defineProperty(e,"morphFrom",{}),_defineProperty(e,"morphing",!1),_defineProperty(e,"rectCache",new Map),e}return _inherits(TreemapSeries,ee),_createClass(TreemapSeries,[{key:"updateSeries",value:function updateSeries(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t&&this.treemap){var r,n={},a=_createForOfIteratorHelper(this.treemap.layout);try{for(a.s();!(r=a.n()).done;){var o=r.value;n["".concat(o.depth,":").concat(o.name)]=_objectSpread2({},o.rect)}}catch(e){a.e(e)}finally{a.f()}this.morphFrom=n,this.morphing=!0}return _superPropGet(TreemapSeries,"updateSeries",this,3)([e,t,i])}},{key:"rectOf",value:function rectOf(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.rectCache,i=this.progress();if(!this.morphing)return e.rect;if(i>=1)return this.morphing=!1,e.rect;var r=t.get(e.id);if(r)return r;var n,a=this.treemap?this.treemap.layout:[],o=this.morphFrom["".concat(e.depth,":").concat(e.name)],s=e.parent>=0?a[e.parent]:null,l=s?this.morphFrom["".concat(s.depth,":").concat(s.name)]:null;if(s&&o&&l&&l.width>1&&l.height>1){var h=this.rectOf(s,t),u=(o.x-l.x)/l.width,c=(o.y-l.y)/l.height,d=o.width/l.width,f=o.height/l.height;n={x:h.x+u*h.width,y:h.y+c*h.height,width:d*h.width,height:f*h.height}}else n=o?{x:o.x+(e.rect.x-o.x)*i,y:o.y+(e.rect.y-o.y)*i,width:o.width+(e.rect.width-o.width)*i,height:o.height+(e.rect.height-o.height)*i}:e.rect;return t.set(e.id,n),n}},{key:"setCoord",value:function setCoord(e){return this.treemap=e||null,this.treemapKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 6}},{key:"highlightRectAt",value:function highlightRectAt(e){var t=this.treemap;if(!t)return null;var i=t.layout[e];if(!i)return null;var r=this.rectOf(i);return{x:r.x-t.plot.x,y:r.y-t.plot.y,width:r.width,height:r.height}}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.treemap,t=e&&e.layout||[];if(e&&t.length){var i=this.buildSeriesKey([t.length,e.plot.width,e.plot.height]);if(i!==this.treemapKey||this.pixels.length!==2*t.length){this.treemapKey=i,this.pixels=new Float64Array(2*t.length);var r,n=_createForOfIteratorHelper(t);try{for(n.s();!(r=n.n()).done;){var a=r.value,o=this.rectOf(a);this.pixels[2*a.id]=o.x-e.plot.x+o.width/2,this.pixels[2*a.id+1]=o.y-e.plot.y+o.height/2}}catch(e){n.e(e)}finally{n.f()}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.treemap;if(!i)return-1;var r,n=-1,a=-1,o=_createForOfIteratorHelper(i.layout);try{for(o.s();!(r=o.n()).done;){var s=r.value,l=this.rectOf(s),h=l.x-i.plot.x,u=l.y-i.plot.y;e<h||e>h+l.width||t<u||t>u+l.height||s.depth>a&&(a=s.depth,n=s.id)}}catch(e){o.e(e)}finally{o.f()}return n}},{key:"doRender",value:function doRender(){var e=this,t=this.treemap;if(t&&this.chartTheme){this.rebuildPixels();var i=this.ctx,r=this.chartTheme,n=this.unit(),a=t.plot,o=t.options||{},s=void 0===o.minLabelRatio?.02:Number(o.minLabelRatio);this.rectCache=new Map,this.beginDraw();var l,h=_createForOfIteratorHelper(t.layout);try{for(h.s();!(l=h.n()).done;){var u=l.value,c=this.rectOf(u),d=c.x-a.x,f=c.y-a.y;i.beginPath(),i.rect(d,f,c.width,c.height),i.fillStyle=u.color,i.fill(),0===u.depth&&(i.strokeStyle="rgba(255,255,255,0.9)",i.lineWidth=1.5*n,i.stroke())}}catch(e){h.e(e)}finally{h.f()}if(null!==this.hoverIndex){var p=t.layout[this.hoverIndex];if(p){var v=this.rectOf(p),m={x:v.x-a.x,y:v.y-a.y,width:v.width,height:p.hasChildren&&p.header>0?p.header:v.height};this.drawHoverOverlay(this.hoverIndex,m,{radius:0,fill:"rgba(255,255,255,0.18)"})}}var g=function fitFontSize(e,t){for(var n=r.fontSize;n>9&&!e.every(function(e){return measureTextWidth(i,e,n,r.fontFamily)<=t});)n-=1;return n};this.setFont(r.fontSize,r.fontFamily),i.textAlign="center",i.textBaseline="middle";var b,k=_createForOfIteratorHelper(t.layout);try{var S=function _loop(){var t=b.value;if(t.ratio<s)return 0;var o=e.rectOf(t),l="".concat((100*t.ratio).toFixed(1),"%");if(t.hasChildren&&t.header>0){i.textAlign="left",i.fillStyle=0===t.depth?"#ffffff":r.textColor;var h="".concat(t.name," ").concat(l),u=g([h],o.width-16*n);return(u>9||measureTextWidth(i,h,u,r.fontFamily)<=o.width-16*n)&&(e.setFont(u,r.fontFamily,"bold"),i.fillText(h,o.x-a.x+8*n,o.y-a.y+t.header/2)),0}if(o.width<44||o.height<26)return 0;var c=(o.height>=40?"".concat(t.name,"\n").concat(l):"".concat(t.name," ").concat(l)).split("\n"),d=g(c,o.width-8*n);if(Math.max.apply(Math,_toConsumableArray(c.map(function(e){return measureTextWidth(i,e,d,r.fontFamily)})))>o.width-8*n)return 0;e.setFont(d,r.fontFamily),i.textAlign="center";var f=0===t.depth?"#ffffff":r.textColor;i.fillStyle=f;for(var p=1.35*d,v=o.y-a.y+o.height/2-(c.length-1)*p/2,m=0;m<c.length;m++)i.fillText(c[m],o.x-a.x+o.width/2,v+m*p)};for(k.s();!(b=k.n()).done;)S()}catch(e){k.e(e)}finally{k.f()}this.endDraw()}}}])}();function forceLayout(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{nodes:[],links:[]},n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:s,a=e.length;if(!a)return{nodes:[],links:[]};var o,l=r.layout||"force",h=_slicedToArray(Array.isArray(r.symbolSizeRange)?r.symbolSizeRange:[12,48],2),u=h[0],c=h[1],d=function indexOf(t){if("number"==typeof t)return t>=0&&t<a?t:-1;for(var i=0;i<a;i++){var r=e[i];if(r.id===t||r.name===t)return i}return-1},f=t.map(function(e,t){return{id:t,source:d(e.source),target:d(e.target),value:Number(e.value)||1,color:e.color}}).filter(function(e){return e.source>=0&&e.target>=0&&e.source!==e.target}),p=i.x+i.width/2,v=i.y+i.height/2,m=Math.max(10,Math.min(i.width,i.height)/2-c/2-4),g=e.map(function(e,t){if(isFinite(Number(e.x))&&isFinite(Number(e.y)))return{x:clamp(Number(e.x),i.x+2,i.x+i.width-2),y:clamp(Number(e.y),i.y+2,i.y+i.height-2)};var r=t/a*Math.PI*2-Math.PI/2;return{x:p+Math.cos(r)*m*.8,y:v+Math.sin(r)*m*.8}}),b=g.map(function(){return{x:0,y:0}}),k=g.map(function(e){return{x:e.x,y:e.y}}),S=new Array(a).fill(0),A=new Array(a).fill(0),w=_createForOfIteratorHelper(f);try{for(w.s();!(o=w.n()).done;){var M=o.value;S[M.source]++,S[M.target]++,A[M.source]+=M.value,A[M.target]+=M.value}}catch(e){w.e(e)}finally{w.f()}var _=Math.max.apply(Math,[1].concat(_toConsumableArray(A))),C=function sizeOf(t){var i=Number(e[t].value);if(!isFinite(i)||i<=0)return u;var r=Math.sqrt(Math.max(0,Math.min(1,A[t]/_)));return u+(c-u)*r};if("force"===l)for(var P=numberOr(r.repulsion,6e3),T=numberOr(r.edgeLength,70),I=numberOr(r.gravity,.06),N=Math.max(.1,Math.min(.98,numberOr(r.damping,.85))),D=Math.max(1,Math.floor(numberOr(r.iterations,240))),O=Math.max(8,(u+c)/6),R=0;R<D;R++){for(var H=1-R/D,z=0;z<a;z++)if(!e[z].fixed)for(var V=z+1;V<a;V++){var E=g[V].x-g[z].x,B=g[V].y-g[z].y,L=Math.hypot(E,B);L<O&&(E=E||(z%2==0?.5:-.5),B=B||(V%2==0?.5:-.5),L=Math.hypot(E,B));var j=P/(L*L)*H,W=E/L*j,X=B/L*j;b[z].x-=W,b[z].y-=X,e[V].fixed||(b[V].x+=W,b[V].y+=X)}var U,G=_createForOfIteratorHelper(f);try{for(G.s();!(U=G.n()).done;){var K=U.value,Y=g[K.source],q=g[K.target],$=q.x-Y.x,Z=q.y-Y.y,J=Math.max(.01,Math.hypot($,Z)),Q=.06*(J-(T+(K.value>1?Math.min(40,K.value):0)))*H,ee=$/J*Q,te=Z/J*Q;e[K.source].fixed||(b[K.source].x+=ee,b[K.source].y+=te),e[K.target].fixed||(b[K.target].x-=ee,b[K.target].y-=te)}}catch(e){G.e(e)}finally{G.f()}for(var ie=0;ie<a;ie++)e[ie].fixed||(b[ie].x+=(p-g[ie].x)*I*H,b[ie].y+=(v-g[ie].y)*I*H,b[ie].x*=N,b[ie].y*=N,g[ie].x+=b[ie].x,g[ie].y+=b[ie].y)}if("force"===l&&a>1){for(var re=1/0,ne=1/0,ae=-1/0,oe=-1/0,se=0;se<a;se++){var le=C(se)/2;re=Math.min(re,g[se].x-le),ae=Math.max(ae,g[se].x+le),ne=Math.min(ne,g[se].y-le),oe=Math.max(oe,g[se].y+le)}var he=Math.max(1,ae-re),ue=Math.max(1,oe-ne),ce=Math.min(3,Math.min((i.width-16)/he,(i.height-16)/ue));if(isFinite(ce)&&ce>0)for(var de=(re+ae)/2,fe=(ne+oe)/2,pe=0;pe<a;pe++)g[pe].x=p+(g[pe].x-de)*ce,g[pe].y=v+(g[pe].y-fe)*ce}var ve=e.map(function(e,t){var a=C(t)/2,o=clamp(g[t].x,i.x+a,i.x+i.width-a),s=clamp(g[t].y,i.y+a,i.y+i.height-a);return{id:t,name:e.name,x:o,y:s,initialX:k[t].x,initialY:k[t].y,size:C(t),value:A[t],degree:S[t],color:e.color||colorOf(e,r,n,t),category:e.category,fixed:!!e.fixed}}),ye=Math.max.apply(Math,[1].concat(_toConsumableArray(f.map(function(e){return e.value})))),me=f.map(function(e){return{id:e.id,source:e.source,target:e.target,value:e.value,width:1+3*Math.sqrt(e.value/ye),color:e.color||ve[e.source].color}});return{nodes:ve,links:me}}function colorOf(e,t,i,r){if(void 0!==e.category&&Array.isArray(t.categories)){var n=t.categories.find(function(t){return t.name===e.category});if(n&&n.color)return n.color;var a=t.categories.findIndex(function(t){return t.name===e.category});if(a>=0)return i[a%i.length]}return i[r%i.length]}function numberOr(e,t){var i=Number(e);return isFinite(i)?i:t}function clamp(e,t,i){return e<t?t:e>i?i:e}function sampleGraphLink(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:14,n=t[e.source],a=t[e.target],o=[];if(!n||!a)return o;if(!i)return o.push([n.x,n.y],[a.x,a.y]),o;for(var s=(n.x+a.x)/2,l=(n.y+a.y)/2,h=a.x-n.x,u=a.y-n.y,c=Math.max(1,Math.hypot(h,u)),d=Math.min(30,.18*c),f=s-u/c*d,p=l+h/c*d,v=0;v<=r;v++){var m=v/r,g=1-m;o.push([g*g*n.x+2*g*m*f+m*m*a.x,g*g*n.y+2*g*m*p+m*m*a.y])}return o}var me=function(){function GraphSeries(){var e;_classCallCheck(this,GraphSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,GraphSeries,[].concat(i)),"seriesType","graph"),_defineProperty(e,"graph",null),_defineProperty(e,"clipToBox",!1),_defineProperty(e,"graphKey",""),e}return _inherits(GraphSeries,ee),_createClass(GraphSeries,[{key:"setCoord",value:function setCoord(e){return this.graph=e||null,this.graphKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 28}},{key:"nodeCount",get:function get(){return this.graph&&this.graph.layout.nodes.length||0}},{key:"moveNode",value:function moveNode(e,t,i){var r=this.graph;if(!r)return!1;var n=r.layout.nodes[e];if(!n)return!1;var a=r.plot,o=n.size/2;return n.x=Math.max(a.x+o,Math.min(a.x+a.width-o,t+a.x)),n.y=Math.max(a.y+o,Math.min(a.y+a.height-o,i+a.y)),n.fixed=!0,this.graphKey="",this.markDirty(),!0}},{key:"settle",value:function settle(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:40,t=this.graph;if(t){var i=t.options||{},r=forceLayout(t.layout.nodes.map(function(e,t){return _objectSpread2(_objectSpread2({},i.nodes&&i.nodes[t]||{name:e.name}),{},{x:e.x,y:e.y,fixed:e.fixed})}),i.links||[],t.plot,_objectSpread2(_objectSpread2({},i),{},{layout:"force",iterations:e}),this.chartTheme?this.chartTheme.colorPalette:void 0);t.layout=r,this.graphKey="",this.markDirty()}}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.graph;if(e){var t=e.layout,i=t.nodes,r=t.links,n=i.length+r.length,a=this.buildSeriesKey([n,e.plot.width,e.plot.height,i.length,r.length]);if(a!==this.graphKey||this.pixels.length!==2*n){this.graphKey=a,this.pixels.length!==2*n&&(this.pixels=new Float64Array(2*n));var o,s=_createForOfIteratorHelper(i);try{for(s.s();!(o=s.n()).done;){var l=o.value;this.pixels[2*l.id]=l.x-e.plot.x,this.pixels[2*l.id+1]=l.y-e.plot.y}}catch(e){s.e(e)}finally{s.f()}var h,u=_createForOfIteratorHelper(r);try{for(u.s();!(h=u.n()).done;){var c=h.value,d=sampleGraphLink(c,i,!1!==e.options.curve,4),f=d[Math.floor(d.length/2)]||[0,0],p=i.length+c.id;this.pixels[2*p]=f[0]-e.plot.x,this.pixels[2*p+1]=f[1]-e.plot.y}}catch(e){u.e(e)}finally{u.f()}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.graph;if(!i)return-1;var r,n=i.layout,a=n.nodes,o=n.links,s=i.plot,l=_createForOfIteratorHelper(a);try{for(l.s();!(r=l.n()).done;){var h=r.value,u=e-(h.x-s.x),c=t-(h.y-s.y),d=h.size/2*this.hoverBoost(h.id,.28)+3;if(u*u+c*c<=d*d)return h.id}}catch(e){l.e(e)}finally{l.f()}var f,p=!1!==i.options.curve,v=_createForOfIteratorHelper(o);try{for(v.s();!(f=v.n()).done;)for(var m=f.value,g=sampleGraphLink(m,a,p,12),b=1;b<g.length;b++){if(distanceToSegment(e,t,g[b-1][0]-s.x,g[b-1][1]-s.y,g[b][0]-s.x,g[b][1]-s.y)<=6)return a.length+m.id}}catch(e){v.e(e)}finally{v.f()}return-1}},{key:"doRender",value:function doRender(){var e=this.graph;if(e&&this.chartTheme){this.rebuildPixels();var t=this.ctx,i=this.chartTheme,r=e.plot,n=this.unit(),a=e.layout,o=a.nodes,s=a.links,l=!1!==e.options.curve,h=this.isEntering(),u=h?Math.max(0,Math.min(1,this.progress())):1,c=function positionOf(e){return h?[e.initialX+(e.x-e.initialX)*u,e.initialY+(e.y-e.initialY)*u]:[e.x,e.y]},d=o.map(function(e){var t=_slicedToArray(c(e),2),i=t[0],r=t[1];return _objectSpread2(_objectSpread2({},e),{},{x:i,y:r})});this.beginDraw(),t.globalAlpha=.55;var f,p=_createForOfIteratorHelper(s);try{for(p.s();!(f=p.n()).done;){var v=f.value,m=sampleGraphLink(v,d,l,16);if(!(m.length<2)){t.beginPath(),t.moveTo(m[0][0]-r.x,m[0][1]-r.y);for(var g=1;g<m.length;g++)t.lineTo(m[g][0]-r.x,m[g][1]-r.y);t.strokeStyle=v.color,t.lineWidth=Math.max(n,v.width*n),t.stroke()}}}catch(e){p.e(e)}finally{p.f()}t.globalAlpha=1;var b,k=_createForOfIteratorHelper(o);try{for(k.s();!(b=k.n()).done;){var S=b.value,A=_slicedToArray(c(S),2),w=A[0],M=A[1],_=w-r.x,C=M-r.y,P=Math.max(2,S.size/2*this.hoverBoost(S.id,.28));t.beginPath(),t.arc(_,C,P,0,2*Math.PI),t.fillStyle=S.color,t.fill(),t.strokeStyle="rgba(255,255,255,0.85)",t.lineWidth=n*(this.hoverBoost(S.id,.28)>1?2:1),t.stroke()}}catch(e){k.e(e)}finally{k.f()}this.setFont(i.fontSize,i.fontFamily),t.textAlign="center",t.textBaseline="middle",t.fillStyle=i.textColor;var T,I=_createForOfIteratorHelper(o);try{for(I.s();!(T=I.n()).done;){var N=T.value,D=_slicedToArray(c(N),2),O=D[0],R=D[1],H=O-r.x,z=R-r.y+N.size/2+9*n;t.strokeStyle=i.labelHaloColor,t.lineWidth=3*n,t.strokeText(N.name,H,z),t.fillText(N.name,H,z)}}catch(e){I.e(e)}finally{I.f()}this.endDraw()}}},{key:"nodeSizeAt",value:function nodeSizeAt(e){var t=this.graph,i=t&&t.layout.nodes[e];return i?i.size*this.hoverBoost(e,.28):10}}])}(),xe=function(){function CurveSeriesBase(){var e;_classCallCheck(this,CurveSeriesBase);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,CurveSeriesBase,[].concat(i)),"curve",[]),_defineProperty(e,"curveKey",""),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"monotonicX",!0),e}return _inherits(CurveSeriesBase,ee),_createClass(CurveSeriesBase,[{key:"resolvedParams",value:function resolvedParams(){var e=_objectSpread2({},this.series.option.params||{}),t=this.series.option.sweep;if(t&&t.name){var i=Number(t.from),r=Number(t.to),n=shouldAnimate()?this.sweepPhase():0;e[t.name]=i+(r-i)*n}return e}},{key:"sweepPhase",value:function sweepPhase(){var e=this.series.option.sweep;if(!e)return 0;var t=Math.max(200,Number(e.duration)||3e3),i=(Date.now()%t+t)%t/t;return"loop"===e.mode?i:1-Math.abs(2*i-1)}},{key:"paramValue",value:function paramValue(e){var t=this.resolvedParams();return"number"==typeof t[e]?t[e]:null}},{key:"syncSweep",value:function syncSweep(){var e=this.series.option.sweep;!!(e&&e.name&&shouldAnimate()&&!1!==this.state.display)?this.keepAnimating():this.stopAnimating()}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.coord;if(!e)return this.pixels=new Float64Array(0),void(this.curve=[]);this.syncSweep();var t=this.resolvedParams(),i=e.plot,r=_slicedToArray(this.parameterRange(i),2),n=r[0],a=r[1],o=this.buildSeriesKey([this.paramKey(t),i.width,i.height,Number(n).toPrecision(12),Number(a).toPrecision(12)]);if(o!==this.curveKey){this.curveKey=o;var s=this.series,l=s.pointCount;this.pixels.length!==2*l&&(this.pixels=new Float64Array(2*l));for(var h=0;h<l;h++){var u=_slicedToArray(this.evaluateAt(Number(s.xValueAt(h)),t),2),c=u[0],d=u[1],f=isFinite(c)?e.xScale.map(c):NaN,p=isFinite(d)?e.yScale.map(d):NaN;this.pixels[2*h]=f,this.pixels[2*h+1]=p}for(var v=this.sampleCurve(t,i),m=new Array(2*v.length),g=0;g<v.length;g++){var b=_slicedToArray(v[g],2),k=b[0],S=b[1];m[2*g]=isFinite(k)?e.xScale.map(k):NaN,m[2*g+1]=isFinite(S)?e.yScale.map(S):NaN}this.curve=m,this.xMonotonic=this.monotonicX,this.computeEffective(),this.renderIndices=null}}},{key:"paramKey",value:function paramKey(e){return Object.keys(e).sort().map(function(t){return"".concat(t,"=").concat(Number(e[t]).toPrecision(10))}).join(",")}},{key:"sampleCount",value:function sampleCount(){return this.rebuildPixels(),this.curve.length/2}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();var i=this.pixels.length/2;if(!i)return-1;for(var r=this.series.option,n=Math.max(6,this.lineWidthDevice()+4)+(isFinite(Number(r.hitRadius))?Number(r.hitRadius):0),a=-1,o=n*n,s=0;s<i;s++){var l=this.pixels[2*s]-e,h=this.pixels[2*s+1]-t;if(isFinite(l)&&isFinite(h)){var u=l*l+h*h;u<=o&&(o=u,a=s)}}return a}},{key:"hoverLineScale",value:function hoverLineScale(){return null===this.hoverIndex?1:1+.45*this.highlightT()}},{key:"doRender",value:function doRender(){if(this.rebuildPixels(),this.curve.length){var e=this.ctx,t=this.unit(),i=this.pointColor(0),r=this.series.option;this.beginDraw(),e.strokeStyle=i,e.lineWidth=this.lineWidthDevice()*t*this.hoverLineScale(),"function"==typeof e.setLineDash&&Array.isArray(r.lineDash)&&e.setLineDash(r.lineDash.map(function(e){return e*t})),e.beginPath();for(var n=this.isEntering()?Math.max(.001,Math.min(1,this.progress())):1,a=this.curve.length/2,o=Math.max(1,Math.ceil(a*n)),s=!1,l=0;l<o;l++){var h=this.curve[2*l],u=this.curve[2*l+1];isFinite(h)&&isFinite(u)?s?e.lineTo(h,u):(e.moveTo(h,u),s=!0):s=!1}e.stroke(),"function"==typeof e.setLineDash&&e.setLineDash([]),this.endDraw()}}},{key:"curvePoints",value:function curvePoints(){return this.rebuildPixels(),this.curve}}])}(),ge=function(){function FunctionSeries(){var e;_classCallCheck(this,FunctionSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,FunctionSeries,[].concat(i)),"seriesType","function"),_defineProperty(e,"cachedSource",""),_defineProperty(e,"sampler",null),e}return _inherits(FunctionSeries,xe),_createClass(FunctionSeries,[{key:"samplerFor",value:function samplerFor(e){var t=String(this.series.option.expression||"");if(t!==this.cachedSource||!this.sampler){this.cachedSource=t;try{this.sampler=compileSampler(t)}catch(e){this.sampler={setParams:function setParams(){},evaluate:function evaluate(){return NaN}}}}var i=this.sampler;return i.setParams(e),function(e){return i.evaluate("x",e)}}},{key:"evaluateAt",value:function evaluateAt(e,t){return[e,this.samplerFor(t)(e)]}},{key:"parameterRange",value:function parameterRange(e){var t=this.coord,i=t&&t.xScale&&t.xScale.domain;if(i&&i.length>=2){var r=Number(i[0]),n=Number(i[i.length-1]);if(isFinite(r)&&isFinite(n)&&n>r)return[r,n]}var a=this.series.option.domain;return[a?Number(a[0]):-10,a?Number(a[1]):10]}},{key:"baseSampleCount",value:function baseSampleCount(){var e=Number(this.series.option.samples);return Math.max(24,Math.min(4e3,isFinite(e)&&e>0?e:240))}},{key:"sampleCurve",value:function sampleCurve(e,t){var i=this.samplerFor(e),r=_slicedToArray(this.parameterRange(t),2);return sampleFunctionCurve(i,r[0],r[1],{base:this.baseSampleCount(),adaptive:!1!==this.series.option.adaptive,tolerance:this.series.option.samplingTolerance})}}])}(),be=function(){function ParametricSeries(){var e;_classCallCheck(this,ParametricSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,ParametricSeries,[].concat(i)),"seriesType","parametric"),_defineProperty(e,"cachedSources",""),_defineProperty(e,"samplerX",null),_defineProperty(e,"samplerY",null),_defineProperty(e,"samplerR",null),e.monotonicX=!1,e}return _inherits(ParametricSeries,xe),_createClass(ParametricSeries,[{key:"samplersFor",value:function samplersFor(e){var t=this.series.option,i=void 0===t.polarExpression||null===t.polarExpression?"":String(t.polarExpression);if(i){var r="polar\0".concat(i,"\0").concat(Object.keys(e).sort().join(","));if(r!==this.cachedSources||!this.samplerR){this.cachedSources=r;try{this.samplerR=compileSampler(i)}catch(e){this.samplerR={setParams:function setParams(){},evaluate:function evaluate(){return NaN}}}}var n=this.samplerR;return n.setParams(e),{x:function x(e){return n.evaluate("t",e)*Math.cos(e)},y:function y(e){return n.evaluate("t",e)*Math.sin(e)}}}var a=String(t.xExpression||""),o=String(t.yExpression||""),s="".concat(a,"\0").concat(o,"\0").concat(Object.keys(e).sort().join(","));if(s!==this.cachedSources||!this.samplerX||!this.samplerY){this.cachedSources=s;var l={setParams:function setParams(){},evaluate:function evaluate(){return NaN}};try{this.samplerX=compileSampler(a)}catch(e){this.samplerX=l}try{this.samplerY=compileSampler(o)}catch(e){this.samplerY=l}}var h=this.samplerX,u=this.samplerY;return h.setParams(e),u.setParams(e),{x:function x(e){return h.evaluate("t",e)},y:function y(e){return u.evaluate("t",e)}}}},{key:"evaluateAt",value:function evaluateAt(e,t){var i=this.samplersFor(t),r=i.x,n=i.y;return[r(e),n(e)]}},{key:"parameterRange",value:function parameterRange(e){var t=this.series.option.domain,i=t?Number(t[0]):0,r=t?Number(t[1]):2*Math.PI;return isFinite(i)&&isFinite(r)&&r!==i?[i,r]:[0,2*Math.PI]}},{key:"baseSampleCount",value:function baseSampleCount(){var e=Number(this.series.option.samples);return Math.max(24,Math.min(6e3,isFinite(e)&&e>0?e:360))}},{key:"sampleCurve",value:function sampleCurve(e,t){var i=this.samplersFor(e),r=i.x,n=i.y,a=_slicedToArray(this.parameterRange(t),2);return sampleParametricCurve(r,n,a[0],a[1],{base:this.baseSampleCount(),adaptive:!1!==this.series.option.adaptive,tolerance:this.series.option.samplingTolerance})}}])}(),ke=2*Math.PI,Se=function(){function LiquidSeries(){var e;_classCallCheck(this,LiquidSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,LiquidSeries,[].concat(i)),"seriesType","liquid"),_defineProperty(e,"liquid",null),_defineProperty(e,"liquidKey",""),_defineProperty(e,"fromRatio",null),e}return _inherits(LiquidSeries,ee),_createClass(LiquidSeries,[{key:"setCoord",value:function setCoord(e){return this.liquid=e||null,this.liquidKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 6}},{key:"localCenter",value:function localCenter(){var e=this.liquid;return[e.polar.cx-e.plot.x,e.polar.cy-e.plot.y]}},{key:"range",value:function range(){var e=this.liquid&&this.liquid.options||{},t=isFinite(Number(e.min))?Number(e.min):0,i=isFinite(Number(e.max))?Number(e.max):100;return{min:t,max:i>t?i:t+1}}},{key:"targetRatio",value:function targetRatio(){var e=this.range(),t=e.min,i=e.max,r=this.series.pointCount&&Number(this.series.pointAt(0).y)||0;return Math.max(0,Math.min(1,(r-t)/(i-t)))}},{key:"currentRatio",value:function currentRatio(){var e=this.targetRatio(),t=Math.max(0,Math.min(1,this.progress())),i=null===this.fromRatio?0:this.fromRatio;return i+(e-i)*t}},{key:"levelRatio",value:function levelRatio(){return this.currentRatio()}},{key:"updateSeries",value:function updateSeries(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t&&this.liquid&&(this.fromRatio=this.currentRatio()),_superPropGet(LiquidSeries,"updateSeries",this,3)([e,t,i])}},{key:"phase",value:function phase(){var e=this.liquid&&this.liquid.options||{};if(!shouldAnimate())return 0;var t=isFinite(Number(e.waveSpeed))?Number(e.waveSpeed):1.6;return Date.now()/1e3*t}},{key:"syncWave",value:function syncWave(){var e=this.targetRatio();shouldAnimate()&&e>.001&&e<.999&&!1!==this.state.display?this.keepAnimating():this.stopAnimating()}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.liquid;if(e){var t=this.series.pointCount&&Number(this.series.pointAt(0).y)||0,i=this.buildSeriesKey([e.polar.radius,e.options.min,e.options.max,t]);if(i!==this.liquidKey||2!==this.pixels.length){this.liquidKey=i,2!==this.pixels.length&&(this.pixels=new Float64Array(2));var r=_slicedToArray(this.localCenter(),2),n=r[0],a=r[1];this.pixels[0]=n,this.pixels[1]=a,this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.liquid;if(!i||!this.series.pointCount)return-1;var r=_slicedToArray(this.localCenter(),2),n=r[0],a=r[1];return Math.hypot(e-n,t-a)<=i.polar.radius+8?0:-1}},{key:"wavePath",value:function wavePath(e,t,i,r,n,a,o,s){var l=Math.max(1,2*r/64);e.beginPath(),e.moveTo(t-r,n+a*Math.sin(s));for(var h=-r+l;h<=r;h+=l)e.lineTo(t+h,n+a*Math.sin(h/o*ke+s))}},{key:"doRender",value:function doRender(){var e=this.liquid;if(e&&this.chartTheme){this.rebuildPixels(),this.syncWave();var t=this.ctx,i=this.chartTheme,r=e.options||{},n=this.unit(),a=_slicedToArray(this.localCenter(),2),o=a[0],s=a[1],l=e.polar.radius,h=Math.max(1,Number(r.borderWidth)||3)*n,u=Math.max(2,l-h),c=r.color||this.pointColor(0),d=this.currentRatio(),f=isFinite(Number(r.waveHeight))?Number(r.waveHeight):.06,p=Math.max(.15,isFinite(Number(r.waveLength))?Number(r.waveLength):1.2)*u,v=f*u,m=this.phase();this.beginDraw(),t.beginPath(),t.arc(o,s,u,0,ke),t.fillStyle=hexToRgba(c,.1),t.fill(),t.save(),t.beginPath(),t.arc(o,s,u,0,ke),t.clip();for(var g=s+u-2*u*d,b=0,k=[{phase:m,alpha:.34,ampScale:1.25},{phase:m+.6*Math.PI,alpha:.55,ampScale:1}];b<k.length;b++){var S=k[b];this.wavePath(t,o,s,u,g,v*S.ampScale,p,S.phase),t.lineTo(o+u,s+u+2*v),t.lineTo(o-u,s+u+2*v),t.closePath(),t.globalAlpha=S.alpha;var A=t.createLinearGradient?t.createLinearGradient(0,g-v,0,s+u):null;A?(A.addColorStop(0,hexToRgba(c,.95)),A.addColorStop(1,hexToRgba(c,.55)),t.fillStyle=A):t.fillStyle=c,t.fill(),t.globalAlpha=1}t.restore(),t.beginPath(),t.arc(o,s,l-h/2,0,ke),t.strokeStyle=r.borderColor||hexToRgba(c,.6),t.lineWidth=h,t.stroke();var w=r.detail||{};if(!1!==w.show){var M=this.range().min,_=M+((this.series.pointCount&&Number(this.series.pointAt(0).y)||0)-M)*Math.max(0,Math.min(1,this.progress())),C="function"==typeof w.formatter?w.formatter(_):"".concat(Number(_.toPrecision(4))).concat(void 0===r.unit?"%":r.unit),P=this.series.pointCount?this.series.pointAt(0).name:void 0;P&&!1!==r.title&&(this.setFont(i.fontSize,i.fontFamily),t.fillStyle=i.subTextColor,t.textAlign="center",t.textBaseline="middle",t.fillText(String(P),o,s-.9*(Number(w.fontSize)||.28*l)*n));var T=isFinite(Number(w.fontSize))?Number(w.fontSize):Math.max(14,.42*l);this.setFont(T*n,i.fontFamily,"bold"),t.fillStyle=r.textColor||i.textColor,t.textAlign="center",t.textBaseline="middle",t.fillText(C,o,s+(P?.18*T*n:0))}this.endDraw()}}}])}(),Ae={bar:function bar(e,t){return new ie(e,t)},area:function area(e,t){return new re(e,t)},line:function line(e,t){return new te(e,t)},scatter:function scatter(e,t){return new ne(e,t)},pie:function pie(e,t){return new oe(e,t)},radar:function radar(e,t){return new se(e,t)},heatmap:function heatmap(e,t){return new le(e,t)},sankey:function sankey(e,t){return new he(e,t)},funnel:function funnel(e,t){return new ue(e,t)},gauge:function gauge(e,t){return new fe(e,t)},boxplot:function boxplot(e,t){return new pe(e,t)},waterfall:function waterfall(e,t){return new ve(e,t)},treemap:function treemap(e,t){return new ye(e,t)},graph:function graph(e,t){return new me(e,t)},function:function _function(e,t){return new ge(e,t)},parametric:function parametric(e,t){return new be(e,t)},liquid:function liquid(e,t){return new Se(e,t)}},we={},Me=/^[a-zA-Z][\w-]*$/;function registerSeriesType(e,t){if("string"!=typeof e||!Me.test(e))throw new Error("[ice-chart] registerSeriesType:类型名必须是非空字符串(字母开头,可含数字 / 下划线 / 连字符),收到「".concat(String(e),"」"));if("function"!=typeof t)throw new Error("[ice-chart] registerSeriesType:factory 必须是函数");if(Object.prototype.hasOwnProperty.call(Ae,e))throw new Error("[ice-chart] registerSeriesType:「".concat(e,"」是内置类型,不能覆盖(会破坏 option 的跨端可复现性)"));var i=we[e];if(i&&i!==t)throw new Error("[ice-chart] registerSeriesType:「".concat(e,"」已经注册过另一个工厂,先 unregisterSeriesType 再注册"));we[e]=t}function unregisterSeriesType(e){return!!Object.prototype.hasOwnProperty.call(we,e)&&(delete we[e],!0)}function getSeriesTypeFactory(e){return Object.prototype.hasOwnProperty.call(Ae,e)?Ae[e]:we[e]||null}function listSeriesTypes(){return[].concat(_toConsumableArray(Object.keys(Ae)),_toConsumableArray(Object.keys(we)))}function isBuiltinSeriesType(e){return Object.prototype.hasOwnProperty.call(Ae,e)}function createSeriesComponent(e,t){return(getSeriesTypeFactory(String(e.type))||Ae.line)(e,t)}function clearCustomSeriesTypes(){for(var e=0,t=Object.keys(we);e<t.length;e++){var i=t[e];delete we[i]}}var _e=function(){return _createClass(function HitResolver(e){_classCallCheck(this,HitResolver),this.host=e},[{key:"resolveTarget",value:function resolveTarget(e,t){var i=this.host.ice,r={kind:"none",component:null,index:-1,local:[0,0],chart:[0,0]};if(!i||"function"!=typeof i.hitTest)return r;var n=_slicedToArray(i.screenToWorld(e,t),2),a=n[0],o=n[1],s=[a,o],l=i.hitTest(e,t);if(!l)return _objectSpread2(_objectSpread2({},r),{},{chart:s});var h=l.globalToLocal?l.globalToLocal(a,o):[0,0];if(l===this.host.plotArea)return{kind:"plot",component:l,index:-1,local:h,chart:s};if(l===this.host.legend)return{kind:"legend",component:l,index:this.host.legend&&"function"==typeof this.host.legend.hitItem?this.host.legend.hitItem(h[0],h[1]):-1,local:h,chart:s};if("function"==typeof l.hitTestIndex){var u=l.hitTestIndex(h[0],h[1]);return{kind:u>=0?"series":"other",component:l,index:u,local:h,chart:s}}return{kind:"other",component:l,index:-1,local:h,chart:s}}},{key:"isInsidePlot",value:function isInsidePlot(e,t){var i=this.host.layout.plot;return e>=i.x&&e<=i.x+i.width&&t>=i.y&&t<=i.y+i.height}},{key:"seriesComponentOf",value:function seriesComponentOf(e){if(!e)return null;var t,i=_createForOfIteratorHelper(this.host.seriesComponents);try{for(i.s();!(t=i.n()).done;){var r=t.value;if(r.series===e)return r}}catch(e){i.e(e)}finally{i.f()}var n=e.id;if(null!=n){var a,o=_createForOfIteratorHelper(this.host.seriesComponents);try{for(o.s();!(a=o.n()).done;){var s=a.value;if(s.series&&s.series.id===n)return s}}catch(e){o.e(e)}finally{o.f()}}return null}},{key:"seriesOfComponent",value:function seriesOfComponent(e){var t,i=_createForOfIteratorHelper(this.host.norm.series);try{for(i.s();!(t=i.n()).done;){var r=t.value;if(this.seriesComponentOf(r)===e)return r}}catch(e){i.e(e)}finally{i.f()}return null}},{key:"buildActiveItem",value:function buildActiveItem(e,t){var i=this.seriesComponentOf(e);if(!i)return null;var r=i.pixelAt(t),n=e.pointAt(t);if(!r||!n)return null;var a=this.host.layout.plot;return{series:e,point:n,pixel:[a.x+r[0],a.y+r[1]],screen:[0,0]}}},{key:"toParams",value:function toParams(e){var t=this.host.ice,i=t&&"function"==typeof t.worldToScreen?t.worldToScreen(e.pixel[0],e.pixel[1]):e.pixel;return{seriesId:e.series.id,seriesName:e.series.name,seriesIndex:e.series.index,seriesType:e.series.type,color:e.series.color,dataIndex:e.point.index,data:e.point.raw,xValue:e.point.xValue,value:e.point.y,screen:[i[0],i[1]]}}},{key:"pickColumn",value:function pickColumn(e){var t=e-this.host.layout.plot.x,i=this.host.norm.series.filter(function(e){return!e.hidden});if(!i.length)return null;var r,n=[],a=null,o=_createForOfIteratorHelper(i);try{for(o.s();!(r=o.n()).done;){var s=r.value,l=this.seriesComponentOf(s);if(l){var h=this.nearestIndexByX(l,t);if(!(h<0)){var u=this.buildActiveItem(s,h);u&&(n.push(u),null===a&&(a=s.pointAt(h).xValue))}}}}catch(e){o.e(e)}finally{o.f()}return n.length?{dataIndex:n[0].point.index,xValue:a,pixelX:n[0].pixel[0],items:n}:null}},{key:"nearestIndexByX",value:function nearestIndexByX(e,t){return e.nearestIndexAtX(t)}},{key:"nearestByXValue",value:function nearestByXValue(e){var t,i=this.host.norm.series.filter(function(e){return!e.hidden}),r=this.host.norm.hiddenSlices||{},n=null,a=_createForOfIteratorHelper(i);try{for(a.s();!(t=a.n()).done;)for(var o=t.value,s=0;s<o.pointCount;s++)if("pie"!==o.type&&"funnel"!==o.type||!r["".concat(o.id,"#").concat(s)]){var l=valueDistance(e,o.pointAt(s).xValue);null!==l&&(!n||l<n.dist)&&(n={series:o,index:s,dist:l})}}catch(e){a.e(e)}finally{a.f()}return n?this.buildActiveItem(n.series,n.index):null}}])}();function valueDistance(e,t){var i=e instanceof Date?e.getTime():Number(e),r=t instanceof Date?t.getTime():Number(t);return isFinite(i)&&isFinite(r)?Math.abs(i-r):String(e)===String(t)?0:null}function barCountRange(e,t){var i=Math.max(1,e),r=Math.max(2,Math.ceil(i/function maxBarSpacingOf(e,t){var i=Number(e&&e.maxBarSpacing);return isFinite(i)&&i>0?i:Math.max(1,.5*t)}(t,i))),n=Math.max(r,Math.floor(i/function minBarSpacingOf(e){var t=Number(e&&e.minBarSpacing);return isFinite(t)&&t>0?t:.5}(t)));return[r,n]}function clampBarCount(e,t,i){var r=_slicedToArray(barCountRange(t,i),2),n=r[0],a=r[1];return isFinite(e)?Math.min(a,Math.max(n,e)):n}var Ce=null,Pe=function(){return _createClass(function InteractionController(e){_classCallCheck(this,InteractionController),_defineProperty(this,"hover",null),_defineProperty(this,"externalHover",!1),_defineProperty(this,"selection",[]),_defineProperty(this,"drag",null),_defineProperty(this,"bound",!1),_defineProperty(this,"lastDimmed",null),_defineProperty(this,"keyboardIndex",0),this.host=e,this.resolver=new _e(e)},[{key:"bind",value:function bind(){if(this.bound)return this;var e=this.host.ice&&this.host.ice.evtBus;return e?(this.bound=!0,e.on("mousemove",this.onBusMove,this),e.on("mousedown",this.onBusDown,this),e.on("mouseup",this.onBusUp,this),e.on("click",this.onBusClick,this),e.on("dblclick",this.onBusDoubleClick,this),e.on("wheel",this.onBusWheel,this),e.on("keydown",this.onBusKeyDown,this),this):this}},{key:"unbind",value:function unbind(){if(this.bound){this.bound=!1;var e=this.host.ice&&this.host.ice.evtBus;e&&(e.off("mousemove",this.onBusMove,this),e.off("mousedown",this.onBusDown,this),e.off("mouseup",this.onBusUp,this),e.off("click",this.onBusClick,this),e.off("dblclick",this.onBusDoubleClick,this),e.off("wheel",this.onBusWheel,this),e.off("keydown",this.onBusKeyDown,this))}}},{key:"pointOf",value:function pointOf(e){if(!e)return null;var t="number"==typeof e.offsetX?e.offsetX:e.x,i="number"==typeof e.offsetY?e.offsetY:e.y;return"number"!=typeof t||"number"!=typeof i?null:[t,i]}},{key:"isOverCanvas",value:function isOverCanvas(e,t){var i=this.host&&this.host.ice;if(!i)return!1;var r=i.dpr||1,n=(i.canvasWidth||0)/r,a=(i.canvasHeight||0)/r;return n>0&&a>0&&(e>=0&&t>=0&&e<=n&&t<=a)}},{key:"preventDefault",value:function preventDefault(e){if(e){if("function"==typeof e.preventDefault)try{return void e.preventDefault()}catch(e){}var t=e.originalEvent;if(t&&"function"==typeof t.preventDefault)try{t.preventDefault()}catch(e){}}}},{key:"onBusMove",value:function onBusMove(e){var t=this.pointOf(e);t&&this.handlePointerMove(t[0],t[1],e)}},{key:"onBusDown",value:function onBusDown(e){var t=this.pointOf(e);t&&this.handlePointerDown(t[0],t[1],e)}},{key:"onBusUp",value:function onBusUp(e){var t=this.pointOf(e);t&&this.handlePointerUp(t[0],t[1],e)}},{key:"onBusClick",value:function onBusClick(e){var t=this.pointOf(e);t&&this.handleClick(t[0],t[1],e)}},{key:"onBusDoubleClick",value:function onBusDoubleClick(e){var t=this.pointOf(e);t&&this.handleDoubleClick(t[0],t[1],e)}},{key:"onBusWheel",value:function onBusWheel(e){var t=this.pointOf(e);t&&this.handleWheel(t[0],t[1],Number(e.deltaY)||0,e)}},{key:"onBusKeyDown",value:function onBusKeyDown(e){this.handleKeyDown(e&&e.key,e)}},{key:"refreshHover",value:function refreshHover(){var e=this.hover;if(e){var t=this.host.norm;if("item"===e.kind){var i=t.series.find(function(t){return t.id===e.item.series.id})||e.item.series,r=e.item.point.index,n=("pie"===i.type||"funnel"===i.type)&&t.hiddenSlices["".concat(i.id,"#").concat(r)];if(i.hidden||n||!i.pointAt(r))return void this.setHover(null);var a=this.resolver.buildActiveItem(i,r);return a&&this.resolver.isInsidePlot(a.pixel[0],a.pixel[1])?void this.setHover({kind:"item",item:a},this.externalHover):void this.setHover(null)}var o=this.resolver.nearestByXValue(e.column.xValue),s=o?this.resolver.pickColumn(o.pixel[0]):null;s&&("cartesian"!==t.kind||this.resolver.isInsidePlot(s.pixelX,s.items[0].pixel[1]))?this.setHover({kind:"axis",column:s},this.externalHover):this.setHover(null)}}},{key:"resolveTarget",value:function resolveTarget(e,t){return this.resolver.resolveTarget(e,t)}},{key:"handlePointerMove",value:function handlePointerMove(e,t,i){this.drag?this.updateDrag(e,t,i):this.isOverCanvas(e,t)?this.updateHover(e,t):this.hover&&!this.externalHover&&this.setHover(null)}},{key:"updateHover",value:function updateHover(e,t){var i=this.host.norm.option.interaction;if(!i||!i.hover||!1!==i.hover.enabled){var r=this.resolveTarget(e,t);if("legend"===r.kind){var n=this.host.legend;return n&&n.hoverIndex!==r.index&&(n.hoverIndex=r.index,n.markDirty()),this.clearDataVisuals(),void this.setHoverState(null)}this.resetLegendHover();var a=this.host.norm.option.tooltip&&this.host.norm.option.tooltip.trigger||"axis";if(this.resolver.isInsidePlot(r.chart[0],r.chart[1])&&"axis"===a){var o=this.resolver.pickColumn(r.chart[0]);if(o)return void this.setHover({kind:"axis",column:o})}if("series"===r.kind&&r.index>=0){var s=this.resolver.seriesOfComponent(r.component),l=s?this.resolver.buildActiveItem(s,r.index):null;if(l)return void this.setHover({kind:"item",item:l})}this.setHover(null)}}},{key:"resetLegendHover",value:function resetLegendHover(){var e=this.host.legend;e&&-1!==e.hoverIndex&&(e.hoverIndex=-1,e.markDirty())}},{key:"setHover",value:function setHover(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.externalHover=!!e&&t;var i=!!this.hover;if(this.hover=e,!e)return this.clearHoverVisuals(),this.dimOthers(null),void(i&&this.host.emit("item:leave",void 0));this.applyHoverVisuals(e),"item"===e.kind?(this.keyboardIndex=e.item.point.index,this.dimOthers(e.item.series.id),this.host.emit("item:hover",this.resolver.toParams(e.item))):(this.dimOthers(null),e.column.items[0]&&this.host.emit("item:hover",this.resolver.toParams(e.column.items[0])))}},{key:"setHoverState",value:function setHoverState(e){this.hover=e}},{key:"applyHoverVisuals",value:function applyHoverVisuals(e){var t=this,i="item"===e.kind?[e.item]:e.column.items,r=i[0];this.syncSeriesHover(i);var n=this.host.highlight;n&&n.setHover(this.hoverMarkEnabled()?i.map(function(e){return t.markFor(e)}):[]);var a=this.host.crosshair;if(a)if("cartesian"!==this.host.norm.kind||"horizontal"===this.host.norm.orientation)a.hide();else{var o=this.host.norm.option.crosshair&&this.host.norm.option.crosshair.axis||"x";a.show("y"===o?null:r.pixel[0],"x"===o?null:r.pixel[1],this.host.formatAxisValue("x",r.point.xValue),null===r.point.y?"":this.host.formatAxisValue("y",r.point.y))}var s=this.host.tooltip;if(s)if(this.host.norm.option.tooltip&&!1===this.host.norm.option.tooltip.show)s.hide();else{var l=this.buildTooltipContent(e),h="axis"===e.kind?[e.column.pixelX,r.pixel[1]]:[r.pixel[0],r.pixel[1]];s.show(l,h)}}},{key:"buildTooltipContent",value:function buildTooltipContent(e){var t=this,i="item"===e.kind?[e.item]:e.column.items,r=i[0];if(r&&"horizontal"===this.host.norm.orientation)return{title:this.host.formatAxisValue("y",r.point.xValue),rows:i.map(function(e){return{name:e.series.name,value:null===e.point.y?"-":t.host.formatAxisValue("x",e.point.y),color:e.series.color}})};if(r&&"pie"===r.series.type){for(var n=r.series,a=r.point,o=0,s=0;s<n.pointCount;s++){var l=n.pointAt(s);this.host.norm.hiddenSlices["".concat(n.id,"#").concat(l.index)]||(o+=l.y||0)}var h=a.y||0,u=o>0?h/o*100:0;return{title:n.name,rows:[{name:a.name||"".concat(this.host.norm.labels.slice," ").concat(a.index+1),value:"".concat(u.toFixed(1),"%"),color:a.color||n.color}]}}if(r&&"funnel"===r.series.type){for(var c=r.series,d=r.point,f=0,p=0;p<c.pointCount;p++){var v=c.pointAt(p);this.host.norm.hiddenSlices["".concat(c.id,"#").concat(v.index)]||(f+=v.y||0)}var m=f>0?(d.y||0)/f*100:0;return{title:d.name||this.host.formatAxisValue("x",d.xValue),rows:[{name:c.name,value:"".concat(null===d.y?"-":d.y,"(").concat(m.toFixed(1),"%)"),color:d.color||c.color}]}}if(r&&"gauge"===r.series.type){var g=r.series,b=r.point;return{title:b.name||g.name,rows:[{name:g.name,value:null===b.y?"-":String(b.y),color:g.color}]}}if(r&&"liquid"===r.series.type){var k=r.series,S=r.point,A=k.option.liquid||{},w=isFinite(Number(A.min))?Number(A.min):0,M=isFinite(Number(A.max))?Number(A.max):100,_=null===S.y?w:Number(S.y),C=M>w?Math.max(0,Math.min(1,(_-w)/(M-w))):0;return{title:S.name||k.name,rows:[{name:k.name,value:"".concat(_).concat(void 0===A.unit?"%":A.unit),color:k.color},{name:this.host.norm.labels.liquid,value:"".concat((100*C).toFixed(1),"%"),color:this.host.norm.theme.subTextColor}]}}if(r&&("function"===r.series.type||"parametric"===r.series.type)){var P,T,I=r.series,N=r.point.raw||{},D="function"===I.type,O=D?"x":"t",R=Number(D?null!==(P=N.x)&&void 0!==P?P:r.point.xValue:null!==(T=N.t)&&void 0!==T?T:r.point.xValue),H=Number(N.x),z=Number(N.y),V=function fmt(e){return isFinite(e)?String(Number(e.toPrecision(4))):"—"};return{title:"".concat(O," = ").concat(V(R)),rows:D?[{name:I.name,value:V(z),color:I.color},{name:this.host.norm.labels.coordinate,value:"(".concat(V(H),", ").concat(V(z),")"),color:this.host.norm.theme.subTextColor}]:[{name:this.host.norm.labels.coordinate,value:"(".concat(V(H),", ").concat(V(z),")"),color:I.color},{name:"y",value:V(z),color:this.host.norm.theme.subTextColor}]}}if(r&&"radar"===r.series.type){for(var E=r.series,B=[],L=0;L<E.pointCount;L++){var j=E.pointAt(L);B.push({name:j.name||"".concat(j.index+1),value:null===j.y?"-":String(j.y),color:j.index===r.point.index?E.color:this.host.norm.theme.subTextColor})}return{title:E.name,rows:B}}if(r&&"boxplot"===r.series.type){var W=r.point,X=W.boxplot;if(X){var U=["最小值","下四分位","中位数","上四分位","最大值"];return{title:W.name||this.host.formatAxisValue("x",W.xValue),rows:X.map(function(e,t){return{name:U[t],value:String(e),color:r.series.color}})}}}if(r&&"waterfall"===r.series.type){var G=r.point,K=G.y||0;return{title:G.name||this.host.formatAxisValue("x",G.xValue),rows:[{name:K>=0?"增加":"减少",value:"".concat(K>=0?"+":"").concat(K),color:r.series.color},{name:"累计",value:String(G.top),color:this.host.norm.theme.subTextColor}]}}if(r&&"treemap"===r.series.type){var Y=r.series,q=r.point,$=Y.pointAt(0);$&&0===$.index&&$.y;for(var Z=q.y||0,J=0,Q=0;Q<Y.pointCount;Q++){var ee=Y.pointAt(Q),te=ee.raw;te&&Array.isArray(te.children)&&te.children.length||(J+=ee.y||0)}var ie=J>0?Z/J*100:0;return{title:q.name||String(q.xValue),rows:[{name:Y.name,value:"".concat(Z,"(").concat(ie.toFixed(1),"%)"),color:r.series.color}]}}if(r&&"graph"===r.series.type){var re=this.resolver.seriesComponentOf(r.series),ne=r.point,ae=re&&re.nodeCount||0;if(ne.index>=ae){var oe=re&&re.graph?re.graph.layout.links[ne.index-ae]:null,se=re&&re.graph?re.graph.layout.nodes:[];return{title:ne.name,rows:[{name:"流量",value:String(oe?oe.value:ne.y),color:oe?oe.color:r.series.color}].concat(_toConsumableArray(oe&&se[oe.source]&&se[oe.target]?[{name:"度数",value:String(se[oe.source].degree+se[oe.target].degree),color:this.host.norm.theme.subTextColor}]:[]))}}return{title:ne.name,rows:[{name:"权重",value:null===ne.y?"-":String(ne.y),color:r.series.color},{name:"连接数",value:String(re&&re.graph&&re.graph.layout.nodes[ne.index]?re.graph.layout.nodes[ne.index].degree:0),color:this.host.norm.theme.subTextColor}]}}if(r&&"heatmap"===r.series.type){var le=r.point;return{title:le.name||this.host.formatAxisValue("x",le.xValue),rows:[{name:this.host.formatAxisValue("x",le.xValue),value:null===le.y?"-":this.host.formatAxisValue("y",le.y),color:le.color||r.series.color}]}}if(r&&"sankey"===r.series.type){var he=r.point,ue=!(!he.raw||!he.raw.__sankeyLink);return{title:ue?he.name:"节点",rows:[{name:ue?"流量":he.name,value:null===he.y?"-":String(he.y),color:r.series.color}]}}var ce="item"===e.kind?e.item.point.xValue:e.column.xValue,de=this.host.formatAxisValue("x",ce),fe=i.map(function(e){return{name:e.series.name,value:null===e.point.y?"-":t.host.formatAxisValue("y",e.point.y),color:e.series.color}}),pe=this.host.norm.option.tooltip&&this.host.norm.option.tooltip.formatter;if("function"==typeof pe){var ve=pe({items:i.map(function(e){return t.resolver.toParams(e)}),dataIndex:"item"===e.kind?e.item.point.index:e.column.dataIndex,xValue:ce});if(Array.isArray(ve))return{title:void 0===ve[0]?de:String(ve[0]),rows:ve.slice(1).map(function(e,t){return{name:String(e),value:"",color:i[t]?i[t].series.color:"#999999"}})};if("string"==typeof ve)return{title:ve,rows:[]};if(ve&&"object"===_typeof(ve)&&(void 0!==ve.title||void 0!==ve.rows))return{title:ve.title||de,rows:ve.rows||fe}}return{title:de,rows:fe}}},{key:"clearHoverVisuals",value:function clearHoverVisuals(){this.clearDataVisuals(),this.resetLegendHover()}},{key:"clearDataVisuals",value:function clearDataVisuals(){this.syncSeriesHover([]),this.host.highlight&&this.host.highlight.setHover([]),this.host.crosshair&&this.host.crosshair.hide(),this.host.tooltip&&this.host.tooltip.hide()}},{key:"hoverMarkEnabled",value:function hoverMarkEnabled(){var e=this.host.norm.option.interaction;return!(e&&e.hover&&!1===e.hover.mark)}},{key:"syncSeriesHover",value:function syncSeriesHover(e){var t,i=new Map,r=_createForOfIteratorHelper(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;i.has(n.series.id)||i.set(n.series.id,n.point.index)}}catch(e){r.e(e)}finally{r.f()}var a,o=_createForOfIteratorHelper(this.host.seriesComponents);try{for(o.s();!(a=o.n()).done;){var s=a.value,l=i.get(s.series.id);s.setHoverIndex(void 0===l?null:l)}}catch(e){o.e(e)}finally{o.f()}}},{key:"markFor",value:function markFor(e){var t,i,r=this.resolver.seriesComponentOf(e.series),n=this.host.layout.plot;if(r&&"bar"===e.series.type&&"function"==typeof r.barRectAt){var a=("function"==typeof r.barDrawRectAt?r.barDrawRectAt(e.point.index,1):null)||r.barRectAt(e.point.index),o=a?{x:Math.max(a.x,0),y:Math.max(a.y,0),width:Math.max(0,Math.min(a.x+a.width,n.width)-Math.max(a.x,0)),height:Math.max(0,Math.min(a.y+a.height,n.height)-Math.max(a.y,0))}:null;if(o&&o.width>0&&o.height>0)return{x:n.x+o.x+o.width/2,y:n.y+o.y+o.height/2,width:o.width,height:o.height,color:e.series.color,size:0,shape:"rect"}}return{x:e.pixel[0],y:e.pixel[1],color:e.series.color,size:(t=e.series,i=t.option&&t.option.symbolSize,isFinite(i)?Number(i):"bar"===t.type?10:8),shape:"circle"}}},{key:"dimOthers",value:function dimOthers(e){var t=this.host.norm.option.interaction,i=!!(t&&t.hover&&t.hover.dimOthers),r=i?e:null;if(r!==this.lastDimmed){this.lastDimmed=r;var n,a=this.host.norm.theme.selection.dimOpacity,o=_createForOfIteratorHelper(this.host.seriesComponents);try{for(o.s();!(n=o.n()).done;){var s=n.value,l=i&&null!==r&&s.series.id!==r;s.setState({opacity:l?a:1})}}catch(e){o.e(e)}finally{o.f()}}}},{key:"handlePointerDown",value:function handlePointerDown(e,t,i){if(!this.isOverCanvas(e,t))return!1;Ce=this;var r=this.resolveTarget(e,t);if("legend"===r.kind)return!0;var n=this.host.dataZoomSlider;if(n&&r.component===n){var a=n.hitPart(r.local[0],r.local[1]);if(a){this.preventDefault(i),this.setHover(null);var o=n.fractionAt(r.local[0]);if(this.drag={mode:"slider",part:a,startX:e,startY:t,originStart:n.start,originEnd:n.end,anchorFraction:o,moved:!1},n.setActive(a),"track"===a){var s=n.end-n.start,l=clamp$2(o-s/2,0,1-s);this.host.setDomainFromFractions(l,l+s,"slider",!0),n.setActive("window"),this.drag.part="window",this.drag.originStart=l,this.drag.originEnd=l+s}return!0}}if("series"===r.kind&&r.index>=0&&r.component&&"graph"===r.component.seriesType&&"function"==typeof r.component.moveNode&&r.index<(r.component.nodeCount||0)&&(!r.component.graph||!1!==r.component.graph.options.draggable))return this.preventDefault(i),this.setHover(null),this.drag={mode:"graph-node",component:r.component,nodeIndex:r.index,startX:e,startY:t,moved:!1},!0;if(r.component&&"function"==typeof this.host.isMarkComponent&&this.host.isMarkComponent(r.component))return this.setHover(null),!1;if(!this.resolver.isInsidePlot(r.chart[0],r.chart[1]))return!1;var h=this.host.norm.option.interaction||{},u=h.brush,c=h.pan,d=!(!u||!1===u||!1===u.enabled),f=!(!c||!1===c||!c.enabled);return this.preventDefault(i),d?(this.setHover(null),this.drag={mode:"brush",startX:e,startY:t,moved:!1},this.host.brush&&this.host.brush.setRect({x:r.chart[0],y:r.chart[1],width:0,height:0}),!0):!!f&&(this.setHover(null),this.drag={mode:"pan",startX:e,startY:t,domainX:this.currentXWindow(),domainY:[this.host.norm.yAxis.domain[0],this.host.norm.yAxis.domain[1]],moved:!1},!0)}},{key:"currentXWindow",value:function currentXWindow(){var e=this.host.norm.xAxis,t=e&&e.domain;return!t||t.length<2?null:"category"===e.type?[t[0],t[t.length-1]]:[t[0],t[1]]}},{key:"handlePointerUp",value:function handlePointerUp(e,t,i){"function"==typeof this.host.finishMarkDrag&&this.host.finishMarkDrag();var r=this.drag;if(r){if(this.drag=null,"brush"===r.mode){if(!r.moved)return this.host.brush&&this.host.brush.setRect(null),void this.updateHover(e,t);var n=this.brushRange(),a=this.host.norm.option.interaction&&this.host.norm.option.interaction.brush;return a&&"zoom"===a.mode&&n&&(this.applyRange(n),this.host.brush&&this.host.brush.setRect(null)),this.host.emit("brush:end",n),void this.updateHover(e,t)}if("slider"===r.mode){var o=this.host.dataZoomSlider;return o&&o.setActive(null),void this.updateHover(e,t)}if("graph-node"===r.mode){var s=r.component;return r.moved&&s&&"function"==typeof s.settle&&s.graph&&!1!==s.graph.options.settleOnDrop&&s.settle(),void this.updateHover(e,t)}"pan"===r.mode&&this.updateHover(e,t)}}},{key:"updateDrag",value:function updateDrag(e,t,i){var r=this.drag;if(r){var n=e-r.startX,a=t-r.startY;if(r.moved||!(Math.abs(n)+Math.abs(a)<3)){r.moved=!0;var o=this.host.layout.plot,s=_slicedToArray(this.host.ice.screenToWorld(r.startX,r.startY),2),l=s[0],h=s[1],u=_slicedToArray(this.host.ice.screenToWorld(e,t),2),c=u[0],d=u[1];if("brush"!==r.mode)if("slider"!==r.mode)if("graph-node"!==r.mode){var f=this.host.norm.option.interaction&&this.host.norm.option.interaction.pan,p=f&&f.axes||"xy";if(("x"===p||"xy"===p)&&r.domainX){var v=this.shiftDomain("x",r.domainX,n);v&&this.host.setDomain("x",v,"pan")}if(("y"===p||"xy"===p)&&r.domainY){var m=this.shiftDomain("y",r.domainY,a);m&&this.host.setDomain("y",m,"pan")}}else{r.moved=!0;var g=r.component,b=_slicedToArray(this.host.ice.screenToWorld(e,t),2),k=b[0],S=b[1],A=g.globalToLocal(k,S);g.moveNode(r.nodeIndex,A[0],A[1]);var w=this.seriesOfGraphComponent(g);if(w){var M=this.resolver.buildActiveItem(w,r.nodeIndex);M&&this.setHover({kind:"item",item:M})}}else{var _=this.host.dataZoomSlider;if(!_)return;r.moved=!0;var C=_slicedToArray(this.host.ice.screenToWorld(e,t),2),P=C[0],T=C[1],I=_.globalToLocal(P,T)[0],N=_.fractionAt(I),D=r.originEnd-r.originStart,O=r.originStart,R=r.originEnd;if("start"===r.part)O=clamp$2(N,0,r.originEnd-.02);else if("end"===r.part)R=clamp$2(N,r.originStart+.02,1);else{var H=N-r.anchorFraction;R=(O=clamp$2(r.originStart+H,0,1-D))+D}this.host.setDomainFromFractions(O,R,"slider",!0)}else{var z=clamp$2(l,o.x,o.x+o.width),V=clamp$2(h,o.y,o.y+o.height),E=clamp$2(c,o.x,o.x+o.width),B=clamp$2(d,o.y,o.y+o.height);this.host.brush&&this.host.brush.setRect({x:Math.min(z,E),y:Math.min(V,B),width:Math.abs(E-z),height:Math.abs(B-V)});var L=this.brushRange();L&&this.host.emit("brush:change",L)}}}}},{key:"shiftDomain",value:function shiftDomain(e,t,i){var r=this.host.norm["x"===e?"xAxis":"yAxis"],n=r.scale;if(!n)return null;var a="x"===e?this.host.layout.plot.width:this.host.layout.plot.height;if(n.isBand()){var o=this.host.fullDomain("x"),s=o&&o.length?o:r.domain,l=s.indexOf(t[0]),h=s.indexOf(t[1]);if(l<0||h<0||s.length<=1)return null;var u=n.step()||a/Math.max(1,s.length),c=h-l,d=clamp$2(l+Math.round(-i/u),0,Math.max(0,s.length-1-c));return[s[d],s[d+c]]}var f=Number(t[1])-Number(t[0]),p=("x"===e?-1:1)*i/Math.max(1,a)*f;return[Number(t[0])+p,Number(t[1])+p]}},{key:"handleClick",value:function handleClick(e,t,i){if(this.isOverCanvas(e,t)){var r=this.resolveTarget(e,t),n=this.host.norm.option.interaction;if("legend"!==r.kind){if("series"===r.kind&&r.index>=0){var a=this.resolver.seriesOfComponent(r.component),o=a?this.resolver.buildActiveItem(a,r.index):null;if(o){var s=this.resolver.toParams(o);this.host.emit("item:click",s);var l=n&&n.select;return void(l&&l.enabled&&this.toggleSelection(o.series.id,o.point.index,l.mode||"single",!1!==l.toggle))}}if(this.resolver.isInsidePlot(r.chart[0],r.chart[1])){var h=this.host.layout.plot;this.host.emit("plot:click",{screen:[e,t],xValue:this.host.norm.xAxis.scale?this.host.norm.xAxis.scale.invert(r.chart[0]-h.x):void 0,yValue:this.host.norm.yAxis.scale?this.host.norm.yAxis.scale.invert(r.chart[1]-h.y):void 0})}else this.host.emit("chart:click",{screen:[e,t]})}else{var u=this.host.legend;if(u&&r.index>=0){var c=u.items[r.index];void 0!==c.dataIndex?this.host.toggleSlice(c.seriesId,c.dataIndex):this.host.toggleSeries(c.seriesId)}}}}},{key:"handleDoubleClick",value:function handleDoubleClick(e,t,i){if(this.isOverCanvas(e,t)){var r=this.resolveTarget(e,t);if(!("series"!==r.kind||r.index<0)){var n=this.resolver.seriesOfComponent(r.component),a=n?this.resolver.buildActiveItem(n,r.index):null;a&&this.host.emit("item:dblclick",this.resolver.toParams(a))}}}},{key:"toggleSelection",value:function toggleSelection(e,t,i,r){var n=this.selection.findIndex(function(i){return i.seriesId===e&&i.dataIndex===t});"single"===i?this.selection=n>=0&&r?[]:[{seriesId:e,dataIndex:t}]:n>=0?this.selection.splice(n,1):this.selection.push({seriesId:e,dataIndex:t}),this.refreshSelectionVisuals(),this.host.emit("select:change",this.getSelectedParams())}},{key:"clearSelection",value:function clearSelection(){this.selection.length&&(this.selection=[],this.refreshSelectionVisuals(),this.host.emit("select:change",[]))}},{key:"refreshSelectionVisuals",value:function refreshSelectionVisuals(){var e=this,t=this.host.highlight;if(t){var i,r=[],n=_createForOfIteratorHelper(this.selection);try{var a=function _loop(){var t=i.value,n=e.host.norm.series.find(function(e){return e.id===t.seriesId});if(!n)return 1;var a=e.resolver.buildActiveItem(n,t.dataIndex);a&&r.push(e.markFor(a))};for(n.s();!(i=n.n()).done;)a()}catch(e){n.e(e)}finally{n.f()}t.setSelection(r)}}},{key:"getSelectedParams",value:function getSelectedParams(){var e,t=this,i=[],r=_createForOfIteratorHelper(this.selection);try{var n=function _loop2(){var r=e.value,n=t.host.norm.series.find(function(e){return e.id===r.seriesId});if(!n)return 1;var a=t.resolver.buildActiveItem(n,r.dataIndex);a&&i.push(t.resolver.toParams(a))};for(r.s();!(e=r.n()).done;)n()}catch(e){r.e(e)}finally{r.f()}return i}},{key:"brushRect",get:function get(){return this.host.brush?this.host.brush.rect:null}},{key:"brushRange",value:function brushRange(){var e=this.brushRect,t=this.host.layout.plot;if(!e||e.width<2&&e.height<2)return null;var i=this.host.norm.option.interaction&&this.host.norm.option.interaction.brush,r=i&&i.axes||"x",n={};if("x"===r||"xy"===r){var a=this.valueAtPixel("x",e.x-t.x),o=this.valueAtPixel("x",e.x+e.width-t.x),s=this.orderValues("x",a,o);s&&(n.x=s)}if("y"===r||"xy"===r){var l=this.valueAtPixel("y",e.y-t.y),h=this.valueAtPixel("y",e.y+e.height-t.y),u=this.orderValues("y",l,h);u&&(n.y=u)}return n.x||n.y?n:null}},{key:"valueAtPixel",value:function valueAtPixel(e,t){var i=this.host.norm["x"===e?"xAxis":"yAxis"],r=i.scale;if(r){if(r.isBand()){var n=r.indexAt(t),a=n>=0?n:r.nearestIndex?r.nearestIndex(t):0;return i.domain[clamp$2(a,0,i.domain.length-1)]}return r.invert(t)}}},{key:"orderValues",value:function orderValues(e,t,i){if(void 0===t||void 0===i)return null;var r=this.host.norm["x"===e?"xAxis":"yAxis"].scale;if(r&&r.isBand()){var n=this.host.norm["x"===e?"xAxis":"yAxis"].domain;return n.indexOf(t)<=n.indexOf(i)?[t,i]:[i,t]}return Number(t)<=Number(i)?[t,i]:[i,t]}},{key:"applyRange",value:function applyRange(e){e.x&&this.host.setDomain("x",e.x,"brush"),e.y&&this.host.setDomain("y",e.y,"brush")}},{key:"handleWheel",value:function handleWheel(e,t,i,r){var n=this.host.norm.option.interaction&&this.host.norm.option.interaction.zoom;if(!n||!1===n||!1===n.enabled||!1===n.wheel)return!1;var a=this.resolveTarget(e,t);if(!this.resolver.isInsidePlot(a.chart[0],a.chart[1]))return!1;this.preventDefault(r);var o=Number(n.wheelFactor)||1.2,s=i<0?o:1/o;if("viewport"===n.mode)return this.host.ice.zoomAt(e,t,s),!0;var l=n.axes||"x",h=this.host.layout.plot;if("x"===l||"xy"===l){var u=this.zoomDomain("x",a.chart[0]-h.x,s);u&&this.host.setDomain("x",u,"zoom")}if("y"===l||"xy"===l){var c=this.zoomDomain("y",a.chart[1]-h.y,s);c&&this.host.setDomain("y",c,"zoom")}return!0}},{key:"zoomDomain",value:function zoomDomain(e,t,i){var r=this.host.norm["x"===e?"xAxis":"yAxis"],n=r.scale;if(!n)return null;var a=this.host.norm.option.interaction&&this.host.norm.option.interaction.zoom,o=Number(a&&a.minSpan)||.05,s=Number(a&&a.maxSpan)||1,l=this.host.fullDomain(e),h=this.host.layout.plot,u="x"===e?h.width:h.height;if(n.isBand()){var c=l,d=c.length;if(d<=2)return null;var f=r.domain,p=Math.max(0,c.indexOf(f[0])),v=c.indexOf(f[f.length-1]),m=Math.max(2,v-p+1),g=clamp$2(t/Math.max(1,u),0,1),b=Math.min(d,clampBarCount(Math.round(m/i),h.width,a)),k=p+g*(m-1),S=Math.round(k-g*(b-1));return[c[S=clamp$2(S,0,Math.max(0,d-b))],c[S+b-1]]}var A=Number(r.domain[0]),w=Number(r.domain[1])-A,M=Number(l[1])-Number(l[0]),_=clamp$2(w/i,M*o,M*s),C=n.invert(t),P=C-(0===w?.5:(C-A)/w)*_;return[P,P+_]}},{key:"currentRange",value:function currentRange(){return{x:[this.host.norm.xAxis.domain[0],this.host.norm.xAxis.domain[1]],y:[Number(this.host.norm.yAxis.domain[0]),Number(this.host.norm.yAxis.domain[1])]}}},{key:"handleKeyDown",value:function handleKeyDown(e,t){var i=this.host.norm.option.interaction;if(i&&!1===i.keyboard)return!1;if(!e)return!1;if(Ce&&Ce!==this&&Ce.host)return!1;if(t&&t.target&&/^(INPUT|TEXTAREA|SELECT)$/.test(t.target.tagName||""))return!1;var r=this.host.norm.series.filter(function(e){return!e.hidden});if(!r.length)return!1;var n=0;if(this.hover){var a="item"===this.hover.kind?this.hover.item.series.id:this.hover.column.items[0].series.id,o=r.findIndex(function(e){return e.id===a});o>=0&&(n=o)}var s=!1;switch(e){case"ArrowRight":case"ArrowLeft":var l=r[n];if(!l.pointCount)break;var h=this.stepVisibleIndex(l,"ArrowRight"===e?1:-1);if(h>=0){this.keyboardIndex=h;var u=this.resolver.buildActiveItem(l,h);u&&this.setHover({kind:"item",item:u})}s=h>=0;break;case"ArrowUp":case"ArrowDown":var c=r[clamp$2(n+("ArrowDown"===e?1:-1),0,r.length-1)];if(!c.pointCount)break;var d=clamp$2(this.keyboardIndex,0,c.pointCount-1),f=this.resolver.buildActiveItem(c,d);f&&this.setHover({kind:"item",item:f}),s=!0;break;case"Escape":this.setHover(null),this.clearSelection(),this.host.brush&&this.host.brush.setRect(null),s=!0;break;case"Enter":case" ":if(this.hover&&"item"===this.hover.kind){var p=this.hover.item,v=i&&i.select;this.toggleSelection(p.series.id,p.point.index,v&&v.mode||"single",!0),this.host.emit("item:click",this.resolver.toParams(p)),s=!0}}return s&&this.preventDefault(t),s}},{key:"showHoverAtValue",value:function showHoverAtValue(e){var t=this.resolver.nearestByXValue(e);t&&this.setHover({kind:"item",item:t},!0)}},{key:"clearHover",value:function clearHover(){this.setHover(null)}},{key:"seriesOfGraphComponent",value:function seriesOfGraphComponent(e){var t,i=_createForOfIteratorHelper(this.host.norm.series);try{for(i.s();!(t=i.n()).done;){var r=t.value;if(this.resolver.seriesComponentOf(r)===e)return r}}catch(e){i.e(e)}finally{i.f()}return null}},{key:"stepVisibleIndex",value:function stepVisibleIndex(e,t){var i=e.pointCount;if(!i)return-1;for(var r=clamp$2(this.keyboardIndex,0,i-1),n=0;n<i;n++){var a=r+t;if(a<0||a>=i)return-1;r=a;var o=this.resolver.buildActiveItem(e,r);if(o&&this.resolver.isInsidePlot(o.pixel[0],o.pixel[1]))return r}return-1}},{key:"destroy",value:function destroy(){this.unbind(),Ce===this&&(Ce=null),this.host=null}}])}();var Te=function(){return _createClass(function Emitter(){_classCallCheck(this,Emitter),_defineProperty(this,"listeners",new Map)},[{key:"on",value:function on(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.listeners.get(e)||[];return this.off(e,t,i),r.push({fn:t,scope:i}),this.listeners.set(e,r),this}},{key:"once",value:function once(e,t){var i=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=function wrapper(a){i.off(e,n,r),t.call(r,a)};return n.__onceOriginal=t,this.on(e,n,r)}},{key:"off",value:function off(e,t,i){var r=this.listeners.get(e);if(!r)return this;if(!t)return this.listeners.delete(e),this;for(var n=r.length-1;n>=0;n--){var a=r[n],o=a.fn;!(o===t||o&&o.__onceOriginal===t)||void 0!==i&&a.scope!==i||r.splice(n,1)}return r.length||this.listeners.delete(e),this}},{key:"emit",value:function emit(e,t){var i=this.listeners.get(e);if(!i||!i.length)return!1;for(var r=i.slice(),n=0;n<r.length;n++)r[n].fn.call(r[n].scope,t);return!0}},{key:"hasListener",value:function hasListener(e){var t=this.listeners.get(e);return!!t&&t.length>0}},{key:"clear",value:function clear(){this.listeners.clear()}}])}();function chartTitle(e){var t=e.option.title&&e.option.title.text;return t?String(t):e.labels.chart}function buildDataTable(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.norm,r=chartTitle(i),n=i.series.filter(function(e){return!e.hidden&&"pie"!==e.type});if("polar"===i.kind){var a=i.series.find(function(e){return"pie"===e.type});if(!a)return{caption:r,columns:[i.labels.sector,i.labels.value,i.labels.ratio],rows:[]};for(var o=[],s=0;s<a.pointCount;s++){var l=a.pointAt(s);i.hiddenSlices["".concat(a.id,"#").concat(l.index)]||o.push(l)}var h=o.reduce(function(e,t){return e+(t.y||0)},0);return{caption:r,columns:[i.labels.sector,i.labels.value,i.labels.ratio],rows:o.map(function(e){return[e.name||"".concat(a.name," ").concat(e.index+1),null===e.y?"":String(e.y),h>0?"".concat(((e.y||0)/h*100).toFixed(1),"%"):"0%"]})}}if("radar"===i.kind){var u=i.radar&&i.radar.indicators||[];return{caption:r,columns:["指标"].concat(_toConsumableArray(n.map(function(e){return e.name}))),rows:u.map(function(e,t){return[e.name].concat(_toConsumableArray(n.map(function(e){var i=e.pointAt(t);return i&&null!==i.y?String(i.y):""})))})}}var c,d=[i.xAxis.option&&i.xAxis.option.name||"类目"].concat(_toConsumableArray(n.map(function(e){return e.name}))),f=Math.max(2,void 0===t.maxTableRows?200:Number(t.maxTableRows)||200),p=n.reduce(function(e,t){return e+t.pointCount},0),v=p>f?Math.ceil(p/f):1,m=[],g={},b=_createForOfIteratorHelper(n);try{for(b.s();!(c=b.n()).done;)for(var k=c.value,S=0,A=k.pointCount;S<A;S+=v){var w=k.pointAt(S),M=String(w.xValue);g[M]||(g[M]={x:w.xValue,cells:{}},m.push(M)),g[M].cells[k.id]=null===w.y?"":e.formatAxisValue("y",w.y)}}catch(e){b.e(e)}finally{b.f()}var _=m.map(function(t){var i=g[t];return[e.formatAxisValue("x",i.x)].concat(_toConsumableArray(n.map(function(e){return i.cells[e.id]||""})))});return{caption:v>1?"".concat(r,"(共 ").concat(p," 点,已按每 ").concat(v," 点抽样 ").concat(_.length," 行)"):r,columns:d,rows:_}}function buildDataNodes(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Math.max(0,void 0===i.maxDataNodesPerSeries?200:i.maxDataNodesPerSeries),n=[],a=_createForOfIteratorHelper(e.norm.series);try{for(a.s();!(t=a.n()).done;){var o=t.value;if(!o.hidden){var s=e.controller&&e.controller.resolver?e.controller.resolver.seriesComponentOf(o):null;if(s)for(var l=Math.min(o.pointCount,r),h=0;h<l;h++){var u=o.pointAt(h),c=s.pixelAt(h);if(c){var d=[e.layout.plot.x+c[0],e.layout.plot.y+c[1]],f=e.ice&&"function"==typeof e.ice.worldToScreen?e.ice.worldToScreen(d[0],d[1]):d,p=seriesSymbolSize(o);n.push({id:"".concat(o.id,"#").concat(h),role:"graphic",label:"".concat(o.name,",").concat(e.formatAxisValue("x",u.xValue),",").concat(null===u.y?"无数据":e.formatAxisValue("y",u.y)),seriesId:o.id,seriesName:o.name,dataIndex:h,value:u.y,box:{x:f[0]-p/2,y:f[1]-p/2,width:p,height:p},focusable:!0})}}}}}catch(e){a.e(e)}finally{a.f()}return n}function seriesSymbolSize(e){var t=e.option.symbolSize;return"number"==typeof t&&isFinite(t)?Math.max(8,t):"bar"===e.type?12:10}var Fe=["position:absolute","width:1px","height:1px","margin:-1px","padding:0","overflow:hidden","clip:rect(0 0 0 0)","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),Ie=function(){function A11yMirror(e){_classCallCheck(this,A11yMirror),_defineProperty(this,"wrapper",null),_defineProperty(this,"live",null),_defineProperty(this,"tableEl",null),_defineProperty(this,"hoverHandler",null),_defineProperty(this,"options",{}),this.chart=e}return _createClass(A11yMirror,[{key:"listOptions",get:function get(){return this.options}},{key:"attached",get:function get(){return!!this.wrapper}},{key:"element",get:function get(){return this.wrapper}},{key:"attach",value:function attach(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=t||{};var i=this.chart.ice,r=this.chart.canvasElement,n=i&&i.root&&i.root.document;if(!n||!r||"function"!=typeof n.createElement||!r.parentNode)return!1;this.detach();var a=n.createElement("div");a.id="ice-chart-a11y-mirror-".concat(++A11yMirror.seq),a.setAttribute("style",Fe),a.setAttribute("data-ice-chart-a11y","mirror"),this.tableEl=n.createElement("table");var o=n.createElement("div");return o.setAttribute("role","status"),o.setAttribute("aria-live","polite"),a.appendChild(this.tableEl),a.appendChild(o),r.parentNode.appendChild(a),r.setAttribute("aria-describedby",a.id),r.getAttribute("aria-label")||r.setAttribute("aria-label",chartTitle(this.chart.norm)),this.wrapper=a,this.live=o,this.refresh(),this.hoverHandler=function(t){t&&e.announce("".concat(t.seriesName,",").concat(e.chart.formatAxisValue("x",t.xValue),",").concat(null===t.value?"无数据":e.chart.formatAxisValue("y",t.value)))},this.chart.on("item:hover",this.hoverHandler),!0}},{key:"detach",value:function detach(){this.hoverHandler&&(this.chart.off("item:hover",this.hoverHandler),this.hoverHandler=null);var e=this.chart.canvasElement;this.wrapper&&this.wrapper.parentNode&&this.wrapper.parentNode.removeChild(this.wrapper),e&&"function"==typeof e.removeAttribute&&e.removeAttribute("aria-describedby"),this.wrapper=null,this.live=null,this.tableEl=null}},{key:"refresh",value:function refresh(){var e=this.chart.ice&&this.chart.ice.root&&this.chart.ice.root.document;if(this.wrapper&&this.tableEl&&e){for(var t=buildDataTable(this.chart,this.options);this.tableEl.firstChild;)this.tableEl.removeChild(this.tableEl.firstChild);var i=e.createElement("caption");i.textContent=t.caption,this.tableEl.appendChild(i);var r,n=e.createElement("thead"),a=e.createElement("tr"),o=_createForOfIteratorHelper(t.columns);try{for(o.s();!(r=o.n()).done;){var s=r.value,l=e.createElement("th");l.setAttribute("scope","col"),l.textContent=s,a.appendChild(l)}}catch(e){o.e(e)}finally{o.f()}n.appendChild(a),this.tableEl.appendChild(n);var h,u=e.createElement("tbody"),c=_createForOfIteratorHelper(t.rows);try{for(c.s();!(h=c.n()).done;){for(var d=h.value,f=e.createElement("tr"),p=0;p<d.length;p++){var v=e.createElement(0===p?"th":"td");0===p&&v.setAttribute("scope","row"),v.textContent=d[p],f.appendChild(v)}u.appendChild(f)}}catch(e){c.e(e)}finally{c.f()}this.tableEl.appendChild(u)}}},{key:"announce",value:function announce(e){this.live&&(this.live.textContent=e)}}])}();_defineProperty(Ie,"seq",0);var Ne={line:"趋势线",area:"面积趋势",bar:"柱形",scatter:"散点",pie:"扇形",radar:"雷达多边形",heatmap:"热力图单元",sankey:"桑基连线",funnel:"漏斗阶段",gauge:"仪表盘",liquid:"水位球",boxplot:"箱线图",waterfall:"瀑布柱",treemap:"矩形树图单元",graph:"关系图节点",function:"函数曲线",parametric:"参数曲线"};function layoutTreemap(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s,n=[],a=Math.max(0,Number(i.gap)||2),o=void 0===i.depthFade?.18:Math.max(0,Math.min(1,Number(i.depthFade)));if(!Array.isArray(e)||!e.length)return n;var l=sumValues(e);if(!(l>0))return n;var h=0,u=function visit(e,t,i,r,s){if(!(t.width<=1||t.height<=1)){var c=e.map(function(e){return{node:e,value:nodeValue(e)}}).filter(function(e){return e.value>0});if(c.length){c.sort(function(e,t){return t.value-e.value});for(var d=c.reduce(function(e,t){return e+t.value},0),f=function squarify(e,t,i){var r=[],n=_objectSpread2({},t),a=e.slice(),o=t.width*t.height/i;if(!(o>0))return r;for(;a.length;){var s=Math.min(n.width,n.height);if(!(s>0))break;for(var l=[],h=0;a.length;){var u=a[0],c=h+u.value*o,d=l.length?worstRatio(l,h,s):1/0,f=worstRatio([].concat(l,[u]),c,s);if(l.length&&f>d)break;l.push(a.shift()),h=c}for(var p=n.width>=n.height,v=h/s,m=0,g=0,b=l;g<b.length;g++){var k=b[g],S=k.value*o/v,A=p?{x:n.x,y:n.y+m,width:v,height:S}:{x:n.x+m,y:n.y,width:S,height:v};r.push({item:k,box:A}),m+=S}n=p?{x:n.x+v,y:n.y,width:Math.max(0,n.width-v),height:n.height}:{x:n.x,y:n.y+v,width:n.width,height:Math.max(0,n.height-v)}}return r}(c,t,d),p=0;p<f.length;p++){var v=f[p],m=v.item,g=v.box,b=m.node.color||shade(s,i*o),k=Array.isArray(m.node.children)?m.node.children:[],S=k.length>0,A=h++,w=S&&g.height>32?16:0;if(n.push({id:A,name:m.node.name,depth:i,parent:r,value:m.value,ratio:m.value/l,rect:g,header:w,color:b,hasChildren:S}),S){var M={x:g.x+a,y:g.y+a+w,width:Math.max(0,g.width-2*a),height:Math.max(0,g.height-2*a-w)};u(k,M,i+1,A,b)}}}}};return u(e,t,0,-1,r[0]),n.filter(function(e){return 0===e.depth}).forEach(function(e,t){var i=r[t%r.length];e.color=i,recolor(n,e.id,i,r,o)}),n}function recolor(e,t,i,r,n){var a,o=_createForOfIteratorHelper(e);try{for(o.s();!(a=o.n()).done;){var s=a.value;s.parent===t&&(s.color=shade(i,s.depth*n),recolor(e,s.id,s.color,r,n))}}catch(e){o.e(e)}finally{o.f()}}function sumValues(e){var t,i=0,r=_createForOfIteratorHelper(e);try{for(r.s();!(t=r.n()).done;){i+=nodeValue(t.value)}}catch(e){r.e(e)}finally{r.f()}return i}function nodeValue(e){if(Array.isArray(e.children)&&e.children.length)return sumValues(e.children);var t=Number(e.value);return isFinite(t)&&t>0?t:0}function worstRatio(e,t,i){if(!(t>0&&i>0))return 1/0;var r,n=0,a=1/0,o=_createForOfIteratorHelper(e);try{for(o.s();!(r=o.n()).done;){var s=r.value;s.value>n&&(n=s.value),s.value<a&&(a=s.value)}}catch(e){o.e(e)}finally{o.f()}if(!(a>0))return 1/0;var l=t,h=i;return Math.max(h*h*n/(l*l),l*l/(h*h*a))}function shade(e,t){var i=function parseHex(e){if("string"!=typeof e)return null;var t=e.trim();if(0===t.indexOf("#"))return 3===(t=t.slice(1)).length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6!==t.length?null:[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)];var i=t.match(/rgba?\(([^)]+)\)/);if(i){var r=i[1].split(",").map(function(e){return parseFloat(e)});return[r[0]||0,r[1]||0,r[2]||0]}return null}(e);if(!i)return e;var r=Math.max(0,Math.min(1,t)),n=Math.round(i[0]+(255-i[0])*r),a=Math.round(i[1]+(255-i[1])*r),o=Math.round(i[2]+(255-i[2])*r);return"rgb(".concat(n,",").concat(a,",").concat(o,")")}var De=10,Oe=20,Re=100,He=300,ze=310,Ve=400,Ee=450,Be=500,Le=600,je=620,We=640,Xe=700,Ue=1;function isChartSnapshot(e){return!!e&&"object"===_typeof(e)&&!Array.isArray(e)&&!!e.option&&("version"in e||"view"in e||"hidden"in e)}function finiteOrNull(e){if(null==e||""===e)return null;var t=Number(e);return isFinite(t)?t:null}function mergeOptionPatch(e,t){var i=_objectSpread2(_objectSpread2({},e),t);return Array.isArray(t&&t.series)&&Array.isArray(e&&e.series)&&(i.series=e.series.map(function(e,i){var r=t.series.find(function(t){return t&&t.id&&e&&e.id&&t.id===e.id}),n=t.series[i],a=r||(n&&!n.id?n:void 0);return a?_objectSpread2(_objectSpread2({},e),a):e})),i}var Ge=function(){function ICEChart(e,t){var i=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(_classCallCheck(this,ICEChart),_defineProperty(this,"axisYList",[]),_defineProperty(this,"legend",null),_defineProperty(this,"titleComponent",null),_defineProperty(this,"tooltip",null),_defineProperty(this,"crosshair",null),_defineProperty(this,"highlight",null),_defineProperty(this,"brushComponent",null),_defineProperty(this,"dataZoomSlider",null),_defineProperty(this,"seriesComponents",[]),_defineProperty(this,"markLayer",null),_defineProperty(this,"marks",[]),_defineProperty(this,"markSeq",0),_defineProperty(this,"syncingMarks",!1),_defineProperty(this,"fullXDomain",[]),_defineProperty(this,"fullYDomain",[]),_defineProperty(this,"fullYDomains",[]),_defineProperty(this,"emitter",new Te),_defineProperty(this,"viewState",{x:null,y:null,yAxes:[]}),_defineProperty(this,"autoYCurve",!1),_defineProperty(this,"hiddenIds",{}),_defineProperty(this,"hiddenSlices",{}),_defineProperty(this,"seriesSignature",""),_defineProperty(this,"axisSignature",""),_defineProperty(this,"resizeObserver",null),_defineProperty(this,"destroyed",!1),_defineProperty(this,"silenceDepth",0),_defineProperty(this,"__appliedEngineThemeKey",null),_defineProperty(this,"__offThemeFollow",null),_defineProperty(this,"a11yMirror",new Ie(this)),_defineProperty(this,"virtualColumns",new Map),_defineProperty(this,"__virtualSourceVersion",1),_defineProperty(this,"domainTransition",null),_defineProperty(this,"domainFrameHandler",null),!e)throw new Error("[ice-chart] 初始化失败:缺少 canvas 元素或其 id。");this.chartOptions=r,this.option=t,this.ice=new o,this.ice.init(e,{renderMode:r.renderMode||"dirty-rect",dpr:r.dpr}),this.canvasEl=this.ice.canvasEl||e,this.registerTypes();var n=this.canvasRect();this.root=new a({left:0,top:0,width:n.width,height:n.height,origin:"top-left",fill:!1,stroke:!1,interactive:!1,draggable:!1,transformable:!1,linkable:!1,clipChildren:!0,zIndex:0}),this.ice.addChild(this.root),this.plotArea=new X({left:0,top:0,width:1,height:1,zIndex:De}),this.grid=new L({width:n.width,height:n.height,zIndex:Oe}),this.annotation=new W({width:n.width,height:n.height,zIndex:ze}),this.radarGrid=new Z({width:n.width,height:n.height,zIndex:Oe+5}),this.polarGrid=new J({width:n.width,height:n.height,zIndex:Oe+6}),this.axisX=new B({orientation:"x",width:n.width,height:n.height,zIndex:Ve}),this.axisYList=[new B({orientation:"y",width:n.width,height:n.height,zIndex:Ve,axisIndex:0,position:"left"})],this.legend=new U({width:n.width,height:n.height,zIndex:Be}),this.titleComponent=new G({width:n.width,height:n.height,zIndex:Ee}),this.crosshair=new Y({width:n.width,height:n.height,zIndex:Le}),this.highlight=new q({width:n.width,height:n.height,zIndex:je}),this.brushComponent=new $({width:n.width,height:n.height,zIndex:We}),this.dataZoomSlider=new Q({left:0,top:0,width:n.width,height:26,zIndex:We+5}),this.tooltip=new K({width:n.width,height:n.height,zIndex:Xe}),this.root.addChildren([this.plotArea,this.grid,this.annotation,this.radarGrid,this.polarGrid,this.axisX].concat(_toConsumableArray(this.axisYList),[this.titleComponent,this.legend,this.crosshair,this.highlight,this.brushComponent,this.dataZoomSlider,this.tooltip])),this.controller=new Pe(this),this.applyOption(t,{animate:"enter",preserveView:!1}),this.controller.bind(),this.__offThemeFollow=this.ice.onThemeChange(function(e){"theme"!==e.kind||i.destroyed||i.option&&"auto"===i.option.theme&&i.rebuild(!1)}),r.autoResize&&this.observeResize()}return _createClass(ICEChart,[{key:"brush",get:function get(){return this.brushComponent}},{key:"setOption",value:function setOption(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.applyOption(e,{animate:void 0===t.animate||t.animate,preserveView:!1!==t.preserveView}),this}},{key:"getOption",value:function getOption(){return this.option}},{key:"expressionDiagnostics",value:function expressionDiagnostics(){var e,t=[],i=_createForOfIteratorHelper(this.norm.series);try{for(i.s();!(e=i.n()).done;){var r=e.value;r.expressionDiagnostics&&r.expressionDiagnostics.length&&t.push({seriesId:r.id,diagnostics:r.expressionDiagnostics})}}catch(e){i.e(e)}finally{i.f()}return t}},{key:"expressionErrors",value:function expressionErrors(){var e,t=[],i=_createForOfIteratorHelper(this.norm.series);try{for(i.s();!(e=i.n()).done;){var r=e.value;if(r.expressionDiagnostics){var n,a=_createForOfIteratorHelper(r.expressionDiagnostics);try{for(a.s();!(n=a.n()).done;){var o=n.value;"error"===o.severity&&t.push({seriesId:r.id,message:o.message})}}catch(e){a.e(e)}finally{a.f()}}}}catch(e){i.e(e)}finally{i.f()}return t}},{key:"annotationDiagnostics",value:function annotationDiagnostics(){return this.annotation?this.annotation.diagnostics.slice():[]}},{key:"annotationErrors",value:function annotationErrors(){return this.annotationDiagnostics().filter(function(e){return"error"===e.severity})}},{key:"setData",value:function setData(e,t){var i=(this.option.series||[]).map(function(e,t){return{item:e,index:t}}).find(function(t){return"number"==typeof e?t.index===e:t.item.id===e||t.item.name===e});if(!i)throw new Error("[ice-chart] 找不到系列:".concat(e));return i.item.data=t,this.applyOption(this.option,{animate:!0,preserveView:!0}),this.emit("data:change",{seriesId:i.item.id,seriesIndex:i.index}),this}},{key:"appendData",value:function appendData(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null==e)throw new Error("[ice-chart] appendData 需要系列 id / name / 下标。");var r=(this.option.series||[]).map(function(e,t){return{item:e,index:t}}).find(function(t){return"number"==typeof e?t.index===e:t.item.id===e||t.item.name===e});if(!r)throw new Error("[ice-chart] 找不到系列:".concat(e));var n=Array.isArray(t)?t:[];if(!n.length)return this;if(r.item.virtual)return this.appendToVirtualSeries(r.item,r.index,n,i);var a=r.item.data;if(void 0!==a&&!Array.isArray(a))throw new Error("[ice-chart] 列式输入({ x, y })不支持 appendData(系列 ".concat(r.item.name||r.item.id||r.index,"):请用 setData 重新给一份数据。"));var o=(a||[]).concat(n),s=Number(i.maxPoints);return r.item.data=isFinite(s)&&s>0&&o.length>s?o.slice(o.length-s):o,this.applyOption(this.option,{animate:!0===i.animate,preserveView:!0}),this.emit("data:change",{seriesId:r.item.id,seriesIndex:r.index}),this}},{key:"appendToVirtualSeries",value:function appendToVirtualSeries(e,t,i,r){var n=this.norm.series.find(function(i){return i.id===(e.id||"series-".concat(t))||i.index===t});if(!n)throw new Error("[ice-chart] appendData:找不到已归一化的系列「".concat(e.id||t,"」。"));if(n.grid)throw new Error("[ice-chart] 虚拟(列存)热力图是稠密矩阵,不支持 appendData(系列 ".concat(e.name||e.id||t,"):请用 setData 重新给一份数据。"));var a,o=Number(r.maxPoints),s=isFinite(o)&&o>0?Math.floor(o):0,l=this.virtualColumns.get(n.id);if(l&&"raw"in l){var h=appendRawItems(l.raw,i,s);if(this.virtualColumns.set(n.id,{raw:h}),h.capacity>0&&void 0!==n.option.data){var u=_objectSpread2(_objectSpread2({},n.option),{},{data:void 0}),c=this.option.series;if(Array.isArray(c)){var d=c.findIndex(function(e,t){return(e&&e.id)===n.id||t===n.index});d>=0&&(c[d]=u)}n.option=u}return this.applyOption(this.option,{animate:!0===r.animate,preserveView:!0}),this.emit("data:change",{seriesId:n.id,seriesIndex:n.index}),this}if(l&&"ring"in l)a=l.ring;else{var f=n.pointCount,p=Math.max(1,s||f);a=createRing(p);for(var v=f-Math.min(f,p);v<f;v++)ringAppend(a,[{x:Number(n.xValueAt(v)),y:n.yValueAt(v)}],0)}if(s&&s!==a.capacity){for(var m=createRing(s),g=Math.min(a.length,s),b=a.length-g;b<a.length;b++){var k=ringYAt(a,b);ringAppend(m,[{x:ringXAt(a,b),y:Number.isNaN(k)?null:k}],0)}a=m}return ringAppend(a,i.map(function(t){if(Array.isArray(t))return{x:finiteOrNull(t[0]),y:finiteOrNull(t[1])};if(t&&"object"===_typeof(t)){var i=e.xField||"x",r=e.yField||"y";return{x:finiteOrNull(void 0!==t[i]?t[i]:t.x),y:finiteOrNull(void 0!==t[r]?t[r]:t.value)}}return{x:void 0,y:finiteOrNull(t)}}),a.length?function ringLastX(e){if(!e.length)return 0;var t=ringXAt(e,e.length-1);return isFinite(t)?t:0}(a)+1:0),function refreshRingDomains(e){for(var t=1/0,i=-1/0,r=1/0,n=-1/0,a=!0,o=-1/0,s=0;s<e.length;s++){var l=ringXAt(e,s);if(isFinite(l)){l<t&&(t=l),l>i&&(i=l),l<o&&(a=!1),o=l;var h=ringYAt(e,s);Number.isNaN(h)||(h<r&&(r=h),h>n&&(n=h))}}e.xDomain=isFinite(t)?[t,i]:[0,1],e.yDomain=isFinite(r)?[r,n]:null,e.xMonotonic=a}(a),this.virtualColumns.set(n.id,{ring:a}),this.applyOption(this.option,{animate:!0===r.animate,preserveView:!0}),this.emit("data:change",{seriesId:n.id,seriesIndex:n.index}),this}},{key:"createVirtualSource",value:function createVirtualSource(e){var t=this,i="number"==typeof e?this.norm.series[e]:this.norm.series.find(function(t){return t.id===e||t.name===e});if(!i)throw new Error("[ice-chart] createVirtualSource:找不到系列「".concat(e,"」。"));if(!i.virtual)throw new Error("[ice-chart] createVirtualSource 只支持虚拟(列存)系列:普通系列本来就是真组件。");var n=this.seriesComponents.find(function(e){return e&&e.series&&e.series.id===i.id});if(!n)throw new Error("[ice-chart] createVirtualSource:系列「".concat(i.id,"」还没有渲染组件。"));var a=new Float64Array(4),o=function readHalo(){return t.norm&&t.norm.theme?t.norm.theme.labelHaloColor:i.color},s=function symbolSize(){var e=i.option,t=Number(e.symbolSize);return isFinite(t)&&t>0?t:8};return{count:i.pointCount,get version(){return function readVersion(){return t.__virtualSourceVersion}()},boxAt:function boxAt(e,t){var i=n.pixelAt(e);if(!i)return t[0]=NaN,t[1]=NaN,t[2]=NaN,void(t[3]=NaN);var r=s()/2;t[0]=i[0]-r,t[1]=i[1]-r,t[2]=i[0]+r,t[3]=i[1]+r},forEachInBox:function forEachInBox(e,t,i,r,a){for(var o=n.virtualIndexRange(e,i),s=o.from,l=o.to,h=Math.max(0,s);h<=l;h++){var u=n.pixelAt(h);u&&(u[1]<t||u[1]>r||a(h))}},hitTest:function hitTest(e,t){return n.hitTestIndex(e,t)},paint:function paint(e){return n.paintInto(e)},materialize:function materialize(e){var t=n.pixelAt(e);if(!t)return null;var l=s();a[0]=t[0],a[1]=t[1];var h=new r({left:t[0]-l/2,top:t[1]-l/2,outerRadius:l/2,innerRadius:l/5,spikes:5,style:{fillStyle:i.color,strokeStyle:o(),lineWidth:1}});return h.__iceChartDataIndex=e,h.__iceChartSeriesId=i.id,h}}}},{key:"setDomain",value:function setDomain(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"api";if(this.destroyed)return this;var r="x"!==e||"zoom"!==i&&"brush"!==i?t:this.guardInteractiveXWindow(t),n=this.clampDomain(e,r,i);if(!n)return this;"x"===e?this.viewState.x=n:this.viewState.y=n,this.rebuild(!1);var a=this.currentRange();return this.emit("pan"===i?"pan:change":"zoom:change",a),this}},{key:"numericXProbe",value:function numericXProbe(){var e,t=[],i=[],r=_createForOfIteratorHelper(this.norm.series);try{for(r.s();!(e=r.n()).done;){var n=e.value;if(!n.hidden){var a=storeDomainOf(n);if(a&&a.xMonotonic)i.push(n);else for(var o=0,s=n.pointCount;o<s;o++){var l=Number(n.xValueAt(o));isFinite(l)&&t.push(l)}}}}catch(e){r.e(e)}finally{r.f()}t.sort(function(e,t){return e-t});for(var h=[],u=0;u<t.length;u++)u>0&&t[u]===t[u-1]||h.push(t[u]);var c=function lowerBound(e,t,i){for(var r=0,n=t;r<n;){var a=r+n>>1;Number(e[a])<i?r=a+1:n=a}return r},d=function upperBound(e,t,i){for(var r=0,n=t;r<n;){var a=r+n>>1;Number(e[a])<=i?r=a+1:n=a}return r},f=function seriesLowerBound(e,t){for(var i=0,r=e.pointCount;i<r;){var n=i+r>>1;Number(e.xValueAt(n))<t?i=n+1:r=n}return i},p=function seriesUpperBound(e,t){for(var i=0,r=e.pointCount;i<r;){var n=i+r>>1;Number(e.xValueAt(n))<=t?i=n+1:r=n}return i};return{total:h.length+i.reduce(function(e,t){return e+t.pointCount},0),countIn:function countIn(e,t){for(var r=d(h,h.length,t)-c(h,h.length,e),n=0,a=i;n<a.length;n++){var o=a[n];r+=p(o,t)-f(o,e)}return r},leftOf:function leftOf(e){var t,r=c(h,h.length,e)-1;r>=0&&(t=h[r]);for(var n=0,a=i;n<a.length;n++){var o=a[n],s=f(o,e)-1;if(!(s<0)){var l=Number(o.xValueAt(s));(void 0===t||l>t)&&(t=l)}}return t},rightOf:function rightOf(e){var t,r=d(h,h.length,e);r<h.length&&(t=h[r]);for(var n=0,a=i;n<a.length;n++){var o=a[n],s=p(o,e);if(!(s>=o.pointCount)){var l=Number(o.xValueAt(s));(void 0===t||l<t)&&(t=l)}}return t}}}},{key:"guardInteractiveXWindow",value:function guardInteractiveXWindow(e){if("category"===this.norm.xAxis.type){var t=this.fullXDomain;if(t.length<2)return e;var i=t.indexOf(e[0]),r=t.indexOf(e[1]);return i<0&&r<0?e:(i<0&&(i=0),r<0&&(r=t.length-1),r-i>=1?e:(i>0?i-=1:r<t.length-1&&(r+=1),[t[i],t[r]]))}var n=this.numericXProbe();if(n.total<2)return e;var a=n.total>=3?2:1,o=Number(e[0]),s=Number(e[1]);if(!isFinite(o)||!isFinite(s)||s<=o)return e;for(var l=n.countIn(o,s),h=0;l<a&&h<4;){h+=1;var u=n.leftOf(o),c=n.rightOf(s);if(void 0===u&&void 0===c)break;(void 0===u?1/0:o-u)<=(void 0===c?1/0:c-s)?o=u:s=c,l=n.countIn(o,s)}return l>=a?[o,s]:e}},{key:"addMark",value:function addMark(e){var t=this,i=e.id||"mark-".concat(++this.markSeq);if(this.marks.some(function(e){return e.id===i}))throw new Error("[ice-chart] addMark:id「".concat(i,"」已经存在"));if(!e||!e.component)throw new Error("[ice-chart] addMark:必须提供 component(一个引擎图元实例)");var r=e.type||"point";if("point"!==r&&"xLine"!==r&&"yLine"!==r&&"xBand"!==r&&"yBand"!==r)throw new Error("[ice-chart] addMark:不支持的 type「".concat(String(r),"」"));var a={id:i,spec:_objectSpread2(_objectSpread2({},e),{},{id:i}),component:e.component,dragging:!1};return this.marks.push(a),this.ensureMarkLayer().addChild(e.component),"function"==typeof e.component.on&&e.component.on(n.AFTER_MOVE,function(e){if(!t.syncingMarks){var i=e&&isFinite(e.left)&&isFinite(e.top)?{left:Number(e.left),top:Number(e.top)}:void 0,n=t.markDataAt(a,i);"point"===r?(a.spec.x=n.xValue,a.spec.y=n.yValue):"xLine"===r||"xBand"===r?"xLine"===r?a.spec.x=n.xValue:a.spec.x0=n.xValue:"yLine"===r?a.spec.y=n.yValue:a.spec.y0=n.yValue,a.dragging=!0,t.syncMarks(),t.emit("mark:drag",n),"function"==typeof a.spec.onDrag&&a.spec.onDrag(n)}}),this.syncMarks(),this.markHandle(a)}},{key:"getMark",value:function getMark(e){var t=this.marks.find(function(t){return t.id===e});return t?this.markHandle(t):null}},{key:"getMarks",value:function getMarks(){var e=this;return this.marks.map(function(t){return e.markHandle(t)})}},{key:"removeMark",value:function removeMark(e){var t=this.marks.findIndex(function(t){return t.id===e});if(t<0)return!1;var i=_slicedToArray(this.marks.splice(t,1),1)[0];return this.markLayer&&i.component&&this.markLayer.removeChild(i.component),!0}},{key:"clearMarks",value:function clearMarks(){var e,t=_createForOfIteratorHelper(this.marks);try{for(t.s();!(e=t.n()).done;){var i=e.value;this.markLayer&&i.component&&this.markLayer.removeChild(i.component)}}catch(e){t.e(e)}finally{t.f()}this.marks=[]}},{key:"isMarkComponent",value:function isMarkComponent(e){return!!e&&this.marks.some(function(t){return t.component===e})}},{key:"finishMarkDrag",value:function finishMarkDrag(){var e,t=_createForOfIteratorHelper(this.marks);try{for(t.s();!(e=t.n()).done;){var i=e.value;i.dragging&&(i.dragging=!1,this.emit("mark:dragend",this.markDataAt(i)))}}catch(e){t.e(e)}finally{t.f()}}},{key:"ensureMarkLayer",value:function ensureMarkLayer(){if(this.markLayer)return this.markLayer;var e=this.layout?this.layout.canvas:this.canvasRect(),t=new a({left:0,top:0,width:e.width,height:e.height,origin:"top-left",fill:!1,stroke:!1,interactive:!1,draggable:!1,transformable:!1,linkable:!1,zIndex:He});return this.root.addChild(t),this.markLayer=t,t}},{key:"markHandle",value:function markHandle(e){var t=this,i={id:e.id,spec:e.spec,component:e.component,update:function update(r){return Object.assign(e.spec,r),t.syncMarks(),i},toData:function toData(){return t.markDataAt(e)},remove:function remove(){t.removeMark(e.id)}};return i}},{key:"markAxis",value:function markAxis(e){if(e.seriesId){var t=this.norm.series.find(function(t){return t.id===e.seriesId||t.name===e.seriesId});if(t)return this.norm.yAxes[t.axisIndex]||this.norm.yAxis}return this.norm.yAxes[0]||this.norm.yAxis}},{key:"markBox",value:function markBox(e,t){var i=e.type||"point",r=this.layout.plot,n=this.norm.xAxis.scale,a=this.markAxis(e),o=a&&a.scale,s=Number(e.dx)||0,l=Number(e.dy)||0,h=function px(e){return r.x+Number(n.map(e))+s},u=function py(e){return r.y+Number(o.map(e))+l},c=t.width||1,d=t.height||1;if("xLine"===i)return{left:h(e.x)-c/2,top:r.y+l,width:c,height:r.height};if("yLine"===i)return{left:r.x+s,top:u(e.y)-d/2,width:r.width,height:d};if("xBand"===i){var f=h(e.x0),p=h(e.x1);return{left:Math.min(f,p),top:r.y+l,width:Math.abs(p-f),height:r.height}}if("yBand"===i){var v=u(e.y0),m=u(e.y1);return{left:r.x+s,top:Math.min(v,m),width:r.width,height:Math.abs(m-v)}}var g=h(e.x),b=u(e.y);return{left:g-c/2,top:b-d/2,width:c,height:d,anchor:[g,b]}}},{key:"markDataAt",value:function markDataAt(e,t){var i,r,n=e.spec,a=n.type||"point",o=this.layout.plot,s=this.norm.xAxis.scale,l=this.markAxis(n),h=l&&l.scale,u=e.component.state||{},c=u.width||0,d=u.height||0,f=t?t.left:u.left,p=t?t.top:u.top;"point"===a?(i=f+c/2,r=p+d/2):"xLine"===a||"xBand"===a?(i=f+c/2,r=o.y+o.height/2):(i=o.x+o.width/2,r=p+d/2);var v=s&&"function"==typeof s.invert?s.invert(i-o.x):null,m=h&&"function"==typeof h.invert?Number(h.invert(r-o.y)):NaN;return{id:e.id,xValue:v,yValue:"xLine"!==a&&"xBand"!==a&&isFinite(m)?m:void 0,pixel:[i,r]}}},{key:"syncMarks",value:function syncMarks(){if(this.marks.length&&this.norm&&this.layout){var e=this.layout.plot;this.syncingMarks=!0;try{var t,i=_createForOfIteratorHelper(this.marks);try{for(i.s();!(t=i.n()).done;){var r=t.value,n=r.component.state||{},a=this.markBox(r.spec,{width:n.width||0,height:n.height||0});if([a.left,a.top,a.width,a.height].every(function(e){return isFinite(e)})){var o=!1!==r.spec.hideWhenOutOfView,s=a.anchor||[a.left+a.width/2,a.top+a.height/2],l=!(isFinite(s[0])&&isFinite(s[1]))||s[0]<e.x-a.width||s[0]>e.x+e.width+a.width||s[1]<e.y-a.height||s[1]>e.y+e.height+a.height,h=Math.round(a.left),u=Math.round(a.top),c=Math.max(1,Math.round(a.width)),d=Math.max(1,Math.round(a.height));n.left===h&&n.top===u||(r.component.setPosition(h,u),!0),n.width===c&&n.height===d||(r.component.setState({width:c,height:d}),!0),r.component.setState({display:!o||!l})}else r.component.setState({display:!1})}}catch(e){i.e(e)}finally{i.f()}}finally{this.syncingMarks=!1}this.markLayer&&this.markLayer.setState({width:this.layout.canvas.width,height:this.layout.canvas.height})}}},{key:"resetZoom",value:function resetZoom(){return this.viewState={x:null,y:null,yAxes:[]},this.rebuild(!0),this.emit("zoom:change",this.currentRange()),this}},{key:"toggleSeries",value:function toggleSeries(e,t){var i=this.norm.series.find(function(t){return t.id===e});if(!i)return this;var r=!!this.hiddenIds[e],n=void 0===t?!r:!t;return this.hiddenIds[e]=n,this.applyOption(this.option,{animate:!0,preserveView:!0}),this.emit("legend:toggle",{seriesId:e,seriesName:i.name,seriesIndex:i.index,selected:!n}),this}},{key:"isSeriesSelected",value:function isSeriesSelected(e){return!this.hiddenIds[e]}},{key:"toggleSlice",value:function toggleSlice(e,t,i){var r=this.norm.series.find(function(t){return t.id===e});if(!r||"pie"!==r.type&&"funnel"!==r.type)return this;var n="".concat(e,"#").concat(t),a=!!this.hiddenSlices[n],o=void 0===i?!a:!i;this.hiddenSlices[n]=o;var s=r.pointAt(t);return this.applyOption(this.option,{animate:!0,preserveView:!0}),this.emit("legend:toggle",{seriesId:e,seriesName:s&&s.name||"".concat(r.name," ").concat(t+1),seriesIndex:r.index,selected:!o,dataIndex:t}),this}},{key:"showHoverAt",value:function showHoverAt(e,t){var i=this.norm.series.find(function(t){return t.id===e});if(!i)return this;var r=this.controller.resolver.buildActiveItem(i,t);return r&&this.controller.setHover({kind:"item",item:r}),this}},{key:"showHoverAtValue",value:function showHoverAtValue(e){return this.controller.showHoverAtValue(e),this}},{key:"clearHover",value:function clearHover(){return this.controller.clearHover(),this}},{key:"getSelection",value:function getSelection(){return this.controller.getSelectedParams()}},{key:"clearSelection",value:function clearSelection(){return this.controller.clearSelection(),this}},{key:"getDomain",value:function getDomain(e){return"x"===e?this.norm.xAxis.domain.slice():this.norm.yAxis.domain.slice()}},{key:"getAxisDomain",value:function getAxisDomain(e){var t=this.norm.yAxes[e];return t?t.domain.slice():this.norm.yAxis.domain.slice()}},{key:"setAxisDomain",value:function setAxisDomain(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"api";if(0===e)return this.setDomain("y",t,i);if(this.destroyed)return this;var r=this.clampAxisDomain(e,t,i);return r?(this.viewState.yAxes[e]=r,this.rebuild(!1),this.emit("pan"===i?"pan:change":"zoom:change",this.currentRange()),this):this}},{key:"fullDomain",value:function fullDomain(e){return("x"===e?this.fullXDomain:this.fullYDomain).slice()}},{key:"canvasElement",get:function get(){return this.canvasEl}},{key:"getDataTable",value:function getDataTable(){return buildDataTable(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}},{key:"getA11yTree",value:function getA11yTree(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t="function"==typeof this.ice.getAccessibilityTree?this.ice.getAccessibilityTree():[];return[].concat(_toConsumableArray(t),_toConsumableArray(buildDataNodes(this,e)))}},{key:"attachA11yMirror",value:function attachA11yMirror(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.a11yMirror.attach(e)}},{key:"detachA11yMirror",value:function detachA11yMirror(){this.a11yMirror.detach()}},{key:"a11yMirrorAttached",get:function get(){return this.a11yMirror.attached}},{key:"announceA11y",value:function announceA11y(e){this.a11yMirror.announce(e)}},{key:"on",value:function on(e,t,i){return this.emitter.on(e,t,i),this}},{key:"once",value:function once(e,t,i){return this.emitter.once(e,t,i),this}},{key:"off",value:function off(e,t,i){return this.emitter.off(e,t,i),this}},{key:"emit",value:function emit(e,t){return!(this.silenceDepth>0)&&this.emitter.emit(e,t)}},{key:"silent",value:function silent(e){this.silenceDepth++;try{return e()}finally{this.silenceDepth--}}},{key:"resize",value:function resize(e,t){return this.destroyed?this:(this.ice.fitCanvasToDisplaySize(e,t),this.ice.canvasWidth>0&&this.ice.canvasHeight>0?(this.rebuild(!1),this):this)}},{key:"destroy",value:function destroy(){this.destroyed||(this.destroyed=!0,this.__offThemeFollow&&(this.__offThemeFollow(),this.__offThemeFollow=null),this.stopDomainTransition(),this.a11yMirror.detach(),this.controller.destroy(),this.resizeObserver&&"function"==typeof this.resizeObserver.disconnect&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.emitter.clear(),this.ice.destroy())}},{key:"nextFrame",value:function nextFrame(){var e=this;return new Promise(function(t){var i=e.ice.evtBus;if(i){var r=function handler(){i.off(n.ROUND_FINISH,r,null),t()};i.on(n.ROUND_FINISH,r,null),e.ice.dirty=!0}else t()})}},{key:"render",value:function render(){return this.ice.dirty=!0,this.nextFrame()}},{key:"formatAxisValue",value:function formatAxisValue(e,t){var i="x"===e?this.norm.xAxis:this.norm.yAxis,r=i.scale;if(!r)return String(t);var n=i.domain.indexOf(t);return formatTick(t,r,n<0?0:n,i.option.formatter)}},{key:"toDataURL",value:function toDataURL(e,t){return this.ice&&"function"==typeof this.ice.toDataURL?this.ice.toDataURL(e,t):""}},{key:"toBlob",value:function toBlob(e,t,i){this.ice&&"function"==typeof this.ice.toBlob?this.ice.toBlob(e,t,i):e(null)}},{key:"toJSON",value:function toJSON(){return{version:1,option:toSerializableOption(this.option),view:{x:this.viewState.x,y:this.viewState.y,yAxes:this.viewState.yAxes},hidden:_objectSpread2({},this.hiddenIds),hiddenSlices:_objectSpread2({},this.hiddenSlices)}}},{key:"toJSONString",value:function toJSONString(){return JSON.stringify(this.toJSON())}},{key:"fromJSONString",value:function fromJSONString(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=JSON.parse(e);return this.loadSnapshot(i,t),this}},{key:"fromJSONObject",value:function fromJSONObject(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.loadSnapshot(e,t),this}},{key:"loadSnapshot",value:function loadSnapshot(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e){var i="string"==typeof e?JSON.parse(e):e,r=i.option||i;if("number"==typeof i.version&&i.version>1)throw new Error("[ice-chart] 快照版本 ".concat(i.version," 高于当前实现支持的 ").concat(1,",请升级 ice-chart 后再还原。"));var n=(Array.isArray(r&&r.series)?r.series:[]).findIndex(function(e){return e&&e.virtual&&!e.data});if(n>=0)throw new Error("[ice-chart] 快照里的 series[".concat(n,"] 是虚拟(列存)系列,数据不在快照里,无法还原:请用 setData 重新给一份数据(虚拟化省内存的代价就是不进快照)。"));var a=t.optionPatch?mergeOptionPatch(r,t.optionPatch):r;this.hiddenIds=i.hidden||{},this.hiddenSlices=i.hiddenSlices||{};var o=i.view||{};this.viewState={x:o.x||null,y:o.y||null,yAxes:o.yAxes||[]},this.applyOption(a,{animate:!1,preserveView:!0})}}},{key:"applyOption",value:function applyOption(e,t){this.option=e;var i=this.norm?this.norm.yAxis.domain.slice():null,r=normalizeOption(e,{hiddenIds:this.hiddenIds,hiddenSlices:this.hiddenSlices,preferDark:isEngineThemeDark(this.ice),virtualColumns:this.virtualColumns});if("auto"!==e.theme){var n=JSON.stringify(r.theme);n!==this.__appliedEngineThemeKey&&(applyChartThemeToEngine(this.ice,r.theme),this.__appliedEngineThemeKey=n)}if(this.fullXDomain=r.xAxis.domain.slice(),this.fullYDomain=r.yAxis.domain.slice(),this.fullYDomains=r.yAxes.map(function(e){return e.domain.slice()}),this.autoYCurve=(e.series||[]).some(function(e){return!!e&&"function"===e.type}),!t.preserveView){this.viewState={x:null,y:null,yAxes:[]};var a=this.initialWindow(r);a&&(this.viewState.x=a)}if(this.hiddenIds=r.hiddenIds,this.hiddenSlices=r.hiddenSlices,this.rebuild("enter"===t.animate?"enter":!1!==t.animate&&"update"),"update"===("enter"===t.animate?"enter":!1!==t.animate&&"update")&&shouldAnimate()&&i&&this.norm&&"cartesian"===this.norm.kind&&2===this.norm.yAxis.domain.length){var o=this.norm.yAxis.domain;(Math.abs(Number(i[0])-Number(o[0]))>1e-9||Math.abs(Number(i[1])-Number(o[1]))>1e-9)&&this.startDomainTransition([Number(i[0]),Number(i[1])],[Number(o[0]),Number(o[1])])}}},{key:"initialWindow",value:function initialWindow(e){var t=e.option.dataZoom;if(!t||void 0===t.start&&void 0===t.end)return null;var i=clamp$2(Number(void 0===t.start?0:t.start)/100,0,1),r=clamp$2(Number(void 0===t.end?100:t.end)/100,0,1);if(i<=0&&r>=1)return null;var n=e.xAxis.domain;if("category"===e.xAxis.type){var a=n.length,o=clamp$2(Math.floor(i*a),0,Math.max(0,a-2)),s=clamp$2(Math.ceil(r*a)-1,o+1,a-1);return[n[o],n[s]]}var l=Number(n[0]),h=Number(n[1])-l;return[l+h*i,l+h*r]}},{key:"startDomainTransition",value:function startDomainTransition(e,t){var i=this;if(this.domainTransition={from:e,to:t},!this.domainFrameHandler){var r=this.ice.evtBus;r&&(this.domainFrameHandler=function(){return i.stepDomainTransition()},r.on(n.ICE_FRAME_EVENT,this.domainFrameHandler,this))}}},{key:"stepDomainTransition",value:function stepDomainTransition(){var e=this.domainTransition;if(e&&!this.destroyed){var t,i=0,r=_createForOfIteratorHelper(this.seriesComponents);try{for(r.s();!(t=r.n()).done;){var n=t.value,a=Number(n.state.progress);isFinite(a)&&a>i&&(i=a)}}catch(e){r.e(e)}finally{r.f()}if(i>=1)return this.domainTransition=null,this.stopDomainTransition(),void this.rebuild(!1);var o=e.to.map(function(t,r){var n=e.from[r];return isFinite(n)?n+(t-n)*i:t});this.rebuild(!1,o)}else this.stopDomainTransition()}},{key:"stopDomainTransition",value:function stopDomainTransition(){if(this.domainFrameHandler){var e=this.ice&&this.ice.evtBus;e&&e.off(n.ICE_FRAME_EVENT,this.domainFrameHandler,this),this.domainFrameHandler=null}}},{key:"rebuild",value:function rebuild(e,t){var i=this;if(!this.destroyed){var r=this.canvasRect(),n=this.viewState.x||this.fullXDomain,a=this.fullYDomains.map(function(e,t){var r=0===t?i.viewState.y:i.viewState.yAxes[t];return r&&2===r.length?r:e}),o=normalizeOption(this.option,{hiddenIds:this.hiddenIds,hiddenSlices:this.hiddenSlices,preferDark:isEngineThemeDark(this.ice),virtualColumns:this.virtualColumns,xDomain:n&&2===n.length?[n[0],n[1]]:null,yDomain:!this.autoYCurve||this.viewState.y||t&&2===t.length?t&&2===t.length?[Number(t[0]),Number(t[1])]:a[0]&&2===a[0].length?[Number(a[0][0]),Number(a[0][1])]:null:null,yDomains:a.map(function(e){return(!i.autoYCurve||i.viewState.y||t&&2===t.length)&&e&&2===e.length?[Number(e[0]),Number(e[1])]:null})});if(this.norm=o,this.__virtualSourceVersion+=1,this.virtualColumns.size){var s,l=new Set,h=_createForOfIteratorHelper(o.series);try{for(h.s();!(s=h.n()).done;){var u=s.value;u.virtual&&l.add(u.id)}}catch(e){h.e(e)}finally{h.f()}for(var c=0,d=Array.from(this.virtualColumns.keys());c<d.length;c++){var f=d[c];l.has(f)||this.virtualColumns.delete(f)}}this.autoYCurve&&(this.fullYDomain=o.yAxis.domain.slice(),this.fullYDomains=o.yAxes.map(function(e){return e.domain.slice()})),this.layout=computeLayout(o,this.ice.ctx,r),this.buildScales(o),this.root.state.ariaLabel=chartTitle(o),this.syncComponents(!t&&e),this.syncMarks(),this.ice.dirty=!0,this.controller&&this.controller.refreshHover(),this.a11yMirror.attached&&this.a11yMirror.refresh()}}},{key:"buildScales",value:function buildScales(e){var t=this.layout.plot;e.xAxis.scale=createScale(e.xAxis.type,e.xAxis.domain,[0,Math.max(1,t.width)],{logBase:e.xAxis.option.logBase});var i,r=_createForOfIteratorHelper(e.yAxes);try{for(r.s();!(i=r.n()).done;){var n=i.value;n.scale=createScale(n.type,n.domain,[Math.max(1,t.height),0],{logBase:n.option.logBase})}}catch(e){r.e(e)}finally{r.f()}}},{key:"syncComponents",value:function syncComponents(e){var t=this.norm,i=this.layout,r=i.canvas,n=i.plot,a=t.theme;this.root.state.width===r.width&&this.root.state.height===r.height||this.root.setState({width:r.width,height:r.height});var o=i.polar,s="cartesian"!==t.kind;this.plotArea.setState({left:n.x,top:n.y,width:n.width,height:n.height}),this.plotArea.setBackground("transparent"===a.backgroundColor?null:a.backgroundColor),this.grid.setState({width:r.width,height:r.height}),this.grid.setState({display:!s}),this.grid.xScale=t.xAxis.scale,this.grid.yScale=t.yAxis.scale;var l=i.xAxisLayout;this.grid.xTicks=l.ticks.filter(function(e,t){return!l.labels||""!==l.labels[t]}),this.grid.horizontal=t.yAxes.map(function(e,t){return{axis:e,axisLayout:i.yAxes[t],index:t}}).filter(function(e){return void 0===e.axis.option.showGrid?0===e.index:!1!==e.axis.option.showGrid}).map(function(e){return{scale:e.axis.scale,ticks:e.axisLayout.ticks,index:e.index}}),this.grid.plot=n,this.grid.grid=t.option.grid||{},this.grid.theme=a,this.grid.markDirty(),this.radarGrid.setState({width:r.width,height:r.height,display:"radar"===t.kind}),this.radarGrid.theme=a,this.radarGrid.coord="radar"===t.kind&&o&&t.radar?{polar:o,plot:n,indicators:t.radar.indicators.map(function(e,i){return{name:e.name,max:t.radarDomains[i]?t.radarDomains[i][1]:1}}),shape:t.radar.shape||"polygon",splitNumber:Math.max(1,Number(t.radar.splitNumber)||4)}:null,this.radarGrid.markDirty();var h=t.option.polarGrid,u="cartesian"===t.kind&&!!h&&"equal"===t.option.aspect;this.polarGrid.setState({width:r.width,height:r.height,display:u}),this.polarGrid.theme=a,this.polarGrid.layout=i,this.polarGrid.coord=u?{plot:n,xScale:t.xAxis.scale,yScale:t.yAxis.scale,options:!0===h?{}:h}:null,this.polarGrid.markDirty(),this.syncAxisComponents();for(var c=0;c<this.axisYList.length;c++){var d=this.axisYList[c];d.setState({width:r.width,height:r.height,display:!s}),d.layout=i,d.theme=a,d.axis=t.yAxes[c]||t.yAxis,d.axisIndex=c,d.position=t.yAxes[c]&&t.yAxes[c].position||"left",d.syncTicks(),d.markDirty()}var f=this.axisX;f.setState({width:r.width,height:r.height,display:!s}),f.layout=i,f.theme=a,f.axis=t.xAxis,f.syncTicks(),f.markDirty(),this.grid.axisX=this.axisX,this.grid.axisYList=this.axisYList,this.grid.syncTicks(),this.annotation.setState({width:r.width,height:r.height,display:!0}),this.annotation.plot=n,this.annotation.xAxis=t.xAxis,this.annotation.yAxes=t.yAxes,this.annotation.sync(t.option.annotation,{kind:t.kind,plot:n,xAxis:t.xAxis,yAxes:t.yAxes,theme:a}),this.legend&&(this.legend.setState({width:r.width,height:r.height}),this.legend.layout=i,this.legend.theme=a,this.legend.selectable=!1!==t.option.legend.selectable,this.legend.markDirty()),this.titleComponent&&(this.titleComponent.setState({width:r.width,height:r.height}),this.titleComponent.layout=i,this.titleComponent.theme=a,this.titleComponent.markDirty());for(var p=0,v=[this.crosshair,this.highlight,this.brushComponent,this.tooltip];p<v.length;p++){var m=v[p];m&&(m.setState({width:r.width,height:r.height}),m.theme=a,m.markDirty())}if(this.tooltip&&(this.tooltip.layout=i),this.crosshair){this.crosshair.layout=i,this.crosshair.option=t.option.crosshair||{};var g=Number(this.crosshair.option.followDuration);this.crosshair.followDuration=isFinite(g)&&g>=0?Math.min(400,g):90}if(this.crosshair&&this.crosshair.setState({display:!s}),this.brushComponent){var b=t.option.interaction&&t.option.interaction.brush;this.brushComponent.color=b&&!1!==b&&b.color?{fill:toAlpha(b.color,.16),stroke:b.color}:null}if(this.dataZoomSlider){var k=i.slider;if(k){this.dataZoomSlider.setState({left:k.x,top:k.y,width:k.width,height:k.height,display:!0});var S=_slicedToArray(this.domainFractions(),2),A=S[0],w=S[1];this.dataZoomSlider.setWindow(A,w)}else this.dataZoomSlider.setState({display:!1});this.dataZoomSlider.theme=a,this.dataZoomSlider.markDirty()}this.syncSeries(e)}},{key:"domainFractions",value:function domainFractions(){var e=this.fullXDomain,t=this.norm.xAxis.domain;if(!e||e.length<2||!t||t.length<2)return[0,1];if("category"===this.norm.xAxis.type){var i=e.length;if(i<=1)return[0,1];var r=Math.max(0,e.indexOf(t[0])),n=e.indexOf(t[t.length-1]);return[r/i,((n<0?i-1:n)+1)/i]}var a=Number(e[0]),o=Number(e[1])-a||1;return[(Number(t[0])-a)/o,(Number(t[1])-a)/o]}},{key:"setDomainFromFractions",value:function setDomainFromFractions(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"slider",r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("cartesian"!==this.norm.kind)return this;var n=_slicedToArray(this.domainFractions(),2),a=n[0],o=n[1];if(Math.abs(a-e)<1e-4&&Math.abs(o-t)<1e-4)return this;var s=this.fullXDomain;if("category"===this.norm.xAxis.type){var l=s.length;if(l<2)return this;var h=Math.round(e*l),u=Math.round(t*l)-1;h=Math.max(0,Math.min(l-1,h)),(u=Math.max(0,Math.min(l-1,u)))<=h&&(u=Math.min(l-1,h+1));var c=[s[h],s[u]];return this.setDomain("x",r?this.guardInteractiveXWindow(c):c,i)}var d=Number(s[0]),f=Number(s[1])-d,p=[d+f*e,d+f*t];return this.setDomain("x",r?this.guardInteractiveXWindow(p):p,i)}},{key:"syncAxisComponents",value:function syncAxisComponents(){var e=this.norm.yAxes,t=e.length,i=e.map(function(e){return e.position}).join("|");if(this.axisSignature!==i){var r,n=_createForOfIteratorHelper(this.axisYList);try{for(n.s();!(r=n.n()).done;){var a=r.value;this.root.removeChild(a)}}catch(e){n.e(e)}finally{n.f()}var o=this.layout.canvas;this.axisYList=e.map(function(e,t){return new B({orientation:"y",width:o.width,height:o.height,zIndex:Ve+t,axisIndex:t,position:e.position})}),this.root.addChildren(this.axisYList),this.axisSignature=i}for(;this.axisYList.length>t;){var s=this.axisYList.pop();this.root.removeChild(s)}}},{key:"syncSeries",value:function syncSeries(e){var t=this.norm,i=this.layout.plot,r=t.series.map(function(e){return"".concat(e.id,":").concat(e.type)}).join("|"),n=computeBarSlots(t.series);if(r!==this.seriesSignature){var a,o=_createForOfIteratorHelper(this.seriesComponents);try{for(o.s();!(a=o.n()).done;){var s=a.value;this.root.removeChild(s)}}catch(e){o.e(e)}finally{o.f()}this.seriesComponents=t.series.map(function(e,t){return createSeriesComponent(e,{left:i.x,top:i.y,width:i.width,height:i.height,zIndex:Re+t})}),this.root.addChildren(this.seriesComponents),this.seriesSignature=r}for(var l=0;l<this.seriesComponents.length;l++){var h=this.seriesComponents[l],u=t.series[l],c=!u.hidden,d=t.yAxes[u.axisIndex]||t.yAxis,f=this.layout.polar,p="pie"===u.type?{polar:f,plot:i,canvas:this.layout.canvas}:"radar"===u.type?{polar:f,plot:i,canvas:this.layout.canvas,domains:t.radarDomains}:"funnel"===u.type?{plot:i,canvas:this.layout.canvas,options:t.funnel||{}}:"gauge"===u.type?{polar:f,plot:i,canvas:this.layout.canvas,options:t.gauge||{}}:"liquid"===u.type?{polar:f,plot:i,canvas:this.layout.canvas,options:t.liquid||{}}:"treemap"===u.type?{plot:i,canvas:this.layout.canvas,layout:layoutTreemap(Array.isArray(u.option.data)?u.option.data:[],i,t.treemap||{},t.theme.colorPalette),options:t.treemap||{}}:"graph"===u.type&&t.graph?{plot:i,canvas:this.layout.canvas,layout:forceLayout(t.graph.nodes||[],t.graph.links||[],i,t.graph,t.theme.colorPalette),options:t.graph}:"sankey"===u.type&&t.sankey?{plot:i,canvas:this.layout.canvas,layout:layoutSankey(t.sankey.nodes||[],t.sankey.links||[],i,t.sankey,t.theme.colorPalette),options:t.sankey}:{plot:i,canvas:this.layout.canvas,xScale:t.xAxis.scale,yScale:d.scale,yAxisIndex:u.axisIndex,theme:t.theme};if(h.setState({left:i.x,top:i.y,width:i.width,height:i.height,display:c,zIndex:Re+l,interactive:c}),h.barSlot=n[u.id]||{index:0,count:1},h.chartTheme=t.theme,h.state.ariaLabel="".concat(u.name," 系列,共 ").concat(u.pointCount," 个数据点"),h.updateSeries(u,!!e&&!this.viewState.x,!!this.domainTransition),"pie"!==u.type&&"funnel"!==u.type||h.setHiddenSlices(hiddenSliceIndexes(t,u.id)),h.setCoord(p),h.markDirty(),e&&c){var v=t.option.animation;if(v&&!1!==v.enabled){var m=v["enter"===e?"enter":"update"];m&&this.playStage(h,_objectSpread2(_objectSpread2({},m),{},{kind:"enter"===e?"enter":"update"}))}}}}},{key:"playStage",value:function playStage(e,t){if(!shouldAnimate())return e.setAnimationStage(t),e.setState({progress:1}),void e.markDirty();e.setAnimationStage(t);var i=_objectSpread2({},e.props.animations||{});i.progress={from:0,to:1,duration:Math.max(1,Number(t.duration)||480),delay:Number(t.delay)||0,easing:t.easing||"easeOutCubic",startTime:void 0,finished:!1},e.props.animations=i,e.setState({progress:0}),this.ice.animationManager&&this.ice.animationManager.add(e)}},{key:"playEnter",value:function playEnter(e,t,i){this.playStage(e,{duration:t,easing:i,stagger:0})}},{key:"finishAnimations",value:function finishAnimations(){this.domainTransition=null,this.stopDomainTransition();var e,t=_createForOfIteratorHelper([].concat(_toConsumableArray(this.seriesComponents),[this.axisX],_toConsumableArray(this.axisYList),[this.grid,this.tooltip,this.crosshair]));try{for(t.s();!(e=t.n()).done;){var i=e.value;if(i){var r=i.props.animations;if(r)for(var n in r)0!==n.indexOf("__")&&r[n]&&(r[n].finished=!0);var a=!!r&&Object.keys(r).some(function(e){return 0===e.indexOf("__")});this.ice.animationManager&&!a&&this.ice.animationManager.remove(i),i.props&&i.props.animations&&i.props.animations.axisMorph&&i.setState({axisMorph:1}),Number(i.state.progress)<1&&i.setState({progress:1}),i.markDirty()}}}catch(e){t.e(e)}finally{t.f()}return this.ice.dirty=!0,this}},{key:"currentRange",value:function currentRange(){return{x:[this.norm.xAxis.domain[0],this.norm.xAxis.domain[this.norm.xAxis.domain.length-1]],y:[Number(this.norm.yAxis.domain[0]),Number(this.norm.yAxis.domain[1])]}}},{key:"clampDomain",value:function clampDomain(e,t,i){return"y"===e?this.clampAxisDomain(0,t,i):this.clampAxisDomain(-1,t,i)}},{key:"clampAxisDomain",value:function clampAxisDomain(e,t,i){var r=e<0?this.fullXDomain:this.fullYDomains[e];if(!r||r.length<2||!t||t.length<2)return null;var n=e<0?this.norm.xAxis:this.norm.yAxes[e];if(!n)return null;if("category"===n.type){var a=r,o=a.indexOf(t[0]),s=a.indexOf(t[1]);if(o<0&&s<0)return null;if(o<0||s<0){var l=Math.max(1,n.domain.length-1);s<0?(s=a.length-1,o=Math.max(0,s-l)):(o=0,s=Math.min(a.length-1,l))}if(o>s){var h=o;o=s,s=h}if(s-o<1)return null;if("zoom"===i||"brush"===i){var u=s-o+1,c=this.norm.option.interaction&&this.norm.option.interaction.zoom,d=clampBarCount(u,this.layout.plot.width,c&&!1!==c?c:void 0);if(d!==u){var f=(o+s)/2,p=Math.round(f-(d-1)/2);if(p=Math.max(0,Math.min(p,a.length-d)),o=Math.max(0,p),(s=Math.min(a.length-1,o+d-1))-o<1)return null}}return[a[o],a[s]]}var v=Number(r[0]),m=Number(r[1]),g=Number(t[0]),b=Number(t[1]);if(!isFinite(g)||!isFinite(b)||b<=g)return null;var k=.001*(m-v);if(b-g<k)return null;if("pan"===i){var S=.25*(b-g),A=g,w=b;return w<v+S&&(A+=v+S-w,w=v+S),A>m-S&&(w-=A-(m-S),A=m-S),[A,w]}var M=Math.max(v,g),_=Math.min(m,b);return _<=M||_-M<k?null:[M,_]}},{key:"canvasRect",value:function canvasRect(){var e=this.ice&&this.ice.dpr||1,t=(this.ice&&this.ice.canvasWidth?this.ice.canvasWidth:this.canvasEl?this.canvasEl.width:0)/e,i=(this.ice&&this.ice.canvasHeight?this.ice.canvasHeight:this.canvasEl?this.canvasEl.height:0)/e;return{x:0,y:0,width:Math.max(1,Math.round(t)),height:Math.max(1,Math.round(i))}}},{key:"observeResize",value:function observeResize(){var e=this,t="undefined"!=typeof window?window.ResizeObserver:null;if(t&&this.canvasEl){var i=this.canvasEl.parentNode||this.canvasEl;this.resizeObserver=new t(function(){e.resize()}),this.resizeObserver.observe(i)}}},{key:"registerTypes",value:function registerTypes(){for(var e=0,t=[["ice-chart:PlotArea",X],["ice-chart:GridLines",L],["ice-chart:Annotation",W],["ice-chart:Axis",B],["ice-chart:Legend",U],["ice-chart:Title",G],["ice-chart:Tooltip",K],["ice-chart:Crosshair",Y],["ice-chart:Highlight",q],["ice-chart:Brush",$]];e<t.length;e++){var i=_slicedToArray(t[e],2),r=i[0],n=i[1];this.ice.registerType(r,n)}}}],[{key:"restore",value:function restore(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=new ICEChart(e,i.initialOption||{series:[]},i.chartOptions);return r.fromJSONObject(t,i),r}}])}();function computeBarSlots(e){var t,i=[],r={},n=_createForOfIteratorHelper(e);try{var a=function _loop(){var e=t.value;if("bar"!==e.type||e.hidden)return 1;var r=e.option.stack?"stack:".concat(e.option.stack):"single:".concat(e.id),n=i.find(function(e){return e.key===r});n||(n={key:r,members:[]},i.push(n)),n.members.push(e)};for(n.s();!(t=n.n()).done;)a()}catch(e){n.e(e)}finally{n.f()}for(var o=0;o<i.length;o++){var s,l=_createForOfIteratorHelper(i[o].members);try{for(l.s();!(s=l.n()).done;){r[s.value.id]={index:o,count:i.length}}}catch(e){l.e(e)}finally{l.f()}}return r}function hiddenSliceIndexes(e,t){var i=[],r=e.series.find(function(e){return e.id===t});if(!r)return i;for(var n=0;n<r.pointCount;n++){var a=r.pointAt(n);e.hiddenSlices["".concat(t,"#").concat(a.index)]&&i.push(a.index)}return i}function isEngineThemeDark(e){try{var t=function parseHexColor(e){if("string"!=typeof e)return null;var t=e.trim();if("#"!==t.charAt(0))return null;var i=t.slice(1);3===i.length&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]);return 6!==i.length?null:[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16)]}(e&&e.getTheme&&e.getTheme().semantic.background);if(!t)return!1;var i=_slicedToArray(t.map(function(e){var t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}),3);return.2126*i[0]+.7152*i[1]+.0722*i[2]<.35}catch(e){return!1}}function toAlpha(e,t){if("string"!=typeof e)return"rgba(0,0,0,".concat(t,")");if(0===e.indexOf("#")){var i=e.slice(1);if(3===i.length&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),6!==i.length)return e;var r=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),a=parseInt(i.slice(4,6),16);return"rgba(".concat(r,",").concat(n,",").concat(a,",").concat(t,")")}return 0===e.indexOf("rgb(")?e.replace("rgb(","rgba(").replace(")",",".concat(t,")")):e}function createChart(e,t,i){return"string"==typeof t||isChartSnapshot(t)?Ge.restore(e,t,{chartOptions:i}):new Ge(e,t,i)}function linkCharts(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.axis||"x",n=!1!==i.hover,a=!1!==i.zoom,o=!1!==i.brush,s=[],l=null,h=_createForOfIteratorHelper(e);try{var u=function _loop(){var i=t.value,h=function onHover(t){if(n&&t){l=i;var r,a=_createForOfIteratorHelper(e);try{var o=function _loop2(){var e=r.value;e!==i&&e.silent(function(){return e.showHoverAtValue(t.xValue)})};for(a.s();!(r=a.n()).done;)o()}catch(e){a.e(e)}finally{a.f()}}},u=function onLeave(){if(n&&l===i){l=null;var t,r=_createForOfIteratorHelper(e);try{var a=function _loop3(){var e=t.value;e!==i&&e.silent(function(){return e.clearHover()})};for(r.s();!(t=r.n()).done;)a()}catch(e){r.e(e)}finally{r.f()}}},c=function onZoom(t){a&&t&&applyRange(e,i,t,r)},d=function onPan(t){a&&t&&applyRange(e,i,t,r)},f=function onBrush(t){o&&t&&applyRange(e,i,t,r)};i.on("item:hover",h),i.on("item:leave",u),i.on("zoom:change",c),i.on("pan:change",d),i.on("brush:end",f),s.push(function(){i.off("item:hover",h),i.off("item:leave",u),i.off("zoom:change",c),i.off("pan:change",d),i.off("brush:end",f)})};for(h.s();!(t=h.n()).done;)u()}catch(e){h.e(e)}finally{h.f()}return{charts:e,unlink:function unlink(){for(var e=0,t=s;e<t.length;e++){(0,t[e])()}s.length=0}}}function applyRange(e,t,i,r){if(("x"===r||"xy"===r)&&i.x){var n,a=_createForOfIteratorHelper(e);try{var o=function _loop4(){var e=n.value;e!==t&&e.silent(function(){return e.setDomain("x",i.x,"link")})};for(a.s();!(n=a.n()).done;)o()}catch(e){a.e(e)}finally{a.f()}}if(("y"===r||"xy"===r)&&i.y){var s,l=_createForOfIteratorHelper(e);try{var h=function _loop5(){var e=s.value;e!==t&&e.silent(function(){return e.setDomain("y",i.y,"link")})};for(l.s();!(s=l.n()).done;)h()}catch(e){l.e(e)}finally{l.f()}}}export{Ie as A11yMirror,W as Annotation,re as AreaSeries,B as Axis,u as BOOTSTRAP_CHART_THEME,c as BOOTSTRAP_DARK_CHART_THEME,l as BOOTSTRAP_TOKENS,H as BandScale,ie as BarSeries,pe as BoxplotSeries,$ as Brush,V as ChartComponent,Y as Crosshair,xe as CurveSeriesBase,f as DARK_CHART_THEME,D as DEFAULT_ANIMATION_STAGES,Te as Emitter,w as ExpressionError,ge as FunctionSeries,ue as FunnelSeries,fe as GaugeSeries,me as GraphSeries,L as GridLines,le as HeatmapSeries,q as Highlight,_e as HitResolver,Ge as ICEChart,Pe as InteractionController,d as LIGHT_CHART_THEME,U as Legend,te as LineSeries,R as LinearScale,Se as LiquidSeries,z as LogScale,be as ParametricSeries,oe as PieSeries,X as PlotArea,Z as RadarGrid,se as RadarSeries,Ne as SERIES_ROLE_HINT,Ue as SNAPSHOT_VERSION,he as SankeySeries,ne as ScatterSeries,ee as SeriesBase,A as TimeScale,G as Title,K as Tooltip,ye as TreemapSeries,Fe as VISUALLY_HIDDEN_STYLE,ve as WaterfallSeries,applyChartThemeToEngine,buildDataNodes,buildDataTable,chartThemeToEnginePatch,chartTitle,clearCustomSeriesTypes,compileExpression,compileSampler,computeBarSlots,computeBoxplotSummary,computeLayout,createChart,createScale,createSeriesComponent,diagnoseExpression,errorsOf,evaluateExpression,forceLayout,formatNumberTick,formatTick,getMotionPreference,getSeriesTypeFactory,isBuiltinSeriesType,isChartSnapshot,layoutSankey,layoutTreemap,linkCharts,listSeriesTypes,mergeOptionPatch,mixColors,normalizeAnimation,normalizeAnnotation,normalizeOption,registerSeriesType,resolveAnnotation,resolveChartTheme,robustRange,roundRect,sampleFunctionCurve,sampleGraphLink,sampleLinkPath,sampleParametricCurve,setMotionPreference,shouldAnimate,toSerializableOption,unregisterSeriesType,warningsOf};
25
+ import{FAMILY_PALETTE as e,FAMILY_PALETTE_DARK as t,ICEComponent as r,ICEStar as n,ICE_EVENT_NAME_CONSTS as a,ICEGroup as s,ICE as l}from"ice-render";function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function _callSuper(e,t,r){return t=_getPrototypeOf(t),function _possibleConstructorReturn(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,_isNativeReflectConstruct()?Reflect.construct(t,r||[],_getPrototypeOf(e).constructor):t.apply(e,r))}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,F=function(){};return{s:F,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){l=!0,a=e},f:function(){try{s||null==r.return||r.return()}finally{if(l)throw a}}}}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function _superPropBase(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}(e,t);if(n){var a=Object.getOwnPropertyDescriptor(n,t);return a.get?a.get.call(arguments.length<3?e:r):a.value}},_get.apply(null,arguments)}function _getPrototypeOf(e){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _isNativeReflectConstruct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_isNativeReflectConstruct=function(){return!!e})()}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _regenerator(){
26
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
27
+ var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",a=r.toStringTag||"@@toStringTag";function i(r,n,a,l){var h=n&&n.prototype instanceof Generator?n:Generator,u=Object.create(h.prototype);return _regeneratorDefine(u,"_invoke",function(r,n,a){var l,h,u,c=0,p=a||[],v=!1,m={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return l=t,h=0,u=e,m.n=r,s}};function d(r,n){for(h=r,u=n,t=0;!v&&c&&!a&&t<p.length;t++){var a,l=p[t],g=m.p,b=l[2];r>3?(a=b===n)&&(u=l[(h=l[4])?5:(h=3,3)],l[4]=l[5]=e):l[0]<=g&&((a=r<2&&g<l[1])?(h=0,m.v=n,m.n=l[1]):g<b&&(a=r<3||l[0]>n||n>b)&&(l[4]=r,l[5]=n,m.n=b,h=0))}if(a||r>1)return s;throw v=!0,n}return function(a,p,g){if(c>1)throw TypeError("Generator is already running");for(v&&1===p&&d(p,g),h=p,u=g;(t=h<2?e:u)||!v;){l||(h?h<3?(h>1&&(m.n=-1),d(h,u)):m.n=u:m.v=u);try{if(c=2,l){if(h||(a="next"),t=l[a]){if(!(t=t.call(l,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,h<2&&(h=0)}else 1===h&&(t=l.return)&&t.call(l),h<2&&(u=TypeError("The iterator does not provide a '"+a+"' method"),h=1);l=e}else if((t=(v=m.n<0)?u:r.call(n,m))!==s)break}catch(t){l=e,h=1,u=t}finally{c=1}}return{value:t,done:v}}}(r,a,l),!0),u}var s={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(_regeneratorDefine(t={},n,function(){return this}),t),h=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(l);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,_regeneratorDefine(e,a,"GeneratorFunction")),e.prototype=Object.create(h),e}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine(h,"constructor",GeneratorFunctionPrototype),_regeneratorDefine(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine(GeneratorFunctionPrototype,a,"GeneratorFunction"),_regeneratorDefine(h),_regeneratorDefine(h,a,"Generator"),_regeneratorDefine(h,n,function(){return this}),_regeneratorDefine(h,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:i,m:f}})()}function _regeneratorDefine(e,t,r,n){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}_regeneratorDefine=function(e,t,r,n){function o(t,r){_regeneratorDefine(e,t,function(e){return this._invoke(t,r,e)})}t?a?a(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},_regeneratorDefine(e,t,r,n)}function _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,s,l,h=[],u=!0,c=!1;try{if(s=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=s.call(r)).done)&&(h.push(n.value),h.length!==t);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(c)throw a}}return h}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _superPropGet(e,t,r,n){var a=_get(_getPrototypeOf(1&n?e.prototype:e),t,r);return 2&n&&"function"==typeof a?function(e){return a.apply(r,e)}:a}function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _wrapNativeSuper(e){var t="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function(e){if(null===e||!function _isNativeFunction(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,Wrapper)}function Wrapper(){return function _construct(e,t,r){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,t);var a=new(e.bind.apply(e,n));return r&&_setPrototypeOf(a,r.prototype),a}(e,arguments,_getPrototypeOf(this).constructor)}return Wrapper.prototype=Object.create(e.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,e)},_wrapNativeSuper(e)}function storeDomainOf(e){var t=e.columns||e.ring||e.chunks||e.raw;return t?{xDomain:t.xDomain,yDomain:t.yDomain,xMonotonic:t.xMonotonic,sizeExtent:t.sizeExtent}:null}function columnAccessors(e){var t=e.x,r=e.y,n=e.size,a=function yAt(e){var t=r[e];return isNaNNumber(t)?null:t};return{pointAt:function pointAt(e){var r=a(e),s=n?n[e]:NaN;return{index:e,xValue:t[e],y:r,raw:void 0,base:0,top:null===r?0:r,name:void 0,size:isNaNNumber(s)?void 0:s}},xValueAt:function xValueAt(e){return t[e]},yValueAt:a,baseAt:function baseAt(){return 0},topAt:function topAt(e){var t=a(e);return null===t?0:t},sizeAt:function sizeAt(e){if(n){var t=n[e];return isNaNNumber(t)?void 0:t}}}}function isNaNNumber(e){return"number"!=typeof e||Number.isNaN(e)}function toNumber(e){if(null==e)return null;var t=Number(e);return isFinite(t)?t:null}function readGenericPointInto(e,t,r,n){n.xValue=t,n.y=null,n.size=void 0,n.name=void 0,n.explicitX=!1;var a=e;if(Array.isArray(e)){if(n.xValue=e[0],n.y=toNumber(e[1]),e.length>2){var s=toNumber(e[2]);n.size=null===s?void 0:s}n.explicitX=!0}else if("number"==typeof e||null===e)n.y=toNumber(e);else if(e&&"object"===_typeof(e)){var l=r.xField||"x",h=r.yField||"y";if(void 0!==e[l]?(n.xValue=e[l],n.explicitX=!0):void 0!==e.x?(n.xValue=e.x,n.explicitX=!0):void 0!==e.name&&"bar"===r.type&&(n.xValue=e.name,n.explicitX=!0),void 0!==e[h]?n.y=toNumber(e[h]):void 0!==e.y?n.y=toNumber(e.y):void 0!==e.value&&(n.y=toNumber(e.value)),void 0!==e.size){var u=toNumber(e.size);n.size=null===u?void 0:u}}return a&&"object"===_typeof(a)&&!Array.isArray(a)&&void 0!==a.name?n.name=String(a.name):"pie"===r.type&&Array.isArray(a)&&"string"==typeof a[0]&&(n.name=a[0]),n}function readGenericPoint(e,t,r){return readGenericPointInto(e,t,r,{xValue:t,y:null,explicitX:!1})}function rawItemAt(e,t){if(!(t<0||t>=e.length))return e.capacity<=0?e.data[t]:e.data[(e.start+t)%e.capacity]}function appendRawItems(e,t,r){var n={type:e.type,xField:e.xField,yField:e.yField},a={xValue:0,y:null,size:void 0,name:void 0,explicitX:!1},s=function parsedOf(e){return readGenericPointInto(e,0,n,a)},l=e.length?Number(s(rawItemAt(e,e.length-1)).xValue):-1/0,h=!1,u=function noteAdded(t){var r=s(t),n=Number(r.xValue);isFinite(n)?(n<e.xDomain[0]&&(e.xDomain[0]=n),n>e.xDomain[1]&&(e.xDomain[1]=n),n<l&&(e.xMonotonic=!1),l=n):e.xMonotonic=!1,null!==r.y&&(e.yDomain?(r.y<e.yDomain[0]&&(e.yDomain[0]=r.y),r.y>e.yDomain[1]&&(e.yDomain[1]=r.y)):e.yDomain=[r.y,r.y])},c=function noteEvicted(t){if(void 0!==t){var r=s(t),n=Number(r.xValue);!isFinite(n)||n!==e.xDomain[0]&&n!==e.xDomain[1]||(h=!0);var a=r.y;null===a||!e.yDomain||a!==e.yDomain[0]&&a!==e.yDomain[1]||(h=!0)}};if(r>0&&e.capacity!==r){for(var p=Math.min(e.length,r),v=new Array(r),m=0;m<p;m++)v[m]=rawItemAt(e,e.length-p+m);e.data=v,e.capacity=r,e.start=0,e.length=p,e.categories=[],e.categoryCounts=new Map,e.categorySeq=new Map,e.categoryNext=0;for(var g=0;g<p;g++){var b,k=readGenericPointInto(rawItemAt(e,g),0,n,a),S=String(k.xValue),A=null!==(b=e.categoryCounts.get(S))&&void 0!==b?b:0;0===A&&(e.categories.push(k.xValue),e.categorySeq.set(S,e.categoryNext++)),e.categoryCounts.set(S,A+1)}}var w=function addCategory(t){var r,n=readGenericPoint(t,0,{type:e.type,xField:e.xField,yField:e.yField}),a=String(n.xValue),s=null!==(r=e.categoryCounts.get(a))&&void 0!==r?r:0;0===s&&(e.categories.push(n.xValue),e.categorySeq.set(a,e.categoryNext++)),e.categoryCounts.set(a,s+1)},_=function removeCategory(t){var r;if(void 0!==t){var n=readGenericPoint(t,0,{type:e.type,xField:e.xField,yField:e.yField}),a=String(n.xValue),s=null!==(r=e.categoryCounts.get(a))&&void 0!==r?r:0;if(s<=1){e.categoryCounts.delete(a);var l=e.categories.findIndex(function(e){return String(e)===a}),h=e.categories.length?e.categorySeq.get(String(e.categories[0])):void 0,u=e.categorySeq.get(a);if(e.categorySeq.delete(a),l>=0&&(e.categories.splice(l,1),void 0!==u&&u!==h)){for(var c=0;c<e.categories.length;c++)e.categorySeq.set(String(e.categories[c]),c);e.categoryNext=e.categories.length}}else e.categoryCounts.set(a,s-1)}};if(e.capacity>0){var M,C=_createForOfIteratorHelper(t);try{for(C.s();!(M=C.n()).done;){var P=M.value,T=void 0,I=void 0;e.length>=e.capacity?(T=e.start,I=e.data[T],e.start=(e.start+1)%e.capacity):(T=(e.start+e.length)%e.capacity,e.length+=1),void 0!==I&&_(I),e.data[T]=P,w(P),c(I),u(P)}}catch(e){C.e(e)}finally{C.f()}}else{var N,D=_createForOfIteratorHelper(t);try{for(D.s();!(N=D.n()).done;){var O=N.value;e.data.push(O),w(O),u(O)}}catch(e){D.e(e)}finally{D.f()}e.length=e.data.length}return h&&function refreshRawDomains(e){for(var t={type:e.type,xField:e.xField,yField:e.yField},r={xValue:0,y:null,size:void 0,name:void 0,explicitX:!1},n=1/0,a=-1/0,s=1/0,l=-1/0,h=1/0,u=-1/0,c=!0,p=-1/0,v=!1,m=0;m<e.length;m++){var g=readGenericPointInto(rawItemAt(e,m),m,t,r),b=Number(g.xValue);isFinite(b)?(b<n&&(n=b),b>a&&(a=b),b<p&&(c=!1),p=b):c=!1,null!==g.y&&(g.y<s&&(s=g.y),g.y>l&&(l=g.y)),"number"==typeof g.size&&isFinite(g.size)&&(v=!0,g.size<h&&(h=g.size),g.size>u&&(u=g.size))}e.xDomain=isFinite(n)?[n,a]:[0,Math.max(0,e.length-1)],e.yDomain=isFinite(s)?[s,l]:null,e.xMonotonic=c,e.sizeExtent=v?h===u?[h,h+1]:[h,u]:null}(e),e}function rawAccessors(e){var t={type:e.type,xField:e.xField,yField:e.yField},r=function readAt(r){var n=rawItemAt(e,r);return void 0===n&&(r<0||r>=e.length)?null:readGenericPoint(n,r,t)};return{pointAt:function pointAt(t){var n=r(t);if(n)return{index:t,xValue:n.xValue,y:n.y,raw:rawItemAt(e,t),base:0,top:null===n.y?0:n.y,name:n.name,size:n.size}},xValueAt:function xValueAt(e){var t=r(e);return t?t.xValue:void 0},yValueAt:function yValueAt(e){var t=r(e);return t?t.y:null},baseAt:function baseAt(){return 0},topAt:function topAt(e){var t=r(e);return t&&null!==t.y?t.y:0},sizeAt:function sizeAt(e){var t=r(e);return t?t.size:void 0}}}function gridAccessors(e){var t=e.xCategories.length,r=function valueAt(t){var r=e.values[t];return isNaNNumber(r)?null:r};return{pointAt:function pointAt(n){var a=t>0?n%t:n,s=t>0?(n-a)/t:0,l=r(n),h=e.yCategories[s];return{index:n,xValue:e.xCategories[a],y:l,raw:void 0,base:0,top:null===l?0:l,name:void 0===h?void 0:String(h)}},xValueAt:function xValueAt(r){return t>0?e.xCategories[r%t]:e.xCategories[r]},yValueAt:r,baseAt:function baseAt(){return 0},topAt:function topAt(e){var t=r(e);return null===t?0:t},sizeAt:function sizeAt(){}}}function createRing(e){var t=Math.max(1,Math.floor(e)||1);return{kind:"ring",capacity:t,start:0,length:0,x:new Float64Array(t),y:new Float64Array(t),xDomain:[0,1],yDomain:null,xMonotonic:!0,sizeExtent:null}}function ringSlot(e,t){return(e.start+t)%e.capacity}function ringXAt(e,t){return e.x[ringSlot(e,t)]}function ringYAt(e,t){return e.y[ringSlot(e,t)]}function ringAppend(e,t,r){var n,a=_createForOfIteratorHelper(t);try{for(a.s();!(n=a.n()).done;){var s=n.value,l=void 0;e.length>=e.capacity?(l=e.start,e.start=(e.start+1)%e.capacity):(l=(e.start+e.length)%e.capacity,e.length+=1);var h=s.x;e.x[l]=null!=h&&isFinite(h)?h:r,e.y[l]=null===s.y?NaN:s.y,r=e.x[l]+1}}catch(e){a.e(e)}finally{a.f()}}function chunkAt(e,t){if(t<0||t>=e.total)return null;var r=function chunkIndexOf(e,t){for(var r=0,n=e.sizes.length-1;r<n;){var a=r+n+1>>1;e.offsets[a]<=t?r=a:n=a-1}return r}(e,t),n=e.resident[r];return n?{columns:n,local:t-e.offsets[r]}:null}function requestChunk(e,t,r){if(!(t<0||t>=e.sizes.length))if(e.resident[t]||e.loading.has(t))touchLru(e,t);else{e.loading.add(t);var n=function settle(n){e.loading.delete(t),n&&(e.resident[t]=n,touchLru(e,t),function refreshChunkMeta(e,t){var r=e.resident[t];if(!r)return;var n=e.sizes[t];if(n){var a=r.x[0],s=r.x[n-1];isFinite(a)&&isFinite(s)&&(e.ranges[t]=[Math.min(a,s),Math.max(a,s)])}var l=e.ranges.filter(function(e){return!!e});l.length&&(e.xDomain=[Math.min.apply(Math,_toConsumableArray(l.map(function(e){return e[0]}))),Math.max.apply(Math,_toConsumableArray(l.map(function(e){return e[1]})))])}(e,t),function evictChunks(e){for(;e.lru.length>e.maxResident;){var t=e.lru.find(function(t){return!e.loading.has(t)});if(void 0===t)return;var r=e.lru.indexOf(t);e.lru.splice(r,1),e.resident[t]=null}}(e),r())};try{var a=e.load(t);a&&"function"==typeof a.then?a.then(function(e){return n(e)},function(){return n(null)}):n(a)}catch(e){n(null)}}}function chunkRangeForX(e,t,r){var n=e.sizes.length;if(!n)return{from:0,to:-1};for(var a=-1,s=-1,l=0;l<n;l++){var h=e.ranges[l];h&&(h[1]<t||h[0]>r||(a<0&&(a=l),s=l))}return a<0?{from:0,to:-1}:{from:Math.max(0,a-1),to:Math.min(n-1,s+1)}}function touchLru(e,t){var r=e.lru.indexOf(t);r>=0&&e.lru.splice(r,1),e.lru.push(t)}function chunkAccessors(e){var t=function yAt(t){var r=chunkAt(e,t);if(!r)return null;var n=r.columns.y[r.local];return Number.isNaN(n)?null:n};return{pointAt:function pointAt(r){var n=chunkAt(e,r);if(n){var a=t(r);return{index:r,xValue:n.columns.x[n.local],y:a,raw:void 0,base:0,top:null===a?0:a,name:void 0}}},xValueAt:function xValueAt(t){var r=chunkAt(e,t);return r?r.columns.x[r.local]:void 0},yValueAt:t,baseAt:function baseAt(){return 0},topAt:function topAt(e){var r=t(e);return null===r?0:r},sizeAt:function sizeAt(){}}}var h=_toConsumableArray(e),u={primary:"#0D6EFD",secondary:"#6C757D",success:"#198754",danger:"#DC3545",warning:"#FFC107",info:"#0DCAF0",light:"#F8F9FA",dark:"#212529",indigo:"#6610F2",purple:"#6F42C1",pink:"#D63384",orange:"#FD7E14",teal:"#20C997",cyan:"#0DCAF0",gray:{100:"#F8F9FA",200:"#E9ECEF",300:"#DEE2E6",400:"#CED4DA",500:"#ADB5BD",600:"#6C757D",700:"#495057",800:"#343A40",900:"#212529"},fontFamily:'system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif',radius:6},c=u,p={backgroundColor:"transparent",colorPalette:h,textColor:c.dark,subTextColor:c.secondary,axisLineColor:c.gray[300],axisLabelColor:c.gray[600],splitLineColor:c.gray[200],labelHaloColor:"rgba(255,255,255,0.85)",fontFamily:c.fontFamily,fontSize:12,legend:{textColor:c.gray[700],inactiveColor:c.gray[400]},tooltip:{background:"#ffffff",borderColor:c.gray[300],textColor:c.dark,shadowColor:"rgba(33,37,41,0.18)",fontSize:12,padding:10,radius:c.radius},crosshair:{lineColor:c.gray[500],labelBackground:c.gray[700],labelColor:"#ffffff"},brush:{fill:"rgba(13,110,253,0.16)",stroke:"rgba(13,110,253,0.8)"},selection:{stroke:c.primary,dimOpacity:.3}},v={backgroundColor:"transparent",colorPalette:_toConsumableArray(t),textColor:c.gray[200],subTextColor:c.gray[500],axisLineColor:c.gray[700],axisLabelColor:c.gray[400],splitLineColor:c.gray[800],labelHaloColor:"rgba(10,18,32,0.88)",fontFamily:c.fontFamily,fontSize:12,legend:{textColor:c.gray[300],inactiveColor:c.gray[700]},tooltip:{background:c.gray[800],borderColor:c.gray[700],textColor:c.gray[100],shadowColor:"rgba(0,0,0,0.5)",fontSize:12,padding:10,radius:c.radius},crosshair:{lineColor:c.gray[600],labelBackground:c.gray[300],labelColor:c.dark},brush:{fill:"rgba(77,148,255,0.2)",stroke:"rgba(77,148,255,0.85)"},selection:{stroke:"#4D94FF",dimOpacity:.32}},m=p,g=v;function resolveChartTheme(e){var t="dark"===e||"auto"===e&&(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).preferDark?v:p;return e&&"string"!=typeof e?_objectSpread2(_objectSpread2(_objectSpread2({},t),e),{},{legend:_objectSpread2(_objectSpread2({},t.legend),e.legend||{}),tooltip:_objectSpread2(_objectSpread2({},t.tooltip),e.tooltip||{}),crosshair:_objectSpread2(_objectSpread2({},t.crosshair),e.crosshair||{}),brush:_objectSpread2(_objectSpread2({},t.brush),e.brush||{}),selection:_objectSpread2(_objectSpread2({},t.selection),e.selection||{})}):t}function clamp$2(e,t,r){return e<t?t:e>r?r:e}function isFiniteNumber(e){return"number"==typeof e&&isFinite(e)}function extent(e){for(var t=1/0,r=-1/0,n=0;n<e.length;n++){var a=e[n];isFiniteNumber(a)&&(a<t&&(t=a),a>r&&(r=a))}if(t===1/0)return[0,1];if(t===r){var s=Math.abs(t)>1?.1*Math.abs(t):1;return[t-s,r+s]}return[t,r]}function niceStep(e,t){if(!(e>0&&t>0))return 1;var r=e/t,n=Math.pow(10,Math.floor(Math.log10(r))),a=r/n;return(a>=5?10:a>=2?5:a>=1?2:1)*n}function niceDomain(e,t){var r=_slicedToArray(e,2),n=r[0],a=r[1],s=niceStep(a-n,t);return[Math.floor(n/s)*s,Math.ceil(a/s)*s]}function round(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,r=Math.pow(10,t);return Math.round(e*r)/r}var b=1e3,k=6e4,S=36e5,A=24*S,w=30*A,_=365*A;function makeInterval(e,t,r,n,a){return{unit:e,ms:t*r,floor:function floor(e){var t=new Date(e);return n(t),t.getTime()},next:function next(e){var t=new Date(e);return a(t),t.getTime()}}}var M=[makeInterval("ms",1,1,function(){},function(e){return e.setUTCMilliseconds(e.getUTCMilliseconds()+1)}),makeInterval("ms",10,1,function(e){return e.setUTCMilliseconds(10*Math.floor(e.getUTCMilliseconds()/10))},function(e){return e.setUTCMilliseconds(e.getUTCMilliseconds()+10)}),makeInterval("ms",100,1,function(e){return e.setUTCMilliseconds(100*Math.floor(e.getUTCMilliseconds()/100))},function(e){return e.setUTCMilliseconds(e.getUTCMilliseconds()+100)}),makeInterval("s",1,b,function(e){return e.setUTCMilliseconds(0)},function(e){return e.setUTCSeconds(e.getUTCSeconds()+1)}),makeInterval("s",5,b,function(e){return e.setUTCSeconds(5*Math.floor(e.getUTCSeconds()/5),0)},function(e){return e.setUTCSeconds(e.getUTCSeconds()+5)}),makeInterval("s",15,b,function(e){return e.setUTCSeconds(15*Math.floor(e.getUTCSeconds()/15),0)},function(e){return e.setUTCSeconds(e.getUTCSeconds()+15)}),makeInterval("s",30,b,function(e){return e.setUTCSeconds(30*Math.floor(e.getUTCSeconds()/30),0)},function(e){return e.setUTCSeconds(e.getUTCSeconds()+30)}),makeInterval("m",1,k,function(e){return e.setUTCSeconds(0,0)},function(e){return e.setUTCMinutes(e.getUTCMinutes()+1)}),makeInterval("m",5,k,function(e){return e.setUTCMinutes(5*Math.floor(e.getUTCMinutes()/5),0,0)},function(e){return e.setUTCMinutes(e.getUTCMinutes()+5)}),makeInterval("m",15,k,function(e){return e.setUTCMinutes(15*Math.floor(e.getUTCMinutes()/15),0,0)},function(e){return e.setUTCMinutes(e.getUTCMinutes()+15)}),makeInterval("m",30,k,function(e){return e.setUTCMinutes(30*Math.floor(e.getUTCMinutes()/30),0,0)},function(e){return e.setUTCMinutes(e.getUTCMinutes()+30)}),makeInterval("h",1,S,function(e){return e.setUTCMinutes(0,0,0)},function(e){return e.setUTCHours(e.getUTCHours()+1)}),makeInterval("h",3,S,function(e){return e.setUTCHours(3*Math.floor(e.getUTCHours()/3),0,0,0)},function(e){return e.setUTCHours(e.getUTCHours()+3)}),makeInterval("h",6,S,function(e){return e.setUTCHours(6*Math.floor(e.getUTCHours()/6),0,0,0)},function(e){return e.setUTCHours(e.getUTCHours()+6)}),makeInterval("h",12,S,function(e){return e.setUTCHours(12*Math.floor(e.getUTCHours()/12),0,0,0)},function(e){return e.setUTCHours(e.getUTCHours()+12)}),makeInterval("d",1,A,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCDate(e.getUTCDate()+1)}),makeInterval("d",2,A,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCDate(e.getUTCDate()+2)}),makeInterval("d",7,A,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCDate(e.getUTCDate()+7)}),makeInterval("mo",1,w,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCMonth(e.getUTCMonth()+1)}),makeInterval("mo",3,w,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCMonth(e.getUTCMonth()+3)}),makeInterval("y",1,_,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCFullYear(e.getUTCFullYear()+1)})];function pad(e){return e<10?"0".concat(e):String(e)}var C=function(){function TimeScale(e,t){_classCallCheck(this,TimeScale),_defineProperty(this,"type","time");var r=Number(e[0]),n=Number(e[1]);this.domain=r===n?[r-A,n+A]:[Math.min(r,n),Math.max(r,n)],this.range=t}return _createClass(TimeScale,[{key:"map",value:function map(e){var t=toTimestamp(e),r=_slicedToArray(this.domain,2),n=r[0],a=r[1],s=_slicedToArray(this.range,2),l=s[0];return l+(t-n)/(a-n)*(s[1]-l)}},{key:"invert",value:function invert(e){var t=_slicedToArray(this.domain,2),r=t[0],n=t[1],a=_slicedToArray(this.range,2),s=a[0],l=a[1];return l===s?r:r+(e-s)/(l-s)*(n-r)}},{key:"pickInterval",value:function pickInterval(e){for(var t=(this.domain[1]-this.domain[0])/Math.max(1,e),r=M[0],n=1/0,a=0;a<M.length;a++){var s=Math.abs(Math.log(M[a].ms/t));s<n&&(n=s,r=M[a])}return r}},{key:"ticks",value:function ticks(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=this.pickInterval(e),r=[],n=t.floor(this.domain[0]);n<this.domain[0]&&(n=t.next(n));for(var a=0;n<=this.domain[1]&&a<1e3;a++){r.push(n);var s=t.next(n);if(s===n)break;n=s}return r}},{key:"bandwidth",value:function bandwidth(){return 0}},{key:"bandStart",value:function bandStart(e){return this.map(e)}},{key:"step",value:function step(){return this.pickInterval(5).ms}},{key:"isBand",value:function isBand(){return!1}},{key:"indexAt",value:function indexAt(e){return-1}},{key:"fractionOf",value:function fractionOf(e){var t=_slicedToArray(this.domain,2),r=t[0],n=t[1];return n===r?0:(toTimestamp(e)-r)/(n-r)}},{key:"valueAtFraction",value:function valueAtFraction(e){var t=_slicedToArray(this.domain,2),r=t[0];return r+e*(t[1]-r)}},{key:"span",value:function span(){return this.domain[1]-this.domain[0]}},{key:"format",value:function format(e,t){return function formatTime(e,t,r){var n=new Date(e),a=pad(n.getUTCHours()),s=pad(n.getUTCMinutes()),l=pad(n.getUTCSeconds()),h=pad(n.getUTCMonth()+1),u=pad(n.getUTCDate()),c=n.getUTCFullYear(),p=r>3*_;switch(t){case"ms":return"".concat(a,":").concat(s,":").concat(l,".").concat(pad(n.getUTCMilliseconds()));case"s":return"".concat(a,":").concat(s,":").concat(l);case"m":return"".concat(a,":").concat(s);case"h":return"".concat(a,":00");case"d":return p?"".concat(c,"-").concat(h,"-").concat(u):"".concat(h,"-").concat(u);case"mo":return p?"".concat(c,"-").concat(h):"".concat(h,"-01");default:return"".concat(c)}}(toTimestamp(e),this.pickInterval(5).unit,this.span())}},{key:"clone",value:function clone(){return new TimeScale([this.domain[0],this.domain[1]],[this.range[0],this.range[1]])}}])}();function toTimestamp(e){if(e instanceof Date)return e.getTime();if("string"==typeof e){var t=Date.parse(e);if(!isNaN(t))return t}var r=Number(e);return isFinite(r)?r:NaN}var P=function(){function ExpressionError(e,t,r){var n,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"syntax";return _classCallCheck(this,ExpressionError),(n=_callSuper(this,ExpressionError,["[ice-chart] 表达式错误:".concat(e,"(位置 ").concat(t,")\n ").concat(r,"\n ").concat(" ".repeat(Math.max(0,t)),"^")])).name="ExpressionError",n.position=t,n.code=a,n}return _inherits(ExpressionError,_wrapNativeSuper(Error)),_createClass(ExpressionError)}(),T={pi:Math.PI,PI:Math.PI,e:Math.E,tau:2*Math.PI,TAU:2*Math.PI,inf:1/0,Infinity:1/0,nan:NaN},I={sin:1,cos:1,tan:1,asin:1,acos:1,atan:1,atan2:2,sinh:1,cosh:1,tanh:1,asinh:1,acosh:1,atanh:1,exp:1,ln:1,log:1,log2:1,log10:1,sqrt:1,cbrt:1,abs:1,sign:1,floor:1,ceil:1,round:1,trunc:1,min:2,max:2,pow:2,mod:2,hypot:2,clamp:3},N={min:Math.min,max:Math.max,pow:Math.pow,mod:function mod(e,t){return e%t},hypot:Math.hypot,clamp:function clamp(e,t,r){return Math.max(t,Math.min(r,e))},ln:Math.log,log:Math.log,log10:Math.log10,cbrt:Math.cbrt,trunc:Math.trunc,sign:Math.sign};var D=function(){return _createClass(function Parser(e){_classCallCheck(this,Parser),_defineProperty(this,"index",0),_defineProperty(this,"variables",new Set),this.source=e,this.tokens=function tokenize(e){for(var t=[],r=0,n=function isDigit(e){return e>="0"&&e<="9"},a=function isIdentStart(e){return/[A-Za-z_]/.test(e)},s=function isIdentPart(e){return/[A-Za-z0-9_]/.test(e)};r<e.length;){var l=e[r];if(" "!==l&&"\t"!==l&&"\n"!==l&&"\r"!==l)if(n(l)||"."===l&&n(e[r+1]||"")){for(var h=r;r<e.length&&(n(e[r])||"."===e[r]);)r++;if("e"===e[r]||"E"===e[r]){var u=r;if("+"!==e[++r]&&"-"!==e[r]||r++,n(e[r]||""))for(;r<e.length&&n(e[r]);)r++;else r=u}t.push({type:"num",value:e.slice(h,r),position:h})}else if(a(l)){for(var c=r;r<e.length&&s(e[r]);)r++;t.push({type:"ident",value:e.slice(c,r),position:c})}else if("+-*/%^".indexOf(l)>=0)t.push({type:"op",value:l,position:r}),r++;else if("("!==l)if(")"!==l){if(","!==l)throw new P("无法识别的字符「".concat(l,"」"),r,e,"unknown-character");t.push({type:"comma",value:l,position:r}),r++}else t.push({type:"rparen",value:l,position:r}),r++;else t.push({type:"lparen",value:l,position:r}),r++;else r++}return t.push({type:"end",value:"",position:e.length}),t}(e)},[{key:"parse",value:function parse(){if("end"===this.peek().type)throw new P("表达式是空的",0,this.source,"empty");var e=this.parseSum(),t=this.peek();if("end"!==t.type)throw new P("多余的内容「".concat(t.value,"」"),t.position,this.source);return e}},{key:"getVariables",value:function getVariables(){return Array.from(this.variables)}},{key:"peek",value:function peek(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.tokens[Math.min(this.index+e,this.tokens.length-1)]}},{key:"next",value:function next(){return this.tokens[this.index++]}},{key:"parseSum",value:function parseSum(){for(var e=this.parseProduct();;){var t=this.peek();if("op"!==t.type||"+"!==t.value&&"-"!==t.value)return e;this.next(),e={kind:"binary",op:t.value,left:e,right:this.parseProduct()}}}},{key:"parseProduct",value:function parseProduct(){for(var e=this.parseUnary();;){var t=this.peek();if("op"===t.type&&"*/%".indexOf(t.value)>=0)this.next(),e={kind:"binary",op:t.value,left:e,right:this.parseUnary()};else{if(!this.startsAtom(t)||!this.endsAtom(e))return e;e={kind:"binary",op:"*",left:e,right:this.parseUnary()}}}}},{key:"startsAtom",value:function startsAtom(e){return"num"===e.type||"ident"===e.type||"lparen"===e.type}},{key:"endsAtom",value:function endsAtom(e){return"num"===e.kind||"var"===e.kind&&void 0!==T[e.name]}},{key:"parseUnary",value:function parseUnary(){var e=this.peek();return"op"!==e.type||"-"!==e.value&&"+"!==e.value?this.parsePower():(this.next(),{kind:"unary",op:e.value,arg:this.parseUnary()})}},{key:"parsePower",value:function parsePower(){var e=this.parseAtom(),t=this.peek();return"op"===t.type&&"^"===t.value?(this.next(),{kind:"binary",op:"^",left:e,right:this.parseUnary()}):e}},{key:"parseAtom",value:function parseAtom(){var e=this.next();if("num"===e.type){var t=Number(e.value);if(!isFinite(t))throw new P("无法解析的数字「".concat(e.value,"」"),e.position,this.source);return{kind:"num",value:t}}if("lparen"===e.type){var r=this.parseSum(),n=this.peek();if("rparen"!==n.type)throw new P("缺少右括号",n.position,this.source);return this.next(),r}if("ident"===e.type){var a=e.value;if("lparen"===this.peek().type){var s=I[a];if(void 0===s)throw new P("未知函数「".concat(a,"」"),e.position,this.source,"unknown-function");this.next();for(var l=[this.parseSum()];"comma"===this.peek().type;)this.next(),l.push(this.parseSum());var h=this.peek();if("rparen"!==h.type)throw new P("函数「".concat(a,"」缺少右括号"),h.position,this.source);if(this.next(),l.length!==s)throw new P("函数「".concat(a,"」需要 ").concat(s," 个参数,收到 ").concat(l.length," 个"),e.position,this.source,"arity");return{kind:"call",name:a,args:l}}return void 0!==T[a]?{kind:"num",value:T[a]}:(this.variables.add(a),{kind:"var",name:a})}throw new P("end"===e.type?"表达式意外结束":"这里不该出现「".concat(e.value,"」"),e.position,this.source)}}])}();function compileNode(e){switch(e.kind){case"num":return function(){return e.value};case"var":return function(t){var r=t[e.name];return"number"==typeof r?r:NaN};case"unary":var t=compileNode(e.arg);return"-"===e.op?function(e){return-t(e)}:t;case"binary":var r=compileNode(e.left),n=compileNode(e.right);switch(e.op){case"+":return function(e){return r(e)+n(e)};case"-":return function(e){return r(e)-n(e)};case"*":return function(e){return r(e)*n(e)};case"/":return function(e){return r(e)/n(e)};case"%":return function(e){return r(e)%n(e)};case"^":return function(e){return Math.pow(r(e),n(e))};default:return function(){return NaN}}case"call":var a=e.name,s=N[a]||Math[a],l=e.args.map(compileNode);return s?function(e){return s.apply(void 0,_toConsumableArray(l.map(function(t){return t(e)})))}:function(){return NaN}}}var O=new Map;function compileExpression(e){var t=String(null==e?"":e),r=O.get(t);if(r)return r;var n=new D(t),a=compileNode(n.parse()),s={source:t,variables:n.getVariables(),evaluate:function evaluate(e){return a(e||{})}};return O.set(t,s),s}function evaluateExpression(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return compileExpression(e).evaluate(t)}function compileSampler(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=compileExpression(e),n=_objectSpread2({},t);return{setParams:function setParams(e){for(var t=0,r=Object.keys(e);t<r.length;t++){var a=r[t];n[a]=Number(e[a])}},evaluate:function evaluate(e,t){return n[e]=t,r.evaluate(n)}}}function quantile(e,t){return e.length?e[Math.min(e.length-1,Math.max(0,Math.round((e.length-1)*t)))]:NaN}function diagnoseExpression(e,t){var r=String(null==e?"":e),n=t.params||{},a=[];if(!r.trim())return a.push({code:"empty",severity:"error",message:"表达式是空的:请填写 ".concat(t.variable," 的公式,例如 ").concat("t"===t.variable?"sin(3*t)":"sin(x)/x")}),a;var s=[];try{s=compileExpression(r).variables}catch(e){return e instanceof P?(a.push({code:e.code,severity:"error",message:e.message,position:e.position}),a):(a.push({code:"syntax",severity:"error",message:String(e&&e.message?e.message:e)}),a)}var l,h=[t.variable].concat(_toConsumableArray(Object.keys(n))),u=s.filter(function(e){return e!==t.variable&&!(e in n)}),c=_createForOfIteratorHelper(u);try{for(c.s();!(l=c.n()).done;){var p=l.value;a.push({code:"unknown-variable",severity:"error",message:"未定义的变量「".concat(p,"」:可用的是 ").concat(h.join("、"),"。想当参数用请写进 series.params(会自动进 JSON 快照)。")})}}catch(e){c.e(e)}finally{c.f()}var v,m=new Set([].concat(_toConsumableArray(s),_toConsumableArray(t.additionalVariables||[]))),g=Object.keys(n).filter(function(e){return!m.has(e)}),b=_createForOfIteratorHelper(g);try{for(b.s();!(v=b.n()).done;){var k=v.value;a.push({code:"unused-parameter",severity:"warning",message:"参数「".concat(k,"」定义了但表达式没有用到,改公式或去掉它。")})}}catch(e){b.e(e)}finally{b.f()}var S=t.values;if(S&&S.length&&!a.some(function(e){return"error"===e.severity})){var A=S.filter(function(e){return"number"==typeof e&&isFinite(e)});if(A.length){var w=A.slice().sort(function(e,t){return e-t}),_=quantile(w,.02),M=quantile(w,.98);Math.abs(M-_)<1e-12&&a.push({code:"constant-value",severity:"warning",message:"输出恒为 ".concat(Number(M.toPrecision(6)),":函数与自变量无关(或恰好取到常数),画出来是一条水平线。")})}else a.push({code:"no-finite-values",severity:"error",message:"在当前区间内没有任何可绘制的值:检查是否对负数开方、对 0 取对数,或者分母整段为 0。"})}return a}function errorsOf(e){return e.filter(function(e){return"error"===e.severity})}function warningsOf(e){return e.filter(function(e){return"warning"===e.severity})}var R=1e7;function robustRange(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,r=e.filter(function(e){return"number"==typeof e&&isFinite(e)&&Math.abs(e)<R});if(!r.length)return[-1,1];var n=r.slice().sort(function(e,t){return e-t}),a=function at(e){return n[Math.min(n.length-1,Math.max(0,Math.round((n.length-1)*e)))]},s=a(.5),l=a(.75)-a(.25),h=n[0],u=n[n.length-1];if(l>0&&(h=Math.max(h,s-t*l),u=Math.min(u,s+t*l)),!(u>h)){var c=(u+h)/2,p=Math.max(1,.2*Math.abs(c));h=c-p,u=c+p}return[h,u]}function refineSegment(e,t,r,n,a,s,l){var h=(t+n)/2;if(isFinite(h)&&h!==t&&h!==n){var u=e.evaluate(h);if(e.isBreak(u))l.push(h,NaN);else e.adaptive&&s<e.maxDepth&&e.count<e.maxSamples&&!e.isBreak(r)&&!e.isBreak(a)&&e.deviation(r,u,a)>e.tolerance&&(e.count++,refineSegment(e,t,r,h,u,s+1,l),e.emit(h,u,l),refineSegment(e,h,u,n,a,s+1,l))}}function sampleFunctionCurve(e,t,r){for(var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=Math.max(2,Math.round(n.base||240)),s=new Float64Array(a),l=new Float64Array(a),h=0;h<a;h++){var u=t+(r-t)*h/(a-1),c=e(u);s[h]=u,l[h]=isFinite(c)&&Math.abs(c)<R?c:NaN}for(var p=_slicedToArray(robustRange(Array.from(l)),2),v=p[0],m=p[1],g=Math.max(1e-9,m-v),b={tolerance:Math.max(1e-9,(void 0===n.tolerance?.0025:n.tolerance)*g),maxDepth:void 0===n.maxDepth?7:n.maxDepth,maxSamples:void 0===n.maxSamples?6e3:n.maxSamples,count:a,adaptive:!1!==n.adaptive,evaluate:function evaluate(t){return e(t)},isBreak:function isBreak(e){return!isFinite(e)||Math.abs(e)>R},deviation:function deviation(e,t,r){return Math.abs(t-(e+r)/2)},emit:function emit(e,t,r){r.push(e,t)}},k=[],S=0;S<a&&(k.push(s[S],isFinite(l[S])?l[S]:NaN),S!==a-1);S++)refineSegment(b,s[S],l[S],s[S+1],l[S+1],0,k);for(var A=[],w=0;w<k.length;w+=2)A.push([k[w],k[w+1]]);return function breakPoles(e,t){for(var r=20*Math.max(1e-9,t),n=[],a=0;a<e.length;a++){var s=e[a],l=n.length?n[n.length-1]:null;l&&isFinite(l[1])&&isFinite(s[1])&&l[1]*s[1]<0&&Math.abs(s[1]-l[1])>r&&n.push([(l[0]+s[0])/2,NaN]),n.push(s)}return n}(A,g)}function sampleParametricCurve(e,t,r,n){for(var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},s=Math.max(2,Math.round(a.base||360)),l=new Float64Array(s),h=new Float64Array(s),u=new Float64Array(s),c=0;c<s;c++){var p=r+(n-r)*c/(s-1);l[c]=p,h[c]=e(p),u[c]=t(p)}for(var v=_slicedToArray(robustRange(Array.from(h)),2),m=v[0],g=v[1],b=_slicedToArray(robustRange(Array.from(u)),2),k=b[0],S=b[1],A=Math.max(1e-9,Math.hypot(g-m,S-k)),w={tolerance:Math.max(1e-9,(void 0===a.tolerance?.0015:a.tolerance)*A),maxDepth:void 0===a.maxDepth?7:a.maxDepth,maxSamples:void 0===a.maxSamples?8e3:a.maxSamples,count:s,adaptive:!1!==a.adaptive,evaluate:function evaluate(r){return[e(r),t(r)]},isBreak:function isBreak(e){return!isFinite(e[0])||!isFinite(e[1])||Math.abs(e[0])>R||Math.abs(e[1])>R},deviation:function deviation(e,t,r){return function midDeviation(e,t,r,n,a,s){var l=r-e,h=n-t,u=l*l+h*h;if(0===u)return Math.hypot(a-e,s-t);var c=((a-e)*l+(s-t)*h)/u;return c=Math.max(0,Math.min(1,c)),Math.hypot(a-(e+c*l),s-(t+c*h))}(e[0],e[1],r[0],r[1],t[0],t[1])},emit:function emit(e,t,r){r.push(t[0],t[1])}},_=[],M=0;M<s;M++){var C=h[M],P=u[M],T=!isFinite(C)||!isFinite(P)||Math.abs(C)>R||Math.abs(P)>R;if(_.push(T?NaN:C,T?NaN:P),M===s-1)break;refineSegment(w,l[M],[h[M],u[M]],l[M+1],[h[M+1],u[M+1]],0,_)}for(var I=[],N=0;N<_.length;N+=2)I.push([_[N],_[N+1]]);return I}var H={top:12,right:16,bottom:12,left:12};function padDomain(e,t,r,n,a){var s=r&&void 0!==r.padding?Number(r.padding):.05;if(!isFinite(s)||s<=0)return[e,t];var l=t-e;if(!isFinite(l)||l<=0)return[e,t];var h=l*Math.min(.5,s);return[n?e:e-h,a?t:t+h]}var z={enter:{duration:520,delay:0,easing:"easeOutCubic",stagger:.35},update:{duration:420,delay:0,easing:"easeOutCubic",stagger:0},highlight:{duration:260,delay:0,easing:"springSnappy",stagger:0}};function normalizeAnimation(e){if(!1===e)return{enabled:!1,enter:!1,update:!1,highlight:!1};var t=e||{},r=!1!==t.enabled,n={duration:t.duration,easing:t.easing,stagger:t.stagger,delay:t.delay},a=function stage(e){if(!1===t[e])return!1;var r=_objectSpread2({},z[e]);if("enter"===e)for(var a=0,s=Object.keys(n);a<s.length;a++){var l=s[a];void 0!==n[l]&&(r[l]=n[l])}return t[e]&&"object"===_typeof(t[e])&&Object.assign(r,t[e]),r};return{enabled:r,enter:a("enter"),update:a("update"),highlight:a("highlight")}}function normalizeAnnotation(e){if(!e||"object"!==_typeof(e))return null;var t=function list(e){return Array.isArray(e)?e.filter(function(e){return e&&"object"===_typeof(e)}):[]},r=t(e.lines),n=t(e.points),a=t(e.areas);return r.length||n.length||a.length?{lines:r,points:n,areas:a}:null}function normalizeOption(e){var t,r,n,a,s,l,h,u,c,p,v,m,g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||!Array.isArray(e.series))throw new Error("[ice-chart] option.series 必须是数组。");var b=resolveChartTheme(e.theme,{preferDark:!!g.preferDark}),k={legend:_objectSpread2({show:e.series.length>1,position:"top",itemWidth:12,itemHeight:12,itemGap:16,selectable:!0},e.legend||{}),tooltip:_objectSpread2({show:!0,trigger:"axis"},e.tooltip||{}),crosshair:_objectSpread2({show:!0,type:"line",axis:"x",showAxisLabel:!0},e.crosshair||{}),grid:_objectSpread2({show:!0,x:!1,y:!0,lineWidth:1},e.grid||{}),interaction:{hover:_objectSpread2({enabled:!0,mode:"nearest-x",dimOthers:!1},(null===(t=e.interaction)||void 0===t?void 0:t.hover)||{}),select:_objectSpread2({enabled:!1,mode:"single",toggle:!0},(null===(r=e.interaction)||void 0===r?void 0:r.select)||{}),brush:!1!==(null===(n=e.interaction)||void 0===n?void 0:n.brush)&&_objectSpread2({enabled:!1,axes:"x",mode:"select"},(null===(a=e.interaction)||void 0===a?void 0:a.brush)||{}),zoom:!1!==(null===(s=e.interaction)||void 0===s?void 0:s.zoom)&&_objectSpread2({enabled:!0,axes:"x",wheel:!0,wheelFactor:1.2,mode:"data"},(null===(l=e.interaction)||void 0===l?void 0:l.zoom)||{}),pan:!1!==(null===(h=e.interaction)||void 0===h?void 0:h.pan)&&_objectSpread2({enabled:!1,axes:"xy"},(null===(u=e.interaction)||void 0===u?void 0:u.pan)||{}),keyboard:void 0===(null===(c=e.interaction)||void 0===c?void 0:c.keyboard)||e.interaction.keyboard},animation:normalizeAnimation(e.animation),margin:_objectSpread2(_objectSpread2({},H),e.margin||{})};k.series=e.series,k.title=e.title,k.xAxis=e.xAxis||{},k.yAxis=e.yAxis||{},k.dataZoom=e.dataZoom||null,k.theme=e.theme,k.aspect="equal"===e.aspect?"equal":"auto",k.polarGrid=e.polarGrid||null,k.annotation=normalizeAnnotation(e.annotation),k.tooltip=_objectSpread2({show:!1!==(null===(p=e.tooltip)||void 0===p?void 0:p.show)},k.tooltip),k.crosshair=_objectSpread2({show:!1!==(null===(v=e.crosshair)||void 0===v?void 0:v.show)},k.crosshair);for(var S=e.radar||null,A=e.graph||null,w=function buildSeries(e,t,r,n,a,s,l){for(var h=[],u={},c=function _loop(r){var c=e[r];if(!c||!c.type)throw new Error("[ice-chart] series[".concat(r,"] 缺少 type。"));var p=c.name;p||(p="series-".concat(r+1)),void 0!==u[p]?(u[p]+=1,p="".concat(p," (").concat(u[p],")")):u[p]=0;var v=c.id||"series-".concat(r),m=c.color||t.colorPalette[r%t.colorPalette.length];if(c.virtual){var g=l&&l.virtualColumns?l.virtualColumns:null,b=g?g.get(v):void 0,k={id:v,index:r,type:c.type,name:p,color:m,points:[],virtual:!0,hasExplicitX:!0,hidden:!1,axisIndex:0},S=b&&"raw"in b&&(void 0===c.data||b.raw.data===c.data)?b.raw:null,A=!S&&b&&void 0===c.data?b:null,w=function takeLean(){var t=_objectSpread2(_objectSpread2({},c),{},{data:void 0});return e[r]=t,t};if(S)return h.push(_objectSpread2(_objectSpread2({},k),{},{option:c,raw:S,pointCount:S.length},rawAccessors(S))),0;if(A&&"ring"in A){var _=A.ring;return h.push(_objectSpread2(_objectSpread2({},k),{},{option:c,ring:_,pointCount:_.length},function ringAccessors(e){var t=function yAt(t){if(t<0||t>=e.length)return null;var r=ringYAt(e,t);return Number.isNaN(r)?null:r};return{pointAt:function pointAt(r){var n=t(r);return{index:r,xValue:ringXAt(e,r),y:n,raw:void 0,base:0,top:null===n?0:n,name:void 0}},xValueAt:function xValueAt(t){return t<0||t>=e.length?void 0:ringXAt(e,t)},yValueAt:t,baseAt:function baseAt(){return 0},topAt:function topAt(e){var r=t(e);return null===r?0:r},sizeAt:function sizeAt(){}}}(_))),0}if(A&&"chunks"in A){var M=A.chunks;return h.push(_objectSpread2(_objectSpread2({},k),{},{option:c,chunks:M,pointCount:M.total},chunkAccessors(M))),0}if(A&&"grid"in A){var C=A.grid;return h.push(_objectSpread2(_objectSpread2({},k),{},{option:c,grid:C,pointCount:C.values.length},gridAccessors(C))),0}if(A&&"columns"in A){var P=A.columns;return h.push(_objectSpread2(_objectSpread2({},k),{},{option:c,columns:P,pointCount:P.y.length},columnAccessors(P))),0}if("heatmap"===c.type){var T=function buildVirtualGrid(e,t){var r=function fail(e){throw new Error("[ice-chart] series[".concat(t,"].virtual ").concat(e))},n=e.data,a=[],s=[],l=null,h=0,u=!1;if(n&&!Array.isArray(n)&&"object"===_typeof(n)&&void 0!==n.values){var c=n;Array.isArray(c.xCategories)&&a.push.apply(a,_toConsumableArray(c.xCategories)),Array.isArray(c.yCategories)&&s.push.apply(s,_toConsumableArray(c.yCategories));var p=a.length,v=s.length;p&&v||r("的矩阵需要非空的 xCategories / yCategories。");var m=p*v,g=Number(c.values.length)||0;g!==m&&r("的 values 长度(".concat(g,")应等于 ").concat(p," × ").concat(v," = ").concat(m,"。")),l=c.values instanceof Float64Array?c.values:Float64Array.from(c.values,function(e){return null==e?NaN:Number(e)}),h=m}else if(Array.isArray(n)){u=!0;for(var b=new Map,k=new Map,S=[],A=0;A<n.length;A++){var w=n[A];if(Array.isArray(w)&&!(w.length<3)){var _=b.get(w[0]);void 0===_&&(_=a.length,b.set(w[0],_),a.push(w[0]));var M=k.get(w[1]);void 0===M&&(M=s.length,k.set(w[1],M),s.push(w[1]));var C=toNumber(w[2]);null!==C&&(S.push({col:_,row:M,value:C}),h+=1)}}var P=a.length,T=s.length;P&&T||r("的矩阵是空的(没有可用的 [x类目, y类目, 值] 数据项)。"),l=new Float64Array(P*T).fill(NaN);for(var I=0,N=S;I<N.length;I++){var D=N[I];l[D.row*P+D.col]=D.value}}else r("需要 data(矩阵 { xCategories, yCategories, values } 或 [x类目, y类目, 值] 数组)。");var O=a.length,R=s.length;u&&h/Math.max(1,O*R)<V&&r("的矩阵太稀疏(".concat(h,"/").concat(O*R," 格有值):虚拟热力图按稠密矩阵存,")+"稀疏数据请用普通路径(去掉 virtual)。");for(var H=l,z=new Map,L=new Map,E=0;E<O;E++)z.set(a[E],E);for(var B=0;B<R;B++)L.set(s[B],B);for(var j=1/0,W=-1/0,X=0;X<H.length;X++){var G=H[X];Number.isNaN(G)||(G<j&&(j=G),G>W&&(W=G))}return{xCategories:a,yCategories:s,values:H,xIndex:z,yIndex:L,valueDomain:isFinite(j)?[j,W]:null}}(c,r);return g&&g.set(v,{grid:T}),h.push(_objectSpread2(_objectSpread2({},k),{},{option:w(),grid:T,pointCount:T.values.length},gridAccessors(T))),0}if(function isChunkedInput(e){return!!e&&!Array.isArray(e)&&"object"===_typeof(e)&&Array.isArray(e.sizes)&&"function"==typeof e.loadChunk}(c.data)){var I=function buildVirtualChunks(e,t){var r=function fail(e){throw new Error("[ice-chart] series[".concat(t,"].virtual ").concat(e))},n=e.sizes;n.length||r("的分块需要至少一块(sizes 为空)。");var a,s=_createForOfIteratorHelper(n);try{for(s.s();!(a=s.n()).done;){var l=a.value;(!isFinite(Number(l))||Number(l)<=0)&&r("的 sizes 必须是正数(收到 ".concat(JSON.stringify(l),")。"))}}catch(e){s.e(e)}finally{s.f()}"function"!=typeof e.rangeOf&&r("的分块需要 rangeOf(i) 声明每块的 x 范围(否则窗口定位要先把块 load 一遍)。");var h=e.yDomain;Array.isArray(h)&&2===h.length&&h.every(function(e){return isFinite(Number(e))})||r("的分块需要声明式 yDomain: [min, max](亿级数据不能为了自动缩放把块全加载一遍)。");return function createChunks(e){var t,r=e.sizes.map(function(e){return Math.max(0,Math.floor(e)||0)}),n=[],a=0,s=_createForOfIteratorHelper(r);try{for(s.s();!(t=s.n()).done;){var l=t.value;n.push(a),a+=l}}catch(e){s.e(e)}finally{s.f()}var h=r.map(function(t,r){return e.rangeOf(r)}),u=h.filter(function(e){return!!e});return{kind:"chunks",sizes:r,offsets:n,total:a,ranges:h,resident:r.map(function(){return null}),loading:new Set,maxResident:Math.max(1,Math.floor(e.maxResidentChunks||4)),lru:[],load:e.load,xDomain:u.length?[Math.min.apply(Math,_toConsumableArray(u.map(function(e){return e[0]}))),Math.max.apply(Math,_toConsumableArray(u.map(function(e){return e[1]})))]:[0,1],yDomain:e.yDomain,xMonotonic:!0,sizeExtent:null}}({sizes:n.map(function(e){return Number(e)}),load:function load(t){var a=e.loadChunk(t),s=function normalize(e){e&&"object"===_typeof(e)&&void 0!==e.x&&void 0!==e.y||r("的 loadChunk(".concat(t,") 必须返回 { x, y }。"));for(var a=void 0===n[t]?0:Number(n[t]),s=e.x instanceof Float64Array?e.x:Float64Array.from(e.x,function(e){return Number(e)}),l=new Float64Array(a),h=0;h<a;h++){var u=e.y[h];l[h]=null==u||""===u?NaN:Number(u)}return s.length!==a&&r("的 loadChunk(".concat(t,") 返回了 ").concat(s.length," 个 x,但 sizes[").concat(t,"] 是 ").concat(a,"。")),{x:s,y:l}};return a&&"function"==typeof a.then?a.then(s):s(a)},rangeOf:e.rangeOf,yDomain:[Number(h[0]),Number(h[1])],maxResidentChunks:e.maxResidentChunks})}(c.data,r);return g&&g.set(v,{chunks:I}),h.push(_objectSpread2(_objectSpread2({},k),{},{option:w(),chunks:I,pointCount:I.total},chunkAccessors(I))),0}if(function isColumnarVirtualType(e){return"scatter"===e||"line"===e||"area"===e||"heatmap"===e}(c.type)){var N=function buildVirtualColumns(e,t){var r=function fail(e){throw new Error("[ice-chart] series[".concat(t,"].virtual ").concat(e))};"scatter"!==e.type&&"line"!==e.type&&"area"!==e.type&&r("目前只支持散点 / 折线 / 面积(scatter / line / area),收到 type: '".concat(e.type,"'。"));e.stack&&r("不支持堆叠(stack)。");var n=e.data,a=0,s=null,l=null,h=null,u=null,c=null,p=null;if(n&&!Array.isArray(n)&&"object"===_typeof(n)&&void 0!==n.x){var v=n;a=Number(v.y.length)||0,Number(v.x.length)!==a&&r("的 x / y 长度不一致(".concat(v.x.length," vs ").concat(v.y.length,")。")),s=function readX(e){return v.x[e]},l=function readY(e){return v.y[e]},h=v.size?function(e){return v.size[e]}:null,u=v.x instanceof Float64Array?v.x:null,c=v.y instanceof Float64Array?v.y:null,p=v.size instanceof Float64Array?v.size:null}else Array.isArray(n)?(a=n.length,s=function readX(e){return Array.isArray(n[e])?n[e][0]:e},l=function readY(e){return Array.isArray(n[e])?n[e][1]:n[e]},h=function readSize(e){return Array.isArray(n[e])&&n[e].length>2?n[e][2]:void 0}):r("需要 data(列式 { x, y }、元组数组或数值数组)。");var m=u&&u.length===a?u:new Float64Array(a),g=c&&c.length===a?c:new Float64Array(a);s&&l||r("的数据无法解析。");if(u&&u.length===a)for(var b=0;b<a;b++)isFinite(m[b])||r("需要数值型 x(第 ".concat(b," 项是 ").concat(JSON.stringify(m[b]),")。"));else for(var k=0;k<a;k++){var S=Number(s(k));isFinite(S)||r("需要数值型 x(第 ".concat(k," 项是 ").concat(JSON.stringify(s(k)),")。")),m[k]=S}for(var A=!1,w=p&&p.length===a?p:new Float64Array(a).fill(NaN),_=0;_<a;_++){var M=h?h(_):void 0;if(null!=M&&""!==M){var C=Number(M);isFinite(C)&&(w[_]=C,A=!0)}var P=toNumber(l(_));g[_]=null===P?NaN:P}for(var T=1/0,I=-1/0,N=1/0,D=-1/0,O=1/0,R=-1/0,H=!0,z=-1/0,V=0;V<a;V++){var L=m[V];L<T&&(T=L),L>I&&(I=L),L<z&&(H=!1),z=L;var E=g[V];Number.isNaN(E)||(E<N&&(N=E),E>D&&(D=E));var B=w[V];Number.isNaN(B)||(B<O&&(O=B),B>R&&(R=B))}isFinite(T)||(T=0,I=1);return{kind:"columns",x:m,y:g,size:A?w:null,xDomain:[T,I],yDomain:isFinite(N)?[N,D]:null,xMonotonic:H,sizeExtent:A?O===R?[O,O+1]:[O,R]:null}}(c,r);return g&&g.set(v,{columns:N}),h.push(_objectSpread2(_objectSpread2({},k),{},{option:w(),columns:N,pointCount:N.y.length},columnAccessors(N))),0}var D=function buildVirtualRawPoints(e,t){for(var r=Array.isArray(e.data)?e.data:[],n=r.length,a={type:e.type,xField:e.xField,yField:e.yField},s=1/0,l=-1/0,h=1/0,u=-1/0,c=1/0,p=-1/0,v=!0,m=-1/0,g=!1,b=[],k=new Map,S=new Map,A=0;A<n;A++){var w,_,M=readGenericPoint(r[A],A,a),C=String(M.xValue);0===(null!==(w=k.get(C))&&void 0!==w?w:0)&&(b.push(M.xValue),S.set(C,S.size)),k.set(C,(null!==(_=k.get(C))&&void 0!==_?_:0)+1);var P=Number(M.xValue);isFinite(P)?(P<s&&(s=P),P>l&&(l=P),P<m&&(v=!1),m=P):v=!1,null!==M.y&&(M.y<h&&(h=M.y),M.y>u&&(u=M.y)),"number"==typeof M.size&&isFinite(M.size)&&(g=!0,M.size<c&&(c=M.size),M.size>p&&(p=M.size))}isFinite(s)||(s=0,l=Math.max(0,n-1));return{kind:"raw",data:r,start:0,length:n,capacity:0,type:e.type,xField:e.xField,yField:e.yField,xDomain:[s,l],yDomain:isFinite(h)?[h,u]:null,xMonotonic:v,sizeExtent:g?c===p?[c,c+1]:[c,p]:null,categories:b,categoryCounts:k,categorySeq:S,categoryNext:S.size}}(c);return g&&g.set(v,{raw:D}),h.push(_objectSpread2(_objectSpread2({},k),{},{option:c,raw:D,pointCount:D.length},rawAccessors(D))),0}var O=function buildPoints(e,t,r,n,a){var s=Array.isArray(e.data)?e.data:[];if(!Array.isArray(e.data)&&e.data&&"object"===_typeof(e.data))throw new Error("[ice-chart] series 的列式 data({ x, y })需要配 virtual: true(当前 type: '".concat(e.type,"')。"));var l=[],h=!1;if("function"===e.type||"parametric"===e.type)return function buildCurvePoints(e,t){var r=[],n=e.params||{},a="function"===e.type,s=void 0===e.polarExpression||null===e.polarExpression?"":String(e.polarExpression).trim(),l=!a&&""!==s,h=a?String(e.expression||""):l?s:String(e.xExpression||""),u=a||l?"":String(e.yExpression||""),c=null,p=null;try{c=compileExpression(h),a||l||(p=compileExpression(u))}catch(e){c=null,p=null}var v=a?[-10,10]:[0,2*Math.PI],m=Array.isArray(e.domain)&&e.domain.length>=2?e.domain:null,g=m?Number(m[0]):v[0],b=m?Number(m[1]):v[1];if(a&&t&&Array.isArray(t.xDomain)&&t.xDomain.length>=2){var k=Number(t.xDomain[0]),S=Number(t.xDomain[1]);isFinite(k)&&isFinite(S)&&S>k&&(g=k,b=S)}isFinite(g)&&isFinite(b)&&b!==g||(g=v[0],b=v[1]);for(var A=Number(e.samples),w=Math.max(24,Math.min(6e3,isFinite(A)&&A>0?Math.round(A):a?240:360)),_=_objectSpread2({},n),M=a?"x":"t",C=0;C<w;C++){var P=g+(b-g)*C/(w-1);_[M]=P;var T=P,I=NaN,N=NaN;c&&(a?I=c.evaluate(_):l?(T=(N=c.evaluate(_))*Math.cos(P),I=N*Math.sin(P)):p&&(T=c.evaluate(_),I=p.evaluate(_)));var D=isFinite(T)&&isFinite(I);r.push({index:C,xValue:P,y:D?I:null,raw:a?{x:P,y:I}:l?{t:P,x:T,y:I,r:N}:{t:P,x:T,y:I},base:0,top:D?I:0,name:a?h:l?"r = ".concat(h):"(".concat(h,", ").concat(u,")")})}return{points:r,hasExplicitX:!0}}(e,a);if("graph"===e.type&&n){for(var u=Array.isArray(n.nodes)?n.nodes:[],c=Array.isArray(n.links)?n.links:[],p=function indexOf(e){return"number"==typeof e?e:u.findIndex(function(t){return t.id===e||t.name===e})},v=0;v<u.length;v++){var m=u[v],g=toNumber(m.value);l.push({index:v,xValue:m.name,y:g,raw:m,base:0,top:null===g?0:g,name:m.name})}for(var b=0;b<c.length;b++){var k=c[b],S=p(k.source),A=p(k.target),w="".concat(S>=0?u[S].name:String(k.source)," → ").concat(A>=0?u[A].name:String(k.target)),_=toNumber(k.value);l.push({index:u.length+b,xValue:w,y:null===_?1:_,raw:{__graphLink:!0,source:k.source,target:k.target,value:k.value},base:0,top:null===_?1:_,name:w})}return{points:l,hasExplicitX:!0}}if("sankey"===e.type&&r){var M,C=Array.isArray(r.nodes)?r.nodes:[],P=Array.isArray(r.links)?r.links:[],T=new Array(C.length).fill(0),I=new Array(C.length).fill(0),N=function _indexOf(e){return"number"==typeof e?e:C.findIndex(function(t){return t.name===e})},D=_createForOfIteratorHelper(P);try{for(D.s();!(M=D.n()).done;){var O=M.value,R=N(O.source),H=N(O.target),z=Number(O.value)||0;R>=0&&(I[R]+=z),H>=0&&(T[H]+=z)}}catch(e){D.e(e)}finally{D.f()}for(var V=T.map(function(e,t){return Math.max(e,I[t])}),L=0;L<C.length;L++){var E=C[L];l.push({index:L,xValue:E.name,y:V[L],raw:E,base:0,top:V[L],name:E.name})}for(var B=0;B<P.length;B++){var j=P[B],W=N(j.source),X=N(j.target),G="".concat(W>=0?C[W].name:String(j.source)," → ").concat(X>=0?C[X].name:String(j.target));l.push({index:C.length+B,xValue:G,y:Number(j.value)||0,raw:{__sankeyLink:!0,source:j.source,target:j.target,value:j.value},base:0,top:Number(j.value)||0,name:G})}return{points:l,hasExplicitX:!0}}if("radar"===e.type&&t&&Array.isArray(t.indicators)){for(var U=0;U<t.indicators.length;U++){var K=t.indicators[U],Y=s[U],q=Y&&"object"===_typeof(Y)&&!Array.isArray(Y)&&void 0!==Y.value?toNumber(Y.value):toNumber(Y);l.push({index:U,xValue:K.name,y:q,raw:Y,base:0,top:null===q?0:q,name:K.name})}return{points:l,hasExplicitX:!0}}if("heatmap"===e.type){for(var $=0;$<s.length;$++){var Z=s[$];if(!Array.isArray(Z)||Z.length<3)l.push({index:$,xValue:$,y:null,raw:Z,base:0,top:0});else{var J=toNumber(Z[2]);h=!0,l.push({index:$,xValue:Z[0],y:J,raw:Z,base:0,top:null===J?0:J,name:String(Z[1])})}}return{points:l,hasExplicitX:h}}if("boxplot"===e.type){for(var Q=0;Q<s.length;Q++){var ee=s[Q],te=Array.isArray(ee)?ee.map(function(e){return Number(e)}):null;if(te&&te.length){var ie=5===te.length?[te[0],te[1],te[2],te[3],te[4]]:computeBoxplotSummary(te);h=!0,l.push({index:Q,xValue:Q,y:ie[2],raw:ee,base:0,top:ie[2],boxplot:ie})}else l.push({index:Q,xValue:Q,y:null,raw:ee,base:0,top:0})}return{points:l,hasExplicitX:h}}if("waterfall"===e.type){for(var re=0;re<s.length;re++){var ne=s[re],ae=null,oe=void 0;if("number"==typeof ne)ae=toNumber(ne);else if(ne&&"object"===_typeof(ne)&&!Array.isArray(ne)){var se=ne;ae=toNumber(void 0===se.value?se.y:se.value),void 0!==se.name&&(oe=String(se.name))}else ae=toNumber(ne);h=!0,l.push({index:re,xValue:void 0===oe?re:oe,y:ae,raw:ne,base:0,top:null===ae?0:ae,name:oe})}return{points:l,hasExplicitX:h}}if("treemap"===e.type){var le=[],he=function visit(e,t){var r,n=_createForOfIteratorHelper(e.slice().sort(function(e,t){return treemapNodeValue(t)-treemapNodeValue(e)}));try{for(n.s();!(r=n.n()).done;){var a=r.value;le.push({node:a,depth:t}),Array.isArray(a&&a.children)&&a.children.length&&he(a.children,t+1)}}catch(e){n.e(e)}finally{n.f()}};Array.isArray(e.data)&&he(e.data,0);for(var ue=0;ue<le.length;ue++){var ce=le[ue].node,de=treemapNodeValue(ce);l.push({index:ue,xValue:ce&&void 0!==ce.name?ce.name:ue,y:de,raw:ce,base:0,top:de,name:ce&&void 0!==ce.name?String(ce.name):String(ue)})}return{points:l,hasExplicitX:!0}}for(var fe=0;fe<s.length;fe++){var pe=s[fe],ve=readGenericPoint(pe,fe,e);ve.explicitX&&(h=!0),l.push({index:fe,xValue:ve.xValue,y:ve.y,raw:pe,base:0,top:null===ve.y?0:ve.y,name:ve.name,size:ve.size})}return{points:l,hasExplicitX:h}}(c,n,a,s,l),R=O.points,H=O.hasExplicitX;if("pie"===c.type)for(var z=0;z<R.length;z++){var L=R[z].raw,E=L&&"object"===_typeof(L)&&!Array.isArray(L)?L.color:void 0;R[z].color=E||(0===z&&c.color?c.color:t.colorPalette[z%t.colorPalette.length])}var B=_objectSpread2(_objectSpread2({id:v,index:r,type:c.type,name:p,color:m,option:c,points:R,virtual:!1,pointCount:R.length},function arrayAccessors(e){return{pointAt:function pointAt(t){return e[t]},xValueAt:function xValueAt(t){return e[t].xValue},yValueAt:function yValueAt(t){return e[t].y},baseAt:function baseAt(t){return e[t].base},topAt:function topAt(t){return e[t].top},sizeAt:function sizeAt(t){return e[t].size}}}(R)),{},{hasExplicitX:H,hidden:!1,axisIndex:0});!function applyCurveDomain(e,t,r){if("function"!==t.type&&"parametric"!==t.type)return;for(var n=[],a=[],s=0,l=e.pointCount;s<l;s++){var h=e.pointAt(s).raw;h&&"object"===_typeof(h)&&("number"==typeof h.x&&a.push(h.x),"number"==typeof h.y&&n.push(h.y))}var u=n.filter(function(e){return isFinite(e)});u.length&&(e.domainValues=robustRange(u));if("parametric"===t.type){var c=a.filter(function(e){return isFinite(e)});c.length&&(e.domainXValues=[Math.min.apply(Math,_toConsumableArray(c)),Math.max.apply(Math,_toConsumableArray(c))])}var p=t.params||{},v=[];if("function"===t.type)v=diagnoseExpression(String(t.expression||""),{variable:"x",params:p,values:n});else if(void 0!==t.polarExpression&&null!==t.polarExpression&&""!==String(t.polarExpression).trim()){for(var m=[],g=0,b=e.pointCount;g<b;g++){var k=e.pointAt(g).raw;k&&"object"===_typeof(k)&&"number"==typeof k.r&&m.push(k.r)}v=diagnoseExpression(String(t.polarExpression),{variable:"t",params:p,values:m}).map(function(e){return _objectSpread2(_objectSpread2({},e),{},{message:"r(θ):".concat(e.message)})})}else{var S=String(t.xExpression||""),A=String(t.yExpression||""),w=expressionVariables(S),_=expressionVariables(A),M=function withPrefix(e,t){return e.map(function(e){return _objectSpread2(_objectSpread2({},e),{},{message:"".concat(t,":").concat(e.message)})})};v=[].concat(_toConsumableArray(M(diagnoseExpression(S,{variable:"t",params:p,values:a,additionalVariables:_}),"x(t)")),_toConsumableArray(M(diagnoseExpression(A,{variable:"t",params:p,values:n,additionalVariables:w}),"y(t)")))}if(v.length){e.expressionDiagnostics=v;var C=v.find(function(e){return"error"===e.severity});C&&(e.expressionError=C.message)}}(B,c),h.push(B)},p=0;p<e.length;p++)c(p);return h}(e.series,b,null===(m=k.legend)||void 0===m||m.selected,S,e.sankey||null,A,g),_=0,M=w;_<M.length;_++){var C=M[_];if("waterfall"===C.type){var P=C.option.waterfall,T=void 0!==P?P:e.waterfall;void 0!==T&&(C.waterfallOption=T)}}for(var I=_objectSpread2({},g.hiddenIds||{}),N=0,D=w;N<D.length;N++){var O,R=D[N];null!==(O=k.legend)&&void 0!==O&&O.selected&&!1===k.legend.selected[R.name]&&(I[R.id]=!0),R.hidden=!!I[R.id]||!1===R.option.show}var z=w.some(function(e){return"pie"===e.type})?"polar":w.some(function(e){return"radar"===e.type})?"radar":w.some(function(e){return"sankey"===e.type})?"sankey":w.some(function(e){return"funnel"===e.type})?"funnel":w.some(function(e){return"gauge"===e.type})?"gauge":w.some(function(e){return"liquid"===e.type})?"liquid":w.some(function(e){return"treemap"===e.type})?"treemap":w.some(function(e){return"graph"===e.type})?"graph":"cartesian",L="sankey"===z&&e.sankey||null,E="funnel"===z?e.funnel||{}:null,B="gauge"===z?e.gauge||{}:null,j="liquid"===z?e.liquid||{}:null,W="treemap"===z?e.treemap||{}:null,X="graph"===z?A:null,G=_objectSpread2({},g.hiddenSlices||{}),U=S?function buildRadarDomains(e,t){for(var r=[],n=Array.isArray(e.indicators)?e.indicators.length:0,a=0;a<n;a++){var s,l=e.indicators[a]||{name:String(a)},h=-1/0,u=_createForOfIteratorHelper(t);try{for(u.s();!(s=u.n()).done;){var c=s.value;if("radar"===c.type&&!c.hidden){var p=c.pointAt(a);p&&null!==p.y&&p.y>h&&(h=p.y)}}}catch(e){u.e(e)}finally{u.f()}isFinite(h)||(h=1);var v=isFiniteNumber(l.min)?l.min:0,m=isFiniteNumber(l.max)?l.max:h;r.push([v,m>v?m:v+1])}return r}(S,w):[];"cartesian"===z||e.tooltip&&void 0!==e.tooltip.trigger||(k.tooltip.trigger="item");var K=k.xAxis;"value"===K.type&&(K.type="linear");var Y=Array.isArray(e.yAxis)?e.yAxis:[e.yAxis||{}];Y.length||Y.push({});var q,$=_createForOfIteratorHelper(Y);try{for($.s();!(q=$.n()).done;){var Z=q.value;"value"===Z.type&&(Z.type="linear")}}catch(e){$.e(e)}finally{$.f()}for(var J=0,Q=w;J<Q.length;J++){var ee=Q[J],te=Number(ee.option.yAxisIndex);ee.axisIndex=isFinite(te)?Math.max(0,Math.min(Y.length-1,Math.floor(te))):0}var ie=function isHorizontalLayout(e,t){var r="category"===t.type||Array.isArray(t.data)&&t.data.length>0;return!!r&&!("category"===e.type||Array.isArray(e.data)&&e.data.length>0)}(K,Y[0]);!ie||e.tooltip&&void 0!==e.tooltip.trigger||(k.tooltip.trigger="item"),function applyAxisCategories(e,t){if(!e||!Array.isArray(e.data)||!e.data.length)return;var r,n=e.data,a=_createForOfIteratorHelper(t);try{for(a.s();!(r=a.n()).done;){var s=r.value;if(!s.virtual)for(var l=0,h=s.pointCount;l<h;l++){var u=s.pointAt(l);u.xValue===u.index&&(void 0!==n[u.index]&&(u.xValue=n[u.index],void 0===u.name&&(u.name=String(n[u.index]))))}}}catch(e){a.e(e)}finally{a.f()}}(ie?Y[0]:K,w);var re,ne,ae,oe=ie?K.type&&"category"!==K.type?K.type:"linear":function resolveXAxisType(e,t){if(e.type)return e.type;if(t.some(function(e){return"bar"===e.type||"heatmap"===e.type||"boxplot"===e.type||"waterfall"===e.type}))return"category";var r,n=[],a=_createForOfIteratorHelper(t);try{for(a.s();!(r=a.n()).done;)for(var s=r.value,l=0,h=s.pointCount;l<h&&(n.push(s.xValueAt(l)),!(n.length>2e3));l++);}catch(e){a.e(e)}finally{a.f()}if(n.some(function(e){return e instanceof Date}))return"time";if(n.some(function(e){return"number"==typeof e&&Math.abs(e)>1e11}))return"time";if(n.some(function(e){return"string"==typeof e&&!isFinite(Number(e))}))return"category";return"linear"}(K,w),se=w.some(function(e){return!!(e.columns||e.ring||e.chunks)});if(se&&("category"===oe||ie))throw new Error("[ice-chart] 虚拟(列存)系列只支持数值型 x 轴(xAxis.type 不要写 category)。");if(w.some(function(e){return e.grid})){if("category"!==oe)throw new Error("[ice-chart] 虚拟(列存)热力图的 x 轴必须是类目轴(xAxis.type: 'category')。");var le=Y[0]&&Y[0].type;if(void 0!==le&&"category"!==le)throw new Error("[ice-chart] 虚拟(列存)热力图的 y 轴必须是类目轴(yAxis.type 不要写别的)。")}if(ie){re=buildYDomain(w,0,K,oe),ne=[];var he=function buildCategoryValues(e,t){if(Array.isArray(e.data)&&e.data.length)return e.data.slice();var r,n={},a=[],s=_createForOfIteratorHelper(t);try{for(s.s();!(r=s.n()).done;){var l=r.value;if(l.raw){var h,u=_createForOfIteratorHelper(l.raw.categories);try{for(u.s();!(h=u.n()).done;){var c=h.value,p=String(c);n[p]||(n[p]=!0,a.push(c))}}catch(e){u.e(e)}finally{u.f()}}else for(var v=0,m=l.pointCount;v<m;v++){var g=l.pointAt(v),b=void 0===g.name?g.xValue:g.name,k=String(b);n[k]||(n[k]=!0,a.push(b))}}}catch(e){s.e(e)}finally{s.f()}return a}(Y[0],w);Y[0]=_objectSpread2(_objectSpread2({},Y[0]),{},{type:"category"}),Y[0].__categories=he}else{var ue=function buildXDomain(e,t,r){if("category"===e){var n=t.find(function(e){return e.grid});if(n&&n.grid)return{domain:n.grid.xCategories.slice(),categories:n.grid.xCategories.slice()};if(Array.isArray(r.data)&&r.data.length)return{domain:r.data.slice(),categories:r.data.slice()};var a={},s=[];if(1===t.length&&t[0].raw){var l=t[0].raw,h=l.categories.slice();return{domain:h,categories:h,categoryLookup:function categoryLookup(e){return function rawCategoryIndex(e,t){var r=e.categorySeq.get(t);if(void 0===r)return-1;var n=e.categories[0];if(void 0===n)return 0;var a=e.categorySeq.get(String(n));return r-(void 0===a?0:a)}(l,e)}}}var u,c=_createForOfIteratorHelper(t);try{for(c.s();!(u=c.n()).done;){var p=u.value;if(p.raw){var v,m=_createForOfIteratorHelper(p.raw.categories);try{for(m.s();!(v=m.n()).done;){var g=v.value,b=String(g);a[b]||(a[b]=!0,s.push(g))}}catch(e){m.e(e)}finally{m.f()}}else for(var k=0,S=p.pointCount;k<S;k++){var A=p.xValueAt(k),w=String(A);a[w]||(a[w]=!0,s.push(A))}}}catch(e){c.e(e)}finally{c.f()}return{domain:s,categories:s}}var _,M=[],C=_createForOfIteratorHelper(t);try{for(C.s();!(_=C.n()).done;){var P=_.value,T=storeDomainOf(P);if(T)M.push(T.xDomain[0],T.xDomain[1]);else if(P.domainXValues&&P.domainXValues.length){var I,N=_createForOfIteratorHelper(P.domainXValues);try{for(N.s();!(I=N.n()).done;){var D=I.value;isFinite(D)&&M.push(D)}}catch(e){N.e(e)}finally{N.f()}}else for(var O=0,R=P.pointCount;O<R;O++){var H=P.xValueAt(O),z="time"===e?toTimestamp(H):Number(H);isFinite(z)&&M.push(z)}}}catch(e){C.e(e)}finally{C.f()}var V=_slicedToArray(extent(M),2),L=V[0],E=V[1],B=isFiniteNumber(r.min),j=isFiniteNumber(r.max);B&&(L=r.min);j&&(E=r.max);if(!1!==r.nice){var W=_slicedToArray(niceDomain([L,E],r.tickCount||5),2);L=W[0],E=W[1]}if("log"!==e){var X=_slicedToArray(padDomain(L,E,r,B,j),2);L=X[0],E=X[1]}return{domain:[L,E],categories:[]}}(oe,w,K);re=ue.domain,ne=ue.categories,ae=ue.categoryLookup}var ce=function resolveXDomain(e,t,r){if(!r)return t;if("category"!==e)return[r[0],r[1]];var n=t.indexOf(r[0]),a=t.indexOf(r[1]);return n>=0&&a>=n?t.slice(n,a+1):t}(oe,re,g.xDomain);ae&&ce===re||(ae=void 0),function applyStacking(e){var t,r={},n=_createForOfIteratorHelper(e);try{for(n.s();!(t=n.n()).done;){var a=t.value;if(!a.virtual)if(a.option.stack){var s="".concat(a.axisIndex,"::").concat(a.option.stack);(r[s]=r[s]||[]).push(a)}else for(var l=0,h=a.pointCount;l<h;l++){var u=a.pointAt(l);u.base=0,u.top=null===u.y?0:u.y}}}catch(e){n.e(e)}finally{n.f()}for(var c in r){var p,v={},m=_createForOfIteratorHelper(r[c]);try{for(m.s();!(p=m.n()).done;)for(var g=p.value,b=0,k=g.pointCount;b<k;b++){var S=g.pointAt(b),A=String(S.xValue),w=v[A]||0,_=null===S.y?0:S.y;S.base=w,S.top=w+_,v[A]=S.top}}catch(e){m.e(e)}finally{m.f()}}}(w),function applyWaterfall(e){var t,r=_createForOfIteratorHelper(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;if("waterfall"===n.type&&!n.virtual)for(var a=0,s=0,l=n.pointCount;s<l;s++){var h=n.pointAt(s),u=h.raw,c=!(!u||"object"!==_typeof(u)||Array.isArray(u)||!u.total),p=h.y||0;c?(h.base=0,h.top=a):(h.base=a,h.top=a+p,a+=p)}}}catch(e){r.e(e)}finally{r.f()}}(w);var de={option:K,type:oe,domain:ce,scale:null,index:0,position:"left"},fe=w.some(function(e){return"heatmap"===e.type}),pe=Y.map(function(e,t){if(ie&&0===t)return{option:e,type:"category",domain:e.__categories||[],scale:null,index:t,position:e.position||"left"};if(fe&&(void 0===e.type||"category"===e.type)){for(var r={},n=[],a=0,s=w;a<s.length;a++){var l=s[a];if("heatmap"===l.type)if(l.grid){var h,u=_createForOfIteratorHelper(l.grid.yCategories);try{for(u.s();!(h=u.n()).done;){var c=h.value,p=String(c);r[p]||(r[p]=!0,n.push(c))}}catch(e){u.e(e)}finally{u.f()}}else for(var v=0,m=l.pointCount;v<m;v++){var b=l.pointAt(v),k=String(void 0===b.name?b.xValue:b.name);r[k]||(r[k]=!0,n.push(void 0===b.name?b.xValue:b.name))}}return{option:e,type:"category",domain:n,scale:null,index:t,position:e.position||(0===t?"left":"right")}}var S=e.type||"linear",A=g.yDomains?g.yDomains[t]:0===t?g.yDomain:null;return{option:e,type:S,domain:A||buildYDomain(w,t,e,S),scale:null,index:t,position:e.position||(0===t?"left":"right")}}),ve=pe[0];return function applyEqualAspect(e,t,r,n){if("equal"!==e.aspect||"cartesian"!==t)return;if("category"===r.type)return;var a=n[0];if(!a||"category"===a.type)return;var s=Number(r.domain[0]),l=Number(r.domain[1]),h=Number(a.domain[0]),u=Number(a.domain[1]);if(![s,l,h,u].every(function(e){return isFinite(e)}))return;var c=Math.abs(l-s),p=Math.abs(u-h),v=Math.max(c,p);if(!(v>0))return;if(c<v){var m=(s+l)/2;r.domain=[m-v/2,m+v/2]}if(p<v){var g=(h+u)/2;a.domain=[g-v/2,g+v/2]}}(e,z,de,pe),ae&&de.domain===ce&&(de.categoryLookup=ae),{labels:_objectSpread2({chart:"图表",sector:"扇区",value:"数值",ratio:"占比",indicator:"指标",coordinate:"坐标",liquid:"水位",slice:"切片"},e.labels||{}),kind:z,orientation:ie?"horizontal":"vertical",radar:S,sankey:L,funnel:E,gauge:B,liquid:j,treemap:W,graph:X,radarDomains:U,option:k,theme:b,series:w,xAxis:de,yAxes:pe,yAxis:ve,categories:ne,visibleSeries:w.filter(function(e){return!e.hidden}),hiddenIds:I,hiddenSlices:G}}var V=.25;function expressionVariables(e){try{return compileExpression(e).variables}catch(e){return[]}}function buildYDomain(e,t,r,n){var a,s=[],l=!1,h=_createForOfIteratorHelper(e);try{for(h.s();!(a=h.n()).done;){var u=a.value;if(!u.hidden&&u.axisIndex===t){"bar"!==u.type&&"area"!==u.type||(l=!0);var c=storeDomainOf(u);if(c)c.yDomain&&s.push(c.yDomain[0],c.yDomain[1]);else if(u.domainValues&&u.domainValues.length){var p=_slicedToArray(robustRange(u.domainValues),2),v=p[0],m=p[1];s.push(v,m)}else for(var g=0,b=u.pointCount;g<b;g++){var k=u.pointAt(g);null!==k.y&&s.push(k.y),k.boxplot&&s.push(k.boxplot[0],k.boxplot[4]),u.option.stack&&(s.push(k.base),s.push(k.top)),"waterfall"===u.type&&s.push(k.base,k.top)}}}}catch(e){h.e(e)}finally{h.f()}var S=_slicedToArray(extent(s),2),A=S[0],w=S[1];l&&(A=Math.min(A,0),w=Math.max(w,0));var _=isFiniteNumber(r.min),M=isFiniteNumber(r.max);if(_&&(A=r.min),M&&(w=r.max),!1!==r.nice&&"log"!==n){var C=_slicedToArray(niceDomain([A,w],r.tickCount||5),2);A=C[0],w=C[1]}if("log"!==n){var P=l&&!_&&Math.abs(A)<1e-12,T=l&&!M&&Math.abs(w)<1e-12,I=_slicedToArray(padDomain(A,w,r,_||P,M||T),2);A=I[0],w=I[1]}if("log"===n){var N=s.filter(function(e){return e>0});N.length?(A=Math.min.apply(Math,_toConsumableArray(N)),w=Math.max.apply(Math,_toConsumableArray(N))):(A=1,w=10),isFiniteNumber(r.min)&&r.min>0&&(A=r.min),isFiniteNumber(r.max)&&r.max>0&&(w=r.max)}return[round(A,10),round(w,10)]}function treemapNodeValue(e){if(!e)return 0;if(Array.isArray(e.children)&&e.children.length)return e.children.reduce(function(e,t){return e+treemapNodeValue(t)},0);var t=Number(e.value);return isFinite(t)&&t>0?t:0}function computeBoxplotSummary(e){var t=e.filter(function(e){return isFinite(e)}).sort(function(e,t){return e-t});if(!t.length)return[0,0,0,0,0];var r=function quantile(e){var r=(t.length-1)*e,n=Math.floor(r),a=Math.ceil(r);return n===a?t[n]:t[n]+(t[a]-t[n])*(r-n)};return[t[0],r(.25),r(.5),r(.75),t[t.length-1]]}function toSerializableOption(e){if(null==e)return e;if(Array.isArray(e))return e.map(toSerializableOption);if("function"!=typeof e){if("object"===_typeof(e)){var t={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=toSerializableOption(e[r]);void 0!==n&&(t[r]=n)}return t}return e}}function chartThemeToEnginePatch(e){var t=Array.isArray(e.colorPalette)&&e.colorPalette.length?e.colorPalette:["#0D6EFD"],r=function pick(e,r){return t[e]||t[0]||r};return{palette:t,chrome:{selection:{stroke:e.selection.stroke},handle:{fill:r(0,"#0D6EFD")},linkHook:{fill:r(1,"#198754")},slot:{fill:r(1,"#198754"),hoverFill:r(2,"#FFC107")},guide:{color:r(0,"#0D6EFD")},linkLabel:{background:e.tooltip.background,fill:e.tooltip.textColor},textSelection:{color:e.brush.fill},shadow:{sm:e.tooltip.shadowColor,md:e.tooltip.shadowColor,lg:e.tooltip.shadowColor}},base:{fontFamily:{base:e.fontFamily},fontSize:{md:e.fontSize}}}}function applyChartThemeToEngine(e,t){if(!e||"function"!=typeof e.setTheme)throw new Error("applyChartThemeToEngine(ice, theme) 需要一个 ICE 实例");var r=chartThemeToEnginePatch(t);return"function"==typeof e.setThemePatch?e.setThemePatch("ice-chart",r):e.setTheme(r),e}function formatNumberTick(e,t){if(!isFinite(e))return String(e);var r=Math.abs(e);if(0!==r&&(r>=1e9||r<1e-4))return e.toExponential(1);var n=0;t>0&&t<1?n=Math.min(6,Math.ceil(-Math.log10(t))):Number.isInteger(e)||(n=2);var a=e.toFixed(n),s=_slicedToArray((n>0?a.replace(/\.?0+$/,""):a).split("."),2),l=s[0],h=s[1],u=l.replace(/\B(?=(\d{3})+(?!\d))/g,",");return h?"".concat(u,".").concat(h):u}function formatTick(e,t,r,n){if("function"==typeof n){var a=n(e,r);return null==a?"":String(a)}return"time"===t.type?t.format(e,r):"linear"===t.type||"log"===t.type?formatNumberTick(Number(e),function tickStep(e){for(var t=e.ticks(5),r=1/0,n=1;n<t.length;n++){var a=Math.abs(Number(t[n])-Number(t[n-1]));a>0&&a<r&&(r=a)}return isFinite(r)?r:0}(t)):String(e)}var L=function(){function LinearScale(e,t){_classCallCheck(this,LinearScale),_defineProperty(this,"type","linear"),this.domain=function normalize(e){var t=Number(e[0]),r=Number(e[1]);if(t===r){var n=Math.abs(t)>1?.1*Math.abs(t):1;return[t-n,r+n]}return[t,r]}(e),this.range=t}return _createClass(LinearScale,[{key:"map",value:function map(e){var t=Number(e);if(!isFinite(t))return NaN;var r=_slicedToArray(this.domain,2),n=r[0],a=r[1],s=_slicedToArray(this.range,2),l=s[0];return l+(t-n)/(a-n)*(s[1]-l)}},{key:"invert",value:function invert(e){var t=_slicedToArray(this.domain,2),r=t[0],n=t[1],a=_slicedToArray(this.range,2),s=a[0],l=a[1];return l===s?r:r+(e-s)/(l-s)*(n-r)}},{key:"ticks",value:function ticks(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=_slicedToArray(this.domain,2),r=t[0],n=t[1],a=niceStep(n-r,e),s=[],l=Math.ceil(r/a)*a;l<=n+1e-6*a&&s.length<1e3;l+=a)s.push(round(l));return s}},{key:"bandwidth",value:function bandwidth(){return 0}},{key:"bandStart",value:function bandStart(e){return this.map(e)}},{key:"step",value:function step(){var e=this.ticks(5);return e.length>1?Math.abs(e[1]-e[0]):0}},{key:"isBand",value:function isBand(){return!1}},{key:"indexAt",value:function indexAt(e){return-1}},{key:"fractionOf",value:function fractionOf(e){var t=_slicedToArray(this.domain,2),r=t[0],n=t[1];return n===r?0:(Number(e)-r)/(n-r)}},{key:"valueAtFraction",value:function valueAtFraction(e){var t=_slicedToArray(this.domain,2),r=t[0];return r+e*(t[1]-r)}},{key:"span",value:function span(){return this.domain[1]-this.domain[0]}},{key:"format",value:function format(e,t){for(var r=this.ticks(5),n=1/0,a=1;a<r.length;a++){var s=Math.abs(r[a]-r[a-1]);s>0&&s<n&&(n=s)}return formatNumberTick(Number(e),isFinite(n)?n:0)}},{key:"clone",value:function clone(){return new LinearScale([this.domain[0],this.domain[1]],[this.range[0],this.range[1]])}}])}();var E=function(){function BandScale(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};_classCallCheck(this,BandScale),_defineProperty(this,"type","category"),_defineProperty(this,"indexCache",null),_defineProperty(this,"indexCacheDomain",null),this.domain=e.length?e.slice():[""],this.range=t,this.paddingInner=void 0===r.paddingInner?.2:r.paddingInner,this.paddingOuter=void 0===r.paddingOuter?.1:r.paddingOuter,this.lookup=r.categoryLookup||null,this._step=this.computeStep()}return _createClass(BandScale,[{key:"computeStep",value:function computeStep(){var e=Math.max(1,this.domain.length),t=_slicedToArray(this.range,2),r=t[0],n=t[1],a=Math.abs(n-r),s=e-this.paddingInner+2*this.paddingOuter;return a/Math.max(1e-4,s)}},{key:"indexOf",value:function indexOf(e){if(null!==e&&"object"===_typeof(e)){var t=this.domain.indexOf(e);if(-1!==t)return t}var r=String(e);if(this.lookup){var n=this.lookup(r);if(n>=0)return n}var a=this.indices().get(r);return void 0!==a?a:-1}},{key:"indices",value:function indices(){if(this.indexCache&&this.indexCacheDomain===this.domain)return this.indexCache;for(var e=new Map,t=0;t<this.domain.length;t++){var r=String(this.domain[t]);e.has(r)||e.set(r,t)}return this.indexCache=e,this.indexCacheDomain=this.domain,e}},{key:"map",value:function map(e){return this.bandStart(e)+this.bandwidth()/2}},{key:"bandStart",value:function bandStart(e,t){var r=void 0!==t&&t>=0?t:this.indexOf(e);return r<0?NaN:_slicedToArray(this.range,1)[0]+(this.range[1]>=this.range[0]?1:-1)*(this.paddingOuter*this._step+r*this._step)}},{key:"bandwidth",value:function bandwidth(){return this._step*(1-this.paddingInner)}},{key:"step",value:function step(){return this._step}},{key:"isBand",value:function isBand(){return!0}},{key:"ticks",value:function ticks(){return this.domain.slice()}},{key:"indexAt",value:function indexAt(e){for(var t=this.bandwidth(),r=this.range[1]>=this.range[0]?1:-1,n=0;n<this.domain.length;n++){var a=this.bandStart(void 0,n),s=a+r*t,l=Math.min(a,s),h=Math.max(a,s);if(e>=l&&e<=h)return n}return-1}},{key:"invert",value:function invert(e){var t=this.indexAt(e);if(t>=0)return this.domain[t];for(var r=0,n=1/0,a=0;a<this.domain.length;a++){var s=Math.abs(this.map(this.domain[a])-e);s<n&&(n=s,r=a)}return this.domain[r]}},{key:"nearestIndex",value:function nearestIndex(e){var t=this.indexAt(e);if(t>=0)return t;for(var r=0,n=1/0,a=0;a<this.domain.length;a++){var s=Math.abs(this.map(this.domain[a])-e);s<n&&(n=s,r=a)}return r}},{key:"fractionOf",value:function fractionOf(e){var t=this.indexOf(e);return t<0?0:this.domain.length<=1?.5:(t+.5)/this.domain.length}},{key:"valueAtFraction",value:function valueAtFraction(e){var t=this.domain.length;if(t){var r=Math.max(0,Math.min(t-1,Math.round(e*t-.5)));return this.domain[r]}}},{key:"span",value:function span(){return this.domain.length}},{key:"format",value:function format(e){return null==e?"":String(e)}},{key:"clone",value:function clone(){return new BandScale(this.domain.slice(),[this.range[0],this.range[1]],{paddingInner:this.paddingInner,paddingOuter:this.paddingOuter,categoryLookup:this.lookup||void 0})}}])}(),B=function(){function LogScale(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};_classCallCheck(this,LogScale),_defineProperty(this,"type","log"),this.base=r.logBase&&r.logBase>1?r.logBase:10;var n=Math.max(Number.MIN_VALUE,Number(e[0])),a=Math.max(1.0001*n,Number(e[1]));this.domain=[n,a],this.range=t}return _createClass(LogScale,[{key:"log",value:function log(e){return Math.log(e)/Math.log(this.base)}},{key:"map",value:function map(e){var t=Number(e);if(!(t>0))return NaN;var r=_slicedToArray(this.domain,2),n=r[0],a=r[1],s=_slicedToArray(this.range,2),l=s[0],h=s[1],u=this.log(n),c=this.log(a);return l+(this.log(t)-u)/(c-u)*(h-l)}},{key:"invert",value:function invert(e){var t=_slicedToArray(this.domain,2),r=t[0],n=t[1],a=_slicedToArray(this.range,2),s=a[0],l=a[1];if(l===s)return r;var h=this.log(r),u=h+(e-s)/(l-s)*(this.log(n)-h);return Math.pow(this.base,u)}},{key:"ticks",value:function ticks(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=_slicedToArray(this.domain,2),r=t[0],n=t[1],a=[],s=Math.floor(this.log(r)),l=Math.ceil(this.log(n)),h=l-s;if(h<=2*e)for(var u=s;u<=l;u++){var c=Math.pow(this.base,u);c>=.999999*r&&c<=1.000001*n&&a.push(c)}else for(var p=Math.max(1,Math.ceil(h/e)),v=s;v<=l;v+=p){var m=Math.pow(this.base,v);m>=.999999*r&&m<=1.000001*n&&a.push(m)}return a.length||a.push(r,n),a}},{key:"bandwidth",value:function bandwidth(){return 0}},{key:"bandStart",value:function bandStart(e){return this.map(e)}},{key:"step",value:function step(){var e=this.ticks(5);return e.length>1?Math.abs(e[1]-e[0]):0}},{key:"isBand",value:function isBand(){return!1}},{key:"indexAt",value:function indexAt(e){return-1}},{key:"fractionOf",value:function fractionOf(e){var t=_slicedToArray(this.domain,2),r=t[0],n=t[1],a=this.log(r),s=this.log(n);return s===a?0:(this.log(Math.max(Number.MIN_VALUE,Number(e)))-a)/(s-a)}},{key:"valueAtFraction",value:function valueAtFraction(e){var t=_slicedToArray(this.domain,2),r=t[0],n=t[1],a=this.log(r),s=this.log(n);return Math.pow(this.base,a+e*(s-a))}},{key:"span",value:function span(){return this.domain[1]-this.domain[0]}},{key:"format",value:function format(e,t){return formatNumberTick(Number(e),this.step())}},{key:"clone",value:function clone(){return new LogScale([this.domain[0],this.domain[1]],[this.range[0],this.range[1]],{logBase:this.base})}}])}();function createScale(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};switch(e){case"category":return new E(t,r,n);case"time":return new C(t,r,n);case"log":return new B(t,r,n);default:return new L(t,r)}}function measureTextWidth(e,t,r,n){if(!t)return 0;if(e&&"function"==typeof e.measureText)try{var a=e.font;e.font="".concat(r,"px ").concat(n);var s=e.measureText(t);if(e.font=a,s&&"number"==typeof s.width&&isFinite(s.width))return s.width}catch(e){}for(var l=0,h=0;h<t.length;h++){l+=t.charCodeAt(h)>11904?1:.55}return l*r}function computeLayout(e,t,r){for(var n=e.option.margin,a=createScale(e.xAxis.type,e.xAxis.domain,[0,Math.max(1,r.width)],{logBase:e.xAxis.option.logBase}),s=buildAxisLayout(e,"x",e.xAxis,a,t),l=e.yAxes.map(function(n){var a=createScale(n.type,n.domain,[Math.max(1,r.height),0],{logBase:n.option.logBase});return buildAxisLayout(e,"y",n,a,t)}),h=0,u=0,c=0;c<e.yAxes.length;c++){var p=e.yAxes[c],v=l[c];if(!1!==p.option.show&&"cartesian"===e.kind){var m=yAxisReserve(p,v);"right"===p.position?(v.offset=u,u+=m):(v.offset=h,h+=m)}else v.offset=0}var g=l[0],b=function buildTitleLayout(e){var t=e.option.title;if(!t||!t.text&&!t.subtext)return null;var r=e.theme,n={color:t.textStyle&&t.textStyle.color||r.textColor,fontSize:t.textStyle&&t.textStyle.fontSize||r.fontSize+4,fontWeight:t.textStyle&&t.textStyle.fontWeight||"bold"},a={color:t.subtextStyle&&t.subtextStyle.color||r.subTextColor,fontSize:t.subtextStyle&&t.subtextStyle.fontSize||r.fontSize},s="left"===t.left?"left":"right"===t.left?"right":"center";return{text:t.text||"",subtext:t.subtext||"",x:0,y:0,align:s,textStyle:n,subtextStyle:a}}(e),k=b?(b.text?1.5*b.textStyle.fontSize:0)+(b.subtext?1.4*b.subtextStyle.fontSize:0):0,S=function layoutLegend(e,t,r,n){var a=e.option.legend;if(!a||!1===a.show)return null;var s=[];if("polar"===e.kind||"funnel"===e.kind){var l,h=_createForOfIteratorHelper(e.series);try{for(h.s();!(l=h.n()).done;){var u=l.value;if("pie"===u.type||"funnel"===u.type)for(var c=0,p=u.pointCount;c<p;c++){var v=u.pointAt(c);s.push({seriesId:u.id,seriesIndex:u.index,dataIndex:v.index,name:v.name||"".concat(u.name," ").concat(v.index+1),color:v.color||u.color,hidden:!!e.hiddenSlices["".concat(u.id,"#").concat(v.index)],x:0,y:0,width:0,height:0})}}}catch(e){h.e(e)}finally{h.f()}}else{var m,g=_createForOfIteratorHelper(e.series);try{for(g.s();!(m=g.n()).done;){var b=m.value;s.push({seriesId:b.id,seriesIndex:b.index,name:b.name,color:b.color,hidden:!!b.hidden,x:0,y:0,width:0,height:0})}}catch(e){g.e(e)}finally{g.f()}}if(!s.length)return null;var k={position:a.position||"top",items:s},S=e.theme.fontSize,A=a.itemWidth||12,w=Math.max(a.itemHeight||12,1.4*S),_=a.itemGap||16,M=s.map(function(r){return{item:r,textWidth:measureTextWidth(t,r.name,S,e.theme.fontFamily)}}),C=w+4,P=e.option.margin;if("left"===k.position||"right"===k.position){for(var T=Math.max.apply(Math,_toConsumableArray(M.map(function(e){return e.textWidth})).concat([0])),I=M.length*C,N="left"===k.position?P.left:r.width-P.right-(A+6+T),D=Math.max(0,r.height-n-P.bottom),O=Math.max(n,n+(D-I)/2),R=0;R<M.length;R++){var H=M[R].item;H.x=N,H.y=O+R*C,H.width=A+6+M[R].textWidth,H.height=C}return k}var z,V=[],L=[],E=0,B=Math.max(40,r.width-P.left-P.right),j=_createForOfIteratorHelper(M);try{for(j.s();!(z=j.n()).done;){var W=z.value,X=A+6+W.textWidth;L.length&&E+_+X>B&&(V.push(L),L=[],E=0),E+=(L.length>1?_:0)+X,L.push(W)}}catch(e){j.e(e)}finally{j.f()}L.length&&V.push(L);for(var G="top"===k.position?n:r.height-P.bottom-V.length*C,U=0,K=V;U<K.length;U++){var Y,q=K[U],$=q.reduce(function(e,t,r){return e+A+6+t.textWidth+(r>0?_:0)},0),Z=(r.width-$)/2,J=_createForOfIteratorHelper(q);try{for(J.s();!(Y=J.n()).done;){var Q=Y.value;Q.item.x=Z,Q.item.y=G,Q.item.width=A+6+Q.textWidth,Q.item.height=C,Z+=Q.item.width+_}}catch(e){J.e(e)}finally{J.f()}G+=C}return k}(e,t,r,n.top+k),A=S?function legendSizeOf(e,t){var r=t.option.legend,n=t.theme.fontSize,a=r.itemWidth||12,s=Math.max(r.itemHeight||12,1.4*n)+4;if("left"===e.position||"right"===e.position){var l=e.items.map(function(e){return e.x}),h=e.items.map(function(e){return e.x+e.width}),u=l.length?Math.min.apply(Math,_toConsumableArray(l)):0,c=h.length?Math.max.apply(Math,_toConsumableArray(h)):0;return{width:Math.max(a+6,c-u),height:e.items.length*s}}var p,v=1,m=e.items.length?e.items[0].y:0,g=_createForOfIteratorHelper(e.items);try{for(g.s();!(p=g.n()).done;){var b=p.value;b.y>m&&(v+=1,m=b.y)}}catch(e){g.e(e)}finally{g.f()}return{width:0,height:v*s}}(S,e):{width:0,height:0},w=n.left,_=n.top,M=r.width-n.right,C=r.height-n.bottom;_+=k,S&&("top"===S.position?_+=A.height+8:"bottom"===S.position?C-=A.height+8:"left"===S.position?w+=A.width+8:M-=A.width+8),w+=h,M-=u,"cartesian"===e.kind&&!1!==e.xAxis.option.show&&(C-=s.labelHeight+4+6,e.xAxis.option.name&&(C-=s.nameHeight+6));var P=e.option.dataZoom&&e.option.dataZoom.slider,T=!("cartesian"!==e.kind||!e.option.dataZoom||P&&!1===P.show),I=Math.max(12,Number(P&&P.height)||26),N=null;if(T){var D=r.height-n.bottom,O=I+14;C+O>D&&(C-=C+O-D),N=C+14}var R={x:Math.round(Math.max(0,w)),y:Math.round(Math.max(0,_)),width:Math.max(1,Math.round(M-w)),height:Math.max(1,Math.round(C-_))};"cartesian"===e.kind&&function thinXAxisLabels(e,t,r,n,a){var s=e.ticks,l=e.labels,h=t.axisLength;if(!s||s.length<=2||!h||h<=0)return;var u=e.formatLabel,c="number"==typeof e.sampledLabelWidth,p=0;if(c)p=e.sampledLabelWidth;else for(var v=Math.max(1,Math.floor(s.length/64)),m=0;m<l.length;m+=v)if(l[m]){var g=measureTextWidth(r,l[m],n,a);g>p&&(p=g)}var b=function materialize(e){if(u){var t,r=_createForOfIteratorHelper(e());try{for(r.s();!(t=r.n()).done;){var n=t.value;l[n]||(l[n]=u(n))}}catch(e){r.e(e)}finally{r.f()}}};if(p<=0)return void b(_regenerator().m(function _callee(){var e;return _regenerator().w(function(t){for(;;)switch(t.n){case 0:e=0;case 1:if(!(e<l.length)){t.n=3;break}return t.n=2,e;case 2:e++,t.n=1;break;case 3:return t.a(2)}},_callee)}));var k=Math.max(p+10,64),S=h/(s.length-1||1);if(S>=k)return void b(_regenerator().m(function _callee2(){var e;return _regenerator().w(function(t){for(;;)switch(t.n){case 0:e=0;case 1:if(!(e<l.length)){t.n=3;break}return t.n=2,e;case 2:e++,t.n=1;break;case 3:return t.a(2)}},_callee2)}));for(var A=Math.max(1,Math.ceil(k/S)),w=new Set,_=0;_<s.length;_+=A)w.add(_);var M=s.length-1;if(M>0&&!w.has(M)){var C=M-M%A;(M-C)*S>=k||w.delete(C),w.add(M)}var P=p/2,T=Number(t.leftRoom)||0,I=Number(t.rightRoom)||0,N=Array.from(w).sort(function(e,t){return e-t});if(N.length){var D=N[0];D*S-P<-T&&w.delete(D);var O=N[N.length-1];O*S+P>h+I&&w.delete(O)}b(function(){return w});for(var R=0;R<l.length;R++)w.has(R)||(l[R]="")}(s,{axisLength:R.width,leftRoom:R.x,rightRoom:Math.max(0,r.width-R.x-R.width)},t,e.theme.fontSize,e.theme.fontFamily);var H=null;if("polar"===e.kind||"radar"===e.kind||"gauge"===e.kind||"liquid"===e.kind){var z,V=Math.min(R.width,R.height)/2,L=R.width/2,E=R.height/2,B="polar"===e.kind&&e.series.some(function(e){return"pie"===e.type&&!(e.option.label&&!1===e.option.label.show)})?Math.min(46,.26*V):6;z="gauge"===e.kind?Math.max(10,.94*Math.min(L-14,E-4)):"liquid"===e.kind?Math.max(10,Math.min(L,E)-3):Math.max(10,V*function polarRadiusRatio(e){if("radar"===e.kind){var t=Number(e.radar&&e.radar.radius);return isFinite(t)&&t>0?Math.max(.1,Math.min(1,t)):.72}var r,n=_createForOfIteratorHelper(e.series);try{for(n.s();!(r=n.n()).done;){var a=r.value;if("pie"===a.type){var s=Number(a.option.radius);if(isFinite(s)&&s>0)return Math.max(.1,Math.min(1,s))}}}catch(e){n.e(e)}finally{n.f()}return.92}(e)-B);var j=R.x+R.width/2,W=R.y+R.height/2;H={cx:j,cy:W,radius:z},R={x:Math.round(j-z),y:Math.round(W-z),width:Math.round(2*z),height:Math.round(2*z)}}if("cartesian"===e.kind&&"equal"===e.option.aspect){var X=Math.min(R.width,R.height);R={x:Math.round(R.x+(R.width-X)/2),y:Math.round(R.y+(R.height-X)/2),width:Math.round(X),height:Math.round(X)}}b&&(b.y=n.top);var G=T&&null!==N?{x:R.x,y:Math.round(N),width:R.width,height:Math.round(I)}:null;return{canvas:r,plot:R,titleRect:b?{x:b.x,y:b.y,width:0,height:k}:null,legendRect:S?legendBoundingRect(S):null,legend:S,title:b,polar:H,slider:G,xAxisLayout:s,yAxes:l,yAxisLayout:g,margin:n}}function yAxisReserve(e,t){var r=t.labelWidth+4+6;return e.option.name&&(r+=t.nameHeight+6),r}function buildAxisLayout(e,t,r,n,a){for(var s=r.option,l=e.theme.fontSize,h=e.theme.fontFamily,u=!1===s.show,c=n.ticks(s.tickCount||5),p=function formatLabel(e){return formatTick(c[e],n,e,s.formatter)},v=c.length>512,m=v?new Array(c.length).fill(""):[],g=0,b=Math.max(1,Math.floor(c.length/64)),k=0;k<c.length;k++){var S=k%b===0||0===k||k===c.length-1;if(!v||S){var A=p(k);if(m[k]=A,S){var w=measureTextWidth(a,A,l,h);w>g&&(g=w)}}}var _=Math.abs(Number(s.labelRotate)||0),M=_*Math.PI/180,C=g*Math.sin(M)+1.4*l,P=s.name||"",T=P?measureTextWidth(a,P,l,h):0;return u?{ticks:c,labels:m,formatLabel:v?p:void 0,sampledLabelWidth:g,offset:0,labelWidth:0,labelHeight:0,nameWidth:0,nameHeight:0}:{ticks:c,labels:m,formatLabel:v?p:void 0,sampledLabelWidth:g,offset:0,labelWidth:"y"===t?g:0,labelHeight:"x"===t?_>0?C:1.4*l:0,nameWidth:"x"===t?T:0,nameHeight:P?1.4*l:0}}function legendBoundingRect(e){if(!e.items.length)return{x:0,y:0,width:0,height:0};var t,r=1/0,n=1/0,a=-1/0,s=-1/0,l=_createForOfIteratorHelper(e.items);try{for(l.s();!(t=l.n()).done;){var h=t.value;r=Math.min(r,h.x),n=Math.min(n,h.y),a=Math.max(a,h.x+h.width),s=Math.max(s,h.y+h.height)}}catch(e){l.e(e)}finally{l.f()}return{x:r,y:n,width:a-r,height:s-n}}var j=function(){function ChartComponent(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ChartComponent),_defineProperty(e=_callSuper(this,ChartComponent,[_objectSpread2({origin:"top-left",fill:!1,stroke:!1,draggable:!1,transformable:!1,linkable:!1,interactive:!1},t)]),"loopRegistered",!1),e}return _inherits(ChartComponent,r),_createClass(ChartComponent,[{key:"keyboardEvtHandler",value:function keyboardEvtHandler(){}},{key:"containsLocalPoint",value:function containsLocalPoint(e,t){return e>=0&&t>=0&&e<=this.state.width&&t<=this.state.height}},{key:"unit",value:function unit(){var e=this.ice;return e?1/((e.viewport&&e.viewport.scale||1)*(e.dpr||1)):1}},{key:"snap",value:function snap(e){var t=this.ice;if(!t)return e;var r=(t.viewport&&t.viewport.scale||1)*(t.dpr||1);return Math.round(e*r)/r+.5/r}},{key:"markDirty",value:function markDirty(){return this.dirty=!0,this.ice&&(this.ice.dirty=!0),this}},{key:"keepAnimating",value:function keepAnimating(){if(!this.loopRegistered){this.loopRegistered=!0;var e=_objectSpread2(_objectSpread2({},this.props.animations||{}),{},{__tick:{from:0,to:1,duration:100,loop:!0}});this.props.animations=e,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),this.markDirty()}}},{key:"stopAnimating",value:function stopAnimating(){if(this.loopRegistered){this.loopRegistered=!1;var e=_objectSpread2({},this.props.animations||{});for(var t in e)e[t]&&(e[t].finished=!0);delete e.__tick,this.props.animations=e,this.ice&&this.ice.animationManager&&this.ice.animationManager.remove(this)}}},{key:"setFont",value:function setFont(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"normal";this.ctx.font="".concat(r," ").concat(e,"px ").concat(t)}}])}(),W="auto";function setMotionPreference(e){W=e}function getMotionPreference(){return W}function shouldAnimate(){return"instant"!==W&&("full"===W||!function prefersReducedMotion(){if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!1;try{return!!window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch(e){return!1}}())}var X=function(){function Axis(e){var t;return _classCallCheck(this,Axis),_defineProperty(t=_callSuper(this,Axis,[_objectSpread2({interactive:!1},e)]),"axisIndex",0),_defineProperty(t,"position","left"),_defineProperty(t,"axis",null),_defineProperty(t,"layout",null),_defineProperty(t,"theme",null),_defineProperty(t,"lastTicks",[]),_defineProperty(t,"morphFrom",[]),t.orientation=e.orientation,t.axisIndex=e.axisIndex||0,t.position=e.position||"left",t}return _inherits(Axis,j),_createClass(Axis,[{key:"edgeX",value:function edgeX(e){var t=this.layout.plot,r=e.offset||0;return"left"===this.position?t.x-r:t.x+t.width+r}},{key:"axisLayoutOf",value:function axisLayoutOf(e){return"x"===this.orientation?e.xAxisLayout:e.yAxes[this.axisIndex]||e.yAxisLayout}},{key:"tickEntries",value:function tickEntries(){var e=this.axis,t=this.layout;if(!e||!t||!e.scale)return null;for(var r=e.option||{},n=e.scale,a=t.plot,s=this.axisLayoutOf(t),l=s.ticks,h=s.labels||[],u=[],c=h.length===l.length,p=0;p<l.length;p++)if(!c||""!==h[p]){var v=n.map(l[p]),m="x"===this.orientation?a.x+v:a.y+v;if(isFinite(m)){var g=formatTick(l[p],n,p,r.formatter)||"";u.push({key:String(l[p]),pos:m,label:g,drawn:!!g})}}return u}},{key:"morphProgress",value:function morphProgress(){var e=Number(this.state.axisMorph);return isFinite(e)?Math.max(0,Math.min(1,e)):1}},{key:"renderedPositions",value:function renderedPositions(){var e,t=this,r=this.morphProgress(),n=new Map,a=_createForOfIteratorHelper(this.lastTicks);try{var s=function _loop(){var a=e.value,s=t.morphFrom.find(function(e){return e.key===a.key});n.set(a.key,s?s.pos+(a.pos-s.pos)*r:a.pos)};for(a.s();!(e=a.n()).done;)s()}catch(e){a.e(e)}finally{a.f()}return n}},{key:"syncTicks",value:function syncTicks(){var e=this,t=this.tickEntries();if(t&&!(t.length===this.lastTicks.length&&t.every(function(t,r){return t.key===e.lastTicks[r].key&&Math.abs(t.pos-e.lastTicks[r].pos)<.01}))){var r=0===this.lastTicks.length,n=this.renderedPositions();if(this.morphFrom=this.lastTicks.map(function(e){var t;return _objectSpread2(_objectSpread2({},e),{},{pos:null!==(t=n.get(e.key))&&void 0!==t?t:e.pos})}),this.lastTicks=t,this.setState({axisMorph:0}),r||!shouldAnimate())return this.setState({axisMorph:1}),void this.markDirty();var a=_objectSpread2({},this.props.animations||{});a.axisMorph={from:0,to:1,duration:240,easing:"easeOutCubic",startTime:void 0,finished:!1},this.props.animations=a,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),this.markDirty()}}},{key:"renderedTickPos",value:function renderedTickPos(e){var t=String(e),r=this.morphFrom.find(function(e){return e.key===t}),n=this.lastTicks.find(function(e){return e.key===t});return r&&n?r.pos+(n.pos-r.pos)*this.morphProgress():n?n.pos:r?r.pos:null}},{key:"morphing",value:function morphing(){return this.morphProgress()<1}},{key:"drawTick",value:function drawTick(e,t,r,n,a){if(!1!==a.showTick){var s=this.ctx;if(s.beginPath(),"x"===this.orientation)s.moveTo(e,t.y+t.height),s.lineTo(e,t.y+t.height+4*n);else{var l="left"===this.position?-1:1;s.moveTo(r,e),s.lineTo(r+4*l*n,e)}s.stroke()}}},{key:"drawTickLabel",value:function drawTickLabel(e,t,r,n,a,s){if(t){var l=this.ctx;if("x"!==this.orientation){var h="left"===this.position?-1:1;l.fillText(t,n+h*a,e)}else{var u=r.y+r.height+a;s.labelRotate?(l.save(),l.translate(e,u),l.rotate(Number(s.labelRotate)*Math.PI/180),l.textAlign="right",l.textBaseline="middle",l.fillText(t,0,0),l.restore()):l.fillText(t,e,u)}}}},{key:"doRender",value:function doRender(){if(this.axis&&this.layout&&this.theme){var e=this.axis.option;if(!1!==e.show)if(this.axis.scale){var t=this.layout.plot,r="x"===this.orientation?this.layout.xAxisLayout:this.layout.yAxes[this.axisIndex]||this.layout.yAxisLayout,n=this.ctx,a=this.theme.fontSize,s=this.unit(),l=10*s;n.beginPath(),n.save(),n.lineWidth=s,n.strokeStyle=this.theme.axisLineColor,n.fillStyle=this.theme.axisLabelColor,this.setFont(a,this.theme.fontFamily),n.textBaseline="x"===this.orientation?"top":"middle",n.textAlign="x"===this.orientation?"center":"left"===this.position?"right":"left";var h="x"===this.orientation?t.x:this.edgeX(r);if(!1!==e.showAxisLine){if(n.beginPath(),"x"===this.orientation){var u=this.snap(t.y+t.height);n.moveTo(t.x,u),n.lineTo(t.x+t.width,u)}else{var c=this.snap(h);n.moveTo(c,t.y),n.lineTo(c,t.y+t.height)}n.stroke()}var p,v="left"===this.position?-1:1,m=this.tickEntries()||[],g=this.morphProgress(),b=new Map,k=_createForOfIteratorHelper(this.morphFrom);try{for(k.s();!(p=k.n()).done;){var S=p.value;b.set(S.key,S.pos)}}catch(e){k.e(e)}finally{k.f()}var A=new Set(m.map(function(e){return e.key}));if(g<1){n.fillStyle=this.theme.axisLabelColor,n.globalAlpha=(1-g)*(1-g);var w,_=_createForOfIteratorHelper(this.morphFrom);try{for(_.s();!(w=_.n()).done;){var M=w.value;!A.has(M.key)&&M.drawn&&(this.drawTick(M.pos,t,h,s,e),this.drawTickLabel(M.pos,M.label,t,h,l,e))}}catch(e){_.e(e)}finally{_.f()}n.globalAlpha=1}var C,P=_createForOfIteratorHelper(m);try{for(P.s();!(C=P.n()).done;){var T=C.value,I=b.get(T.key),N=void 0===I?T.pos:I+(T.pos-I)*g;n.globalAlpha=void 0===I?Math.min(1,.15+.85*g):1,this.drawTick(N,t,h,s,e),T.drawn&&this.drawTickLabel(N,T.label,t,h,l,e)}}catch(e){P.e(e)}finally{P.f()}if(n.globalAlpha=1,e.name)if(this.setFont(a,this.theme.fontFamily),n.fillStyle=this.theme.subTextColor,"x"===this.orientation)if(n.textAlign="center",n.textBaseline="middle",this.layout.slider)n.textAlign="right",n.textBaseline="bottom",n.fillText(e.name,t.x+t.width,t.y+t.height-4*s);else{var D=t.y+t.height+l+r.labelHeight+6*s+.5*a;n.fillText(e.name,t.x+t.width/2,D)}else{var O=h+v*(r.labelWidth+l+r.nameHeight+4*s);n.save(),n.translate("left"===this.position?Math.max(.6*a,O):O,t.y+t.height/2),n.rotate(-Math.PI/2),n.textAlign="center",n.textBaseline="middle",n.fillText(e.name,0,0),n.restore()}n.restore()}}}}])}(),G=function(){function GridLines(e){var t;return _classCallCheck(this,GridLines),_defineProperty(t=_callSuper(this,GridLines,[_objectSpread2({interactive:!1},e)]),"xScale",null),_defineProperty(t,"yScale",null),_defineProperty(t,"horizontal",[]),_defineProperty(t,"xTicks",[]),_defineProperty(t,"plot",{x:0,y:0,width:0,height:0}),_defineProperty(t,"grid",{}),_defineProperty(t,"theme",null),_defineProperty(t,"axisX",null),_defineProperty(t,"axisYList",[]),t}return _inherits(GridLines,j),_createClass(GridLines,[{key:"syncTicks",value:function syncTicks(){if([this.axisX].concat(_toConsumableArray(this.axisYList)).filter(Boolean).some(function(e){return"function"==typeof e.morphing&&e.morphing()})){var e=_objectSpread2({},this.props.animations||{});e.axisMorph={from:0,to:1,duration:240,easing:"easeOutCubic",startTime:void 0,finished:!1},this.props.animations=e,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),this.markDirty()}}},{key:"yTickPos",value:function yTickPos(e,t,r){var n=void 0===e?null:this.axisYList[e];if(!n||"function"!=typeof n.renderedTickPos)return r;var a=n.renderedTickPos(t);return null==a?r:a}},{key:"xTickPos",value:function xTickPos(e,t){var r=this.axisX;if(!r||"function"!=typeof r.renderedTickPos)return t;var n=r.renderedTickPos(e);return null==n?t:n}},{key:"doRender",value:function doRender(){var e=this;if(this.theme&&this.xScale&&this.yScale&&!1!==this.grid.show){var t=this.plot,r=this.ctx;r.beginPath(),r.save(),r.strokeStyle=this.grid.color||this.theme.splitLineColor,r.lineWidth=(this.grid.lineWidth||1)*this.unit(),"function"==typeof r.setLineDash&&r.setLineDash((this.grid.lineDash||[]).map(function(t){return t*e.unit()}));var n=this.horizontal.length?this.horizontal:this.yScale?[{scale:this.yScale,ticks:this.yScale.ticks(5)}]:[];if(!1!==this.grid.y){r.beginPath();var a,s=_createForOfIteratorHelper(n);try{for(s.s();!(a=s.n()).done;){var l,h=a.value,u=_createForOfIteratorHelper(h.ticks);try{for(u.s();!(l=u.n()).done;){var c=l.value,p=t.y+h.scale.map(c);if(isFinite(p)){var v=this.snap(this.yTickPos(h.index,c,p));r.moveTo(t.x,v),r.lineTo(t.x+t.width,v)}}}catch(e){u.e(e)}finally{u.f()}}}catch(e){s.e(e)}finally{s.f()}r.stroke()}if(this.grid.x){r.beginPath();var m,g=_createForOfIteratorHelper(this.xTicks.length?this.xTicks:this.xScale.ticks(5));try{for(g.s();!(m=g.n()).done;){var b=m.value,k=t.x+this.xScale.map(b);if(isFinite(k)){var S=this.snap(this.xTickPos(b,k));r.moveTo(S,t.y),r.lineTo(S,t.y+t.height)}}}catch(e){g.e(e)}finally{g.f()}r.stroke()}r.restore()}}}])}(),U=[6,4];function resolveAxisValue(e,t,r,n){if(null==t||""===t)return{ok:!1,code:"annotation:invalid-value",message:"".concat(n," 标注缺少定位值。")};var a=e.scale;if(!a||"function"!=typeof a.map)return{ok:!1,code:"annotation:unsupported-scene",message:"当前场景没有可用于定位的坐标系。"};var s,l=a.domain||[],h=t;if("category"===e.type){var u=l.indexOf(h);if(u<0&&(u=l.findIndex(function(e){return String(e)===String(h)})),u<0){var c=Number(h);if(!(Number.isInteger(c)&&c>=0&&c<l.length))return{ok:!1,code:"annotation:unknown-category",message:"".concat(n," 轴没有类目「").concat(String(t),"」。")};u=c}h=l[u];var p=Number(a.map(h));return isFinite(p)?{ok:!0,pixel:r+p,inside:!0,label:String(h)}:{ok:!1,code:"annotation:unknown-category",message:"".concat(n," 轴定位不到「").concat(String(t),"」。")}}if("time"===e.type){if(s=toTimestamp(h),!isFinite(s))return{ok:!1,code:"annotation:invalid-value",message:"".concat(n," 标注的「").concat(String(t),"」不是合法时间。")}}else if(s=Number(h),!isFinite(s))return{ok:!1,code:"annotation:invalid-value",message:"".concat(n," 标注的「").concat(String(t),"」不是合法数值。")};var v=Number(a.map(s));if(!isFinite(v))return{ok:!1,code:"annotation:out-of-range",message:"".concat(n," 标注的「").concat(String(t),"」无法定位。")};var m=function domainRange(e){if(!e||!e.length)return[null,null];var t=e.map(function(e){return Number(e)});if(t.length&&t.every(function(e){return isFinite(e)}))return[Math.min.apply(Math,_toConsumableArray(t)),Math.max.apply(Math,_toConsumableArray(t))];return[0,e.length-1]}(l),g=_slicedToArray(m,2),b=g[0],k=g[1];return{ok:!0,pixel:r+v,inside:null===b||null===k||s>=b-1e-9&&s<=k+1e-9,label:String(t)}}function pickAxis(e,t,r){if("x"===t)return e.xAxis;var n=Number.isInteger(r)&&Number(r)>=0?Number(r):0;return e.yAxes[n]||e.yAxes[0]||e.xAxis}function positiveNumber(e,t){var r=Number(e);return isFinite(r)&&r>0?r:t}function textPosition(e,t){return"start"===e||"center"===e||"end"===e?e:t}function pointTextPosition(e){return"bottom"===e||"left"===e||"right"===e||"top"===e?e:"top"}function resolvedLineDash(e){return Array.isArray(e.lineDash)?e.lineDash.filter(function(e){return isFinite(Number(e))&&Number(e)>=0}).map(Number):!1===e.dashed?[]:U}function symbolOf(e){return"rect"===e||"diamond"===e||"triangle"===e?e:"circle"}function clamp$1(e,t,r){return Math.max(t,Math.min(r,e))}function plainText(e){return null==e?"":String(e)}function withAlpha(e,t){if("string"!=typeof e)return"rgba(0,0,0,".concat(t,")");if("#"===e.charAt(0)){var r=e.slice(1);if(3===r.length&&(r=r[0]+r[0]+r[1]+r[1]+r[2]+r[2]),6!==r.length)return e;var n=parseInt(r.slice(0,2),16),a=parseInt(r.slice(2,4),16),s=parseInt(r.slice(4,6),16);return"rgba(".concat(n,",").concat(a,",").concat(s,",").concat(t,")")}return 0===e.indexOf("rgb(")?e.replace("rgb(","rgba(").replace(")",",".concat(t,")")):e}function resolveAnnotation(e,t){var r={lines:[],points:[],areas:[]},n=[];if(!e||"object"!==_typeof(e))return{resolved:r,diagnostics:n};var a=Array.isArray(e.lines)?e.lines:[],s=Array.isArray(e.points)?e.points:[],l=Array.isArray(e.areas)?e.areas:[];if(!(a.length+s.length+l.length))return{resolved:r,diagnostics:n};if("cartesian"!==t.kind)return n.push({code:"annotation:unsupported-scene",severity:"warning",message:"标注需要直角坐标系(x / y 轴),当前场景没有,已跳过全部标注。",kind:"line",index:0}),{resolved:r,diagnostics:n};for(var h=t.theme,u=h.textColor,c=h.fontSize||12,p=0;p<l.length;p++){var v=l[p]||{},m="x"===v.axis?"x":"y",g="x"===m?"x":"y",b=pickAxis(t,m,v.axisIndex),k="x"===m?t.plot.x:t.plot.y,S="x"===m?t.plot.width:t.plot.height,A=resolveAxisValue(b,v.from,k,g),w=resolveAxisValue(b,v.to,k,g);if(A.ok&&w.ok){var _=k,M=k+S,C=clamp$1(A.pixel,_,M),P=clamp$1(w.pixel,_,M);Math.abs(P-C)<=0?n.push({code:"annotation:out-of-range",severity:"warning",message:"标注区间#".concat(p,":区间「").concat(plainText(v.from)," ~ ").concat(plainText(v.to),"」不在当前可视范围内,已跳过。"),kind:"area",index:p}):r.areas.push({kind:"area",index:p,axis:m,axisIndex:Number.isInteger(v.axisIndex)?Number(v.axisIndex):0,from:C,to:P,color:"string"==typeof v.color&&v.color?v.color:withAlpha(u,.1),text:plainText(v.text),textPosition:textPosition(v.textPosition,"center"),textColor:"string"==typeof v.textColor&&v.textColor?v.textColor:u,fontSize:positiveNumber(v.fontSize,c)})}else pushDiagnostic(n,A.ok?w:A,"area",p)}for(var T=0;T<a.length;T++){var I=a[T]||{},N="x"===I.axis?"x":"y",D="x"===N?"x":"y",O=pickAxis(t,N,I.axisIndex),R="x"===N?t.plot.x:t.plot.y,H=resolveAxisValue(O,I.value,R,D);if(H.ok)if(H.inside){var z="string"==typeof I.color&&I.color?I.color:u;r.lines.push({kind:"line",index:T,axis:N,axisIndex:Number.isInteger(I.axisIndex)?Number(I.axisIndex):0,pixel:H.pixel,text:plainText(I.text),color:z,lineWidth:positiveNumber(I.lineWidth,1),lineDash:resolvedLineDash(I),textPosition:textPosition(I.textPosition,"end"),textColor:"string"==typeof I.textColor&&I.textColor?I.textColor:z,fontSize:positiveNumber(I.fontSize,c)})}else pushDiagnostic(n,{ok:!1,code:"annotation:out-of-range",message:"".concat(D," 标注的「").concat(H.label,"」不在当前可视范围内,已跳过。")},"line",T);else pushDiagnostic(n,H,"line",T)}for(var V=0;V<s.length;V++){var L=s[V]||{},E=resolveAxisValue(t.xAxis,L.x,t.plot.x,"x"),B=resolveAxisValue(pickAxis(t,"y",L.axisIndex),L.y,t.plot.y,"y");if(E.ok&&B.ok&&E.inside&&B.inside){var j="string"==typeof L.color&&L.color?L.color:u;r.points.push({kind:"point",index:V,axisIndex:Number.isInteger(L.axisIndex)?Number(L.axisIndex):0,x:E.pixel,y:B.pixel,text:plainText(L.text),color:j,symbol:symbolOf(L.symbol),symbolSize:positiveNumber(L.symbolSize,8),textPosition:pointTextPosition(L.textPosition),textColor:"string"==typeof L.textColor&&L.textColor?L.textColor:j,fontSize:positiveNumber(L.fontSize,c)})}else{pushDiagnostic(n,E.ok?B.ok?E.inside?{ok:!1,code:"annotation:out-of-range",message:"y 标注的「".concat(B.label,"」不在当前可视范围内,已跳过。")}:{ok:!1,code:"annotation:out-of-range",message:"x 标注的「".concat(E.label,"」不在当前可视范围内,已跳过。")}:B:E,"point",V)}}return{resolved:r,diagnostics:n}}function pushDiagnostic(e,t,r,n){var a="line"===r?"标注线":"point"===r?"标注点":"标注区间";e.push({code:t.code,severity:"annotation:invalid-value"===t.code?"error":"warning",message:"".concat(a,"#").concat(n,":").concat(t.message),kind:r,index:n})}var K=function(){function Annotation(e){var t;return _classCallCheck(this,Annotation),_defineProperty(t=_callSuper(this,Annotation,[_objectSpread2({interactive:!1},e)]),"resolved",{lines:[],points:[],areas:[]}),_defineProperty(t,"diagnostics",[]),_defineProperty(t,"ink",[]),_defineProperty(t,"theme",null),_defineProperty(t,"option",null),_defineProperty(t,"__boxScratch",[0,0,0,0]),_defineProperty(t,"plot",{x:0,y:0,width:0,height:0}),_defineProperty(t,"xAxis",null),_defineProperty(t,"yAxes",[]),t}return _inherits(Annotation,j),_createClass(Annotation,[{key:"sync",value:function sync(e,t){this.option=e||null,this.theme=t.theme;var r=resolveAnnotation(e,t),n=r.resolved,a=r.diagnostics;this.resolved=n,this.diagnostics=a,this.markDirty()}},{key:"hasInk",get:function get(){return this.resolved.lines.length>0||this.resolved.points.length>0||this.resolved.areas.length>0}},{key:"__localBox",value:function __localBox(){var e=this.__boxScratch;return e[0]=0,e[1]=0,e[2]=this.state.width||0,e[3]=this.state.height||0,e}},{key:"doRender",value:function doRender(){if(this.theme&&this.hasInk){var e=this.plot,t=[];this.drawAreas(t,e),this.drawLines(t,e),this.drawPoints(t),this.ink=t}else this.ink=[]}},{key:"drawAreas",value:function drawAreas(e,t){var r,n=this,a=_createForOfIteratorHelper(this.resolved.areas);try{var s=function _loop(){var a=r.value,s=n.ctx;s.beginPath();var l=Math.min(a.from,a.to),h=Math.max(a.from,a.to),u="x"===a.axis?l:t.x,c="y"===a.axis?l:t.y,p="x"===a.axis?h-l:t.width,v="y"===a.axis?h-l:t.height;if(p<=0||v<=0)return 1;s.save(),s.fillStyle=a.color,s.fillRect(u,c,p,v),s.restore();var m=null;if(a.text){s.save(),n.setFont(a.fontSize,n.theme.fontFamily,"normal"),s.fillStyle=a.textColor;if("y"===a.axis){var g="start"===a.textPosition?"left":"end"===a.textPosition?"right":"center",b="start"===a.textPosition?t.x+6:"end"===a.textPosition?t.x+t.width-6:t.x+t.width/2;s.textAlign=g,s.textBaseline="middle";var k=(a.from+a.to)/2;n.strokeHalo(function(){return s.strokeText(a.text,b,k)}),s.fillText(a.text,b,k),m={kind:"area",index:a.index,x:"right"===g?b-n.textWidth(a.text,a.fontSize):"center"===g?b-n.textWidth(a.text,a.fontSize)/2:b,y:k-a.fontSize/2,width:n.textWidth(a.text,a.fontSize),height:a.fontSize,text:a.text}}else{var S=(a.from+a.to)/2;s.textAlign="center",s.textBaseline="top";var A=t.y+6;n.strokeHalo(function(){return s.strokeText(a.text,S,A)}),s.fillText(a.text,S,A),m={kind:"area",index:a.index,x:S-n.textWidth(a.text,a.fontSize)/2,y:A,width:n.textWidth(a.text,a.fontSize),height:a.fontSize,text:a.text}}s.restore()}e.push({kind:"area",index:a.index,x:u,y:c,width:p,height:v,text:a.text}),m&&e.push(m)};for(a.s();!(r=a.n()).done;)s()}catch(e){a.e(e)}finally{a.f()}}},{key:"drawLines",value:function drawLines(e,t){var r,n=this,a=_createForOfIteratorHelper(this.resolved.lines);try{for(a.s();!(r=a.n()).done;){var s=r.value,l=this.ctx,h="y"===s.axis,u=this.snap(s.pixel);l.save(),l.beginPath(),l.strokeStyle=s.color,l.lineWidth=s.lineWidth*this.unit(),"function"==typeof l.setLineDash&&l.setLineDash(s.lineDash.map(function(e){return e*n.unit()})),h?(l.moveTo(t.x,u),l.lineTo(t.x+t.width,u)):(l.moveTo(u,t.y),l.lineTo(u,t.y+t.height)),l.stroke(),l.restore();var c=h?{kind:"line",index:s.index,x:t.x,y:s.pixel-1,width:t.width,height:2,text:s.text}:{kind:"line",index:s.index,x:s.pixel-1,y:t.y,width:2,height:t.height,text:s.text};e.push(c),s.text&&e.push(this.drawLineText(s,t,h))}}catch(e){a.e(e)}finally{a.f()}}},{key:"drawLineText",value:function drawLineText(e,t,r){var n=this.ctx;n.save(),this.setFont(e.fontSize,this.theme.fontFamily,"normal"),n.fillStyle=e.textColor;var a,s=this.textWidth(e.text,e.fontSize);if(r){var l="start"===e.textPosition?"left":"end"===e.textPosition?"right":"center",h="start"===e.textPosition?t.x+6:"end"===e.textPosition?t.x+t.width-6:t.x+t.width/2,u=e.pixel-e.fontSize-4<t.y,c=u?e.pixel+4:e.pixel-4;n.textAlign=l,n.textBaseline=u?"top":"bottom",this.strokeHalo(function(){return n.strokeText(e.text,h,c)}),n.fillText(e.text,h,c);var p="right"===l?h-s:"center"===l?h-s/2:h;a={kind:"line",index:e.index,x:p,y:u?c:c-e.fontSize,width:s,height:e.fontSize,text:e.text}}else{var v=e.pixel+4+s>t.x+t.width,m=v?e.pixel-4:e.pixel+4,g=t.y+6;n.textAlign=v?"right":"left",n.textBaseline="top",this.strokeHalo(function(){return n.strokeText(e.text,m,g)}),n.fillText(e.text,m,g),a={kind:"line",index:e.index,x:v?m-s:m,y:g,width:s,height:e.fontSize,text:e.text}}return n.restore(),a}},{key:"drawPoints",value:function drawPoints(e){var t,r=_createForOfIteratorHelper(this.resolved.points);try{for(r.s();!(t=r.n()).done;){var n=t.value,a=this.ctx,s=n.symbolSize/2;a.save(),a.beginPath(),a.fillStyle=n.color,"circle"===n.symbol?a.arc(n.x,n.y,s,0,2*Math.PI):"rect"===n.symbol?a.rect(n.x-s,n.y-s,n.symbolSize,n.symbolSize):"diamond"===n.symbol?(a.moveTo(n.x,n.y-s),a.lineTo(n.x+s,n.y),a.lineTo(n.x,n.y+s),a.lineTo(n.x-s,n.y),a.closePath()):(a.moveTo(n.x,n.y-s),a.lineTo(n.x+s,n.y+s),a.lineTo(n.x-s,n.y+s),a.closePath()),a.fill(),a.restore(),e.push({kind:"point",index:n.index,x:n.x-s,y:n.y-s,width:n.symbolSize,height:n.symbolSize,text:n.text}),n.text&&e.push(this.drawPointText(n))}}catch(e){r.e(e)}finally{r.f()}}},{key:"drawPointText",value:function drawPointText(e){var t=this.ctx,r=e.symbolSize/2;t.save(),this.setFont(e.fontSize,this.theme.fontFamily,"normal"),t.fillStyle=e.textColor;var n=this.textWidth(e.text,e.fontSize),a=e.x,s=e.y,l="center",h="bottom";"top"===e.textPosition?(l="center",h="bottom",s=e.y-r-3):"bottom"===e.textPosition?(l="center",h="top",s=e.y+r+3):"left"===e.textPosition?(l="right",h="middle",a=e.x-r-3):(l="left",h="middle",a=e.x+r+3),t.textAlign=l,t.textBaseline=h,this.strokeHalo(function(){return t.strokeText(e.text,a,s)}),t.fillText(e.text,a,s),t.restore();var u="right"===l?a-n:"center"===l?a-n/2:a,c=e.fontSize,p="bottom"===h?s-c:"middle"===h?s-c/2:s;return{kind:"point",index:e.index,x:u,y:p,width:n,height:c,text:e.text}}},{key:"strokeHalo",value:function strokeHalo(e){var t=this.ctx,r=this.theme?this.theme.labelHaloColor:null;if(r){var n=t.lineWidth,a=t.lineJoin,s=t.strokeStyle;t.lineWidth=3*this.unit(),t.lineJoin="round",t.strokeStyle=r,e(),t.lineWidth=n,t.lineJoin=a,t.strokeStyle=s}}},{key:"textWidth",value:function textWidth(e,t){return measureTextWidth(this.ctx,e,t,this.theme?this.theme.fontFamily:"sans-serif")}}])}(),Y=function(){function PlotArea(e){var t;return _classCallCheck(this,PlotArea),_defineProperty(t=_callSuper(this,PlotArea,[_objectSpread2({interactive:!0},e)]),"background",null),_defineProperty(t,"borderColor",null),t}return _inherits(PlotArea,j),_createClass(PlotArea,[{key:"setBackground",value:function setBackground(e){return this.background=e,this.markDirty()}},{key:"doRender",value:function doRender(){this.ctx.beginPath();var e=this.state,t=e.width,r=e.height;if(this.background&&(this.ctx.fillStyle=this.background,this.ctx.fillRect(0,0,t,r)),this.borderColor){this.ctx.strokeStyle=this.borderColor,this.ctx.lineWidth=this.unit();var n=this.unit()/2;this.ctx.strokeRect(n,n,t-this.unit(),r-this.unit())}}}])}(),q=function(){function Legend(e){var t;return _classCallCheck(this,Legend),_defineProperty(t=_callSuper(this,Legend,[_objectSpread2({interactive:!0},e)]),"layout",null),_defineProperty(t,"theme",null),_defineProperty(t,"selectable",!0),_defineProperty(t,"hoverIndex",-1),t}return _inherits(Legend,j),_createClass(Legend,[{key:"items",get:function get(){return this.layout&&this.layout.legend?this.layout.legend.items:[]}},{key:"hitItem",value:function hitItem(e,t){for(var r=this.items,n=0;n<r.length;n++){var a=r[n];if(e>=a.x&&e<=a.x+a.width&&t>=a.y&&t<=a.y+a.height)return n}return-1}},{key:"containsLocalPoint",value:function containsLocalPoint(e,t){return this.selectable&&this.hitItem(e,t)>=0}},{key:"doRender",value:function doRender(){if(this.theme&&this.layout&&this.layout.legend){var e=this.ctx,t=this.layout.legend.items;this.layout.legend,e.beginPath(),e.save();for(var r=0;r<t.length;r++){var n=t[r],a=n.y+n.height/2;e.globalAlpha=n.hidden?.45:1,e.fillStyle=n.color,roundRect(e,n.x,a-6,12,12,Math.min(3,6)),e.fill(),this.setFont(this.theme.fontSize,this.theme.fontFamily),e.textAlign="left",e.textBaseline="middle",e.fillStyle=n.hidden?this.theme.legend.inactiveColor:this.theme.legend.textColor,e.fillText(n.name,n.x+12+6,a),this.hoverIndex===r&&(e.globalAlpha=1,e.strokeStyle=this.theme.axisLineColor,e.lineWidth=this.unit(),roundRect(e,n.x-4,n.y+1,n.width+8,n.height-2,4),e.stroke())}e.restore()}}}])}();function roundRect(e,t,r,n,a,s){var l=Math.max(0,Math.min(s,n/2,a/2));e.beginPath(),l<=0?e.rect(t,r,n,a):(e.moveTo(t+l,r),e.lineTo(t+n-l,r),e.arcTo(t+n,r,t+n,r+l,l),e.lineTo(t+n,r+a-l),e.arcTo(t+n,r+a,t+n-l,r+a,l),e.lineTo(t+l,r+a),e.arcTo(t,r+a,t,r+a-l,l),e.lineTo(t,r+l),e.arcTo(t,r,t+l,r,l),e.closePath())}var $=function(){function Title(e){var t;return _classCallCheck(this,Title),_defineProperty(t=_callSuper(this,Title,[_objectSpread2({interactive:!1},e)]),"layout",null),_defineProperty(t,"theme",null),t}return _inherits(Title,j),_createClass(Title,[{key:"doRender",value:function doRender(){var e=this.layout&&this.layout.title;if(e&&this.theme&&this.layout){var t=this.layout.canvas,r=this.ctx,n="left"===e.align?0:"right"===e.align?t.width:t.width/2,a=e.y;r.save(),r.textAlign=e.align,r.textBaseline="top",e.text&&(this.setFont(e.textStyle.fontSize,this.theme.fontFamily,e.textStyle.fontWeight),r.fillStyle=e.textStyle.color,r.fillText(e.text,n,a),a+=1.5*e.textStyle.fontSize),e.subtext&&(this.setFont(e.subtextStyle.fontSize,this.theme.fontFamily),r.fillStyle=e.subtextStyle.color,r.fillText(e.subtext,n,a)),r.restore()}}}])}(),Z=function(){function Tooltip(e){var t;return _classCallCheck(this,Tooltip),_defineProperty(t=_callSuper(this,Tooltip,[_objectSpread2({interactive:!1},e)]),"theme",null),_defineProperty(t,"option",{}),_defineProperty(t,"layout",null),_defineProperty(t,"content",null),_defineProperty(t,"anchor",[0,0]),_defineProperty(t,"follow",!0),_defineProperty(t,"lastRect",null),_defineProperty(t,"pendingClear",!1),t}return _inherits(Tooltip,j),_createClass(Tooltip,[{key:"show",value:function show(e,t){var r=!this.content||this.pendingClear||this.currentOpacity()<.999;return this.content=e,this.anchor=t,this.pendingClear=!1,r&&this.playFade(!0),this.markDirty()}},{key:"hide",value:function hide(){return this.content?shouldAnimate()?(this.pendingClear=!0,this.playFade(!1),this.markDirty()):(this.content=null,this.lastRect=null,this.markDirty()):this}},{key:"panelOpacity",value:function panelOpacity(){var e=Number(this.state.panelOpacity);return isFinite(e)?Math.max(0,Math.min(1,e)):1}},{key:"currentOpacity",value:function currentOpacity(){var e=Number(this.state.panelOpacity);return isFinite(e)?Math.max(0,Math.min(1,e)):0}},{key:"playFade",value:function playFade(e){if(!shouldAnimate())return this.setState({panelOpacity:e?1:0,slideY:0}),void(e||(this.content=null,this.lastRect=null));var t=_objectSpread2({},this.props.animations||{});t.panelOpacity={from:this.currentOpacity(),to:e?1:0,duration:e?140:110,easing:e?"easeOutCubic":"easeInQuad",startTime:void 0,finished:!1},e&&(t.slideY={from:6,to:0,duration:180,easing:"easeOutCubic",startTime:void 0,finished:!1},this.state.slideY=6),this.props.animations=t,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),this.markDirty()}},{key:"doRender",value:function doRender(){if(this.lastRect=null,this.content&&this.theme&&this.layout){var e=this.panelOpacity();if(this.pendingClear&&e<=.02)return this.content=null,void(this.pendingClear=!1);var t,r=this.theme,n=this.option,a=r.tooltip,s=n.fontSize||a.fontSize,l=r.fontFamily,h=a.padding,u=1.6*s,c=this.content.rows,p=this.content.title?measureTextWidth(this.ctx,this.content.title,s,l):0,v=0,m=_createForOfIteratorHelper(c);try{for(m.s();!(t=m.n()).done;){var g=t.value,b=16+measureTextWidth(this.ctx,g.name,s,l)+16+measureTextWidth(this.ctx,g.value,s,l);b>v&&(v=b)}}catch(e){m.e(e)}finally{m.f()}var k=Math.max(p,v)+2*h,S=2*h+(this.content.title?u:0)+c.length*u,A=n.offset||[14,14],w=this.layout.canvas,_=this.layout.plot,M=this.anchor[0]+A[0],C=this.anchor[1]+A[1];M+k>w.width&&(M=this.anchor[0]-A[0]-k),M=k<=_.width-4?Math.max(_.x+2,Math.min(M,_.x+_.width-k-2)):Math.max(2,Math.min(M,Math.max(2,w.width-k-2))),C+S>w.height&&(C=this.anchor[1]-A[1]-S);var P=_.y+_.height-(s+8)/2;if(C+S>P){var T=this.anchor[1]-A[1]-S;C=T>=_.y+2?T:Math.max(_.y+2,P-S)}C=Math.max(2,Math.min(C,Math.max(2,w.height-S-2))),this.lastRect={x:M,y:C,width:k,height:S};var I=this.ctx,N=this.unit();I.beginPath(),I.save(),I.globalAlpha=e,C+=Number(this.state.slideY)||0,I.shadowColor=a.shadowColor,I.shadowBlur=10*N,I.shadowOffsetY=2*N,I.fillStyle=n.backgroundColor||a.background,roundRect(I,M,C,k,S,a.radius),I.fill(),I.shadowColor="transparent",I.shadowBlur=0,I.shadowOffsetY=0,I.strokeStyle=n.borderColor||a.borderColor,I.lineWidth=N,roundRect(I,M+N/2,C+N/2,k-N,S-N,a.radius),I.stroke(),I.fillStyle=n.textColor||a.textColor,I.textAlign="left",I.textBaseline="middle";var D=C+h+u/2;this.content.title&&(this.setFont(s,l,"bold"),I.fillText(this.content.title,M+h,D),D+=u);var O,R=_createForOfIteratorHelper(c);try{for(R.s();!(O=R.n()).done;){var H=O.value,z=D+u/2-u/2+u/2;this.setFont(s,l),I.fillStyle=H.color,roundRect(I,M+h,z-4,8,8,2),I.fill(),I.fillStyle=n.textColor||a.textColor,I.fillText(H.name,M+h+8+8,z),I.textAlign="right",I.fillText(H.value,M+k-h,z),I.textAlign="left",D+=u}}catch(e){R.e(e)}finally{R.f()}I.restore()}}}])}();var J=function(){function Crosshair(e){var t;return _classCallCheck(this,Crosshair),_defineProperty(t=_callSuper(this,Crosshair,[_objectSpread2({interactive:!1},e)]),"layout",null),_defineProperty(t,"theme",null),_defineProperty(t,"option",{}),_defineProperty(t,"pixelX",null),_defineProperty(t,"pixelY",null),_defineProperty(t,"xLabel",""),_defineProperty(t,"yLabel",""),_defineProperty(t,"lastChipRects",[]),_defineProperty(t,"followDuration",90),t}return _inherits(Crosshair,j),_createClass(Crosshair,[{key:"show",value:function show(e,t,r,n){var a=null!==this.pixelX&&null!==e&&Math.abs(this.pixelX-e)<.5&&(this.pixelY===t||null!==this.pixelY&&null!==t&&Math.abs(this.pixelY-t)<.5);return this.pixelX=e,this.pixelY=t,this.xLabel=r,this.yLabel=n,a||this.animateAxis(e,t),this.markDirty()}},{key:"drawnX",value:function drawnX(){var e=Number(this.state.axisX);return null===this.pixelX?null:isFinite(e)?e:this.pixelX}},{key:"drawnY",value:function drawnY(){var e=Number(this.state.axisY);return null===this.pixelY?null:isFinite(e)?e:this.pixelY}},{key:"animateAxis",value:function animateAxis(e,t){if(!shouldAnimate()||null===e||this.followDuration<=0)this.setState({axisX:e,axisY:t});else{var r=this.drawnX(),n=this.drawnY();if(null!==r){var a=function crosshairGlideDuration(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;if(!isFinite(t)||t<=0)return 0;var n=Math.abs(e);return!isFinite(n)||n<=0?0:Math.max(16,Math.min(t,n/r))}(Math.abs(e-r),this.followDuration);if(a<=0)this.setState({axisX:e,axisY:t});else{var s=_objectSpread2({},this.props.animations||{});s.axisX={from:r,to:e,duration:a,easing:"easeOutCubic",startTime:void 0,finished:!1},null!==n&&null!==t&&(s.axisY={from:n,to:t,duration:a,easing:"easeOutCubic",startTime:void 0,finished:!1}),this.props.animations=s,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this)}}else this.setState({axisX:e,axisY:t})}}},{key:"hide",value:function hide(){return null===this.pixelX&&null===this.pixelY?this:(this.pixelX=null,this.pixelY=null,this.stopAxisAnimation(),this.markDirty())}},{key:"stopAxisAnimation",value:function stopAxisAnimation(){var e=this.props.animations;if(e)for(var t in e)e[t]&&(e[t].finished=!0);this.ice&&this.ice.animationManager&&this.ice.animationManager.remove(this),this.state.axisX=null,this.state.axisY=null}},{key:"doRender",value:function doRender(){if(this.lastChipRects=[],this.layout&&this.theme&&!1!==this.option.show&&"none"!==this.option.type&&(null!==this.pixelX||null!==this.pixelY)){var e=this.layout.plot,t=this.ctx,r=this.unit(),n=this.option.axis||"x";if(t.beginPath(),t.save(),t.strokeStyle=this.option.lineColor||this.theme.crosshair.lineColor,t.lineWidth=r,"function"==typeof t.setLineDash&&t.setLineDash([3*r,3*r]),t.beginPath(),null!==this.pixelX&&"y"!==n){var a=this.snap(this.drawnX());t.moveTo(a,e.y),t.lineTo(a,e.y+e.height)}if(null!==this.pixelY&&("y"===n||"xy"===n)){var s=this.snap(this.drawnY());t.moveTo(e.x,s),t.lineTo(e.x+e.width,s)}t.stroke(),"function"==typeof t.setLineDash&&t.setLineDash([]),!1!==this.option.showAxisLabel&&(this.setFont(this.theme.fontSize,this.theme.fontFamily),t.textAlign="center",t.textBaseline="middle",null!==this.pixelX&&this.xLabel&&"y"!==n&&this.drawChip(this.snap(this.drawnX()),e.y+e.height,this.xLabel),null===this.pixelY||!this.yLabel||"y"!==n&&"xy"!==n||this.drawChip(e.x,this.snap(this.drawnY()),this.yLabel)),t.restore()}}},{key:"drawChip",value:function drawChip(e,t,r){var n=this.ctx,a=this.theme,s=n.measureText(r).width+12,l=a.fontSize+6;n.fillStyle=a.crosshair.labelBackground,this.lastChipRects.push({x:e-s/2,y:t-l/2,width:s,height:l}),n.fillRect(e-s/2,t-l/2,s,l),n.fillStyle=a.crosshair.labelColor,n.fillText(r,e,t)}}])}(),Q=function(){function Highlight(e){var t;return _classCallCheck(this,Highlight),_defineProperty(t=_callSuper(this,Highlight,[_objectSpread2({interactive:!1},e)]),"theme",null),_defineProperty(t,"hoverItems",[]),_defineProperty(t,"selectionItems",[]),t}return _inherits(Highlight,j),_createClass(Highlight,[{key:"setHover",value:function setHover(e){return this.hoverItems=e,this.markDirty()}},{key:"setSelection",value:function setSelection(e){return this.selectionItems=e,this.markDirty()}},{key:"doRender",value:function doRender(){if(this.theme){var e=this.ctx,t=this.unit();e.beginPath(),e.save();var r,n=_createForOfIteratorHelper(this.hoverItems);try{for(n.s();!(r=n.n()).done;){var a=r.value;if("rect"===a.shape){var s=a.width||0,l=a.height||0;if(s<=0||l<=0)continue;e.strokeStyle=a.color,e.lineWidth=Math.max(t,1.5*t),roundRect(e,a.x-s/2,a.y-l/2,s,l,Math.min(4,s/2,l/2)),e.stroke()}else{var h=Math.max(3,a.size/2+3);e.beginPath(),e.arc(a.x,a.y,h,0,2*Math.PI),e.fillStyle="rgba(255,255,255,0.55)",e.fill(),e.beginPath(),e.arc(a.x,a.y,h,0,2*Math.PI),e.strokeStyle=a.color,e.lineWidth=Math.max(t,1.5*t),e.stroke()}}}catch(e){n.e(e)}finally{n.f()}var u,c=_createForOfIteratorHelper(this.selectionItems);try{for(c.s();!(u=c.n()).done;){var p=u.value;if(e.strokeStyle=this.theme.selection.stroke,e.lineWidth=Math.max(t,1.5*t),"rect"===p.shape){var v=p.width||0,m=p.height||0;if(v<=0||m<=0)continue;roundRect(e,p.x-v/2-2,p.y-m/2-2,v+4,m+4,5),e.stroke()}else{var g=Math.max(3,p.size/2+3);e.beginPath(),e.arc(p.x,p.y,g,0,2*Math.PI),e.stroke()}}}catch(e){c.e(e)}finally{c.f()}e.restore()}}}])}(),ee=function(){function Brush(e){var t;return _classCallCheck(this,Brush),_defineProperty(t=_callSuper(this,Brush,[_objectSpread2({interactive:!1},e)]),"theme",null),_defineProperty(t,"rect",null),_defineProperty(t,"color",null),t}return _inherits(Brush,j),_createClass(Brush,[{key:"setRect",value:function setRect(e){return this.rect=e,e?this.keepAnimating():this.stopAnimating(),this.markDirty()}},{key:"doRender",value:function doRender(){if(this.rect&&this.theme){var e=this.ctx,t=this.color||this.theme.brush,r=this.unit();if(e.beginPath(),e.save(),e.fillStyle=t.fill,e.fillRect(this.rect.x,this.rect.y,this.rect.width,this.rect.height),e.strokeStyle=t.stroke,e.lineWidth=r,"function"==typeof e.setLineDash){var n=[5*r,4*r],a=n[0]+n[1]||1;e.setLineDash(n),"number"==typeof e.lineDashOffset&&(e.lineDashOffset=-Date.now()/1e3*26%a)}e.strokeRect(this.rect.x,this.rect.y,this.rect.width,this.rect.height),"function"==typeof e.setLineDash&&e.setLineDash([]),e.restore()}}}])}(),te=function(){function RadarGrid(e){var t;return _classCallCheck(this,RadarGrid),_defineProperty(t=_callSuper(this,RadarGrid,[_objectSpread2({interactive:!1},e)]),"coord",null),_defineProperty(t,"theme",null),_defineProperty(t,"layout",null),t}return _inherits(RadarGrid,j),_createClass(RadarGrid,[{key:"doRender",value:function doRender(){var e=this.coord,t=this.theme;if(e&&t){var r=this.ctx,n=this.unit(),a=e.indicators.length;if(a){var s=e.polar.cx,l=e.polar.cy,h=e.polar.radius,u=function angleOf(e){return-Math.PI/2+e/a*Math.PI*2};this.layout,r.beginPath(),r.save(),r.lineWidth=n,r.strokeStyle=t.splitLineColor;for(var c=1;c<=e.splitNumber;c++){var p=h*c/e.splitNumber;if(r.beginPath(),"circle"===e.shape)r.arc(s,l,p,0,2*Math.PI);else{for(var v=0;v<a;v++){var m=u(v),g=s+Math.cos(m)*p,b=l+Math.sin(m)*p;0===v?r.moveTo(g,b):r.lineTo(g,b)}r.closePath()}r.stroke()}r.beginPath();for(var k=0;k<a;k++){var S=u(k);r.moveTo(s,l),r.lineTo(s+Math.cos(S)*h,l+Math.sin(S)*h)}r.stroke(),this.setFont(t.fontSize,t.fontFamily),r.fillStyle=t.subTextColor,r.textBaseline="middle";for(var A=0;A<a;A++){var w=u(A),_=s+Math.cos(w)*(h+10*n),M=l+Math.sin(w)*(h+10*n),C=Math.cos(w);r.textAlign=Math.abs(C)<.2?"center":C>0?"left":"right",r.fillText(e.indicators[A].name,_,M)}r.restore()}}}}])}(),ie=function(){function PolarGrid(e){var t;return _classCallCheck(this,PolarGrid),_defineProperty(t=_callSuper(this,PolarGrid,[_objectSpread2({interactive:!1},e)]),"coord",null),_defineProperty(t,"theme",null),_defineProperty(t,"layout",null),t}return _inherits(PolarGrid,j),_createClass(PolarGrid,[{key:"geometry",value:function geometry(){var e=this.coord;if(!e)return null;var t=e.plot,r=t.x+e.xScale.map(0),n=t.y+e.yScale.map(0);if(!isFinite(r)||!isFinite(n))return null;var a=Math.min(Math.abs(r-t.x),Math.abs(t.x+t.width-r),Math.abs(n-t.y),Math.abs(t.y+t.height-n));if(!(a>1))return null;var s=e.xScale.map(1)-e.xScale.map(0);return{cx:r,cy:n,radiusPx:a,rMax:Math.abs(s)>1e-9?a/Math.abs(s):0}}},{key:"doRender",value:function doRender(){var e=this.coord,t=this.theme;if(e&&t&&!1!==e.options.show){var r=this.geometry();if(r){var n=r.cx,a=r.cy,s=r.radiusPx,l=r.rMax,h=e.options,u=Math.max(1,Math.min(12,Number(h.splitNumber)||4)),c=Math.max(4,Math.min(36,Number(h.spokeCount)||12)),p=(Number(h.startAngle)||0)*Math.PI/180,v=this.unit(),m=this.ctx;m.beginPath(),m.save(),m.lineWidth=v,m.strokeStyle=t.splitLineColor;for(var g=1;g<=u;g++)m.beginPath(),m.arc(n,a,s*g/u,0,2*Math.PI),m.stroke();m.beginPath();for(var b=0;b<c;b++){var k=p+b/c*Math.PI*2;m.moveTo(n,a),m.lineTo(n+Math.cos(k)*s,a+Math.sin(k)*s)}if(m.stroke(),!1!==h.showLabels&&l>0){var S=p+Math.PI/4,A=Math.cos(S),w=Math.sin(S);this.setFont(t.fontSize,t.fontFamily),m.fillStyle=t.subTextColor,m.textBaseline="middle";for(var _=1;_<=u;_++){var M=l*_/u,C=n+A*(s*_/u),P=a+w*(s*_/u);m.textAlign=A>=0?"left":"right";var T=Math.abs(M)>=1?String(Number(M.toPrecision(3))):String(Number(M.toPrecision(2)));m.strokeStyle="transparent"===t.backgroundColor?"#ffffff":t.backgroundColor,m.lineWidth=3*v,m.strokeText(T,C+3*A*v,P+3*w*v),m.fillText(T,C+3*A*v,P+3*w*v),m.strokeStyle=t.splitLineColor,m.lineWidth=v}}m.restore()}}}}])}(),re=function(){function DataZoomSlider(e){var t;return _classCallCheck(this,DataZoomSlider),_defineProperty(t=_callSuper(this,DataZoomSlider,[_objectSpread2({interactive:!0},e)]),"theme",null),_defineProperty(t,"start",0),_defineProperty(t,"end",1),_defineProperty(t,"activePart",null),_defineProperty(t,"handleWidth",12),t}return _inherits(DataZoomSlider,j),_createClass(DataZoomSlider,[{key:"setWindow",value:function setWindow(e,t){var r=clamp$2(e,0,1),n=clamp$2(t,0,1);return Math.abs(r-this.start)<1e-6&&Math.abs(n-this.end)<1e-6?this:(this.start=r,this.end=n,this.markDirty())}},{key:"setActive",value:function setActive(e){return this.activePart===e?this:(this.activePart=e,this.markDirty())}},{key:"hitPart",value:function hitPart(e,t){var r=this.state,n=r.width,a=r.height;if(e<0||e>n||t<0||t>a)return null;var s=this.start*n,l=this.end*n,h=this.handleWidth/2;return Math.abs(e-s)<=h?"start":Math.abs(e-l)<=h?"end":e>s&&e<l?"window":"track"}},{key:"fractionAt",value:function fractionAt(e){return clamp$2(e/(this.state.width||1),0,1)}},{key:"doRender",value:function doRender(){if(this.theme){var e=this.ctx,t=this.state,r=t.width,n=t.height,a=this.unit(),s=Math.max(4,Math.round(.34*n)),l=(n-s)/2,h=this.start*r,u=this.end*r,c=this.theme.colorPalette[0],p=this.handleWidth;e.beginPath(),e.save(),e.fillStyle=this.theme.splitLineColor,roundRect(e,0,l,r,s,s/2),e.fill(),e.fillStyle=c,e.globalAlpha=.85,roundRect(e,h,l,Math.max(2,u-h),s,s/2),e.fill(),e.globalAlpha=1;for(var v=0,m=[[h,"start"],[u,"end"]];v<m.length;v++){var g=_slicedToArray(m[v],2),b=g[0],k=g[1],S=clamp$2(b-p/2,0,Math.max(0,r-p));e.fillStyle="#ffffff",e.strokeStyle=this.activePart===k?c:this.theme.axisLineColor,e.lineWidth=(this.activePart===k?2:1)*a,roundRect(e,S,1,p,n-2,3),e.fill(),e.stroke(),e.beginPath(),e.moveTo(S+p/2-2,l-3),e.lineTo(S+p/2-2,l+s+3),e.moveTo(S+p/2+2,l-3),e.lineTo(S+p/2+2,l+s+3),e.strokeStyle=this.theme.subTextColor,e.lineWidth=a,e.stroke()}e.restore()}}}])}(),ne=function(){function SeriesBase(e,t){var r;return _classCallCheck(this,SeriesBase),_defineProperty(r=_callSuper(this,SeriesBase,[_objectSpread2({interactive:!0},t)]),"chartTheme",null),_defineProperty(r,"hiddenSlices",[]),_defineProperty(r,"coord",null),_defineProperty(r,"barSlot",{index:0,count:1}),_defineProperty(r,"pixels",new Float64Array(0)),_defineProperty(r,"effective",new Float64Array(0)),_defineProperty(r,"fromEffective",null),_defineProperty(r,"renderIndices",null),_defineProperty(r,"xMonotonic",!0),_defineProperty(r,"sizeExtent",[0,1]),_defineProperty(r,"itemProgress",new Float64Array(0)),_defineProperty(r,"stagger",0),_defineProperty(r,"animationKind","enter"),_defineProperty(r,"hoverIndex",null),_defineProperty(r,"cacheKey",""),_defineProperty(r,"supportsSampling",!0),_defineProperty(r,"clipToBox",!1),_defineProperty(r,"localBoxScratch",[0,0,0,0]),r.series=e,r}return _inherits(SeriesBase,j),_createClass(SeriesBase,[{key:"__localBox",value:function __localBox(){var e=this.paintPad(),t=this.localBoxScratch;return t[0]=-e,t[1]=-e,t[2]=(this.state.width||0)+e,t[3]=(this.state.height||0)+e,t}},{key:"paintPad",value:function paintPad(){var e=this.series.option,t=!1===e.showSymbol?0:this.maxSymbolSize()/2+4;return Math.max(t,(e.lineWidth||2)+4,6)}},{key:"symbolSizeAt",value:function symbolSizeAt(e){var t=this.series.option,r=t.symbolSize;if("function"==typeof r){var n=this.series.yValueAt(e),a=NaN;try{var s=this.series.virtual?null:this.series.pointAt(e);a=Number(r(n,{dataIndex:e,data:s?s.raw:void 0,seriesName:this.series.name}))}catch(e){a=NaN}return isFinite(a)&&a>0?a:8}var l=this.series.sizeAt(e);if("number"==typeof l&&isFinite(l)){var h=Array.isArray(t.symbolSizeRange)?t.symbolSizeRange:[8,40],u=_slicedToArray(this.sizeExtent,2),c=u[0],p=u[1],v=p>c?(l-c)/(p-c):.5;return h[0]+(h[1]-h[0])*Math.max(0,Math.min(1,v))}var m=Number(r);return isFinite(m)&&m>0?m:8}},{key:"maxSymbolSize",value:function maxSymbolSize(){var e=this.series.option;if("function"==typeof e.symbolSize||this.hasPointSize()){var t=Array.isArray(e.symbolSizeRange)?e.symbolSizeRange:[8,40];return Math.max(8,Number(t[1])||40)}var r=Number(e.symbolSize);return isFinite(r)&&r>0?r:8}},{key:"hasPointSize",value:function hasPointSize(){var e=storeDomainOf(this.series);if(this.series.virtual)return!(!e||!e.sizeExtent);for(var t=this.series,r=0,n=t.pointCount;r<n;r++)if("number"==typeof t.sizeAt(r))return!0;return!1}},{key:"setCoord",value:function setCoord(e){return this.coord=e,this.cacheKey="",this.series.virtual&&this.syncVirtualMeta(),this.markDirty()}},{key:"setHiddenSlices",value:function setHiddenSlices(e){return this.hiddenSlices=e||[],this.markDirty()}},{key:"setAnimationStage",value:function setAnimationStage(e){return this.stagger=e&&isFinite(Number(e.stagger))?Math.max(0,Math.min(.95,Number(e.stagger))):0,this.animationKind=e&&"update"===e.kind?"update":"enter",this}},{key:"isEntering",value:function isEntering(){return"enter"===this.animationKind&&this.progress()<1}},{key:"progressFor",value:function progressFor(e,t){var r=this.progress();if(r>=1)return 1;if(this.stagger<=0||t<=1)return r;var n=1/(1+this.stagger),a=(r-e/(t-1)*this.stagger*n)/n;return a<=0?0:a>=1?1:a}},{key:"computeItemProgress",value:function computeItemProgress(){var e=this.series.pointCount;this.itemProgress.length!==e&&(this.itemProgress=new Float64Array(e));for(var t=0;t<e;t++)this.itemProgress[t]=this.progressFor(t,e)}},{key:"getAnimationState",value:function getAnimationState(){return this.computeItemProgress(),{progress:this.progress(),kind:this.animationKind,stagger:this.stagger,itemProgress:Array.from(this.itemProgress)}}},{key:"setHoverIndex",value:function setHoverIndex(e){var t=void 0===e?null:e;if(this.hoverIndex!==t){var r=null!==this.hoverIndex;this.hoverIndex=t;var n=this.highlightT(),a=null===t?0:1;if(!shouldAnimate())return this.setState({highlightT:a}),void this.markDirty();var s=_objectSpread2({},this.props.animations||{});s.highlightT={from:n,to:a,duration:null===t?180:260,easing:null===t?"easeOutCubic":"springSnappy",startTime:void 0,finished:!1},this.props.animations=s,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),r||null===t||this.markDirty()}}},{key:"highlightT",value:function highlightT(){var e=Number(this.state.highlightT);return isFinite(e)?Math.max(0,Math.min(1.2,e)):0}},{key:"hoverBoost",value:function hoverBoost(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.12,r=arguments.length>2?arguments[2]:void 0;return this.hoverIndex!==e?1:1+t*(void 0===r?this.highlightT():Math.max(0,Math.min(1,r)))}},{key:"hoverAlpha",value:function hoverAlpha(e){return this.hoverIndex!==e?0:Math.max(0,Math.min(1,this.highlightT()))}},{key:"drawHoverOverlay",value:function drawHoverOverlay(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.hoverAlpha(e);if(!(n<=.01||t.width<=0||t.height<=0)){var a=this.ctx,s=this.unit(),l=Number(r.radius)||0;a.save(),a.globalAlpha=n,"none"!==r.fill&&(roundRect(a,t.x,t.y,t.width,t.height,l),a.fillStyle=r.fill||"rgba(255,255,255,0.16)",a.fill()),roundRect(a,t.x,t.y,t.width,t.height,l),a.strokeStyle=r.stroke||"rgba(255,255,255,0.95)",a.lineWidth=Math.max(s,(r.lineWidth||2)*s),a.stroke(),a.restore()}}},{key:"buildSeriesKey",value:function buildSeriesKey(e){return[].concat(_toConsumableArray(e),[this.coordKey(),this.progress(),this.animationKind,this.stagger]).join("|")}},{key:"coordKey",value:function coordKey(){var e=this.coord;if(!e)return"-";var t=[];e.plot&&t.push("p".concat(e.plot.x,",").concat(e.plot.y,",").concat(e.plot.width,",").concat(e.plot.height));for(var r=0,n=["xScale","yScale"];r<n.length;r++){var a=n[r],s=e[a],l=s&&s.domain;l&&l.length&&t.push("".concat(a,"[").concat(l.length,"]:").concat(String(l[0]),"~").concat(String(l[l.length-1])))}return t.join(";")}},{key:"updateSeries",value:function updateSeries(e,t){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]||(this.fromEffective=t&&this.effective.length===2*e.pointCount?new Float64Array(this.effective):null),this.series=e,this.cacheKey="",e.virtual&&this.syncVirtualMeta(),this.markDirty()}},{key:"pixelAt",value:function pixelAt(e){if(this.series.virtual)return this.virtualPixelAt(e);this.rebuildPixels();var t=this.pixels[2*e],r=this.pixels[2*e+1];return isFinite(t)&&isFinite(r)?[t,r]:null}},{key:"barRectAt",value:function barRectAt(e){return null}},{key:"containsLocalPoint",value:function containsLocalPoint(e,t){return this.hitTestIndex(e,t)>=0}},{key:"progress",value:function progress(){var e=Number(this.state.progress);return isFinite(e)?Math.max(0,Math.min(1,e)):1}},{key:"computeEffective",value:function computeEffective(){var e=this.series,t=e.pointCount;this.effective.length!==2*t&&(this.effective=new Float64Array(2*t),this.fromEffective=null),this.computeItemProgress();for(var r=this.progress(),n=0;n<t;n++){var a=this.itemProgress[n];if(null!==this.series.yValueAt(n)){var s=e.topAt(n);if(null!=s){var l=e.baseAt(n),h=isFinite(l)?l:0,u=0,c=0;if(this.fromEffective){var p=this.fromEffective[2*n],v=this.fromEffective[2*n+1];isFinite(p)&&(u=p),isFinite(v)&&(c=v)}this.effective[2*n]=a>=1?h:u+(h-u)*a,this.effective[2*n+1]=a>=1?s:c+(s-c)*a}else this.effective[2*n]=NaN,this.effective[2*n+1]=NaN}else this.effective[2*n]=NaN,this.effective[2*n+1]=NaN}r>=1&&(this.fromEffective=null)}},{key:"rebuildPixels",value:function rebuildPixels(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.series.virtual||this.series.raw){var t=this.coord;if(t){var r=this.buildCacheKey(t);if(e||r!==this.cacheKey){var n=t.xScale.domain,a=t.yScale.domain,s=this.__incrementalXDomain,l=this.__incrementalYDomain,h=function numericPair(e){return Array.isArray(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]&&isFinite(e[0])&&isFinite(e[1])};if(!e&&h(n)&&h(a)&&h(s)&&h(l)&&n[1]-n[0]===s[1]-s[0]&&a[0]===l[0]&&a[1]===l[1]&&this.pixels.length===2*this.series.pointCount){for(var u=(s[0]-n[0])/(n[1]-n[0])*t.plot.width,c=0;c<this.pixels.length;c+=2)this.pixels[c]+=u;return this.__incrementalXDomain=[n[0],n[1]],void(this.cacheKey=r)}this.computeEffective();var p=this.series,v=p.pointCount;this.pixels.length!==2*v&&(this.pixels=new Float64Array(2*v));for(var m=t.xScale,g=t.yScale,b=!0,k=-1/0,S=0;S<v;S++){var A=m.map(p.xValueAt(S)),w=this.effective[2*S+1],_=isFinite(w)?g.map(w):NaN;this.pixels[2*S]=A,this.pixels[2*S+1]=_,isFinite(A)&&(A<k&&(b=!1),k=A)}this.xMonotonic=b,this.sizeExtent=function computeSizeExtent(e){for(var t=1/0,r=-1/0,n=0,a=e.pointCount;n<a;n++){var s=e.sizeAt(n);"number"==typeof s&&isFinite(s)&&(s<t&&(t=s),s>r&&(r=s))}return isFinite(t)?t===r?[t,t+1]:[t,r]:[0,1]}(p),this.renderIndices=this.buildRenderIndices(v,t.plot.width),this.__incrementalXDomain=Array.isArray(n)&&2===n.length?[n[0],n[1]]:null,this.__incrementalYDomain=Array.isArray(a)&&2===a.length?[a[0],a[1]]:null,this.cacheKey=r}}else this.pixels=new Float64Array(0)}else this.syncVirtualMeta()}},{key:"syncVirtualMeta",value:function syncVirtualMeta(){this.pixels.length&&(this.pixels=new Float64Array(0));var e=storeDomainOf(this.series);this.xMonotonic=!(!e||!e.xMonotonic),this.renderIndices=null,e&&e.sizeExtent&&(this.sizeExtent=e.sizeExtent)}},{key:"virtualLowerBound",value:function virtualLowerBound(e){for(var t=this.series,r=0,n=t.pointCount;r<n;){var a=r+n>>1;Number(t.xValueAt(a))<e?r=a+1:n=a}return r}},{key:"virtualUpperBound",value:function virtualUpperBound(e){for(var t=this.series,r=0,n=t.pointCount;r<n;){var a=r+n>>1;Number(t.xValueAt(a))<=e?r=a+1:n=a}return r}},{key:"virtualVisibleWindow",value:function virtualVisibleWindow(e){var t=this.coord,r=this.series.pointCount;if(!t||!r)return{i0:0,i1:-1};if(this.series.chunks)return this.chunkWindow(this.series.chunks,t,e);if(!this.xMonotonic)return{i0:0,i1:r-1};var n=t.xScale.invert(-e),a=t.xScale.invert(t.plot.width+e),s=this.virtualLowerBound(Math.min(n,a)),l=this.virtualUpperBound(Math.max(n,a));return{i0:Math.max(0,s-1),i1:Math.min(r-1,l)}}},{key:"chunkWindow",value:function chunkWindow(e,t,r){var n=this,a=t.xScale.invert(-r),s=t.xScale.invert(t.plot.width+r),l=chunkRangeForX(e,Math.min(a,s),Math.max(a,s)),h=l.from,u=l.to;if(u<h)return{i0:0,i1:-1};var c,p=_createForOfIteratorHelper(function pickChunksForWindow(e,t,r){var n=t-e+1;if(n<=0)return[];var a=Math.max(1,Math.min(Math.max(1,r),n));if(n===a){for(var s=[],l=e;l<=t;l++)s.push(l);return s}for(var h=[],u=0;u<a;u++){var c=e+Math.round(u*(n-1)/(a-1));h[h.length-1]!==c&&h.push(c)}return h}(h,u,e.maxResident));try{for(p.s();!(c=p.n()).done;){requestChunk(e,c.value,function(){return n.markDirty()})}}catch(e){p.e(e)}finally{p.f()}var v=e.offsets[h],m=e.offsets[u]+e.sizes[u]-1;return{i0:v,i1:Math.min(e.total-1,m)}}},{key:"virtualPixelAt",value:function virtualPixelAt(e){var t=this.coord,r=this.series;if(!t||e<0||e>=r.pointCount)return null;var n=r.yValueAt(e);if(null===n)return null;var a=t.xScale.map(r.xValueAt(e)),s=t.yScale.map(n);return isFinite(a)&&isFinite(s)?[a,s]:null}},{key:"virtualNearestIndexAtX",value:function virtualNearestIndexAtX(e){var t=this.coord,r=this.series,n=r.pointCount;if(!t||!n)return-1;var a=function pixelX(e){return t.xScale.map(r.xValueAt(e))},s=r.chunks;if(s){for(var l=Number(t.xScale.invert(e)),h=chunkRangeForX(s,l,l),u=h.from,c=h.to,p=-1,v=1/0,m=Math.max(0,u);m<=c&&m<s.sizes.length;m++)if(s.resident[m]){for(var g=s.offsets[m],b=Math.min(s.total-1,g+s.sizes[m]-1),k=g,S=b;k<S;){var A=k+S>>1,w=a(A);!isFinite(w)||w<e?k=A+1:S=A}for(var _=0,M=[k-1,k,k+1];_<M.length;_++){var C=M[_];if(!(C<g||C>b)){var P=a(C);if(isFinite(P)){var T=Math.abs(P-e);T<v&&(v=T,p=C)}}}}return p}if(!this.xMonotonic){for(var I=-1,N=1/0,D=0;D<n;D++){var O=a(D);if(isFinite(O)){var R=Math.abs(O-e);R<N&&(N=R,I=D)}}return I}for(var H=0,z=n-1;H<z;){var V=H+z>>1,L=a(V);!isFinite(L)||L<e?H=V+1:z=V}for(var E=-1,B=1/0,j=0,W=[H,H-1];j<W.length;j++){var X=W[j];if(!(X<0||X>=n)){var G=a(X);if(isFinite(G)){var U=Math.abs(G-e);U<B&&(B=U,E=X)}}}return E}},{key:"paintInto",value:function paintInto(e){if(!this.series.virtual)return!1;var t=this.ctx;this.ctx=e;try{return this.doRender(),!0}finally{this.ctx=t}}},{key:"virtualIndexRange",value:function virtualIndexRange(e,t){var r=this.coord,n=this.series,a=n.pointCount;if(!r||!a||!n.virtual)return{from:0,to:-1};var s=function inverted(e){return Number(r.xScale.invert(e))},l=s(Math.min(e,t)),h=s(Math.max(e,t));return isFinite(l)&&isFinite(h)?{from:this.virtualLowerBound(l),to:this.virtualUpperBound(h)-1}:{from:0,to:a-1}}},{key:"buildRenderIndices",value:function buildRenderIndices(e,t){if(!this.supportsSampling||!this.xMonotonic)return null;var r=this.series.option;if("none"===r.sampling)return null;if(!r.sampling&&e<=Math.max(2e3,3*t))return null;var n=Math.max(64,Math.min(e,Math.floor(2*t)));return e<=n+2?null:function lttbIndices(e,t,r){if(r>=t||r<=2){for(var n=[],a=0;a<t;a++)n.push(a);return n}for(var s=[0],l=(t-2)/(r-2),h=0,u=0;u<r-2;u++){var c=Math.floor((u+1)*l)+1,p=Math.floor((u+2)*l)+1;p>t&&(p=t);for(var v=0,m=0,g=0;c<p;c++){var b=e[2*c+1];isFinite(b)&&(v+=e[2*c],m+=b,g++)}g?(v/=g,m/=g):(v=e[2*(t-1)],m=e[2*(t-1)+1],isFinite(m)||(m=e[2*h+1],v=e[2*h]));for(var k=Math.floor(u*l)+1,S=Math.min(Math.floor((u+1)*l)+1,t-1),A=e[2*h],w=e[2*h+1],_=-1,M=k,C=k;C<S;C++){var P=e[2*C+1];if(isFinite(P)){var T=e[2*C],I=Math.abs((A-v)*(P-w)-(A-T)*(m-w));I>_&&(_=I,M=C)}}s.push(M),h=M}return s.push(t-1),s}(this.pixels,e,n)}},{key:"renderCount",value:function renderCount(){return this.renderIndices?this.renderIndices.length:this.pixels.length/2}},{key:"renderIndexAt",value:function renderIndexAt(e){return this.renderIndices?this.renderIndices[e]:e}},{key:"nearestIndexAtX",value:function nearestIndexAtX(e){var t=this;if(this.rebuildPixels(),this.series.virtual)return this.virtualNearestIndexAtX(e);var r=this.pixels.length/2;if(!r)return-1;if(!this.xMonotonic){for(var n=-1,a=1/0,s=0;s<r;s++){var l=this.pixels[2*s];if(isFinite(l)){var h=Math.abs(l-e);h<a&&(a=h,n=s)}}return n}for(var u=0,c=r-1;u<c;){var p=u+c>>1,v=this.pixels[2*p];!isFinite(v)||v<e?u=p+1:c=p}var m,g=[u,u-1].filter(function(e){return e>=0&&e<r&&isFinite(t.pixels[2*e])}),b=-1,k=1/0,S=_createForOfIteratorHelper(g);try{for(S.s();!(m=S.n()).done;){var A=m.value,w=Math.abs(this.pixels[2*A]-e);w<k&&(k=w,b=A)}}catch(e){S.e(e)}finally{S.f()}return b}},{key:"buildCacheKey",value:function buildCacheKey(e){var t=e.xScale.domain,r=e.yScale.domain;return[this.series.pointCount,this.progress(),e.plot.width,e.plot.height,String(t[0]),String(t[t.length-1]),String(r[0]),String(r[1]),this.series.pointCount?String(this.series.xValueAt(0)):""].join("|")}},{key:"eachSegment",value:function eachSegment(e){for(var t=this.pixels.length/2,r=0;r<t-1;r++){var n=this.pixels[2*r],a=this.pixels[2*r+1],s=this.pixels[2*(r+1)],l=this.pixels[2*(r+1)+1];isFinite(n)&&isFinite(a)&&isFinite(s)&&isFinite(l)&&e(n,a,s,l,r)}}},{key:"pointColor",value:function pointColor(e){return this.series.option.color||this.series.color}},{key:"lineWidthDevice",value:function lineWidthDevice(){var e=this.series.option.lineWidth;return isFinite(e)?e:2}},{key:"opacity",value:function opacity(){var e=Number(this.series.option.opacity);return isFinite(e)?Math.max(0,Math.min(1,e)):1}},{key:"beginDraw",value:function beginDraw(){this.ctx.beginPath(),this.ctx.save(),this.clipToBox&&(this.ctx.beginPath(),this.ctx.rect(0,0,this.state.width,this.state.height),this.ctx.clip()),this.ctx.lineJoin="round",this.ctx.lineCap="round",this.ctx.globalAlpha=this.opacity()}},{key:"endDraw",value:function endDraw(){this.ctx.restore()}},{key:"drawSymbol",value:function drawSymbol(e,t,r,n,a,s){var l=this.ctx,h=this.unit();l.beginPath(),"rect"===r?l.rect(e-n/2,t-n/2,n,n):l.arc(e,t,Math.max(1,n/2),0,2*Math.PI),a&&(l.fillStyle=a,l.fill()),s&&(l.strokeStyle=s,l.lineWidth=h,l.stroke())}},{key:"pointByIndex",value:function pointByIndex(e){return this.series.pointAt(e)||null}}])}();var ae=function(){function LineSeries(){var e;_classCallCheck(this,LineSeries);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _defineProperty(e=_callSuper(this,LineSeries,[].concat(r)),"seriesType","line"),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"fillArea",!1),e}return _inherits(LineSeries,ne),_createClass(LineSeries,[{key:"doRender",value:function doRender(){this.rebuildPixels();var e=this.renderSequence(),t=e.pts,r=e.indices;if(t.length){var n=this.series.option,a=this.pointColor(0),s=this.unit(),l=this.lineWidthDevice()*s,h=n.symbol||"circle",u=!0===n.showSymbol||"scatter"===this.seriesType,c=this.ctx;if(this.beginDraw(),this.fillArea&&this.drawArea(a,t,r),c.beginPath(),c.strokeStyle=a,c.lineWidth=l,"function"==typeof c.setLineDash&&Array.isArray(n.lineDash)&&c.setLineDash(n.lineDash.map(function(e){return e*s})),n.smooth?this.drawSmoothLine(t,"number"==typeof n.smooth?n.smooth:.5):this.drawStraightLine(t),c.stroke(),"function"==typeof c.setLineDash&&c.setLineDash([]),u&&"none"!==h)for(var p=n.symbolFill||a,v=n.symbolStroke||"#ffffff",m=0;m<t.length;m++){var g=t[m];g&&this.drawSymbol(g[0],g[1],h,this.symbolSizeAt(r[m]),p,v)}this.endDraw()}}},{key:"renderSequence",value:function renderSequence(){if(this.rebuildPixels(),this.series.virtual)return this.virtualRenderSequence();var e=[],t=[],r=this.renderCount();this.isEntering()&&(r=Math.max(1,Math.ceil(r*this.progress())));for(var n=0;n<r;n++){var a=this.renderIndexAt(n),s=this.pixels[2*a],l=this.pixels[2*a+1];isFinite(s)&&isFinite(l)?(e.push([s,l]),t.push(a)):e.length&&null!==e[e.length-1]&&(e.push(null),t.push(-1))}return{pts:e,indices:t}}},{key:"renderPoints",value:function renderPoints(){return this.renderSequence().pts.filter(function(e){return!!e})}},{key:"revealedPointCount",value:function revealedPointCount(){return this.rebuildPixels(),this.renderPoints().length}},{key:"virtualRenderSequence",value:function virtualRenderSequence(){var e=this,t=this.coord,r=this.series,n=r.pointCount,a={pts:[],indices:[]};if(!t||!n)return a;var s=this.virtualVisibleWindow(this.maxSymbolSize()),l=s.i0,h=s.i1;if(h<l)return a;var u=h-l+1,c=t.plot.width,p=this.isEntering()?Math.max(0,Math.ceil(u*this.progress())):u;if(p<=0)return a;var v=Math.min(h,l+p-1),m=u>4096?Math.max(1,Math.floor(u/(8*c))):1,g=[],b=[],k=function pushBreak(){g.length&&null!==g[g.length-1]&&(g.push(null),b.push(-1))};if(1===m){for(var S=l;S<=v;S++){var A=this.virtualPixelAt(S);A?(g.push(A),b.push(S)):k()}return{pts:g,indices:b}}for(var w=NaN,_=-1,M=-1,C=-1,P=-1,T=1/0,I=-1/0,N=function flush(){if(!(_<0)){for(var t=[],r=0,n=[_,C,P,M];r<n.length;r++){var a=n[r];a<0||t.indexOf(a)>=0||t.push(a)}t.sort(function(e,t){return e-t});for(var s=0,l=t;s<l.length;s++){var h=l[s],u=e.virtualPixelAt(h);u&&(g.push(u),b.push(h))}_=-1}},D=l;D<=v;D+=m){var O=r.yValueAt(D);if(null!==O){var R=t.xScale.map(r.xValueAt(D)),H=t.yScale.map(O);if(isFinite(R)&&isFinite(H)){var z=Math.floor(R);z===w?(M=D,H<T&&(T=H,C=D),H>I&&(I=H,P=D)):(N(),w=z,_=D,M=D,C=D,P=D,T=H,I=H)}}else N(),k(),w=NaN}return N(),{pts:g,indices:b}}},{key:"drawStraightLine",value:function drawStraightLine(e){var t,r=this.ctx,n=!1,a=_createForOfIteratorHelper(e);try{for(a.s();!(t=a.n()).done;){var s=t.value;s?n?r.lineTo(s[0],s[1]):(r.moveTo(s[0],s[1]),n=!0):n=!1}}catch(e){a.e(e)}finally{a.f()}}},{key:"drawSmoothLine",value:function drawSmoothLine(e,t){var r,n=this.ctx,a=Math.max(.05,Math.min(1,t))/3,s=[],l=function flush(){if(1===s.length)n.moveTo(s[0][0],s[0][1]);else if(s.length>1){n.moveTo(s[0][0],s[0][1]);for(var e=0;e<s.length-1;e++){var t=e>0?s[e-1]:s[e],r=s[e],l=s[e+1],h=e+2<s.length?s[e+2]:l,u=r[0]+(l[0]-t[0])*a,c=r[1]+(l[1]-t[1])*a,p=l[0]-(h[0]-r[0])*a,v=l[1]-(h[1]-r[1])*a;n.bezierCurveTo(u,c,p,v,l[0],l[1])}}s=[]},h=_createForOfIteratorHelper(e);try{for(h.s();!(r=h.n()).done;){var u=r.value;u?s.push(u):l()}}catch(e){h.e(e)}finally{h.f()}l()}},{key:"drawArea",value:function drawArea(e,t,r){var n=this.coord;if(n){var a=this.ctx,s=Number(this.series.option.areaOpacity),l=isFinite(s)?Math.max(0,Math.min(1,s)):.28,h=a.createLinearGradient?a.createLinearGradient(0,0,0,n.plot.height):null;h?(h.addColorStop(0,hexToRgba(e,l)),h.addColorStop(1,hexToRgba(e,.02)),a.fillStyle=h):a.fillStyle=hexToRgba(e,l);for(var u=0;u<t.length;)if(t[u]){for(var c=u;c<t.length&&t[c];)c+=1;if(c-u>=2){a.beginPath(),a.moveTo(t[u][0],this.baselineYForIndex(r[u]));for(var p=u;p<c;p++)a.lineTo(t[p][0],t[p][1]);for(var v=c-1;v>=u;v--)a.lineTo(t[v][0],this.baselineYForIndex(r[v]));a.closePath(),a.fill()}u=c}else u+=1}}},{key:"baselineYForIndex",value:function baselineYForIndex(e){var t=this.coord;if(!t)return 0;if(this.series.virtual){var r=t.yScale.map(0);return isFinite(r)?r:t.plot.height}var n=this.effective[2*e];return isFinite(n)?t.yScale.map(n):t.plot.height}},{key:"hitTestIndex",value:function hitTestIndex(e,t){if(this.series.virtual)return this.hitTestVirtual(e,t);this.rebuildPixels();var r=this.pixels.length/2;if(!r)return-1;var n=this.series.option,a=n.hitRadius?Number(n.hitRadius):Math.max(8,this.maxSymbolSize()/2+4);if(r>1024&&this.xMonotonic){var s=this.nearestIndexAtX(e);if(s<0)return-1;for(var l=-1,h=a*a,u=Math.max(0,s-2),c=Math.min(r-1,s+2),p=u;p<=c;p++){var v=this.pixels[2*p],m=this.pixels[2*p+1];if(isFinite(v)&&isFinite(m)){var g=v-e,b=m-t,k=g*g+b*b;k<=h&&(h=k,l=p)}}if(l>=0)return l;for(var S=Math.max(4,this.lineWidthDevice()+4),A=Math.max(0,s-1);A<=Math.min(r-2,s);A++){if(distanceToSegment(e,t,this.pixels[2*A],this.pixels[2*A+1],this.pixels[2*(A+1)],this.pixels[2*(A+1)+1])<=S)return Math.abs(e-this.pixels[2*A])<=Math.abs(e-this.pixels[2*(A+1)])?A:A+1}return-1}for(var w=-1,_=a*a,M=0;M<r;M++){var C=this.pixels[2*M],P=this.pixels[2*M+1];if(isFinite(C)&&isFinite(P)){var T=C-e,I=P-t,N=T*T+I*I;N<=_&&(_=N,w=M)}}if(w>=0)return w;var D=Math.max(4,this.lineWidthDevice()+4),O=-1;return this.eachSegment(function(r,n,a,s,l){O>=0||distanceToSegment(e,t,r,n,a,s)<=D&&(O=Math.abs(e-r)<=Math.abs(e-a)?l:l+1)}),O}},{key:"hitTestVirtual",value:function hitTestVirtual(e,t){this.rebuildPixels();var r=this.series.pointCount;if(!r)return-1;var n=this.series.option,a=n.hitRadius?Number(n.hitRadius):Math.max(8,this.maxSymbolSize()/2+4),s=this.nearestIndexAtX(e);if(s<0)return-1;for(var l=-1,h=a*a,u=Math.max(0,s-2);u<=Math.min(r-1,s+2);u++){var c=this.virtualPixelAt(u);if(c){var p=c[0]-e,v=c[1]-t,m=p*p+v*v;m<=h&&(h=m,l=u)}}if(l>=0)return l;for(var g=Math.max(4,this.lineWidthDevice()+4),b=Math.max(0,s-1);b<=Math.min(r-2,s);b++){var k=this.virtualPixelAt(b),S=this.virtualPixelAt(b+1);if(k&&S&&distanceToSegment(e,t,k[0],k[1],S[0],S[1])<=g)return Math.abs(e-k[0])<=Math.abs(e-S[0])?b:b+1}return-1}}])}();function distanceToSegment(e,t,r,n,a,s){var l=a-r,h=s-n,u=l*l+h*h;if(0===u)return Math.hypot(e-r,t-n);var c=((e-r)*l+(t-n)*h)/u;return c=Math.max(0,Math.min(1,c)),Math.hypot(e-(r+c*l),t-(n+c*h))}function hexToRgba(e,t){if(!e)return"rgba(0,0,0,".concat(t,")");if(0===e.indexOf("rgba"))return e;if(0===e.indexOf("rgb("))return e.replace("rgb(","rgba(").replace(")",",".concat(t,")"));var r=e.replace("#","");if(3===r.length&&(r=r[0]+r[0]+r[1]+r[1]+r[2]+r[2]),6!==r.length)return e;var n=parseInt(r.slice(0,2),16),a=parseInt(r.slice(2,4),16),s=parseInt(r.slice(4,6),16);return"rgba(".concat(n,",").concat(a,",").concat(s,",").concat(t,")")}var oe=function(){function BarSeries(){var e;_classCallCheck(this,BarSeries);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _defineProperty(e=_callSuper(this,BarSeries,[].concat(r)),"seriesType","bar"),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"barCacheKey",""),e}return _inherits(BarSeries,ne),_createClass(BarSeries,[{key:"isHorizontal",value:function isHorizontal(){var e=this.coord;return!!e&&e.yScale.isBand()&&!e.xScale.isBand()}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.coord,t=this.series.pointCount;if(e){var r=this.buildSeriesKey([t,e.plot.width,e.plot.height,this.isHorizontal()?"h":"v",String(e.yScale.domain.join(","))]);if(r!==this.barCacheKey||this.pixels.length!==2*t){this.barCacheKey=r,this.computeEffective(),this.pixels.length!==2*t&&(this.pixels=new Float64Array(2*t));for(var n=0;n<t;n++){var a=this.barRectAt(n);a?(this.pixels[2*n]=a.x+a.width/2,this.pixels[2*n+1]=a.y+a.height/2):(this.pixels[2*n]=NaN,this.pixels[2*n+1]=NaN)}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"barRectAt",value:function barRectAt(e){var t=this.coord,r=this.series.pointAt(e);if(!t||!r)return null;this.effective.length!==2*this.series.pointCount&&this.computeEffective();var n=this.effective[2*e+1],a=this.effective[2*e];if(!isFinite(n))return null;if(this.isHorizontal()){var s=t.yScale.bandStart(r.xValue);if(!isFinite(s))return null;var l=t.yScale.bandwidth()||.6*t.yScale.step(),h=l/Math.max(1,this.barSlot.count),u=this.resolveBarWidth(l,h),c=t.yScale.range[1]>=t.yScale.range[0]?1:-1,p=s+c*(h*this.barSlot.index+(h-u)/2),v=c>0?p:p-u,m=t.xScale.map(a),g=t.xScale.map(n);return isFinite(m)&&isFinite(g)?{x:Math.min(m,g),y:v,width:Math.abs(g-m),height:u}:null}var b=t.xScale.bandStart(r.xValue);if(!isFinite(b))return null;var k=t.xScale.bandwidth()||.6*t.xScale.step(),S=k/Math.max(1,this.barSlot.count),A=this.resolveBarWidth(k,S),w=b+S*this.barSlot.index+(S-A)/2,_=t.yScale.map(a),M=t.yScale.map(n);return isFinite(_)&&isFinite(M)?{x:w,y:Math.min(_,M),width:A,height:Math.abs(M-_)}:null}},{key:"resolveBarWidth",value:function resolveBarWidth(e,t){var r=this.series.option,n=Number(r.barWidth);return!isFinite(n)||n<=0?Math.max(1,t*(1-(isFinite(Number(r.barGap))?Number(r.barGap):.2))):n<=1?Math.max(1,e*n):Math.max(1,n*this.unit())}},{key:"barColorAt",value:function barColorAt(e){var t=this.series.pointAt(e),r=t&&t.raw;return(r&&"object"===_typeof(r)&&!Array.isArray(r)?r.color:void 0)||this.pointColor(e)}},{key:"barDrawRectAt",value:function barDrawRectAt(e,t){var r=this.barRectAt(e),n=this.coord;if(!r||!n)return r;var a=this.hoverBoost(e,.08,t)-1;if(a<=0)return r;var s=this.effective[2*e];if(this.isHorizontal()){var l=r.width*a;return r.x+r.width/2>=n.xScale.map(s)?{x:r.x,y:r.y,width:r.width+l,height:r.height}:{x:r.x-l,y:r.y,width:r.width+l,height:r.height}}var h=r.height*a;return r.y+r.height/2<=n.yScale.map(s)?{x:r.x,y:r.y-h,width:r.width,height:r.height+h}:{x:r.x,y:r.y,width:r.width,height:r.height+h}}},{key:"doRender",value:function doRender(){if(this.rebuildPixels(),this.coord){var e=Number(this.series.option.barRadius),t=this.ctx;this.beginDraw();for(var r=0;r<this.series.pointCount;r++){var n=this.barDrawRectAt(r);if(n&&!(n.height<=0)){var a=this.barColorAt(r),s=n;if(t.beginPath(),roundRect(t,s.x,s.y,s.width,s.height,isFinite(e)?e:0),t.createLinearGradient){var l=this.isHorizontal()?t.createLinearGradient(s.x,0,s.x+s.width,0):t.createLinearGradient(0,s.y,0,s.y+s.height);l.addColorStop(0,hexToRgba(a,.95)),l.addColorStop(1,hexToRgba(a,.7)),t.fillStyle=l}else t.fillStyle=a;t.fill()}}this.endDraw()}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();for(var r=this.series.pointCount,n=0;n<r;n++){var a=this.barRectAt(n);if(a&&(e>=a.x&&e<=a.x+a.width&&t>=a.y&&t<=a.y+a.height))return n}return-1}}])}(),se=function(){function AreaSeries(e,t){var r;return _classCallCheck(this,AreaSeries),_defineProperty(r=_callSuper(this,AreaSeries,[e,t]),"seriesType","area"),r.fillArea=!0,r}return _inherits(AreaSeries,ae),_createClass(AreaSeries)}(),le=function(){function ScatterSeries(){var e;_classCallCheck(this,ScatterSeries);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _defineProperty(e=_callSuper(this,ScatterSeries,[].concat(r)),"seriesType","scatter"),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"clipToBox",!0),e}return _inherits(ScatterSeries,ne),_createClass(ScatterSeries,[{key:"symbolStyle",value:function symbolStyle(){var e=this.series.option,t=this.pointColor(0);return{shape:e.symbol||"circle",fill:e.symbolFill||t,stroke:e.symbolStroke||"#ffffff"}}},{key:"doRender",value:function doRender(){if(this.series.virtual)this.renderVirtual();else{this.rebuildPixels();var e=this.pixels.length/2;if(e){var t=0,r=e-1;if(this.xMonotonic&&e>2048){var n=this.__localBox(),a=this.maxSymbolSize();t=this.__lowerBoundX(n[0]-a),r=this.__upperBoundX(n[2]+a)}if(r<t)return this.beginDraw(),void this.endDraw();var s=r-t+1,l=this.coord?this.coord.plot.width:960,h=this.xMonotonic&&s>4096?Math.max(1,Math.floor(s/(2*l))):1,u=this.symbolStyle(),c=u.shape,p=u.fill,v=u.stroke;this.beginDraw();var m=this.isEntering();this.computeItemProgress();for(var g=t;g<=r;g+=h){var b=this.pixels[2*g],k=this.pixels[2*g+1];if(isFinite(b)&&isFinite(k)){var S=m?this.itemProgress[g]:1;if(!(S<=0)){var A=this.symbolSizeAt(g)*(m?.2+.8*S:1)*this.hoverBoost(g,.18);m&&S<1&&(this.ctx.globalAlpha=.25+.75*S),this.drawSymbol(b,k,c,A,p,v),m&&S<1&&(this.ctx.globalAlpha=1)}}}this.endDraw()}}}},{key:"renderVirtual",value:function renderVirtual(){var e=this.coord,t=this.series;if(e&&t.pointCount){this.rebuildPixels();var r=e.plot.width,n=this.virtualVisibleWindow(this.maxSymbolSize()),a=n.i0,s=n.i1;if(!(s<a)){var l=s-a+1,h=this.xMonotonic&&l>4096?Math.max(1,Math.floor(l/(2*r))):1,u=this.symbolStyle(),c=u.shape,p=u.fill,v=u.stroke,m=this.isEntering(),g=m?this.progress():1;if(!(m&&g<=0)){this.beginDraw();for(var b=a;b<=s;b+=h){var k=t.yValueAt(b);if(null!==k){var S=e.xScale.map(t.xValueAt(b)),A=e.yScale.map(k);if(isFinite(S)&&isFinite(A)){var w=this.symbolSizeAt(b)*(m?.2+.8*g:1)*this.hoverBoost(b,.18);m&&g<1&&(this.ctx.globalAlpha=.25+.75*g),this.drawSymbol(S,A,c,w,p,v),m&&g<1&&(this.ctx.globalAlpha=1)}}}this.endDraw()}}}}},{key:"__lowerBoundX",value:function __lowerBoundX(e){for(var t=0,r=this.pixels.length/2;t<r;){var n=t+r>>1;this.pixels[2*n]<e?t=n+1:r=n}return Math.max(0,t-1)}},{key:"__upperBoundX",value:function __upperBoundX(e){for(var t=this.pixels.length/2,r=0,n=t;r<n;){var a=r+n>>1;this.pixels[2*a]<=e?r=a+1:n=a}return Math.min(t-1,r)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){if(this.series.virtual)return this.hitTestVirtual(e,t);this.rebuildPixels();var r=this.series.option,n=r.hitRadius?Number(r.hitRadius):this.maxSymbolSize()/2+4,a=n*n,s=-1,l=a,h=this.pixels.length/2;if(h>1024&&this.xMonotonic){var u=this.nearestIndexAtX(e);if(u<0)return-1;for(var c=-1,p=a,v=Math.max(0,u-3);v<=Math.min(h-1,u+3);v++){var m=this.pixels[2*v]-e,g=this.pixels[2*v+1]-t,b=m*m+g*g;b<=p&&(p=b,c=v)}return c}for(var k=0;k<h;k++){var S=this.pixels[2*k],A=this.pixels[2*k+1];if(isFinite(S)&&isFinite(A)){var w=S-e,_=A-t,M=w*w+_*_;M<=l&&(l=M,s=k)}}return s}},{key:"hitTestVirtual",value:function hitTestVirtual(e,t){this.rebuildPixels();var r=this.series.pointCount;if(!r)return-1;var n=this.series.option,a=n.hitRadius?Number(n.hitRadius):this.maxSymbolSize()/2+4,s=a*a,l=this.nearestIndexAtX(e);if(l<0)return-1;for(var h=-1,u=s,c=Math.max(0,l-3);c<=Math.min(r-1,l+3);c++){var p=this.virtualPixelAt(c);if(p){var v=p[0]-e,m=p[1]-t,g=v*v+m*m;g<=u&&(u=g,h=c)}}return h}}])}(),he=2*Math.PI;function normalizeAngle(e){return(e%he+he)%he}function shortestAngleDelta(e,t){var r=normalizeAngle(t-e);return r>Math.PI&&(r-=he),r}var ue=function(){function PieSeries(){var e;_classCallCheck(this,PieSeries);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _defineProperty(e=_callSuper(this,PieSeries,[].concat(r)),"seriesType","pie"),_defineProperty(e,"polar",null),_defineProperty(e,"slices",new Float64Array(0)),_defineProperty(e,"pieCacheKey",""),_defineProperty(e,"sliceFrom",null),e}return _inherits(PieSeries,ne),_createClass(PieSeries,[{key:"setCoord",value:function setCoord(e){return this.polar=e||null,this.pieCacheKey="",this.markDirty()}},{key:"setHiddenSlices",value:function setHiddenSlices(e){return e.join(",")!==this.hiddenSlices.join(",")&&this.slices.length&&(this.sliceFrom=new Float64Array(this.slices)),_superPropGet(PieSeries,"setHiddenSlices",this,3)([e]),this.pieCacheKey="",this}},{key:"paintPad",value:function paintPad(){var e=this.series.option.label;return e&&!1===e.show?4:48}},{key:"localCenter",value:function localCenter(){var e=this.polar;return[e.polar.cx-e.plot.x,e.polar.cy-e.plot.y]}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.polar,t=this.series;if(!e)return this.pixels=new Float64Array(0),void(this.slices=new Float64Array(0));var r=this.series.option,n=[t.pointCount,r.startAngle,r.clockwise,r.roseType,r.radius,r.innerRadius,e.polar.radius,e.plot.width,this.hiddenSlices.join(","),this.progress(),t.pointCount?String(t.pointAt(0).y):""].join("|");if(n!==this.pieCacheKey){this.pieCacheKey=n;var a=t.pointCount;this.pixels.length!==2*a&&(this.pixels=new Float64Array(2*a)),this.slices.length!==4*a&&(this.slices=new Float64Array(4*a));for(var s=_slicedToArray(this.localCenter(),2),l=s[0],h=s[1],u=e.polar.radius,c=0,p=0,v=0;v<a;v++)if(!(this.hiddenSlices.indexOf(v)>=0)){var m=t.pointAt(v).y||0;m>0&&(c+=m),m>p&&(p=m)}this.computeItemProgress();for(var g=!1===r.clockwise?-1:1,b=-(void 0===r.startAngle?90:Number(r.startAngle))*Math.PI/180,k=Math.max(0,Math.min(.95,Number(r.innerRadius)||0)),S=r.roseType,A=0;A<a;A++){var w=this.hiddenSlices.indexOf(A)>=0,_=w?0:t.pointAt(A).y||0,M=b,C=b+g*(c>0?_/c*he*(w?0:this.itemProgress[A]):0);b=C;var P=u;S&&p>0&&(P="area"===S?u*Math.sqrt(Math.max(0,_)/p):u*(Math.max(0,_)/p),P=Math.max(3,P));var T=u*k;this.slices[4*A]=M,this.slices[4*A+1]=C,this.slices[4*A+2]=T,this.slices[4*A+3]=P}this.blendSliceMorph(this.isEntering());for(var I=0;I<a;I++)this.writeCentroid(I,l,h)}}},{key:"blendSliceMorph",value:function blendSliceMorph(e){var t=this.sliceFrom;if(!(!t||e||t.length<this.slices.length)){var r=Math.max(0,Math.min(1,this.progress()));if(r>=1)this.sliceFrom=null;else for(var n=0;n<this.slices.length/4;n++){var a=t[4*n],s=this.slices[4*n],l=a+shortestAngleDelta(a,s)*r,h=t[4*n+1]-a,u=this.slices[4*n+1]-s;this.slices[4*n]=l,this.slices[4*n+1]=l+h+(u-h)*r;for(var c=0,p=[2,3];c<p.length;c++){var v=p[c],m=t[4*n+v];this.slices[4*n+v]=m+(this.slices[4*n+v]-m)*r}}}}},{key:"writeCentroid",value:function writeCentroid(e,t,r){var n=this.slices[4*e],a=this.slices[4*e+1],s=this.slices[4*e+2],l=this.slices[4*e+3];if(Math.abs(a-n)<=1e-9)return this.pixels[2*e]=NaN,void(this.pixels[2*e+1]=NaN);var h=(n+a)/2,u=s+.6*(l-s);this.pixels[2*e]=t+Math.cos(h)*u,this.pixels[2*e+1]=r+Math.sin(h)*u}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var r=this.polar;if(!r)return-1;this.rebuildPixels();var n=_slicedToArray(this.localCenter(),2),a=e-n[0],s=t-n[1],l=Math.hypot(a,s);if(l>r.polar.radius+4)return-1;for(var h=this.series.pointCount,u=Math.atan2(s,a),c=0;c<h;c++){var p=this.slices[4*c],v=this.slices[4*c+1],m=this.slices[4*c+2],g=this.slices[4*c+3],b=Math.abs(v-p);if(!(b<=1e-9))if(!(l<m-1))if(normalizeAngle(v>p?u-p:p-u)<=b+1e-9&&l<=g+4)return c}return-1}},{key:"doRender",value:function doRender(){var e=this,t=this.polar;if(t){this.rebuildPixels();for(var r=this.ctx,n=_slicedToArray(this.localCenter(),2),a=n[0],s=n[1],l=this.unit(),h=!1===this.series.option.clockwise?-1:1,u=this.series.pointCount,c=this.series.option.label,p=!(c&&!1===c.show)&&u>0&&u<=16,v=c&&"inside"===c.position,m=0,g=0;g<u;g++)if(!(this.hiddenSlices.indexOf(g)>=0)){var b=this.series.pointAt(g).y||0;b>0&&(m+=b)}this.beginDraw();for(var k=0;k<u;k++){var S=this.slices[4*k],A=this.slices[4*k+1],w=this.slices[4*k+2],_=this.slices[4*k+3];if(!(Math.abs(A-S)<=1e-9)){var M=this.series.pointAt(k).color||this.series.color,C=this.hoverBoost(k,1),P=C>1?7*(C-1)*this.unit():0,T=(S+A)/2,I=Math.cos(T)*P,N=Math.sin(T)*P;r.beginPath(),w>0?(r.arc(a+I,s+N,_,S,A,h<0),r.arc(a+I,s+N,w,A,S,h>0)):(r.moveTo(a+I,s+N),r.arc(a+I,s+N,_,S,A,h<0)),r.closePath(),r.fillStyle=M,r.fill(),u>1&&(r.strokeStyle="rgba(255,255,255,0.85)",r.lineWidth=l,r.stroke())}}if(p){this.setFont(this.fontSize(),this.fontFamily());for(var D=NaN,O=0,R=[],H=0;H<u;H++){var z=this.slices[4*H],V=this.slices[4*H+1],L=this.slices[4*H+2],E=this.slices[4*H+3];if(!(Math.abs(V-z)<=1e-9)){var B=this.series.pointAt(H),j=B.y||0,W=t.polar.radius,X=m>0?j/m*100:0,G={name:B.name||"".concat(this.series.name," ").concat(H+1),value:B.y,percent:X,dataIndex:H,seriesId:this.series.id,seriesName:this.series.name,color:B.color||this.series.color},U=c&&"function"==typeof c.formatter?String(c.formatter(G)):"".concat(G.name," ").concat(X.toFixed(1),"%"),K=(z+V)/2;if(v){if(isFinite(D))O=Math.abs(Math.atan2(Math.sin(K-D),Math.cos(K-D)))<.42?Math.min(3,O+1):0;else O=0;D=K;var Y=L+.62*(E-L)+O*(this.fontSize()+4),q=Math.abs(V-z)*Y;if(measureTextWidth(this.ctx,U,this.fontSize(),this.fontFamily())<=q+6){r.textAlign="center",r.textBaseline="middle",r.fillStyle="#ffffff",r.fillText(U,a+Math.cos(K)*Y,s+Math.sin(K)*Y);continue}}var $=W+8,Z=W+26,J=Math.cos(K)>=0;R.push({x1:a+Math.cos(K)*E,y1:s+Math.sin(K)*E,x2:a+Math.cos(K)*$,y2:s+Math.sin(K)*$,x3:a+Math.cos(K)*Z+(J?8:-8),y3:s+Math.sin(K)*Z,text:U,right:J})}}for(var Q=1.45*this.fontSize(),ee=function _loop(){for(var n=ie[te],a=R.filter(function(e){return e.right===n}).sort(function(e,t){return e.y3-t.y3}),h=1;h<a.length;h++)a[h].y3-a[h-1].y3<Q&&(a[h].y3=a[h-1].y3+Q);if(a.length){var u=a[a.length-1].y3-(s+t.polar.radius+2*Q);if(u>0){var c,p=_createForOfIteratorHelper(a);try{for(p.s();!(c=p.n()).done;){c.value.y3-=u}}catch(e){p.e(e)}finally{p.f()}}}var v,m=_createForOfIteratorHelper(a);try{for(m.s();!(v=m.n()).done;){var g=v.value;r.strokeStyle="rgba(148,163,184,0.9)",r.lineWidth=l,r.beginPath(),r.moveTo(g.x1,g.y1),r.lineTo(g.x2,g.y2),r.lineTo(g.x2,g.y3),r.lineTo(g.x3,g.y3),r.stroke(),r.textAlign=g.right?"left":"right",r.textBaseline="middle",r.fillStyle=e.chartTheme&&e.chartTheme.axisLabelColor||"#475569",r.fillText(g.text,g.x3+(g.right?4:-4)*l,g.y3)}}catch(e){m.e(e)}finally{m.f()}},te=0,ie=[!0,!1];te<ie.length;te++)ee()}this.endDraw()}}},{key:"fontSize",value:function fontSize(){return this.chartTheme&&this.chartTheme.fontSize||12}},{key:"fontFamily",value:function fontFamily(){return this.chartTheme&&this.chartTheme.fontFamily||"Arial"}}])}(),ce=function(){function RadarSeries(){var e;_classCallCheck(this,RadarSeries);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _defineProperty(e=_callSuper(this,RadarSeries,[].concat(r)),"seriesType","radar"),_defineProperty(e,"radar",null),_defineProperty(e,"radarCacheKey",""),e}return _inherits(RadarSeries,ne),_createClass(RadarSeries,[{key:"setCoord",value:function setCoord(e){return this.radar=e||null,this.radarCacheKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 14}},{key:"localCenter",value:function localCenter(){var e=this.radar;return[e.polar.cx-e.plot.x,e.polar.cy-e.plot.y]}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.radar,t=this.series,r=t.pointCount;if(e){var n=[r,e.polar.radius,e.plot.width,this.progress(),e.domains.map(function(e){return e.join(":")}).join("|")].join("::");if(n!==this.radarCacheKey||this.pixels.length!==2*r){this.radarCacheKey=n,this.pixels.length!==2*r&&(this.pixels=new Float64Array(2*r));for(var a=_slicedToArray(this.localCenter(),2),s=a[0],l=a[1],h=this.progress(),u=0;u<r;u++){var c=-Math.PI/2+u/Math.max(1,r)*Math.PI*2,p=e.domains[u]||[0,1],v=t.pointAt(u).y,m=null==v?p[0]:v,g=p[1]-p[0],b=g>0?(m-p[0])/g:0;b=Math.max(0,Math.min(1,b)),b*=h;var k=e.polar.radius*b;this.pixels[2*u]=s+Math.cos(c)*k,this.pixels[2*u+1]=l+Math.sin(c)*k}}}else this.pixels=new Float64Array(0)}},{key:"doRender",value:function doRender(){if(this.radar){this.rebuildPixels();var e=this.pixels.length/2;if(e){var t=this.ctx,r=this.pointColor(0),n=this.unit(),a=_slicedToArray(this.localCenter(),2);a[0],a[1],this.beginDraw(),t.beginPath();for(var s=0;s<e;s++){var l=this.pixels[2*s],h=this.pixels[2*s+1];0===s?t.moveTo(l,h):t.lineTo(l,h)}t.closePath(),t.fillStyle=hexToRgba(r,.22),t.fill(),t.strokeStyle=r,t.lineWidth=this.lineWidthDevice()*n,t.stroke();for(var u=0;u<e;u++){var c=this.hoverBoost(u,.3);this.drawSymbol(this.pixels[2*u],this.pixels[2*u+1],"circle",this.symbolSizeAt(u)*c,r,"#ffffff")}this.endDraw()}}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();var r=this.pixels.length/2;if(!r)return-1;for(var n=this.series.option,a=n.hitRadius?Number(n.hitRadius):24,s=-1,l=a*a,h=0;h<r;h++){var u=this.pixels[2*h]-e,c=this.pixels[2*h+1]-t,p=u*u+c*c;p<=l&&(l=p,s=h)}if(s>=0)return s;if(this.containsPointInPolygon(e,t)){var v=_slicedToArray(this.localCenter(),2),m=v[0],g=v[1],b=Math.atan2(t-g,e-m),k=2*Math.PI/r,S=((b+Math.PI/2)%(2*Math.PI)+2*Math.PI)%(2*Math.PI);return Math.round(S/k)%r}return-1}},{key:"containsPointInPolygon",value:function containsPointInPolygon(e,t){for(var r=this.pixels.length/2,n=!1,a=0,s=r-1;a<r;s=a++){var l=this.pixels[2*a],h=this.pixels[2*a+1],u=this.pixels[2*s],c=this.pixels[2*s+1];h>t!=c>t&&e<(u-l)*(t-h)/(c-h)+l&&(n=!n)}return n}}])}(),de=function(){function HeatmapSeries(){var e;_classCallCheck(this,HeatmapSeries);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _defineProperty(e=_callSuper(this,HeatmapSeries,[].concat(r)),"seriesType","heatmap"),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"heatCacheKey",""),_defineProperty(e,"gridKey",""),_defineProperty(e,"gridX",new Float64Array(0)),_defineProperty(e,"gridY",new Float64Array(0)),_defineProperty(e,"gridCellW",1),_defineProperty(e,"gridCellH",1),_defineProperty(e,"gridVisibleCols",[]),_defineProperty(e,"gridVisibleRows",[]),_defineProperty(e,"gridBlocks",new Float64Array(0)),_defineProperty(e,"gridBlockCols",0),_defineProperty(e,"gridBlockRows",0),_defineProperty(e,"gridBlockPx",0),e}return _inherits(HeatmapSeries,ne),_createClass(HeatmapSeries,[{key:"rebuildPixels",value:function rebuildPixels(){var e=this.coord,t=this.series.pointCount;if(e){var r=this.buildSeriesKey([t,e.plot.width,e.plot.height,String(e.yScale.domain.join(","))]);if(r!==this.heatCacheKey||this.pixels.length!==2*t){this.heatCacheKey=r,this.pixels.length!==2*t&&(this.pixels=new Float64Array(2*t));for(var n=0;n<t;n++){var a=this.cellRectAt(n);a?(this.pixels[2*n]=a.x+a.width/2,this.pixels[2*n+1]=a.y+a.height/2):(this.pixels[2*n]=NaN,this.pixels[2*n+1]=NaN)}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"valueRange",value:function valueRange(){var e=this.series.grid;if(e)return e.valueDomain||[0,1];for(var t=1/0,r=-1/0,n=0,a=this.series.pointCount;n<a;n++){var s=this.series.pointAt(n).y;null!==s&&isFinite(s)&&(s<t&&(t=s),s>r&&(r=s))}return isFinite(t)&&isFinite(r)?t===r?[t,t+1]:[t,r]:[0,1]}},{key:"heatColors",value:function heatColors(){var e=this.series.option.heatmap||{};return{from:e.minColor||"#EFF6FF",to:e.maxColor||this.series.color}}},{key:"cellRectAt",value:function cellRectAt(e){if(this.series.grid)return this.virtualCellRect(e);var t=this.coord,r=this.series.pointAt(e);if(!t||!r)return null;var n=t.xScale.bandStart(r.xValue,void 0),a=void 0===r.name?r.index:r.name,s=t.yScale.bandStart(a,void 0);if(!isFinite(n)||!isFinite(s))return null;var l=t.xScale.bandwidth()||.8*t.xScale.step(),h=t.yScale.bandwidth()||.8*t.yScale.step(),u=t.xScale.range[1]>=t.xScale.range[0]?1:-1,c=t.yScale.range[1]>=t.yScale.range[0]?1:-1,p=Math.max(1,l),v=Math.max(1,h);return{x:u>0?n:n-p,y:c>0?s:s-v,width:p,height:v}}},{key:"doRender",value:function doRender(){var e=this.coord;if(e)if(this.series.grid)this.renderVirtual();else{var t=this.ctx,r=_slicedToArray(this.valueRange(),2),n=r[0],a=r[1],s=this.heatColors(),l=s.from,h=s.to,u=this.isEntering();this.computeItemProgress();var c=e.xScale.domain.length||1;this.beginDraw();for(var p=0;p<this.series.pointCount;p++){var v=this.series.pointAt(p),m=this.cellRectAt(p);if(m){var g=null===v.y?0:(v.y-n)/(a-n||1),b=1;if(u){var k=(p%c+Math.floor(p/c))%Math.max(1,c)/Math.max(1,c),S=this.progress();if((b=Math.max(0,Math.min(1,(S-k*(this.stagger||.35))/Math.max(.05,1-k*(this.stagger||.35)))))<=0)continue;t.globalAlpha=b}t.fillStyle=mixColors(l,h,Math.max(0,Math.min(1,g))),t.fillRect(m.x,m.y,m.width,m.height),u&&(t.globalAlpha=1)}}null!==this.hoverIndex&&this.drawHoverOverlay(this.hoverIndex,this.cellRectAt(this.hoverIndex),{radius:0}),this.endDraw()}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){if(this.series.grid)return this.hitTestGrid(e,t);for(var r=0;r<this.series.pointCount;r++){var n=this.cellRectAt(r);if(n&&(e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height))return r}return-1}},{key:"paintPad",value:function paintPad(){return 4}},{key:"syncGrid",value:function syncGrid(){var e=this.coord,t=this.series.grid;if(e&&t){var r=t.xCategories.length,n=t.yCategories.length,a=function axisKey(e){return"".concat(e.domain.length,":").concat(String(e.domain[0]),"~").concat(String(e.domain[e.domain.length-1]))},s=[this.series.pointCount,e.plot.width.toFixed(2),e.plot.height.toFixed(2),a(e.xScale),a(e.yScale)].join("|");if(s!==this.gridKey){this.gridKey=s;for(var l=e.xScale.range[1]>=e.xScale.range[0]?1:-1,h=e.yScale.range[1]>=e.yScale.range[0]?1:-1,u=Math.max(.01,e.xScale.bandwidth()||.8*e.xScale.step()),c=Math.max(.01,e.yScale.bandwidth()||.8*e.yScale.step()),p=new Float64Array(r),v=new Float64Array(n),m=0;m<r;m++){var g=e.xScale.bandStart(t.xCategories[m],void 0);p[m]=l>0?g:g-u}for(var b=0;b<n;b++){var k=e.yScale.bandStart(t.yCategories[b],void 0);v[b]=h>0?k:k-c}this.gridX=p,this.gridY=v,this.gridCellW=u,this.gridCellH=c;for(var S=e.plot.width,A=e.plot.height,w=[],_=[],M=0;M<r;M++)!isFinite(p[M])||p[M]+u<-1||p[M]>S+1||w.push(M);for(var C=0;C<n;C++)!isFinite(v[C])||v[C]+c<-1||v[C]>A+1||_.push(C);this.gridVisibleCols=w,this.gridVisibleRows=_;var P=w.length*_.length,T=P<=HeatmapSeries.MAX_DIRECT_CELLS?0:Math.max(1,Math.ceil(Math.sqrt(P/HeatmapSeries.MAX_BLOCKS)));if(this.gridBlockPx=T,0===T)return this.gridBlocks=new Float64Array(0),this.gridBlockCols=0,void(this.gridBlockRows=0);for(var I=Math.max(1,Math.ceil(S/T)),N=Math.max(1,Math.ceil(A/T)),D=new Float64Array(I*N).fill(NaN),O=t.values,R=0,H=_;R<H.length;R++){var z,V=H[R],L=V*r,E=Math.min(N-1,Math.max(0,Math.floor((v[V]+c/2)/T))),B=_createForOfIteratorHelper(w);try{for(B.s();!(z=B.n()).done;){var j=z.value,W=O[L+j];if(!Number.isNaN(W)){var X=E*I+Math.min(I-1,Math.max(0,Math.floor((p[j]+u/2)/T))),G=D[X];(Number.isNaN(G)||W>G)&&(D[X]=W)}}}catch(e){B.e(e)}finally{B.f()}}this.gridBlocks=D,this.gridBlockCols=I,this.gridBlockRows=N}}}},{key:"virtualCellRect",value:function virtualCellRect(e){var t=this.series.grid;if(!this.coord||!t)return null;this.syncGrid();var r=t.xCategories.length,n=r>0?e%r:0,a=r>0?(e-n)/r:0,s=this.gridX[n],l=this.gridY[a];return isFinite(s)&&isFinite(l)?{x:s,y:l,width:Math.max(1,this.gridCellW),height:Math.max(1,this.gridCellH)}:null}},{key:"virtualPixelAt",value:function virtualPixelAt(e){var t=this.virtualCellRect(e);return t?[t.x+t.width/2,t.y+t.height/2]:null}},{key:"hitTestGrid",value:function hitTestGrid(e,t){var r=this.coord,n=this.series.grid;if(!r||!n)return-1;var a=this.state,s=a.width,l=a.height;if(e<0||t<0||e>s||t>l)return-1;var h=n.xIndex.get(String(r.xScale.invert(e))),u=n.yIndex.get(String(r.yScale.invert(t)));if(void 0===h||void 0===u)return-1;var c=u*n.xCategories.length+h;return Number.isNaN(n.values[c])?-1:c}},{key:"nearestIndexAtX",value:function nearestIndexAtX(e){var t=this.series.grid,r=this.coord;if(!t||!r)return _superPropGet(HeatmapSeries,"nearestIndexAtX",this,3)([e]);var n=r.xScale,a="function"==typeof n.nearestIndex?n.nearestIndex(e):-1;if(a<0)return-1;var s=t.xIndex.get(String(r.xScale.domain[a]));if(void 0===s)return-1;for(var l=t.xCategories.length,h=0;h<t.yCategories.length;h++){var u=h*l+s;if(!Number.isNaN(t.values[u]))return u}return-1}},{key:"renderVirtual",value:function renderVirtual(){var e=this.coord,t=this.series.grid;if(e&&t){this.syncGrid();var r=this.ctx,n=_slicedToArray(this.valueRange(),2),a=n[0],s=n[1],l=this.heatColors(),h=l.from,u=l.to,c=function ratioAt(e){var t=s-a?(e-a)/(s-a):0;return Math.max(0,Math.min(1,t))},p=t.xCategories.length,v=t.values,m=Math.max(1,this.gridCellW),g=Math.max(1,this.gridCellH);if(this.beginDraw(),0===this.gridBlockPx){var b,k=_createForOfIteratorHelper(this.gridVisibleRows);try{for(k.s();!(b=k.n()).done;){var S,A=b.value,w=this.gridY[A],_=A*p,M=_createForOfIteratorHelper(this.gridVisibleCols);try{for(M.s();!(S=M.n()).done;){var C=S.value,P=v[_+C];Number.isNaN(P)||(r.fillStyle=mixColors(h,u,c(P)),r.fillRect(this.gridX[C],w,m,g))}}catch(e){M.e(e)}finally{M.f()}}}catch(e){k.e(e)}finally{k.f()}}else for(var T=this.gridBlockPx,I=0;I<this.gridBlockRows;I++)for(var N=0;N<this.gridBlockCols;N++){var D=this.gridBlocks[I*this.gridBlockCols+N];Number.isNaN(D)||(r.fillStyle=mixColors(h,u,c(D)),r.fillRect(N*T,I*T,T,T))}if(null!==this.hoverIndex){var O=this.cellRectAt(this.hoverIndex);O&&this.drawHoverOverlay(this.hoverIndex,O,{radius:0})}this.endDraw()}}}])}();function mixColors(e,t,r){var n=parseHex$1(e),a=parseHex$1(t);if(!n||!a)return t;var s=Math.round(n[0]+(a[0]-n[0])*r),l=Math.round(n[1]+(a[1]-n[1])*r),h=Math.round(n[2]+(a[2]-n[2])*r);return"rgb(".concat(s,",").concat(l,",").concat(h,")")}function parseHex$1(e){if("string"!=typeof e)return null;var t=e.trim();if(0===t.indexOf("#"))return 3===(t=t.slice(1)).length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6!==t.length?null:[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)];var r=t.match(/rgba?\(([^)]+)\)/);if(r){var n=r[1].split(",").map(function(e){return parseFloat(e)});return[n[0]||0,n[1]||0,n[2]||0]}return null}function layoutSankey(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{nodes:[],links:[]},a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:h,s=e.length;if(!s)return{nodes:[],links:[]};var l,u=Math.max(2,Number(n.nodeWidth)||16),c=Math.max(0,Number(n.nodePadding)||10),p=Math.max(0,void 0===Number(n.iterations)?6:Number(n.iterations)),v=function indexOf(t){return"number"==typeof t?t>=0&&t<s?t:-1:e.findIndex(function(e){return e.name===t})},m=t.map(function(e,t){return{id:t,source:v(e.source),target:v(e.target),value:Math.max(0,Number(e.value)||0),color:e.color}}).filter(function(e){return e.source>=0&&e.target>=0&&e.value>0}),g=e.map(function(){return[]}),b=e.map(function(){return[]}),k=new Array(s).fill(0),S=_createForOfIteratorHelper(m);try{for(S.s();!(l=S.n()).done;){var A=l.value;g[A.source].push(A.target),b[A.target].push(A.source),k[A.target]++}}catch(e){S.e(e)}finally{S.f()}for(var w=new Array(s).fill(0),_=[],M=0;M<s;M++)0===k[M]&&_.push(M);for(;_.length;){var C,P=_.shift(),T=_createForOfIteratorHelper(g[P]);try{for(T.s();!(C=T.n()).done;){var I=C.value;w[I]=Math.max(w[I],w[P]+1),0===--k[I]&&_.push(I)}}catch(e){T.e(e)}finally{T.f()}}for(var N=0;N<s;N++)void 0!==e[N].depth&&(w[N]=Math.max(0,Number(e[N].depth)||0));var D,O=Math.max.apply(Math,[1].concat(_toConsumableArray(w))),R=function columnX(e){return r.x+e*(r.width-u)/O},H=new Array(s).fill(0),z=new Array(s).fill(0),V=_createForOfIteratorHelper(m);try{for(V.s();!(D=V.n()).done;){var L=D.value;z[L.source]+=L.value,H[L.target]+=L.value}}catch(e){V.e(e)}finally{V.f()}for(var E=new Array(s).fill(0).map(function(e,t){return Math.max(H[t],z[t])}),B=new Array(O+1).fill(0),j=0;j<s;j++){B[w[j]]+=E[j]}for(var W=new Array(O+1).fill(0),X=0;X<s;X++)W[w[X]]++;var G,U=B.map(function(e,t){var n=r.height-c*Math.max(0,W[t]-1);return e>0?Math.max(1,n)/e:1}),K=e.map(function(e,t){var n=Math.max(2,E[t]*U[w[t]]);return{id:t,name:e.name,depth:w[t],x:R(w[t]),y:r.y,width:u,height:n,value:E[t],color:e.color||a[t%a.length]}}),Y=new Array(O+1).fill(0).map(function(){return[]}),q=_createForOfIteratorHelper(K);try{for(q.s();!(G=q.n()).done;){var $=G.value;Y[$.depth].push($.id)}}catch(e){q.e(e)}finally{q.f()}var Z,J=_createForOfIteratorHelper(Y);try{for(J.s();!(Z=J.n()).done;){var Q,ee=Z.value,te=r.y,ie=_createForOfIteratorHelper(ee);try{for(ie.s();!(Q=ie.n()).done;){var re=Q.value;K[re].y=te,te+=K[re].height+c}}catch(e){ie.e(e)}finally{ie.f()}}}catch(e){J.e(e)}finally{J.f()}for(var ne=0;ne<p;ne++){var ae,oe=_createForOfIteratorHelper(K);try{for(oe.s();!(ae=oe.n()).done;){var se,le=ae.value,he=[],ue=_createForOfIteratorHelper(m);try{for(ue.s();!(se=ue.n()).done;){var ce=se.value;ce.source===le.id?he.push({id:ce.target,weight:ce.value}):ce.target===le.id&&he.push({id:ce.source,weight:ce.value})}}catch(e){ue.e(e)}finally{ue.f()}if(he.length){for(var de=0,fe=0,pe=0,ve=he;pe<ve.length;pe++){var ye=ve[pe],me=K[ye.id];fe+=(me.y+me.height/2)*ye.weight,de+=ye.weight}var xe=de>0?fe/de:le.y+le.height/2;le.y=xe-le.height/2}}}catch(e){oe.e(e)}finally{oe.f()}var ge,be=_createForOfIteratorHelper(Y);try{for(be.s();!(ge=be.n()).done;){var ke=ge.value;ke.sort(function(e,t){return K[e].y-K[t].y});var Se,Ae=r.y,we=_createForOfIteratorHelper(ke);try{for(we.s();!(Se=we.n()).done;){var _e=Se.value;K[_e].y=Ae,Ae+=K[_e].height+c}}catch(e){we.e(e)}finally{we.f()}}}catch(e){be.e(e)}finally{be.f()}}var Me,Ce=_createForOfIteratorHelper(Y);try{for(Ce.s();!(Me=Ce.n()).done;){var Pe=Me.value,Te=Pe.length?K[Pe[Pe.length-1]].y+K[Pe[Pe.length-1]].height-(r.y+r.height):0;if(Te>0){var Fe,Ie=_createForOfIteratorHelper(Pe);try{for(Ie.s();!(Fe=Ie.n()).done;){var Ne=Fe.value;K[Ne].y=Math.max(r.y,K[Ne].y-Te)}}catch(e){Ie.e(e)}finally{Ie.f()}}}}catch(e){Ce.e(e)}finally{Ce.f()}var De,Oe=new Array(s).fill(0),Re=new Array(s).fill(0),He=[],ze=_createForOfIteratorHelper(m.slice().sort(function(e,t){return e.source-t.source||e.target-t.target}));try{for(ze.s();!(De=ze.n()).done;){var Ve=De.value,Le=K[Ve.source],Ee=K[Ve.target],Be=Le.value>0?Le.height/Le.value:0,je=Ee.value>0?Ee.height/Ee.value:0,We=Math.max(1,Ve.value*Math.min(Be,je)),Xe=Le.y+Oe[Ve.source],Ge=Ee.y+Re[Ve.target];Oe[Ve.source]+=We,Re[Ve.target]+=We,He.push({id:Ve.id,source:Ve.source,target:Ve.target,value:Ve.value,width:We,sy:Xe,ty:Ge,color:Ve.color||Le.color})}}catch(e){ze.e(e)}finally{ze.f()}return{nodes:K,links:He}}function sampleLinkPath(e,t,r){for(var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:16,s=[],l=e.sy+e.width/2-n,h=e.ty+e.width/2-n,u=t+.5*(r-t),c=r-.5*(r-t),p=0;p<=a;p++){var v=p/a,m=1-v,g=m*m*m*t+3*m*m*v*u+3*m*v*v*c+v*v*v*r,b=m*m*m*l+3*m*m*v*l+3*m*v*v*h+v*v*v*h;s.push([g,b])}return s}_defineProperty(de,"MAX_DIRECT_CELLS",2e4),_defineProperty(de,"MAX_BLOCKS",2e4);var fe=function(){function SankeySeries(){var e;_classCallCheck(this,SankeySeries);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _defineProperty(e=_callSuper(this,SankeySeries,[].concat(r)),"seriesType","sankey"),_defineProperty(e,"sankey",null),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"sankeyCacheKey",""),e}return _inherits(SankeySeries,ne),_createClass(SankeySeries,[{key:"setCoord",value:function setCoord(e){return this.sankey=e||null,this.sankeyCacheKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 24}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.sankey;if(e){var t=e.layout,r=t.nodes,n=t.links,a=r.length+n.length,s=[e.plot.x,e.plot.y],l=s[0],h=s[1],u=this.buildSeriesKey([a,l,h,e.plot.width,e.plot.height,r.length,n.length]);if(u!==this.sankeyCacheKey||this.pixels.length!==2*a){this.sankeyCacheKey=u,this.pixels=new Float64Array(2*a);var c,p=_createForOfIteratorHelper(r);try{for(p.s();!(c=p.n()).done;){var v=c.value;this.pixels[2*v.id]=v.x-l+v.width/2,this.pixels[2*v.id+1]=v.y-h+v.height/2}}catch(e){p.e(e)}finally{p.f()}var m,g=_createForOfIteratorHelper(n);try{for(g.s();!(m=g.n()).done;){var b=m.value,k=r[b.source],S=r[b.target];if(k&&S){var A=r.length+b.id;this.pixels[2*A]=(k.x+k.width+S.x)/2-l,this.pixels[2*A+1]=(b.sy+b.ty)/2+b.width/2-h}}}catch(e){g.e(e)}finally{g.f()}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"doRender",value:function doRender(){var e=this.sankey;if(e){var t=e.layout,r=t.nodes,n=t.links,a=this.ctx,s=e.plot,l=this.unit();this.beginDraw();var h=e.options.flow;h?this.keepAnimating():this.stopAnimating();var u=Number(e.options.linkOpacity);a.globalAlpha=isFinite(u)?Math.max(0,Math.min(1,u)):.42;var c,p=_createForOfIteratorHelper(n);try{for(p.s();!(c=p.n()).done;){var v=c.value,m=r[v.source],g=r[v.target];if(m&&g){var b=m.x-s.x+m.width,k=g.x-s.x,S=v.sy-s.y,A=v.ty-s.y,w=b+.5*(k-b),_=k-.5*(k-b);if(a.beginPath(),a.moveTo(b,S),a.bezierCurveTo(w,S,_,A,k,A),a.lineTo(k,A+v.width),a.bezierCurveTo(_,A+v.width,w,S+v.width,b,S+v.width),a.closePath(),a.fillStyle=v.color,a.fill(),h){var M=Number(e.options.flowSpeed)||40;if(a.save(),a.globalAlpha=.9,a.beginPath(),a.moveTo(b,(S+A)/2),a.bezierCurveTo(w,(S+A)/2,_,(S+A)/2,k,(S+A)/2),a.strokeStyle="#ffffff",a.lineWidth=Math.max(l,Math.min(5*l,.28*v.width)),"function"==typeof a.setLineDash){var C=[6*l,10*l];a.setLineDash(C),"number"==typeof a.lineDashOffset&&(a.lineDashOffset=-Date.now()/1e3*M%(C[0]+C[1]))}a.stroke(),"function"==typeof a.setLineDash&&a.setLineDash([]),a.restore()}}}}catch(e){p.e(e)}finally{p.f()}a.globalAlpha=1;var P,T=_createForOfIteratorHelper(r);try{for(T.s();!(P=T.n()).done;){var I=P.value;a.beginPath();var N=I.x-s.x,D=I.y-s.y,O=Math.min(3,I.width/2);a.moveTo(N+O,D),a.lineTo(N+I.width-O,D),a.arcTo(N+I.width,D,N+I.width,D+O,O),a.lineTo(N+I.width,D+I.height-O),a.arcTo(N+I.width,D+I.height,N+I.width-O,D+I.height,O),a.lineTo(N+O,D+I.height),a.arcTo(N,D+I.height,N,D+I.height-O,O),a.lineTo(N,D+O),a.arcTo(N,D,N+O,D,O),a.closePath(),a.fillStyle=I.color,a.fill(),a.strokeStyle="rgba(255,255,255,0.75)",a.lineWidth=l,a.stroke()}}catch(e){T.e(e)}finally{T.f()}if(!e.options.label||!1!==e.options.label.show){var R=this.chartTheme;if(R){this.setFont(R.fontSize,R.fontFamily),a.fillStyle=R.textColor,a.textBaseline="middle";var H,z=Math.max.apply(Math,_toConsumableArray(r.map(function(e){return e.depth})).concat([0])),V=_createForOfIteratorHelper(r);try{for(V.s();!(H=V.n()).done;){var L=H.value,E=L.x-s.x,B=L.y-s.y+L.height/2;L.depth>=z?(a.textAlign="right",this.fillLabelWithHalo(L.name,E-6*l,B)):(a.textAlign="left",this.fillLabelWithHalo(L.name,E+L.width+6*l,B))}}catch(e){V.e(e)}finally{V.f()}}}this.endDraw()}}},{key:"fillLabelWithHalo",value:function fillLabelWithHalo(e,t,r){var n=this.ctx,a=this.chartTheme;n.lineWidth=3*this.unit(),n.strokeStyle=a&&a.labelHaloColor||"rgba(255,255,255,0.85)",n.lineJoin="round",n.strokeText(e,t,r),n.fillStyle=a&&a.textColor||"#212529",n.fillText(e,t,r)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var r=this.sankey;if(!r)return-1;var n,a=r.layout,s=a.nodes,l=a.links,h=r.plot,u=_createForOfIteratorHelper(s);try{for(u.s();!(n=u.n()).done;){var c=n.value,p=c.x-h.x,v=c.y-h.y;if(e>=p-2&&e<=p+c.width+2&&t>=v-2&&t<=v+c.height+2)return c.id}}catch(e){u.e(e)}finally{u.f()}var m,g=_createForOfIteratorHelper(l);try{for(g.s();!(m=g.n()).done;){var b=m.value,k=s[b.source],S=s[b.target];if(k&&S)for(var A=sampleLinkPath(b,k.x-h.x+k.width,S.x-h.x,h.y,12),w=1;w<A.length;w++){if(distanceToSegment(e,t,A[w-1][0],A[w-1][1],A[w][0],A[w][1])<=6)return s.length+b.id}}}catch(e){g.e(e)}finally{g.f()}return-1}}])}(),pe=function(){function FunnelSeries(){var e;_classCallCheck(this,FunnelSeries);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _defineProperty(e=_callSuper(this,FunnelSeries,[].concat(r)),"seriesType","funnel"),_defineProperty(e,"funnel",null),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"stageGeom",[]),_defineProperty(e,"stageRects",[]),_defineProperty(e,"funnelKey",""),_defineProperty(e,"stageFrom",null),e}return _inherits(FunnelSeries,ne),_createClass(FunnelSeries,[{key:"setHiddenSlices",value:function setHiddenSlices(e){return e.join(",")!==this.hiddenSlices.join(",")&&this.stageGeom.length&&(this.stageFrom=this.stageGeom.map(function(e){return e?_objectSpread2({},e):null})),_superPropGet(FunnelSeries,"setHiddenSlices",this,3)([e]),this.funnelKey="",this}},{key:"setCoord",value:function setCoord(e){return this.funnel=e||null,this.funnelKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 12}},{key:"highlightRectAt",value:function highlightRectAt(e){return this.rebuildPixels(),this.stageRects[e]||null}},{key:"widthAt",value:function widthAt(e,t){var r=e.y1-e.y0||1,n=Math.max(0,Math.min(1,(t-e.y0)/r));return e.topWidth+(e.bottomWidth-e.topWidth)*n}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.funnel,t=this.series,r=t.pointCount;if(!e||!r)return this.pixels=new Float64Array(0),this.stageGeom=[],void(this.stageRects=[]);var n=e.options||{},a=this.buildSeriesKey([r,e.plot.width,e.plot.height,n.sort,n.minSize,n.trapezoid,this.hiddenSlices.join(",")]);if(a!==this.funnelKey||this.pixels.length!==2*r){this.funnelKey=a,this.pixels.length!==2*r&&(this.pixels=new Float64Array(2*r)),this.stageGeom=new Array(r).fill(null),this.stageRects=new Array(r).fill(null);for(var s=[],l=0;l<r;l++)this.hiddenSlices.indexOf(l)>=0||null!==t.pointAt(l).y&&s.push(l);var h=n.sort||"descending";if("none"!==h&&s.sort(function(e,r){return"ascending"===h?(t.pointAt(e).y||0)-(t.pointAt(r).y||0):(t.pointAt(r).y||0)-(t.pointAt(e).y||0)}),s.length){for(var u=Math.max(0,Number(n.gap)||2),c=Math.max(4,(e.plot.height-u*(s.length-1))/s.length),p=Math.max.apply(Math,_toConsumableArray(s.map(function(e){return t.pointAt(e).y||0})).concat([0])),v=Math.max(0,Math.min(1,void 0===n.minSize?.12:Number(n.minSize))),m=e.plot.width,g=e.plot.width/2,b=this.isEntering()?Math.max(0,Math.min(1,this.progress())):1,k=.72*m,S=s.map(function(e){var r=t.pointAt(e).y||0,n=p>0?r/p:1,a=Math.max(m*v,m*Math.max(0,Math.min(1,n)));return k+(a-k)*b}),A=!1!==n.trapezoid,w=0;w<s.length;w++){var _=s[w],M=w*(c+u),C=M+c,P=S[w],T=A&&w+1<S.length?S[w+1]:S[w],I={y0:M,y1:C,topWidth:P,bottomWidth:T,cx:g};this.stageGeom[_]=I;var N=Math.max(P,T)/2;this.stageRects[_]={x:g-N,y:M,width:2*N,height:C-M},this.pixels[2*_]=g,this.pixels[2*_+1]=(M+C)/2}this.blendStageMorph(),this.xMonotonic=!1,this.renderIndices=null}}}},{key:"blendStageMorph",value:function blendStageMorph(){var e=this.stageFrom;if(e&&!this.isEntering()){var t=Math.max(0,Math.min(1,this.progress()));if(t>=1)this.stageFrom=null;else for(var r=0;r<this.stageGeom.length;r++){var n=this.stageGeom[r],a=e[r];if(n&&a){var s=function lerp(e,r){return e+(r-e)*t};n.y0=s(a.y0,n.y0),n.y1=s(a.y1,n.y1),n.topWidth=s(a.topWidth,n.topWidth),n.bottomWidth=s(a.bottomWidth,n.bottomWidth);var l=Math.max(n.topWidth,n.bottomWidth)/2;this.stageRects[r]={x:n.cx-l,y:n.y0,width:2*l,height:n.y1-n.y0},this.pixels[2*r]=n.cx,this.pixels[2*r+1]=(n.y0+n.y1)/2}}}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();for(var r=0;r<this.stageGeom.length;r++){var n=this.stageGeom[r];if(n&&!(t<n.y0-1||t>n.y1+1)){var a=this.widthAt(n,t)/2*this.hoverBoost(r,.06)+1;if(Math.abs(e-n.cx)<=a)return r}}return-1}},{key:"doRender",value:function doRender(){var e=this.funnel;if(e&&this.chartTheme){this.rebuildPixels();for(var t=this.ctx,r=this.unit(),n=this.chartTheme,a=(e.options||{}).labelPosition||"inside",s=0,l=0;l<this.stageGeom.length;l++)this.stageGeom[l]&&s++;for(var h=0,u=0;u<this.series.pointCount;u++)this.stageGeom[u]&&(h+=this.series.pointAt(u).y||0);this.beginDraw();for(var c=0;c<this.stageGeom.length;c++){var p=this.stageGeom[c];if(p){var v=this.series.pointAt(c).color||this.series.color,m=this.hoverBoost(c,.06),g=p.topWidth*m,b=p.bottomWidth*m;t.beginPath(),t.moveTo(p.cx-g/2,p.y0),t.lineTo(p.cx+g/2,p.y0),t.lineTo(p.cx+b/2,p.y1),t.lineTo(p.cx-b/2,p.y1),t.closePath();var k=t.createLinearGradient(0,p.y0,0,p.y1);k.addColorStop(0,hexToRgba(v,.95)),k.addColorStop(1,hexToRgba(v,.75)),t.fillStyle=k,t.fill(),t.strokeStyle="rgba(255,255,255,0.7)",t.lineWidth=r,t.stroke()}}this.setFont(n.fontSize,n.fontFamily),t.textBaseline="middle";for(var S=0;S<this.stageGeom.length;S++){var A=this.stageGeom[S];if(A){var w=this.series.pointAt(S),_=w.y||0,M=h>0?_/h*100:0,C="".concat(w.name||w.xValue," ").concat(_).concat(s>1?" ".concat(M.toFixed(1),"%"):""),P=(A.y0+A.y1)/2,T=this.widthAt(A,P);if("right"!==a)measureTextWidth(t,C,n.fontSize,n.fontFamily)+12>T?(t.textAlign="left",t.fillStyle=n.textColor,t.fillText(C,A.cx+Math.max(A.topWidth,A.bottomWidth)/2+8*r,P)):(t.textAlign="center",t.fillStyle="#ffffff",t.fillText(C,A.cx,P));else t.textAlign="left",t.fillStyle=n.textColor,t.fillText(C,A.cx+Math.max(A.topWidth,A.bottomWidth)/2+8*r,P)}}this.endDraw()}}}])}(),ve=2*Math.PI,ye=Math.PI/180,me=function(){function GaugeSeries(){var e;_classCallCheck(this,GaugeSeries);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _defineProperty(e=_callSuper(this,GaugeSeries,[].concat(r)),"seriesType","gauge"),_defineProperty(e,"gauge",null),_defineProperty(e,"gaugeKey",""),_defineProperty(e,"fromValue",null),e}return _inherits(GaugeSeries,ne),_createClass(GaugeSeries,[{key:"setCoord",value:function setCoord(e){return this.gauge=e||null,this.gaugeKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 8}},{key:"updateSeries",value:function updateSeries(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t&&this.gauge&&(this.fromValue=this.renderedValue()),_superPropGet(GaugeSeries,"updateSeries",this,3)([e,t,r])}},{key:"renderedValue",value:function renderedValue(){var e=this.range().min,t=this.series.pointCount&&Number(this.series.pointAt(0).y)||0,r=Math.max(0,Math.min(1,this.progress())),n=null===this.fromValue?e:this.fromValue;return n+(t-n)*r}},{key:"angles",value:function angles(){for(var e=this.gauge&&this.gauge.options||{},t=void 0===e.startAngle?225:Number(e.startAngle),r=void 0===e.endAngle?-45:Number(e.endAngle),n=-t*ye,a=-r*ye;a<=n;)a+=ve;return{a0:n,a1:a,sweep:a-n}}},{key:"range",value:function range(){var e=this.gauge&&this.gauge.options||{},t=isFinite(Number(e.min))?Number(e.min):0,r=isFinite(Number(e.max))?Number(e.max):100;return{min:t,max:r>t?r:t+1}}},{key:"angleFor",value:function angleFor(e){var t=this.angles(),r=t.a0,n=t.sweep,a=this.range(),s=a.min,l=a.max;return r+Math.max(0,Math.min(1,(e-s)/(l-s)))*n}},{key:"localCenter",value:function localCenter(){var e=this.gauge;return[e.polar.cx-e.plot.x,e.polar.cy-e.plot.y]}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.gauge;if(e){var t=e.options||{},r=this.series.pointCount&&Number(this.series.pointAt(0).y)||0,n=this.buildSeriesKey([e.polar.radius,t.startAngle,t.endAngle,t.min,t.max,r]);if(n!==this.gaugeKey||2!==this.pixels.length){this.gaugeKey=n,2!==this.pixels.length&&(this.pixels=new Float64Array(2));var a=_slicedToArray(this.localCenter(),2),s=a[0],l=a[1],h=Number(t.pointer&&t.pointer.length||.72)*e.polar.radius,u=this.angleFor(r);this.pixels[0]=s+Math.cos(u)*h,this.pixels[1]=l+Math.sin(u)*h,this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var r=this.gauge;if(!r||!this.series.pointCount)return-1;var n=_slicedToArray(this.localCenter(),2),a=n[0],s=n[1];return Math.hypot(e-a,t-s)<=r.polar.radius+12?0:-1}},{key:"doRender",value:function doRender(){var e=this.gauge;if(e&&this.chartTheme){this.rebuildPixels();var t=this.ctx,r=this.chartTheme,n=e.options||{},a=this.unit(),s=_slicedToArray(this.localCenter(),2),l=s[0],h=s[1],u=e.polar.radius,c=this.angles(),p=c.a0,v=c.sweep,m=this.range(),g=m.min,b=m.max,k=Math.max(2,Number(n.lineWidth)||14),S=this.renderedValue();this.beginDraw();for(var A=n.axisLineColor&&n.axisLineColor.length?n.axisLineColor:[[1,r.colorPalette[0]]],w=0,_=0;_<A.length;_++){var M=_slicedToArray(A[_],2),C=M[0],P=M[1],T=w,I=Math.max(w,Math.min(1,Number(C)));w=I,I<=T||(t.beginPath(),t.arc(l,h,u,p+T*v,p+I*v),t.strokeStyle=P,t.lineWidth=k,t.lineCap="butt",t.stroke())}var N=Math.max(1,Number(n.splitNumber)||5);this.setFont(.85*r.fontSize,r.fontFamily),t.fillStyle=r.subTextColor,t.textBaseline="middle",t.textAlign="center";for(var D=0;D<=N;D++){var O=D/N,R=p+O*v,H=u-k-2*a,z=u-k-8*a;t.beginPath(),t.moveTo(l+Math.cos(R)*H,h+Math.sin(R)*H),t.lineTo(l+Math.cos(R)*z,h+Math.sin(R)*z),t.strokeStyle=r.axisLineColor,t.lineWidth=a,t.stroke();var V=u-k-20*a;t.fillText(String(Math.round(g+O*(b-g))),l+Math.cos(R)*V,h+Math.sin(R)*V)}var L=n.pointer||{};if(!1!==L.show){var E=Math.max(.1,Number(L.length)||.72)*u,B=Math.max(1,Number(L.width)||5)*a,j=this.angleFor(S),W=l+Math.cos(j)*E,X=h+Math.sin(j)*E,G=l+Math.cos(j+Math.PI/2)*B,U=h+Math.sin(j+Math.PI/2)*B,K=l+Math.cos(j-Math.PI/2)*B,Y=h+Math.sin(j-Math.PI/2)*B;t.beginPath(),t.moveTo(W,X),t.lineTo(G,U),t.lineTo(K,Y),t.closePath(),t.fillStyle=r.textColor,t.fill(),t.beginPath(),t.arc(l,h,1.6*B,0,ve),t.fillStyle=r.textColor,t.fill(),t.beginPath(),t.arc(l,h,.7*B,0,ve),t.fillStyle="#ffffff",t.fill()}var q=n.detail||{},$=q.formatter?String(q.formatter(S)):"".concat(Math.round(100*S)/100),Z=Math.max(0,360-this.angles().sweep/ye)>20;if(!1!==q.show){var J=Number(q.fontSize)||Math.max(16,Math.round(.26*u));this.setFont(J,r.fontFamily,"bold"),t.textAlign="center",t.textBaseline="middle",t.fillStyle=r.textColor,t.fillText($,l,h+u*(Z?.78:.42))}var Q=n.title||{},ee=this.series.pointAt(0),te=ee&&(ee.name||void 0!==ee.xValue)?ee.name||String(ee.xValue):"";if(!1!==Q.show&&te){var ie=Number(Q.fontSize)||r.fontSize;this.setFont(ie,r.fontFamily),measureTextWidth(t,te,ie,r.fontFamily),t.textAlign="center",t.textBaseline="middle",t.fillStyle=r.subTextColor,t.fillText(te,l,h+u*(Z?.6:.68))}this.endDraw()}}}])}(),xe=function(){function BoxplotSeries(){var e;_classCallCheck(this,BoxplotSeries);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _defineProperty(e=_callSuper(this,BoxplotSeries,[].concat(r)),"seriesType","boxplot"),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"boxCacheKey",""),e}return _inherits(BoxplotSeries,ne),_createClass(BoxplotSeries,[{key:"boxWidthAt",value:function boxWidthAt(e){var t=Number(this.series.option.barWidth);return!isFinite(t)||t<=0?Math.max(4,.5*e):t<=1?Math.max(4,e*t):Math.max(4,t*this.unit())}},{key:"boxRectAt",value:function boxRectAt(e){var t=this.coord,r=this.series.pointAt(e);if(!t||!r||!r.boxplot)return null;var n=t.xScale.map(r.xValue);if(!isFinite(n))return null;var a=t.xScale.bandwidth()||.5*t.xScale.step(),s=this.boxWidthAt(a),l=_slicedToArray(r.boxplot,4),h=l[1],u=l[3],c=_slicedToArray(r.boxplot,5),p=c[0],v=c[4],m=t.yScale.map(h),g=t.yScale.map(u),b=t.yScale.map(p),k=t.yScale.map(v);return isFinite(m)&&isFinite(g)&&isFinite(b)&&isFinite(k)?{x:n-s/2,y:Math.min(m,g),width:s,height:Math.max(Math.abs(g-m),this.unit())}:null}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.coord,t=this.series.pointCount;if(e){var r=this.buildSeriesKey([t,e.plot.width,e.plot.height,String(e.xScale.domain.join(","))]);if(r!==this.boxCacheKey||this.pixels.length!==2*t){this.boxCacheKey=r,this.pixels.length!==2*t&&(this.pixels=new Float64Array(2*t));for(var n=0;n<t;n++){var a=this.boxRectAt(n),s=this.series.pointAt(n);a&&s&&s.boxplot?(this.pixels[2*n]=a.x+a.width/2,this.pixels[2*n+1]=e.yScale.map(s.boxplot[2])):(this.pixels[2*n]=NaN,this.pixels[2*n+1]=NaN)}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();var r=this.coord;if(!r)return-1;for(var n=0;n<this.series.pointCount;n++){var a=this.series.pointAt(n),s=this.boxRectAt(n);if(a&&a.boxplot&&s){var l=s.x+s.width/2;if(!(Math.abs(e-l)>s.width/2+1)){var h=r.yScale.map(a.boxplot[0]),u=r.yScale.map(a.boxplot[4]),c=Math.min(h,u),p=Math.max(h,u);if(t>=c-2&&t<=p+2)return n}}}return-1}},{key:"doRender",value:function doRender(){var e=this,t=this.coord;if(t&&this.chartTheme){this.rebuildPixels();var r=this.ctx;this.chartTheme;var n=this.unit(),a=this.pointColor(0),s=this.isEntering();this.computeItemProgress(),this.beginDraw();for(var l=function _loop(){var l=e.series.pointAt(h),u=e.boxRectAt(h);if(!l||!l.boxplot||!u)return 0;var c=_slicedToArray(l.boxplot,5),p=c[0],v=c[1],m=c[2],g=c[3],b=c[4],k=u.x+u.width/2,S=t.yScale.map(m),A=s?e.itemProgress[h]:1;if(A<=0)return 0;var w=function lerp(e){return S+(e-S)*A},_=w(t.yScale.map(p)),M=w(t.yScale.map(b)),C=w(t.yScale.map(g)),P=w(t.yScale.map(v)),T={x:u.x,y:Math.min(C,P),width:u.width,height:Math.max(Math.abs(P-C),e.unit())};r.beginPath(),r.moveTo(k,M),r.lineTo(k,T.y),r.moveTo(k,T.y+T.height),r.lineTo(k,_),r.strokeStyle=a,r.lineWidth=n,r.stroke(),r.beginPath(),r.moveTo(k-u.width/4,M),r.lineTo(k+u.width/4,M),r.moveTo(k-u.width/4,_),r.lineTo(k+u.width/4,_),r.stroke(),r.beginPath(),r.rect(T.x,T.y,T.width,T.height),r.fillStyle=function hexWithAlpha(e,t){if(!e)return"rgba(0,0,0,".concat(t,")");var r=e.replace("#","");3===r.length&&(r=r[0]+r[0]+r[1]+r[1]+r[2]+r[2]);if(6!==r.length)return e;var n=parseInt(r.slice(0,2),16),a=parseInt(r.slice(2,4),16),s=parseInt(r.slice(4,6),16);return"rgba(".concat(n,",").concat(a,",").concat(s,",").concat(t,")")}(a,.28),r.fill(),r.strokeStyle=a,r.lineWidth=n,r.stroke(),r.beginPath(),r.moveTo(T.x,S),r.lineTo(T.x+T.width,S),r.lineWidth=Math.max(n,2*n),r.stroke(),e.drawHoverOverlay(h,T,{radius:1})},h=0;h<this.series.pointCount;h++)l();this.endDraw()}}}])}();var ge=function(){function WaterfallSeries(){var e;_classCallCheck(this,WaterfallSeries);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _defineProperty(e=_callSuper(this,WaterfallSeries,[].concat(r)),"seriesType","waterfall"),e}return _inherits(WaterfallSeries,oe),_createClass(WaterfallSeries,[{key:"isTotalItem",value:function isTotalItem(e){var t=this.series.pointAt(e),r=t&&t.raw;return!(!r||"object"!==_typeof(r)||Array.isArray(r)||!r.total)}},{key:"isIncrease",value:function isIncrease(e){var t=this.series.pointAt(e);return!t||(t.y||0)>=0}},{key:"barColorAt",value:function barColorAt(e){var t=waterfallOptionOf(this.series),r=this.chartTheme,n=r&&r.colorPalette||h;return this.isTotalItem(e)?t.totalColor||n[0]:this.isIncrease(e)?t.increaseColor||n[1]:t.decreaseColor||n[2]}},{key:"doRender",value:function doRender(){if(_superPropGet(WaterfallSeries,"doRender",this,3)([]),!1!==waterfallOptionOf(this.series).connector){var e=this.coord;if(e){var t=this.ctx,r=this.unit(),n=this.chartTheme,a=e.yScale.isBand&&e.yScale.isBand();t.save(),t.strokeStyle=n&&n.subTextColor||"#6C757D",t.lineWidth=r,"function"==typeof t.setLineDash&&t.setLineDash([4*r,3*r]),t.beginPath();for(var s=0;s<this.series.pointCount-1;s++){var l=this.barRectAt(s),h=this.barRectAt(s+1);if(l&&h)if(a){var u=Math.max(l.x+l.width,h.x+h.width),c=l.y+l.height/2,p=h.y+h.height/2;t.moveTo(u,c),t.lineTo(u,p)}else{var v=Math.min(l.y,h.y),m=l.x+l.width/2,g=h.x+h.width/2;t.moveTo(m,v),t.lineTo(g,v)}}t.stroke(),"function"==typeof t.setLineDash&&t.setLineDash([]),t.restore()}}}}])}();function waterfallOptionOf(e){return e&&e.waterfallOption?e.waterfallOption:e&&e.option&&e.option.waterfall||{}}var be=function(){function TreemapSeries(){var e;_classCallCheck(this,TreemapSeries);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _defineProperty(e=_callSuper(this,TreemapSeries,[].concat(r)),"seriesType","treemap"),_defineProperty(e,"treemap",null),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"treemapKey",""),_defineProperty(e,"morphFrom",{}),_defineProperty(e,"morphing",!1),_defineProperty(e,"rectCache",new Map),e}return _inherits(TreemapSeries,ne),_createClass(TreemapSeries,[{key:"updateSeries",value:function updateSeries(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t&&this.treemap){var n,a={},s=_createForOfIteratorHelper(this.treemap.layout);try{for(s.s();!(n=s.n()).done;){var l=n.value;a["".concat(l.depth,":").concat(l.name)]=_objectSpread2({},l.rect)}}catch(e){s.e(e)}finally{s.f()}this.morphFrom=a,this.morphing=!0}return _superPropGet(TreemapSeries,"updateSeries",this,3)([e,t,r])}},{key:"rectOf",value:function rectOf(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.rectCache,r=this.progress();if(!this.morphing)return e.rect;if(r>=1)return this.morphing=!1,e.rect;var n=t.get(e.id);if(n)return n;var a,s=this.treemap?this.treemap.layout:[],l=this.morphFrom["".concat(e.depth,":").concat(e.name)],h=e.parent>=0?s[e.parent]:null,u=h?this.morphFrom["".concat(h.depth,":").concat(h.name)]:null;if(h&&l&&u&&u.width>1&&u.height>1){var c=this.rectOf(h,t),p=(l.x-u.x)/u.width,v=(l.y-u.y)/u.height,m=l.width/u.width,g=l.height/u.height;a={x:c.x+p*c.width,y:c.y+v*c.height,width:m*c.width,height:g*c.height}}else a=l?{x:l.x+(e.rect.x-l.x)*r,y:l.y+(e.rect.y-l.y)*r,width:l.width+(e.rect.width-l.width)*r,height:l.height+(e.rect.height-l.height)*r}:e.rect;return t.set(e.id,a),a}},{key:"setCoord",value:function setCoord(e){return this.treemap=e||null,this.treemapKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 6}},{key:"highlightRectAt",value:function highlightRectAt(e){var t=this.treemap;if(!t)return null;var r=t.layout[e];if(!r)return null;var n=this.rectOf(r);return{x:n.x-t.plot.x,y:n.y-t.plot.y,width:n.width,height:n.height}}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.treemap,t=e&&e.layout||[];if(e&&t.length){var r=this.buildSeriesKey([t.length,e.plot.width,e.plot.height]);if(r!==this.treemapKey||this.pixels.length!==2*t.length){this.treemapKey=r,this.pixels=new Float64Array(2*t.length);var n,a=_createForOfIteratorHelper(t);try{for(a.s();!(n=a.n()).done;){var s=n.value,l=this.rectOf(s);this.pixels[2*s.id]=l.x-e.plot.x+l.width/2,this.pixels[2*s.id+1]=l.y-e.plot.y+l.height/2}}catch(e){a.e(e)}finally{a.f()}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var r=this.treemap;if(!r)return-1;var n,a=-1,s=-1,l=_createForOfIteratorHelper(r.layout);try{for(l.s();!(n=l.n()).done;){var h=n.value,u=this.rectOf(h),c=u.x-r.plot.x,p=u.y-r.plot.y;e<c||e>c+u.width||t<p||t>p+u.height||h.depth>s&&(s=h.depth,a=h.id)}}catch(e){l.e(e)}finally{l.f()}return a}},{key:"doRender",value:function doRender(){var e=this,t=this.treemap;if(t&&this.chartTheme){this.rebuildPixels();var r=this.ctx,n=this.chartTheme,a=this.unit(),s=t.plot,l=t.options||{},h=void 0===l.minLabelRatio?.02:Number(l.minLabelRatio);this.rectCache=new Map,this.beginDraw();var u,c=_createForOfIteratorHelper(t.layout);try{for(c.s();!(u=c.n()).done;){var p=u.value,v=this.rectOf(p),m=v.x-s.x,g=v.y-s.y;r.beginPath(),r.rect(m,g,v.width,v.height),r.fillStyle=p.color,r.fill(),0===p.depth&&(r.strokeStyle="rgba(255,255,255,0.9)",r.lineWidth=1.5*a,r.stroke())}}catch(e){c.e(e)}finally{c.f()}if(null!==this.hoverIndex){var b=t.layout[this.hoverIndex];if(b){var k=this.rectOf(b),S={x:k.x-s.x,y:k.y-s.y,width:k.width,height:b.hasChildren&&b.header>0?b.header:k.height};this.drawHoverOverlay(this.hoverIndex,S,{radius:0,fill:"rgba(255,255,255,0.18)"})}}var A=function fitFontSize(e,t){for(var a=n.fontSize;a>9&&!e.every(function(e){return measureTextWidth(r,e,a,n.fontFamily)<=t});)a-=1;return a};this.setFont(n.fontSize,n.fontFamily),r.textAlign="center",r.textBaseline="middle";var w,_=_createForOfIteratorHelper(t.layout);try{var M=function _loop(){var t=w.value;if(t.ratio<h)return 0;var l=e.rectOf(t),u="".concat((100*t.ratio).toFixed(1),"%");if(t.hasChildren&&t.header>0){r.textAlign="left",r.fillStyle=0===t.depth?"#ffffff":n.textColor;var c="".concat(t.name," ").concat(u),p=A([c],l.width-16*a);return(p>9||measureTextWidth(r,c,p,n.fontFamily)<=l.width-16*a)&&(e.setFont(p,n.fontFamily,"bold"),r.fillText(c,l.x-s.x+8*a,l.y-s.y+t.header/2)),0}if(l.width<44||l.height<26)return 0;var v=(l.height>=40?"".concat(t.name,"\n").concat(u):"".concat(t.name," ").concat(u)).split("\n"),m=A(v,l.width-8*a);if(Math.max.apply(Math,_toConsumableArray(v.map(function(e){return measureTextWidth(r,e,m,n.fontFamily)})))>l.width-8*a)return 0;e.setFont(m,n.fontFamily),r.textAlign="center";var g=0===t.depth?"#ffffff":n.textColor;r.fillStyle=g;for(var b=1.35*m,k=l.y-s.y+l.height/2-(v.length-1)*b/2,S=0;S<v.length;S++)r.fillText(v[S],l.x-s.x+l.width/2,k+S*b)};for(_.s();!(w=_.n()).done;)M()}catch(e){_.e(e)}finally{_.f()}this.endDraw()}}}])}();function forceLayout(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{nodes:[],links:[]},a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:h,s=e.length;if(!s)return{nodes:[],links:[]};var l,u=n.layout||"force",c=_slicedToArray(Array.isArray(n.symbolSizeRange)?n.symbolSizeRange:[12,48],2),p=c[0],v=c[1],m=function indexOf(t){if("number"==typeof t)return t>=0&&t<s?t:-1;for(var r=0;r<s;r++){var n=e[r];if(n.id===t||n.name===t)return r}return-1},g=t.map(function(e,t){return{id:t,source:m(e.source),target:m(e.target),value:Number(e.value)||1,color:e.color}}).filter(function(e){return e.source>=0&&e.target>=0&&e.source!==e.target}),b=r.x+r.width/2,k=r.y+r.height/2,S=Math.max(10,Math.min(r.width,r.height)/2-v/2-4),A=e.map(function(e,t){if(isFinite(Number(e.x))&&isFinite(Number(e.y)))return{x:clamp(Number(e.x),r.x+2,r.x+r.width-2),y:clamp(Number(e.y),r.y+2,r.y+r.height-2)};var n=t/s*Math.PI*2-Math.PI/2;return{x:b+Math.cos(n)*S*.8,y:k+Math.sin(n)*S*.8}}),w=A.map(function(){return{x:0,y:0}}),_=A.map(function(e){return{x:e.x,y:e.y}}),M=new Array(s).fill(0),C=new Array(s).fill(0),P=_createForOfIteratorHelper(g);try{for(P.s();!(l=P.n()).done;){var T=l.value;M[T.source]++,M[T.target]++,C[T.source]+=T.value,C[T.target]+=T.value}}catch(e){P.e(e)}finally{P.f()}var I=Math.max.apply(Math,[1].concat(_toConsumableArray(C))),N=function sizeOf(t){var r=Number(e[t].value);if(!isFinite(r)||r<=0)return p;var n=Math.sqrt(Math.max(0,Math.min(1,C[t]/I)));return p+(v-p)*n};if("force"===u)for(var D=numberOr(n.repulsion,6e3),O=numberOr(n.edgeLength,70),R=numberOr(n.gravity,.06),H=Math.max(.1,Math.min(.98,numberOr(n.damping,.85))),z=Math.max(1,Math.floor(numberOr(n.iterations,240))),V=Math.max(8,(p+v)/6),L=0;L<z;L++){for(var E=1-L/z,B=0;B<s;B++)if(!e[B].fixed)for(var j=B+1;j<s;j++){var W=A[j].x-A[B].x,X=A[j].y-A[B].y,G=Math.hypot(W,X);G<V&&(W=W||(B%2==0?.5:-.5),X=X||(j%2==0?.5:-.5),G=Math.hypot(W,X));var U=D/(G*G)*E,K=W/G*U,Y=X/G*U;w[B].x-=K,w[B].y-=Y,e[j].fixed||(w[j].x+=K,w[j].y+=Y)}var q,$=_createForOfIteratorHelper(g);try{for($.s();!(q=$.n()).done;){var Z=q.value,J=A[Z.source],Q=A[Z.target],ee=Q.x-J.x,te=Q.y-J.y,ie=Math.max(.01,Math.hypot(ee,te)),re=.06*(ie-(O+(Z.value>1?Math.min(40,Z.value):0)))*E,ne=ee/ie*re,ae=te/ie*re;e[Z.source].fixed||(w[Z.source].x+=ne,w[Z.source].y+=ae),e[Z.target].fixed||(w[Z.target].x-=ne,w[Z.target].y-=ae)}}catch(e){$.e(e)}finally{$.f()}for(var oe=0;oe<s;oe++)e[oe].fixed||(w[oe].x+=(b-A[oe].x)*R*E,w[oe].y+=(k-A[oe].y)*R*E,w[oe].x*=H,w[oe].y*=H,A[oe].x+=w[oe].x,A[oe].y+=w[oe].y)}if("force"===u&&s>1){for(var se=1/0,le=1/0,he=-1/0,ue=-1/0,ce=0;ce<s;ce++){var de=N(ce)/2;se=Math.min(se,A[ce].x-de),he=Math.max(he,A[ce].x+de),le=Math.min(le,A[ce].y-de),ue=Math.max(ue,A[ce].y+de)}var fe=Math.max(1,he-se),pe=Math.max(1,ue-le),ve=Math.min(3,Math.min((r.width-16)/fe,(r.height-16)/pe));if(isFinite(ve)&&ve>0)for(var ye=(se+he)/2,me=(le+ue)/2,xe=0;xe<s;xe++)A[xe].x=b+(A[xe].x-ye)*ve,A[xe].y=k+(A[xe].y-me)*ve}var ge=e.map(function(e,t){var s=N(t)/2,l=clamp(A[t].x,r.x+s,r.x+r.width-s),h=clamp(A[t].y,r.y+s,r.y+r.height-s);return{id:t,name:e.name,x:l,y:h,initialX:_[t].x,initialY:_[t].y,size:N(t),value:C[t],degree:M[t],color:e.color||colorOf(e,n,a,t),category:e.category,fixed:!!e.fixed}}),be=Math.max.apply(Math,[1].concat(_toConsumableArray(g.map(function(e){return e.value})))),ke=g.map(function(e){return{id:e.id,source:e.source,target:e.target,value:e.value,width:1+3*Math.sqrt(e.value/be),color:e.color||ge[e.source].color}});return{nodes:ge,links:ke}}function colorOf(e,t,r,n){if(void 0!==e.category&&Array.isArray(t.categories)){var a=t.categories.find(function(t){return t.name===e.category});if(a&&a.color)return a.color;var s=t.categories.findIndex(function(t){return t.name===e.category});if(s>=0)return r[s%r.length]}return r[n%r.length]}function numberOr(e,t){var r=Number(e);return isFinite(r)?r:t}function clamp(e,t,r){return e<t?t:e>r?r:e}function sampleGraphLink(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:14,a=t[e.source],s=t[e.target],l=[];if(!a||!s)return l;if(!r)return l.push([a.x,a.y],[s.x,s.y]),l;for(var h=(a.x+s.x)/2,u=(a.y+s.y)/2,c=s.x-a.x,p=s.y-a.y,v=Math.max(1,Math.hypot(c,p)),m=Math.min(30,.18*v),g=h-p/v*m,b=u+c/v*m,k=0;k<=n;k++){var S=k/n,A=1-S;l.push([A*A*a.x+2*A*S*g+S*S*s.x,A*A*a.y+2*A*S*b+S*S*s.y])}return l}var ke=function(){function GraphSeries(){var e;_classCallCheck(this,GraphSeries);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _defineProperty(e=_callSuper(this,GraphSeries,[].concat(r)),"seriesType","graph"),_defineProperty(e,"graph",null),_defineProperty(e,"clipToBox",!1),_defineProperty(e,"graphKey",""),e}return _inherits(GraphSeries,ne),_createClass(GraphSeries,[{key:"setCoord",value:function setCoord(e){return this.graph=e||null,this.graphKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 28}},{key:"nodeCount",get:function get(){return this.graph&&this.graph.layout.nodes.length||0}},{key:"moveNode",value:function moveNode(e,t,r){var n=this.graph;if(!n)return!1;var a=n.layout.nodes[e];if(!a)return!1;var s=n.plot,l=a.size/2;return a.x=Math.max(s.x+l,Math.min(s.x+s.width-l,t+s.x)),a.y=Math.max(s.y+l,Math.min(s.y+s.height-l,r+s.y)),a.fixed=!0,this.graphKey="",this.markDirty(),!0}},{key:"settle",value:function settle(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:40,t=this.graph;if(t){var r=t.options||{},n=forceLayout(t.layout.nodes.map(function(e,t){return _objectSpread2(_objectSpread2({},r.nodes&&r.nodes[t]||{name:e.name}),{},{x:e.x,y:e.y,fixed:e.fixed})}),r.links||[],t.plot,_objectSpread2(_objectSpread2({},r),{},{layout:"force",iterations:e}),this.chartTheme?this.chartTheme.colorPalette:void 0);t.layout=n,this.graphKey="",this.markDirty()}}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.graph;if(e){var t=e.layout,r=t.nodes,n=t.links,a=r.length+n.length,s=this.buildSeriesKey([a,e.plot.width,e.plot.height,r.length,n.length]);if(s!==this.graphKey||this.pixels.length!==2*a){this.graphKey=s,this.pixels.length!==2*a&&(this.pixels=new Float64Array(2*a));var l,h=_createForOfIteratorHelper(r);try{for(h.s();!(l=h.n()).done;){var u=l.value;this.pixels[2*u.id]=u.x-e.plot.x,this.pixels[2*u.id+1]=u.y-e.plot.y}}catch(e){h.e(e)}finally{h.f()}var c,p=_createForOfIteratorHelper(n);try{for(p.s();!(c=p.n()).done;){var v=c.value,m=sampleGraphLink(v,r,!1!==e.options.curve,4),g=m[Math.floor(m.length/2)]||[0,0],b=r.length+v.id;this.pixels[2*b]=g[0]-e.plot.x,this.pixels[2*b+1]=g[1]-e.plot.y}}catch(e){p.e(e)}finally{p.f()}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var r=this.graph;if(!r)return-1;var n,a=r.layout,s=a.nodes,l=a.links,h=r.plot,u=_createForOfIteratorHelper(s);try{for(u.s();!(n=u.n()).done;){var c=n.value,p=e-(c.x-h.x),v=t-(c.y-h.y),m=c.size/2*this.hoverBoost(c.id,.28)+3;if(p*p+v*v<=m*m)return c.id}}catch(e){u.e(e)}finally{u.f()}var g,b=!1!==r.options.curve,k=_createForOfIteratorHelper(l);try{for(k.s();!(g=k.n()).done;)for(var S=g.value,A=sampleGraphLink(S,s,b,12),w=1;w<A.length;w++){if(distanceToSegment(e,t,A[w-1][0]-h.x,A[w-1][1]-h.y,A[w][0]-h.x,A[w][1]-h.y)<=6)return s.length+S.id}}catch(e){k.e(e)}finally{k.f()}return-1}},{key:"doRender",value:function doRender(){var e=this.graph;if(e&&this.chartTheme){this.rebuildPixels();var t=this.ctx,r=this.chartTheme,n=e.plot,a=this.unit(),s=e.layout,l=s.nodes,h=s.links,u=!1!==e.options.curve,c=this.isEntering(),p=c?Math.max(0,Math.min(1,this.progress())):1,v=function positionOf(e){return c?[e.initialX+(e.x-e.initialX)*p,e.initialY+(e.y-e.initialY)*p]:[e.x,e.y]},m=l.map(function(e){var t=_slicedToArray(v(e),2),r=t[0],n=t[1];return _objectSpread2(_objectSpread2({},e),{},{x:r,y:n})});this.beginDraw(),t.globalAlpha=.55;var g,b=_createForOfIteratorHelper(h);try{for(b.s();!(g=b.n()).done;){var k=g.value,S=sampleGraphLink(k,m,u,16);if(!(S.length<2)){t.beginPath(),t.moveTo(S[0][0]-n.x,S[0][1]-n.y);for(var A=1;A<S.length;A++)t.lineTo(S[A][0]-n.x,S[A][1]-n.y);t.strokeStyle=k.color,t.lineWidth=Math.max(a,k.width*a),t.stroke()}}}catch(e){b.e(e)}finally{b.f()}t.globalAlpha=1;var w,_=_createForOfIteratorHelper(l);try{for(_.s();!(w=_.n()).done;){var M=w.value,C=_slicedToArray(v(M),2),P=C[0],T=C[1],I=P-n.x,N=T-n.y,D=Math.max(2,M.size/2*this.hoverBoost(M.id,.28));t.beginPath(),t.arc(I,N,D,0,2*Math.PI),t.fillStyle=M.color,t.fill(),t.strokeStyle="rgba(255,255,255,0.85)",t.lineWidth=a*(this.hoverBoost(M.id,.28)>1?2:1),t.stroke()}}catch(e){_.e(e)}finally{_.f()}this.setFont(r.fontSize,r.fontFamily),t.textAlign="center",t.textBaseline="middle",t.fillStyle=r.textColor;var O,R=_createForOfIteratorHelper(l);try{for(R.s();!(O=R.n()).done;){var H=O.value,z=_slicedToArray(v(H),2),V=z[0],L=z[1],E=V-n.x,B=L-n.y+H.size/2+9*a;t.strokeStyle=r.labelHaloColor,t.lineWidth=3*a,t.strokeText(H.name,E,B),t.fillText(H.name,E,B)}}catch(e){R.e(e)}finally{R.f()}this.endDraw()}}},{key:"nodeSizeAt",value:function nodeSizeAt(e){var t=this.graph,r=t&&t.layout.nodes[e];return r?r.size*this.hoverBoost(e,.28):10}}])}(),Se=function(){function CurveSeriesBase(){var e;_classCallCheck(this,CurveSeriesBase);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _defineProperty(e=_callSuper(this,CurveSeriesBase,[].concat(r)),"curve",[]),_defineProperty(e,"curveKey",""),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"monotonicX",!0),e}return _inherits(CurveSeriesBase,ne),_createClass(CurveSeriesBase,[{key:"resolvedParams",value:function resolvedParams(){var e=_objectSpread2({},this.series.option.params||{}),t=this.series.option.sweep;if(t&&t.name){var r=Number(t.from),n=Number(t.to),a=shouldAnimate()?this.sweepPhase():0;e[t.name]=r+(n-r)*a}return e}},{key:"sweepPhase",value:function sweepPhase(){var e=this.series.option.sweep;if(!e)return 0;var t=Math.max(200,Number(e.duration)||3e3),r=(Date.now()%t+t)%t/t;return"loop"===e.mode?r:1-Math.abs(2*r-1)}},{key:"paramValue",value:function paramValue(e){var t=this.resolvedParams();return"number"==typeof t[e]?t[e]:null}},{key:"syncSweep",value:function syncSweep(){var e=this.series.option.sweep;!!(e&&e.name&&shouldAnimate()&&!1!==this.state.display)?this.keepAnimating():this.stopAnimating()}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.coord;if(!e)return this.pixels=new Float64Array(0),void(this.curve=[]);this.syncSweep();var t=this.resolvedParams(),r=e.plot,n=_slicedToArray(this.parameterRange(r),2),a=n[0],s=n[1],l=this.buildSeriesKey([this.paramKey(t),r.width,r.height,Number(a).toPrecision(12),Number(s).toPrecision(12)]);if(l!==this.curveKey){this.curveKey=l;var h=this.series,u=h.pointCount;this.pixels.length!==2*u&&(this.pixels=new Float64Array(2*u));for(var c=0;c<u;c++){var p=_slicedToArray(this.evaluateAt(Number(h.xValueAt(c)),t),2),v=p[0],m=p[1],g=isFinite(v)?e.xScale.map(v):NaN,b=isFinite(m)?e.yScale.map(m):NaN;this.pixels[2*c]=g,this.pixels[2*c+1]=b}for(var k=this.sampleCurve(t,r),S=new Array(2*k.length),A=0;A<k.length;A++){var w=_slicedToArray(k[A],2),_=w[0],M=w[1];S[2*A]=isFinite(_)?e.xScale.map(_):NaN,S[2*A+1]=isFinite(M)?e.yScale.map(M):NaN}this.curve=S,this.xMonotonic=this.monotonicX,this.computeEffective(),this.renderIndices=null}}},{key:"paramKey",value:function paramKey(e){return Object.keys(e).sort().map(function(t){return"".concat(t,"=").concat(Number(e[t]).toPrecision(10))}).join(",")}},{key:"sampleCount",value:function sampleCount(){return this.rebuildPixels(),this.curve.length/2}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();var r=this.pixels.length/2;if(!r)return-1;for(var n=this.series.option,a=Math.max(6,this.lineWidthDevice()+4)+(isFinite(Number(n.hitRadius))?Number(n.hitRadius):0),s=-1,l=a*a,h=0;h<r;h++){var u=this.pixels[2*h]-e,c=this.pixels[2*h+1]-t;if(isFinite(u)&&isFinite(c)){var p=u*u+c*c;p<=l&&(l=p,s=h)}}return s}},{key:"hoverLineScale",value:function hoverLineScale(){return null===this.hoverIndex?1:1+.45*this.highlightT()}},{key:"doRender",value:function doRender(){if(this.rebuildPixels(),this.curve.length){var e=this.ctx,t=this.unit(),r=this.pointColor(0),n=this.series.option;this.beginDraw(),e.strokeStyle=r,e.lineWidth=this.lineWidthDevice()*t*this.hoverLineScale(),"function"==typeof e.setLineDash&&Array.isArray(n.lineDash)&&e.setLineDash(n.lineDash.map(function(e){return e*t})),e.beginPath();for(var a=this.isEntering()?Math.max(.001,Math.min(1,this.progress())):1,s=this.curve.length/2,l=Math.max(1,Math.ceil(s*a)),h=!1,u=0;u<l;u++){var c=this.curve[2*u],p=this.curve[2*u+1];isFinite(c)&&isFinite(p)?h?e.lineTo(c,p):(e.moveTo(c,p),h=!0):h=!1}e.stroke(),"function"==typeof e.setLineDash&&e.setLineDash([]),this.endDraw()}}},{key:"curvePoints",value:function curvePoints(){return this.rebuildPixels(),this.curve}}])}(),Ae=function(){function FunctionSeries(){var e;_classCallCheck(this,FunctionSeries);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _defineProperty(e=_callSuper(this,FunctionSeries,[].concat(r)),"seriesType","function"),_defineProperty(e,"cachedSource",""),_defineProperty(e,"sampler",null),e}return _inherits(FunctionSeries,Se),_createClass(FunctionSeries,[{key:"samplerFor",value:function samplerFor(e){var t=String(this.series.option.expression||"");if(t!==this.cachedSource||!this.sampler){this.cachedSource=t;try{this.sampler=compileSampler(t)}catch(e){this.sampler={setParams:function setParams(){},evaluate:function evaluate(){return NaN}}}}var r=this.sampler;return r.setParams(e),function(e){return r.evaluate("x",e)}}},{key:"evaluateAt",value:function evaluateAt(e,t){return[e,this.samplerFor(t)(e)]}},{key:"parameterRange",value:function parameterRange(e){var t=this.coord,r=t&&t.xScale&&t.xScale.domain;if(r&&r.length>=2){var n=Number(r[0]),a=Number(r[r.length-1]);if(isFinite(n)&&isFinite(a)&&a>n)return[n,a]}var s=this.series.option.domain;return[s?Number(s[0]):-10,s?Number(s[1]):10]}},{key:"baseSampleCount",value:function baseSampleCount(){var e=Number(this.series.option.samples);return Math.max(24,Math.min(4e3,isFinite(e)&&e>0?e:240))}},{key:"sampleCurve",value:function sampleCurve(e,t){var r=this.samplerFor(e),n=_slicedToArray(this.parameterRange(t),2);return sampleFunctionCurve(r,n[0],n[1],{base:this.baseSampleCount(),adaptive:!1!==this.series.option.adaptive,tolerance:this.series.option.samplingTolerance})}}])}(),we=function(){function ParametricSeries(){var e;_classCallCheck(this,ParametricSeries);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _defineProperty(e=_callSuper(this,ParametricSeries,[].concat(r)),"seriesType","parametric"),_defineProperty(e,"cachedSources",""),_defineProperty(e,"samplerX",null),_defineProperty(e,"samplerY",null),_defineProperty(e,"samplerR",null),e.monotonicX=!1,e}return _inherits(ParametricSeries,Se),_createClass(ParametricSeries,[{key:"samplersFor",value:function samplersFor(e){var t=this.series.option,r=void 0===t.polarExpression||null===t.polarExpression?"":String(t.polarExpression);if(r){var n="polar\0".concat(r,"\0").concat(Object.keys(e).sort().join(","));if(n!==this.cachedSources||!this.samplerR){this.cachedSources=n;try{this.samplerR=compileSampler(r)}catch(e){this.samplerR={setParams:function setParams(){},evaluate:function evaluate(){return NaN}}}}var a=this.samplerR;return a.setParams(e),{x:function x(e){return a.evaluate("t",e)*Math.cos(e)},y:function y(e){return a.evaluate("t",e)*Math.sin(e)}}}var s=String(t.xExpression||""),l=String(t.yExpression||""),h="".concat(s,"\0").concat(l,"\0").concat(Object.keys(e).sort().join(","));if(h!==this.cachedSources||!this.samplerX||!this.samplerY){this.cachedSources=h;var u={setParams:function setParams(){},evaluate:function evaluate(){return NaN}};try{this.samplerX=compileSampler(s)}catch(e){this.samplerX=u}try{this.samplerY=compileSampler(l)}catch(e){this.samplerY=u}}var c=this.samplerX,p=this.samplerY;return c.setParams(e),p.setParams(e),{x:function x(e){return c.evaluate("t",e)},y:function y(e){return p.evaluate("t",e)}}}},{key:"evaluateAt",value:function evaluateAt(e,t){var r=this.samplersFor(t),n=r.x,a=r.y;return[n(e),a(e)]}},{key:"parameterRange",value:function parameterRange(e){var t=this.series.option.domain,r=t?Number(t[0]):0,n=t?Number(t[1]):2*Math.PI;return isFinite(r)&&isFinite(n)&&n!==r?[r,n]:[0,2*Math.PI]}},{key:"baseSampleCount",value:function baseSampleCount(){var e=Number(this.series.option.samples);return Math.max(24,Math.min(6e3,isFinite(e)&&e>0?e:360))}},{key:"sampleCurve",value:function sampleCurve(e,t){var r=this.samplersFor(e),n=r.x,a=r.y,s=_slicedToArray(this.parameterRange(t),2);return sampleParametricCurve(n,a,s[0],s[1],{base:this.baseSampleCount(),adaptive:!1!==this.series.option.adaptive,tolerance:this.series.option.samplingTolerance})}}])}(),_e=2*Math.PI,Me=function(){function LiquidSeries(){var e;_classCallCheck(this,LiquidSeries);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _defineProperty(e=_callSuper(this,LiquidSeries,[].concat(r)),"seriesType","liquid"),_defineProperty(e,"liquid",null),_defineProperty(e,"liquidKey",""),_defineProperty(e,"fromRatio",null),e}return _inherits(LiquidSeries,ne),_createClass(LiquidSeries,[{key:"setCoord",value:function setCoord(e){return this.liquid=e||null,this.liquidKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 6}},{key:"localCenter",value:function localCenter(){var e=this.liquid;return[e.polar.cx-e.plot.x,e.polar.cy-e.plot.y]}},{key:"range",value:function range(){var e=this.liquid&&this.liquid.options||{},t=isFinite(Number(e.min))?Number(e.min):0,r=isFinite(Number(e.max))?Number(e.max):100;return{min:t,max:r>t?r:t+1}}},{key:"targetRatio",value:function targetRatio(){var e=this.range(),t=e.min,r=e.max,n=this.series.pointCount&&Number(this.series.pointAt(0).y)||0;return Math.max(0,Math.min(1,(n-t)/(r-t)))}},{key:"currentRatio",value:function currentRatio(){var e=this.targetRatio(),t=Math.max(0,Math.min(1,this.progress())),r=null===this.fromRatio?0:this.fromRatio;return r+(e-r)*t}},{key:"levelRatio",value:function levelRatio(){return this.currentRatio()}},{key:"updateSeries",value:function updateSeries(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t&&this.liquid&&(this.fromRatio=this.currentRatio()),_superPropGet(LiquidSeries,"updateSeries",this,3)([e,t,r])}},{key:"phase",value:function phase(){var e=this.liquid&&this.liquid.options||{};if(!shouldAnimate())return 0;var t=isFinite(Number(e.waveSpeed))?Number(e.waveSpeed):1.6;return Date.now()/1e3*t}},{key:"syncWave",value:function syncWave(){var e=this.targetRatio();shouldAnimate()&&e>.001&&e<.999&&!1!==this.state.display?this.keepAnimating():this.stopAnimating()}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.liquid;if(e){var t=this.series.pointCount&&Number(this.series.pointAt(0).y)||0,r=this.buildSeriesKey([e.polar.radius,e.options.min,e.options.max,t]);if(r!==this.liquidKey||2!==this.pixels.length){this.liquidKey=r,2!==this.pixels.length&&(this.pixels=new Float64Array(2));var n=_slicedToArray(this.localCenter(),2),a=n[0],s=n[1];this.pixels[0]=a,this.pixels[1]=s,this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var r=this.liquid;if(!r||!this.series.pointCount)return-1;var n=_slicedToArray(this.localCenter(),2),a=n[0],s=n[1];return Math.hypot(e-a,t-s)<=r.polar.radius+8?0:-1}},{key:"wavePath",value:function wavePath(e,t,r,n,a,s,l,h){var u=Math.max(1,2*n/64);e.beginPath(),e.moveTo(t-n,a+s*Math.sin(h));for(var c=-n+u;c<=n;c+=u)e.lineTo(t+c,a+s*Math.sin(c/l*_e+h))}},{key:"doRender",value:function doRender(){var e=this.liquid;if(e&&this.chartTheme){this.rebuildPixels(),this.syncWave();var t=this.ctx,r=this.chartTheme,n=e.options||{},a=this.unit(),s=_slicedToArray(this.localCenter(),2),l=s[0],h=s[1],u=e.polar.radius,c=Math.max(1,Number(n.borderWidth)||3)*a,p=Math.max(2,u-c),v=n.color||this.pointColor(0),m=this.currentRatio(),g=isFinite(Number(n.waveHeight))?Number(n.waveHeight):.06,b=Math.max(.15,isFinite(Number(n.waveLength))?Number(n.waveLength):1.2)*p,k=g*p,S=this.phase();this.beginDraw(),t.beginPath(),t.arc(l,h,p,0,_e),t.fillStyle=hexToRgba(v,.1),t.fill(),t.save(),t.beginPath(),t.arc(l,h,p,0,_e),t.clip();for(var A=h+p-2*p*m,w=0,_=[{phase:S,alpha:.34,ampScale:1.25},{phase:S+.6*Math.PI,alpha:.55,ampScale:1}];w<_.length;w++){var M=_[w];this.wavePath(t,l,h,p,A,k*M.ampScale,b,M.phase),t.lineTo(l+p,h+p+2*k),t.lineTo(l-p,h+p+2*k),t.closePath(),t.globalAlpha=M.alpha;var C=t.createLinearGradient?t.createLinearGradient(0,A-k,0,h+p):null;C?(C.addColorStop(0,hexToRgba(v,.95)),C.addColorStop(1,hexToRgba(v,.55)),t.fillStyle=C):t.fillStyle=v,t.fill(),t.globalAlpha=1}t.restore(),t.beginPath(),t.arc(l,h,u-c/2,0,_e),t.strokeStyle=n.borderColor||hexToRgba(v,.6),t.lineWidth=c,t.stroke();var P=n.detail||{};if(!1!==P.show){var T=this.range().min,I=T+((this.series.pointCount&&Number(this.series.pointAt(0).y)||0)-T)*Math.max(0,Math.min(1,this.progress())),N="function"==typeof P.formatter?P.formatter(I):"".concat(Number(I.toPrecision(4))).concat(void 0===n.unit?"%":n.unit),D=this.series.pointCount?this.series.pointAt(0).name:void 0;D&&!1!==n.title&&(this.setFont(r.fontSize,r.fontFamily),t.fillStyle=r.subTextColor,t.textAlign="center",t.textBaseline="middle",t.fillText(String(D),l,h-.9*(Number(P.fontSize)||.28*u)*a));var O=isFinite(Number(P.fontSize))?Number(P.fontSize):Math.max(14,.42*u);this.setFont(O*a,r.fontFamily,"bold"),t.fillStyle=n.textColor||r.textColor,t.textAlign="center",t.textBaseline="middle",t.fillText(N,l,h+(D?.18*O*a:0))}this.endDraw()}}}])}(),Ce={bar:function bar(e,t){return new oe(e,t)},area:function area(e,t){return new se(e,t)},line:function line(e,t){return new ae(e,t)},scatter:function scatter(e,t){return new le(e,t)},pie:function pie(e,t){return new ue(e,t)},radar:function radar(e,t){return new ce(e,t)},heatmap:function heatmap(e,t){return new de(e,t)},sankey:function sankey(e,t){return new fe(e,t)},funnel:function funnel(e,t){return new pe(e,t)},gauge:function gauge(e,t){return new me(e,t)},boxplot:function boxplot(e,t){return new xe(e,t)},waterfall:function waterfall(e,t){return new ge(e,t)},treemap:function treemap(e,t){return new be(e,t)},graph:function graph(e,t){return new ke(e,t)},function:function _function(e,t){return new Ae(e,t)},parametric:function parametric(e,t){return new we(e,t)},liquid:function liquid(e,t){return new Me(e,t)}},Pe={},Te=/^[a-zA-Z][\w-]*$/;function registerSeriesType(e,t){if("string"!=typeof e||!Te.test(e))throw new Error("[ice-chart] registerSeriesType:类型名必须是非空字符串(字母开头,可含数字 / 下划线 / 连字符),收到「".concat(String(e),"」"));if("function"!=typeof t)throw new Error("[ice-chart] registerSeriesType:factory 必须是函数");if(Object.prototype.hasOwnProperty.call(Ce,e))throw new Error("[ice-chart] registerSeriesType:「".concat(e,"」是内置类型,不能覆盖(会破坏 option 的跨端可复现性)"));var r=Pe[e];if(r&&r!==t)throw new Error("[ice-chart] registerSeriesType:「".concat(e,"」已经注册过另一个工厂,先 unregisterSeriesType 再注册"));Pe[e]=t}function unregisterSeriesType(e){return!!Object.prototype.hasOwnProperty.call(Pe,e)&&(delete Pe[e],!0)}function getSeriesTypeFactory(e){return Object.prototype.hasOwnProperty.call(Ce,e)?Ce[e]:Pe[e]||null}function listSeriesTypes(){return[].concat(_toConsumableArray(Object.keys(Ce)),_toConsumableArray(Object.keys(Pe)))}function isBuiltinSeriesType(e){return Object.prototype.hasOwnProperty.call(Ce,e)}function createSeriesComponent(e,t){return(getSeriesTypeFactory(String(e.type))||Ce.line)(e,t)}function clearCustomSeriesTypes(){for(var e=0,t=Object.keys(Pe);e<t.length;e++){var r=t[e];delete Pe[r]}}var Fe=function(){return _createClass(function HitResolver(e){_classCallCheck(this,HitResolver),this.host=e},[{key:"resolveTarget",value:function resolveTarget(e,t){var r=this.host.ice,n={kind:"none",component:null,index:-1,local:[0,0],chart:[0,0]};if(!r||"function"!=typeof r.hitTest)return n;var a=_slicedToArray(r.screenToWorld(e,t),2),s=a[0],l=a[1],h=[s,l],u=r.hitTest(e,t);if(!u)return _objectSpread2(_objectSpread2({},n),{},{chart:h});var c=u.globalToLocal?u.globalToLocal(s,l):[0,0];if(u===this.host.plotArea)return{kind:"plot",component:u,index:-1,local:c,chart:h};if(u===this.host.legend)return{kind:"legend",component:u,index:this.host.legend&&"function"==typeof this.host.legend.hitItem?this.host.legend.hitItem(c[0],c[1]):-1,local:c,chart:h};if("function"==typeof u.hitTestIndex){var p=u.hitTestIndex(c[0],c[1]);return{kind:p>=0?"series":"other",component:u,index:p,local:c,chart:h}}return{kind:"other",component:u,index:-1,local:c,chart:h}}},{key:"isInsidePlot",value:function isInsidePlot(e,t){var r=this.host.layout.plot;return e>=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height}},{key:"seriesComponentOf",value:function seriesComponentOf(e){if(!e)return null;var t,r=_createForOfIteratorHelper(this.host.seriesComponents);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(n.series===e)return n}}catch(e){r.e(e)}finally{r.f()}var a=e.id;if(null!=a){var s,l=_createForOfIteratorHelper(this.host.seriesComponents);try{for(l.s();!(s=l.n()).done;){var h=s.value;if(h.series&&h.series.id===a)return h}}catch(e){l.e(e)}finally{l.f()}}return null}},{key:"seriesOfComponent",value:function seriesOfComponent(e){var t,r=_createForOfIteratorHelper(this.host.norm.series);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(this.seriesComponentOf(n)===e)return n}}catch(e){r.e(e)}finally{r.f()}return null}},{key:"buildActiveItem",value:function buildActiveItem(e,t){var r=this.seriesComponentOf(e);if(!r)return null;var n=r.pixelAt(t),a=e.pointAt(t);if(!n||!a)return null;var s=this.host.layout.plot;return{series:e,point:a,pixel:[s.x+n[0],s.y+n[1]],screen:[0,0]}}},{key:"toParams",value:function toParams(e){var t=this.host.ice,r=t&&"function"==typeof t.worldToScreen?t.worldToScreen(e.pixel[0],e.pixel[1]):e.pixel;return{seriesId:e.series.id,seriesName:e.series.name,seriesIndex:e.series.index,seriesType:e.series.type,color:e.series.color,dataIndex:e.point.index,data:e.point.raw,xValue:e.point.xValue,value:e.point.y,screen:[r[0],r[1]]}}},{key:"pickColumn",value:function pickColumn(e){var t=e-this.host.layout.plot.x,r=this.host.norm.series.filter(function(e){return!e.hidden});if(!r.length)return null;var n,a=[],s=null,l=_createForOfIteratorHelper(r);try{for(l.s();!(n=l.n()).done;){var h=n.value,u=this.seriesComponentOf(h);if(u){var c=this.nearestIndexByX(u,t);if(!(c<0)){var p=this.buildActiveItem(h,c);p&&(a.push(p),null===s&&(s=h.pointAt(c).xValue))}}}}catch(e){l.e(e)}finally{l.f()}return a.length?{dataIndex:a[0].point.index,xValue:s,pixelX:a[0].pixel[0],items:a}:null}},{key:"nearestIndexByX",value:function nearestIndexByX(e,t){return e.nearestIndexAtX(t)}},{key:"nearestByXValue",value:function nearestByXValue(e){var t,r=this.host.norm.series.filter(function(e){return!e.hidden}),n=this.host.norm.hiddenSlices||{},a=null,s=_createForOfIteratorHelper(r);try{for(s.s();!(t=s.n()).done;)for(var l=t.value,h=0;h<l.pointCount;h++)if("pie"!==l.type&&"funnel"!==l.type||!n["".concat(l.id,"#").concat(h)]){var u=valueDistance(e,l.pointAt(h).xValue);null!==u&&(!a||u<a.dist)&&(a={series:l,index:h,dist:u})}}catch(e){s.e(e)}finally{s.f()}return a?this.buildActiveItem(a.series,a.index):null}}])}();function valueDistance(e,t){var r=e instanceof Date?e.getTime():Number(e),n=t instanceof Date?t.getTime():Number(t);return isFinite(r)&&isFinite(n)?Math.abs(r-n):String(e)===String(t)?0:null}function barCountRange(e,t){var r=Math.max(1,e),n=Math.max(2,Math.ceil(r/function maxBarSpacingOf(e,t){var r=Number(e&&e.maxBarSpacing);return isFinite(r)&&r>0?r:Math.max(1,.5*t)}(t,r))),a=Math.max(n,Math.floor(r/function minBarSpacingOf(e){var t=Number(e&&e.minBarSpacing);return isFinite(t)&&t>0?t:.5}(t)));return[n,a]}function clampBarCount(e,t,r){var n=_slicedToArray(barCountRange(t,r),2),a=n[0],s=n[1];return isFinite(e)?Math.min(s,Math.max(a,e)):a}var Ie=null,Ne=function(){return _createClass(function InteractionController(e){_classCallCheck(this,InteractionController),_defineProperty(this,"hover",null),_defineProperty(this,"externalHover",!1),_defineProperty(this,"selection",[]),_defineProperty(this,"drag",null),_defineProperty(this,"bound",!1),_defineProperty(this,"lastDimmed",null),_defineProperty(this,"keyboardIndex",0),this.host=e,this.resolver=new Fe(e)},[{key:"bind",value:function bind(){if(this.bound)return this;var e=this.host.ice&&this.host.ice.evtBus;return e?(this.bound=!0,e.on("mousemove",this.onBusMove,this),e.on("mousedown",this.onBusDown,this),e.on("mouseup",this.onBusUp,this),e.on("click",this.onBusClick,this),e.on("dblclick",this.onBusDoubleClick,this),e.on("wheel",this.onBusWheel,this),e.on("keydown",this.onBusKeyDown,this),this):this}},{key:"unbind",value:function unbind(){if(this.bound){this.bound=!1;var e=this.host.ice&&this.host.ice.evtBus;e&&(e.off("mousemove",this.onBusMove,this),e.off("mousedown",this.onBusDown,this),e.off("mouseup",this.onBusUp,this),e.off("click",this.onBusClick,this),e.off("dblclick",this.onBusDoubleClick,this),e.off("wheel",this.onBusWheel,this),e.off("keydown",this.onBusKeyDown,this))}}},{key:"pointOf",value:function pointOf(e){if(!e)return null;var t="number"==typeof e.offsetX?e.offsetX:e.x,r="number"==typeof e.offsetY?e.offsetY:e.y;return"number"!=typeof t||"number"!=typeof r?null:[t,r]}},{key:"isOverCanvas",value:function isOverCanvas(e,t){var r=this.host&&this.host.ice;if(!r)return!1;var n=r.dpr||1,a=(r.canvasWidth||0)/n,s=(r.canvasHeight||0)/n;return a>0&&s>0&&(e>=0&&t>=0&&e<=a&&t<=s)}},{key:"preventDefault",value:function preventDefault(e){if(e){if("function"==typeof e.preventDefault)try{return void e.preventDefault()}catch(e){}var t=e.originalEvent;if(t&&"function"==typeof t.preventDefault)try{t.preventDefault()}catch(e){}}}},{key:"onBusMove",value:function onBusMove(e){var t=this.pointOf(e);t&&this.handlePointerMove(t[0],t[1],e)}},{key:"onBusDown",value:function onBusDown(e){var t=this.pointOf(e);t&&this.handlePointerDown(t[0],t[1],e)}},{key:"onBusUp",value:function onBusUp(e){var t=this.pointOf(e);t&&this.handlePointerUp(t[0],t[1],e)}},{key:"onBusClick",value:function onBusClick(e){var t=this.pointOf(e);t&&this.handleClick(t[0],t[1],e)}},{key:"onBusDoubleClick",value:function onBusDoubleClick(e){var t=this.pointOf(e);t&&this.handleDoubleClick(t[0],t[1],e)}},{key:"onBusWheel",value:function onBusWheel(e){var t=this.pointOf(e);t&&this.handleWheel(t[0],t[1],Number(e.deltaY)||0,e)}},{key:"onBusKeyDown",value:function onBusKeyDown(e){this.handleKeyDown(e&&e.key,e)}},{key:"refreshHover",value:function refreshHover(){var e=this.hover;if(e){var t=this.host.norm;if("item"===e.kind){var r=t.series.find(function(t){return t.id===e.item.series.id})||e.item.series,n=e.item.point.index,a=("pie"===r.type||"funnel"===r.type)&&t.hiddenSlices["".concat(r.id,"#").concat(n)];if(r.hidden||a||!r.pointAt(n))return void this.setHover(null);var s=this.resolver.buildActiveItem(r,n);return s&&this.resolver.isInsidePlot(s.pixel[0],s.pixel[1])?void this.setHover({kind:"item",item:s},this.externalHover):void this.setHover(null)}var l=this.resolver.nearestByXValue(e.column.xValue),h=l?this.resolver.pickColumn(l.pixel[0]):null;h&&("cartesian"!==t.kind||this.resolver.isInsidePlot(h.pixelX,h.items[0].pixel[1]))?this.setHover({kind:"axis",column:h},this.externalHover):this.setHover(null)}}},{key:"resolveTarget",value:function resolveTarget(e,t){return this.resolver.resolveTarget(e,t)}},{key:"handlePointerMove",value:function handlePointerMove(e,t,r){this.drag?this.updateDrag(e,t,r):this.isOverCanvas(e,t)?this.updateHover(e,t):this.hover&&!this.externalHover&&this.setHover(null)}},{key:"updateHover",value:function updateHover(e,t){var r=this.host.norm.option.interaction;if(!r||!r.hover||!1!==r.hover.enabled){var n=this.resolveTarget(e,t);if("legend"===n.kind){var a=this.host.legend;return a&&a.hoverIndex!==n.index&&(a.hoverIndex=n.index,a.markDirty()),this.clearDataVisuals(),void this.setHoverState(null)}this.resetLegendHover();var s=this.host.norm.option.tooltip&&this.host.norm.option.tooltip.trigger||"axis";if(this.resolver.isInsidePlot(n.chart[0],n.chart[1])&&"axis"===s){var l=this.resolver.pickColumn(n.chart[0]);if(l)return void this.setHover({kind:"axis",column:l})}if("series"===n.kind&&n.index>=0){var h=this.resolver.seriesOfComponent(n.component),u=h?this.resolver.buildActiveItem(h,n.index):null;if(u)return void this.setHover({kind:"item",item:u})}this.setHover(null)}}},{key:"resetLegendHover",value:function resetLegendHover(){var e=this.host.legend;e&&-1!==e.hoverIndex&&(e.hoverIndex=-1,e.markDirty())}},{key:"setHover",value:function setHover(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.externalHover=!!e&&t;var r=!!this.hover;if(this.hover=e,!e)return this.clearHoverVisuals(),this.dimOthers(null),void(r&&this.host.emit("item:leave",void 0));this.applyHoverVisuals(e),"item"===e.kind?(this.keyboardIndex=e.item.point.index,this.dimOthers(e.item.series.id),this.host.emit("item:hover",this.resolver.toParams(e.item))):(this.dimOthers(null),e.column.items[0]&&this.host.emit("item:hover",this.resolver.toParams(e.column.items[0])))}},{key:"setHoverState",value:function setHoverState(e){this.hover=e}},{key:"applyHoverVisuals",value:function applyHoverVisuals(e){var t=this,r="item"===e.kind?[e.item]:e.column.items,n=r[0];this.syncSeriesHover(r);var a=this.host.highlight;a&&a.setHover(this.hoverMarkEnabled()?r.map(function(e){return t.markFor(e)}):[]);var s=this.host.crosshair;if(s)if("cartesian"!==this.host.norm.kind||"horizontal"===this.host.norm.orientation)s.hide();else{var l=this.host.norm.option.crosshair&&this.host.norm.option.crosshair.axis||"x";s.show("y"===l?null:n.pixel[0],"x"===l?null:n.pixel[1],this.host.formatAxisValue("x",n.point.xValue),null===n.point.y?"":this.host.formatAxisValue("y",n.point.y))}var h=this.host.tooltip;if(h)if(this.host.norm.option.tooltip&&!1===this.host.norm.option.tooltip.show)h.hide();else{var u=this.buildTooltipContent(e),c="axis"===e.kind?[e.column.pixelX,n.pixel[1]]:[n.pixel[0],n.pixel[1]];h.show(u,c)}}},{key:"buildTooltipContent",value:function buildTooltipContent(e){var t=this,r="item"===e.kind?[e.item]:e.column.items,n=r[0];if(n&&"horizontal"===this.host.norm.orientation)return{title:this.host.formatAxisValue("y",n.point.xValue),rows:r.map(function(e){return{name:e.series.name,value:null===e.point.y?"-":t.host.formatAxisValue("x",e.point.y),color:e.series.color}})};if(n&&"pie"===n.series.type){for(var a=n.series,s=n.point,l=0,h=0;h<a.pointCount;h++){var u=a.pointAt(h);this.host.norm.hiddenSlices["".concat(a.id,"#").concat(u.index)]||(l+=u.y||0)}var c=s.y||0,p=l>0?c/l*100:0;return{title:a.name,rows:[{name:s.name||"".concat(this.host.norm.labels.slice," ").concat(s.index+1),value:"".concat(p.toFixed(1),"%"),color:s.color||a.color}]}}if(n&&"funnel"===n.series.type){for(var v=n.series,m=n.point,g=0,b=0;b<v.pointCount;b++){var k=v.pointAt(b);this.host.norm.hiddenSlices["".concat(v.id,"#").concat(k.index)]||(g+=k.y||0)}var S=g>0?(m.y||0)/g*100:0;return{title:m.name||this.host.formatAxisValue("x",m.xValue),rows:[{name:v.name,value:"".concat(null===m.y?"-":m.y,"(").concat(S.toFixed(1),"%)"),color:m.color||v.color}]}}if(n&&"gauge"===n.series.type){var A=n.series,w=n.point;return{title:w.name||A.name,rows:[{name:A.name,value:null===w.y?"-":String(w.y),color:A.color}]}}if(n&&"liquid"===n.series.type){var _=n.series,M=n.point,C=_.option.liquid||{},P=isFinite(Number(C.min))?Number(C.min):0,T=isFinite(Number(C.max))?Number(C.max):100,I=null===M.y?P:Number(M.y),N=T>P?Math.max(0,Math.min(1,(I-P)/(T-P))):0;return{title:M.name||_.name,rows:[{name:_.name,value:"".concat(I).concat(void 0===C.unit?"%":C.unit),color:_.color},{name:this.host.norm.labels.liquid,value:"".concat((100*N).toFixed(1),"%"),color:this.host.norm.theme.subTextColor}]}}if(n&&("function"===n.series.type||"parametric"===n.series.type)){var D,O,R=n.series,H=n.point.raw||{},z="function"===R.type,V=z?"x":"t",L=Number(z?null!==(D=H.x)&&void 0!==D?D:n.point.xValue:null!==(O=H.t)&&void 0!==O?O:n.point.xValue),E=Number(H.x),B=Number(H.y),j=function fmt(e){return isFinite(e)?String(Number(e.toPrecision(4))):"—"};return{title:"".concat(V," = ").concat(j(L)),rows:z?[{name:R.name,value:j(B),color:R.color},{name:this.host.norm.labels.coordinate,value:"(".concat(j(E),", ").concat(j(B),")"),color:this.host.norm.theme.subTextColor}]:[{name:this.host.norm.labels.coordinate,value:"(".concat(j(E),", ").concat(j(B),")"),color:R.color},{name:"y",value:j(B),color:this.host.norm.theme.subTextColor}]}}if(n&&"radar"===n.series.type){for(var W=n.series,X=[],G=0;G<W.pointCount;G++){var U=W.pointAt(G);X.push({name:U.name||"".concat(U.index+1),value:null===U.y?"-":String(U.y),color:U.index===n.point.index?W.color:this.host.norm.theme.subTextColor})}return{title:W.name,rows:X}}if(n&&"boxplot"===n.series.type){var K=n.point,Y=K.boxplot;if(Y){var q=["最小值","下四分位","中位数","上四分位","最大值"];return{title:K.name||this.host.formatAxisValue("x",K.xValue),rows:Y.map(function(e,t){return{name:q[t],value:String(e),color:n.series.color}})}}}if(n&&"waterfall"===n.series.type){var $=n.point,Z=$.y||0;return{title:$.name||this.host.formatAxisValue("x",$.xValue),rows:[{name:Z>=0?"增加":"减少",value:"".concat(Z>=0?"+":"").concat(Z),color:n.series.color},{name:"累计",value:String($.top),color:this.host.norm.theme.subTextColor}]}}if(n&&"treemap"===n.series.type){var J=n.series,Q=n.point,ee=J.pointAt(0);ee&&0===ee.index&&ee.y;for(var te=Q.y||0,ie=0,re=0;re<J.pointCount;re++){var ne=J.pointAt(re),ae=ne.raw;ae&&Array.isArray(ae.children)&&ae.children.length||(ie+=ne.y||0)}var oe=ie>0?te/ie*100:0;return{title:Q.name||String(Q.xValue),rows:[{name:J.name,value:"".concat(te,"(").concat(oe.toFixed(1),"%)"),color:n.series.color}]}}if(n&&"graph"===n.series.type){var se=this.resolver.seriesComponentOf(n.series),le=n.point,he=se&&se.nodeCount||0;if(le.index>=he){var ue=se&&se.graph?se.graph.layout.links[le.index-he]:null,ce=se&&se.graph?se.graph.layout.nodes:[];return{title:le.name,rows:[{name:"流量",value:String(ue?ue.value:le.y),color:ue?ue.color:n.series.color}].concat(_toConsumableArray(ue&&ce[ue.source]&&ce[ue.target]?[{name:"度数",value:String(ce[ue.source].degree+ce[ue.target].degree),color:this.host.norm.theme.subTextColor}]:[]))}}return{title:le.name,rows:[{name:"权重",value:null===le.y?"-":String(le.y),color:n.series.color},{name:"连接数",value:String(se&&se.graph&&se.graph.layout.nodes[le.index]?se.graph.layout.nodes[le.index].degree:0),color:this.host.norm.theme.subTextColor}]}}if(n&&"heatmap"===n.series.type){var de=n.point;return{title:de.name||this.host.formatAxisValue("x",de.xValue),rows:[{name:this.host.formatAxisValue("x",de.xValue),value:null===de.y?"-":this.host.formatAxisValue("y",de.y),color:de.color||n.series.color}]}}if(n&&"sankey"===n.series.type){var fe=n.point,pe=!(!fe.raw||!fe.raw.__sankeyLink);return{title:pe?fe.name:"节点",rows:[{name:pe?"流量":fe.name,value:null===fe.y?"-":String(fe.y),color:n.series.color}]}}var ve="item"===e.kind?e.item.point.xValue:e.column.xValue,ye=this.host.formatAxisValue("x",ve),me=r.map(function(e){return{name:e.series.name,value:null===e.point.y?"-":t.host.formatAxisValue("y",e.point.y),color:e.series.color}}),xe=this.host.norm.option.tooltip&&this.host.norm.option.tooltip.formatter;if("function"==typeof xe){var ge=xe({items:r.map(function(e){return t.resolver.toParams(e)}),dataIndex:"item"===e.kind?e.item.point.index:e.column.dataIndex,xValue:ve});if(Array.isArray(ge))return{title:void 0===ge[0]?ye:String(ge[0]),rows:ge.slice(1).map(function(e,t){return{name:String(e),value:"",color:r[t]?r[t].series.color:"#999999"}})};if("string"==typeof ge)return{title:ge,rows:[]};if(ge&&"object"===_typeof(ge)&&(void 0!==ge.title||void 0!==ge.rows))return{title:ge.title||ye,rows:ge.rows||me}}return{title:ye,rows:me}}},{key:"clearHoverVisuals",value:function clearHoverVisuals(){this.clearDataVisuals(),this.resetLegendHover()}},{key:"clearDataVisuals",value:function clearDataVisuals(){this.syncSeriesHover([]),this.host.highlight&&this.host.highlight.setHover([]),this.host.crosshair&&this.host.crosshair.hide(),this.host.tooltip&&this.host.tooltip.hide()}},{key:"hoverMarkEnabled",value:function hoverMarkEnabled(){var e=this.host.norm.option.interaction;return!(e&&e.hover&&!1===e.hover.mark)}},{key:"syncSeriesHover",value:function syncSeriesHover(e){var t,r=new Map,n=_createForOfIteratorHelper(e);try{for(n.s();!(t=n.n()).done;){var a=t.value;r.has(a.series.id)||r.set(a.series.id,a.point.index)}}catch(e){n.e(e)}finally{n.f()}var s,l=_createForOfIteratorHelper(this.host.seriesComponents);try{for(l.s();!(s=l.n()).done;){var h=s.value,u=r.get(h.series.id);h.setHoverIndex(void 0===u?null:u)}}catch(e){l.e(e)}finally{l.f()}}},{key:"markFor",value:function markFor(e){var t,r,n=this.resolver.seriesComponentOf(e.series),a=this.host.layout.plot;if(n&&"bar"===e.series.type&&"function"==typeof n.barRectAt){var s=("function"==typeof n.barDrawRectAt?n.barDrawRectAt(e.point.index,1):null)||n.barRectAt(e.point.index),l=s?{x:Math.max(s.x,0),y:Math.max(s.y,0),width:Math.max(0,Math.min(s.x+s.width,a.width)-Math.max(s.x,0)),height:Math.max(0,Math.min(s.y+s.height,a.height)-Math.max(s.y,0))}:null;if(l&&l.width>0&&l.height>0)return{x:a.x+l.x+l.width/2,y:a.y+l.y+l.height/2,width:l.width,height:l.height,color:e.series.color,size:0,shape:"rect"}}return{x:e.pixel[0],y:e.pixel[1],color:e.series.color,size:(t=e.series,r=t.option&&t.option.symbolSize,isFinite(r)?Number(r):"bar"===t.type?10:8),shape:"circle"}}},{key:"dimOthers",value:function dimOthers(e){var t=this.host.norm.option.interaction,r=!!(t&&t.hover&&t.hover.dimOthers),n=r?e:null;if(n!==this.lastDimmed){this.lastDimmed=n;var a,s=this.host.norm.theme.selection.dimOpacity,l=_createForOfIteratorHelper(this.host.seriesComponents);try{for(l.s();!(a=l.n()).done;){var h=a.value,u=r&&null!==n&&h.series.id!==n;h.setState({opacity:u?s:1})}}catch(e){l.e(e)}finally{l.f()}}}},{key:"handlePointerDown",value:function handlePointerDown(e,t,r){if(!this.isOverCanvas(e,t))return!1;Ie=this;var n=this.resolveTarget(e,t);if("legend"===n.kind)return!0;var a=this.host.dataZoomSlider;if(a&&n.component===a){var s=a.hitPart(n.local[0],n.local[1]);if(s){this.preventDefault(r),this.setHover(null);var l=a.fractionAt(n.local[0]);if(this.drag={mode:"slider",part:s,startX:e,startY:t,originStart:a.start,originEnd:a.end,anchorFraction:l,moved:!1},a.setActive(s),"track"===s){var h=a.end-a.start,u=clamp$2(l-h/2,0,1-h);this.host.setDomainFromFractions(u,u+h,"slider",!0),a.setActive("window"),this.drag.part="window",this.drag.originStart=u,this.drag.originEnd=u+h}return!0}}if("series"===n.kind&&n.index>=0&&n.component&&"graph"===n.component.seriesType&&"function"==typeof n.component.moveNode&&n.index<(n.component.nodeCount||0)&&(!n.component.graph||!1!==n.component.graph.options.draggable))return this.preventDefault(r),this.setHover(null),this.drag={mode:"graph-node",component:n.component,nodeIndex:n.index,startX:e,startY:t,moved:!1},!0;if(n.component&&"function"==typeof this.host.isMarkComponent&&this.host.isMarkComponent(n.component))return this.setHover(null),!1;if(!this.resolver.isInsidePlot(n.chart[0],n.chart[1]))return!1;var c=this.host.norm.option.interaction||{},p=c.brush,v=c.pan,m=!(!p||!1===p||!1===p.enabled),g=!(!v||!1===v||!v.enabled);return this.preventDefault(r),m?(this.setHover(null),this.drag={mode:"brush",startX:e,startY:t,moved:!1},this.host.brush&&this.host.brush.setRect({x:n.chart[0],y:n.chart[1],width:0,height:0}),!0):!!g&&(this.setHover(null),this.drag={mode:"pan",startX:e,startY:t,domainX:this.currentXWindow(),domainY:[this.host.norm.yAxis.domain[0],this.host.norm.yAxis.domain[1]],moved:!1},!0)}},{key:"currentXWindow",value:function currentXWindow(){var e=this.host.norm.xAxis,t=e&&e.domain;return!t||t.length<2?null:"category"===e.type?[t[0],t[t.length-1]]:[t[0],t[1]]}},{key:"handlePointerUp",value:function handlePointerUp(e,t,r){"function"==typeof this.host.finishMarkDrag&&this.host.finishMarkDrag();var n=this.drag;if(n){if(this.drag=null,"brush"===n.mode){if(!n.moved)return this.host.brush&&this.host.brush.setRect(null),void this.updateHover(e,t);var a=this.brushRange(),s=this.host.norm.option.interaction&&this.host.norm.option.interaction.brush;return s&&"zoom"===s.mode&&a&&(this.applyRange(a),this.host.brush&&this.host.brush.setRect(null)),this.host.emit("brush:end",a),void this.updateHover(e,t)}if("slider"===n.mode){var l=this.host.dataZoomSlider;return l&&l.setActive(null),void this.updateHover(e,t)}if("graph-node"===n.mode){var h=n.component;return n.moved&&h&&"function"==typeof h.settle&&h.graph&&!1!==h.graph.options.settleOnDrop&&h.settle(),void this.updateHover(e,t)}"pan"===n.mode&&this.updateHover(e,t)}}},{key:"updateDrag",value:function updateDrag(e,t,r){var n=this.drag;if(n){var a=e-n.startX,s=t-n.startY;if(n.moved||!(Math.abs(a)+Math.abs(s)<3)){n.moved=!0;var l=this.host.layout.plot,h=_slicedToArray(this.host.ice.screenToWorld(n.startX,n.startY),2),u=h[0],c=h[1],p=_slicedToArray(this.host.ice.screenToWorld(e,t),2),v=p[0],m=p[1];if("brush"!==n.mode)if("slider"!==n.mode)if("graph-node"!==n.mode){var g=this.host.norm.option.interaction&&this.host.norm.option.interaction.pan,b=g&&g.axes||"xy";if(("x"===b||"xy"===b)&&n.domainX){var k=this.shiftDomain("x",n.domainX,a);k&&this.host.setDomain("x",k,"pan")}if(("y"===b||"xy"===b)&&n.domainY){var S=this.shiftDomain("y",n.domainY,s);S&&this.host.setDomain("y",S,"pan")}}else{n.moved=!0;var A=n.component,w=_slicedToArray(this.host.ice.screenToWorld(e,t),2),_=w[0],M=w[1],C=A.globalToLocal(_,M);A.moveNode(n.nodeIndex,C[0],C[1]);var P=this.seriesOfGraphComponent(A);if(P){var T=this.resolver.buildActiveItem(P,n.nodeIndex);T&&this.setHover({kind:"item",item:T})}}else{var I=this.host.dataZoomSlider;if(!I)return;n.moved=!0;var N=_slicedToArray(this.host.ice.screenToWorld(e,t),2),D=N[0],O=N[1],R=I.globalToLocal(D,O)[0],H=I.fractionAt(R),z=n.originEnd-n.originStart,V=n.originStart,L=n.originEnd;if("start"===n.part)V=clamp$2(H,0,n.originEnd-.02);else if("end"===n.part)L=clamp$2(H,n.originStart+.02,1);else{var E=H-n.anchorFraction;L=(V=clamp$2(n.originStart+E,0,1-z))+z}this.host.setDomainFromFractions(V,L,"slider",!0)}else{var B=clamp$2(u,l.x,l.x+l.width),j=clamp$2(c,l.y,l.y+l.height),W=clamp$2(v,l.x,l.x+l.width),X=clamp$2(m,l.y,l.y+l.height);this.host.brush&&this.host.brush.setRect({x:Math.min(B,W),y:Math.min(j,X),width:Math.abs(W-B),height:Math.abs(X-j)});var G=this.brushRange();G&&this.host.emit("brush:change",G)}}}}},{key:"shiftDomain",value:function shiftDomain(e,t,r){var n=this.host.norm["x"===e?"xAxis":"yAxis"],a=n.scale;if(!a)return null;var s="x"===e?this.host.layout.plot.width:this.host.layout.plot.height;if(a.isBand()){var l=this.host.fullDomain("x"),h=l&&l.length?l:n.domain,u=h.indexOf(t[0]),c=h.indexOf(t[1]);if(u<0||c<0||h.length<=1)return null;var p=a.step()||s/Math.max(1,h.length),v=c-u,m=clamp$2(u+Math.round(-r/p),0,Math.max(0,h.length-1-v));return[h[m],h[m+v]]}var g=Number(t[1])-Number(t[0]),b=("x"===e?-1:1)*r/Math.max(1,s)*g;return[Number(t[0])+b,Number(t[1])+b]}},{key:"handleClick",value:function handleClick(e,t,r){if(this.isOverCanvas(e,t)){var n=this.resolveTarget(e,t),a=this.host.norm.option.interaction;if("legend"!==n.kind){if("series"===n.kind&&n.index>=0){var s=this.resolver.seriesOfComponent(n.component),l=s?this.resolver.buildActiveItem(s,n.index):null;if(l){var h=this.resolver.toParams(l);this.host.emit("item:click",h);var u=a&&a.select;return void(u&&u.enabled&&this.toggleSelection(l.series.id,l.point.index,u.mode||"single",!1!==u.toggle))}}if(this.resolver.isInsidePlot(n.chart[0],n.chart[1])){var c=this.host.layout.plot;this.host.emit("plot:click",{screen:[e,t],xValue:this.host.norm.xAxis.scale?this.host.norm.xAxis.scale.invert(n.chart[0]-c.x):void 0,yValue:this.host.norm.yAxis.scale?this.host.norm.yAxis.scale.invert(n.chart[1]-c.y):void 0})}else this.host.emit("chart:click",{screen:[e,t]})}else{var p=this.host.legend;if(p&&n.index>=0){var v=p.items[n.index];void 0!==v.dataIndex?this.host.toggleSlice(v.seriesId,v.dataIndex):this.host.toggleSeries(v.seriesId)}}}}},{key:"handleDoubleClick",value:function handleDoubleClick(e,t,r){if(this.isOverCanvas(e,t)){var n=this.resolveTarget(e,t);if(!("series"!==n.kind||n.index<0)){var a=this.resolver.seriesOfComponent(n.component),s=a?this.resolver.buildActiveItem(a,n.index):null;s&&this.host.emit("item:dblclick",this.resolver.toParams(s))}}}},{key:"toggleSelection",value:function toggleSelection(e,t,r,n){var a=this.selection.findIndex(function(r){return r.seriesId===e&&r.dataIndex===t});"single"===r?this.selection=a>=0&&n?[]:[{seriesId:e,dataIndex:t}]:a>=0?this.selection.splice(a,1):this.selection.push({seriesId:e,dataIndex:t}),this.refreshSelectionVisuals(),this.host.emit("select:change",this.getSelectedParams())}},{key:"clearSelection",value:function clearSelection(){this.selection.length&&(this.selection=[],this.refreshSelectionVisuals(),this.host.emit("select:change",[]))}},{key:"refreshSelectionVisuals",value:function refreshSelectionVisuals(){var e=this,t=this.host.highlight;if(t){var r,n=[],a=_createForOfIteratorHelper(this.selection);try{var s=function _loop(){var t=r.value,a=e.host.norm.series.find(function(e){return e.id===t.seriesId});if(!a)return 1;var s=e.resolver.buildActiveItem(a,t.dataIndex);s&&n.push(e.markFor(s))};for(a.s();!(r=a.n()).done;)s()}catch(e){a.e(e)}finally{a.f()}t.setSelection(n)}}},{key:"getSelectedParams",value:function getSelectedParams(){var e,t=this,r=[],n=_createForOfIteratorHelper(this.selection);try{var a=function _loop2(){var n=e.value,a=t.host.norm.series.find(function(e){return e.id===n.seriesId});if(!a)return 1;var s=t.resolver.buildActiveItem(a,n.dataIndex);s&&r.push(t.resolver.toParams(s))};for(n.s();!(e=n.n()).done;)a()}catch(e){n.e(e)}finally{n.f()}return r}},{key:"brushRect",get:function get(){return this.host.brush?this.host.brush.rect:null}},{key:"brushRange",value:function brushRange(){var e=this.brushRect,t=this.host.layout.plot;if(!e||e.width<2&&e.height<2)return null;var r=this.host.norm.option.interaction&&this.host.norm.option.interaction.brush,n=r&&r.axes||"x",a={};if("x"===n||"xy"===n){var s=this.valueAtPixel("x",e.x-t.x),l=this.valueAtPixel("x",e.x+e.width-t.x),h=this.orderValues("x",s,l);h&&(a.x=h)}if("y"===n||"xy"===n){var u=this.valueAtPixel("y",e.y-t.y),c=this.valueAtPixel("y",e.y+e.height-t.y),p=this.orderValues("y",u,c);p&&(a.y=p)}return a.x||a.y?a:null}},{key:"valueAtPixel",value:function valueAtPixel(e,t){var r=this.host.norm["x"===e?"xAxis":"yAxis"],n=r.scale;if(n){if(n.isBand()){var a=n.indexAt(t),s=a>=0?a:n.nearestIndex?n.nearestIndex(t):0;return r.domain[clamp$2(s,0,r.domain.length-1)]}return n.invert(t)}}},{key:"orderValues",value:function orderValues(e,t,r){if(void 0===t||void 0===r)return null;var n=this.host.norm["x"===e?"xAxis":"yAxis"].scale;if(n&&n.isBand()){var a=this.host.norm["x"===e?"xAxis":"yAxis"].domain;return a.indexOf(t)<=a.indexOf(r)?[t,r]:[r,t]}return Number(t)<=Number(r)?[t,r]:[r,t]}},{key:"applyRange",value:function applyRange(e){e.x&&this.host.setDomain("x",e.x,"brush"),e.y&&this.host.setDomain("y",e.y,"brush")}},{key:"handleWheel",value:function handleWheel(e,t,r,n){var a=this.host.norm.option.interaction&&this.host.norm.option.interaction.zoom;if(!a||!1===a||!1===a.enabled||!1===a.wheel)return!1;var s=this.resolveTarget(e,t);if(!this.resolver.isInsidePlot(s.chart[0],s.chart[1]))return!1;this.preventDefault(n);var l=Number(a.wheelFactor)||1.2,h=r<0?l:1/l;if("viewport"===a.mode)return this.host.ice.zoomAt(e,t,h),!0;var u=a.axes||"x",c=this.host.layout.plot;if("x"===u||"xy"===u){var p=this.zoomDomain("x",s.chart[0]-c.x,h);p&&this.host.setDomain("x",p,"zoom")}if("y"===u||"xy"===u){var v=this.zoomDomain("y",s.chart[1]-c.y,h);v&&this.host.setDomain("y",v,"zoom")}return!0}},{key:"zoomDomain",value:function zoomDomain(e,t,r){var n=this.host.norm["x"===e?"xAxis":"yAxis"],a=n.scale;if(!a)return null;var s=this.host.norm.option.interaction&&this.host.norm.option.interaction.zoom,l=Number(s&&s.minSpan)||.05,h=Number(s&&s.maxSpan)||1,u=this.host.fullDomain(e),c=this.host.layout.plot,p="x"===e?c.width:c.height;if(a.isBand()){var v=u,m=v.length;if(m<=2)return null;var g=n.domain,b=Math.max(0,v.indexOf(g[0])),k=v.indexOf(g[g.length-1]),S=Math.max(2,k-b+1),A=clamp$2(t/Math.max(1,p),0,1),w=Math.min(m,clampBarCount(Math.round(S/r),c.width,s)),_=b+A*(S-1),M=Math.round(_-A*(w-1));return[v[M=clamp$2(M,0,Math.max(0,m-w))],v[M+w-1]]}var C=Number(n.domain[0]),P=Number(n.domain[1])-C,T=Number(u[1])-Number(u[0]),I=clamp$2(P/r,T*l,T*h),N=a.invert(t),D=N-(0===P?.5:(N-C)/P)*I;return[D,D+I]}},{key:"currentRange",value:function currentRange(){return{x:[this.host.norm.xAxis.domain[0],this.host.norm.xAxis.domain[1]],y:[Number(this.host.norm.yAxis.domain[0]),Number(this.host.norm.yAxis.domain[1])]}}},{key:"handleKeyDown",value:function handleKeyDown(e,t){var r=this.host.norm.option.interaction;if(r&&!1===r.keyboard)return!1;if(!e)return!1;if(Ie&&Ie!==this&&Ie.host)return!1;if(t&&t.target&&/^(INPUT|TEXTAREA|SELECT)$/.test(t.target.tagName||""))return!1;var n=this.host.norm.series.filter(function(e){return!e.hidden});if(!n.length)return!1;var a=0;if(this.hover){var s="item"===this.hover.kind?this.hover.item.series.id:this.hover.column.items[0].series.id,l=n.findIndex(function(e){return e.id===s});l>=0&&(a=l)}var h=!1;switch(e){case"ArrowRight":case"ArrowLeft":var u=n[a];if(!u.pointCount)break;var c=this.stepVisibleIndex(u,"ArrowRight"===e?1:-1);if(c>=0){this.keyboardIndex=c;var p=this.resolver.buildActiveItem(u,c);p&&this.setHover({kind:"item",item:p})}h=c>=0;break;case"ArrowUp":case"ArrowDown":var v=n[clamp$2(a+("ArrowDown"===e?1:-1),0,n.length-1)];if(!v.pointCount)break;var m=clamp$2(this.keyboardIndex,0,v.pointCount-1),g=this.resolver.buildActiveItem(v,m);g&&this.setHover({kind:"item",item:g}),h=!0;break;case"Escape":this.setHover(null),this.clearSelection(),this.host.brush&&this.host.brush.setRect(null),h=!0;break;case"Enter":case" ":if(this.hover&&"item"===this.hover.kind){var b=this.hover.item,k=r&&r.select;this.toggleSelection(b.series.id,b.point.index,k&&k.mode||"single",!0),this.host.emit("item:click",this.resolver.toParams(b)),h=!0}}return h&&this.preventDefault(t),h}},{key:"showHoverAtValue",value:function showHoverAtValue(e){var t=this.resolver.nearestByXValue(e);t&&this.setHover({kind:"item",item:t},!0)}},{key:"clearHover",value:function clearHover(){this.setHover(null)}},{key:"seriesOfGraphComponent",value:function seriesOfGraphComponent(e){var t,r=_createForOfIteratorHelper(this.host.norm.series);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(this.resolver.seriesComponentOf(n)===e)return n}}catch(e){r.e(e)}finally{r.f()}return null}},{key:"stepVisibleIndex",value:function stepVisibleIndex(e,t){var r=e.pointCount;if(!r)return-1;for(var n=clamp$2(this.keyboardIndex,0,r-1),a=0;a<r;a++){var s=n+t;if(s<0||s>=r)return-1;n=s;var l=this.resolver.buildActiveItem(e,n);if(l&&this.resolver.isInsidePlot(l.pixel[0],l.pixel[1]))return n}return-1}},{key:"destroy",value:function destroy(){this.unbind(),Ie===this&&(Ie=null),this.host=null}}])}();var De=function(){return _createClass(function Emitter(){_classCallCheck(this,Emitter),_defineProperty(this,"listeners",new Map)},[{key:"on",value:function on(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=this.listeners.get(e)||[];return this.off(e,t,r),n.push({fn:t,scope:r}),this.listeners.set(e,n),this}},{key:"once",value:function once(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=function wrapper(s){r.off(e,a,n),t.call(n,s)};return a.__onceOriginal=t,this.on(e,a,n)}},{key:"off",value:function off(e,t,r){var n=this.listeners.get(e);if(!n)return this;if(!t)return this.listeners.delete(e),this;for(var a=n.length-1;a>=0;a--){var s=n[a],l=s.fn;!(l===t||l&&l.__onceOriginal===t)||void 0!==r&&s.scope!==r||n.splice(a,1)}return n.length||this.listeners.delete(e),this}},{key:"emit",value:function emit(e,t){var r=this.listeners.get(e);if(!r||!r.length)return!1;for(var n=r.slice(),a=0;a<n.length;a++)n[a].fn.call(n[a].scope,t);return!0}},{key:"hasListener",value:function hasListener(e){var t=this.listeners.get(e);return!!t&&t.length>0}},{key:"clear",value:function clear(){this.listeners.clear()}}])}();function chartTitle(e){var t=e.option.title&&e.option.title.text;return t?String(t):e.labels.chart}function buildDataTable(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.norm,n=chartTitle(r),a=r.series.filter(function(e){return!e.hidden&&"pie"!==e.type});if("polar"===r.kind){var s=r.series.find(function(e){return"pie"===e.type});if(!s)return{caption:n,columns:[r.labels.sector,r.labels.value,r.labels.ratio],rows:[]};for(var l=[],h=0;h<s.pointCount;h++){var u=s.pointAt(h);r.hiddenSlices["".concat(s.id,"#").concat(u.index)]||l.push(u)}var c=l.reduce(function(e,t){return e+(t.y||0)},0);return{caption:n,columns:[r.labels.sector,r.labels.value,r.labels.ratio],rows:l.map(function(e){return[e.name||"".concat(s.name," ").concat(e.index+1),null===e.y?"":String(e.y),c>0?"".concat(((e.y||0)/c*100).toFixed(1),"%"):"0%"]})}}if("radar"===r.kind){var p=r.radar&&r.radar.indicators||[];return{caption:n,columns:["指标"].concat(_toConsumableArray(a.map(function(e){return e.name}))),rows:p.map(function(e,t){return[e.name].concat(_toConsumableArray(a.map(function(e){var r=e.pointAt(t);return r&&null!==r.y?String(r.y):""})))})}}var v,m=[r.xAxis.option&&r.xAxis.option.name||"类目"].concat(_toConsumableArray(a.map(function(e){return e.name}))),g=Math.max(2,void 0===t.maxTableRows?200:Number(t.maxTableRows)||200),b=a.reduce(function(e,t){return e+t.pointCount},0),k=b>g?Math.ceil(b/g):1,S=[],A={},w=_createForOfIteratorHelper(a);try{for(w.s();!(v=w.n()).done;)for(var _=v.value,M=0,C=_.pointCount;M<C;M+=k){var P=_.pointAt(M),T=String(P.xValue);A[T]||(A[T]={x:P.xValue,cells:{}},S.push(T)),A[T].cells[_.id]=null===P.y?"":e.formatAxisValue("y",P.y)}}catch(e){w.e(e)}finally{w.f()}var I=S.map(function(t){var r=A[t];return[e.formatAxisValue("x",r.x)].concat(_toConsumableArray(a.map(function(e){return r.cells[e.id]||""})))});return{caption:k>1?"".concat(n,"(共 ").concat(b," 点,已按每 ").concat(k," 点抽样 ").concat(I.length," 行)"):n,columns:m,rows:I}}function buildDataNodes(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Math.max(0,void 0===r.maxDataNodesPerSeries?200:r.maxDataNodesPerSeries),a=[],s=_createForOfIteratorHelper(e.norm.series);try{for(s.s();!(t=s.n()).done;){var l=t.value;if(!l.hidden){var h=e.controller&&e.controller.resolver?e.controller.resolver.seriesComponentOf(l):null;if(h)for(var u=Math.min(l.pointCount,n),c=0;c<u;c++){var p=l.pointAt(c),v=h.pixelAt(c);if(v){var m=[e.layout.plot.x+v[0],e.layout.plot.y+v[1]],g=e.ice&&"function"==typeof e.ice.worldToScreen?e.ice.worldToScreen(m[0],m[1]):m,b=seriesSymbolSize(l);a.push({id:"".concat(l.id,"#").concat(c),role:"graphic",label:"".concat(l.name,",").concat(e.formatAxisValue("x",p.xValue),",").concat(null===p.y?"无数据":e.formatAxisValue("y",p.y)),seriesId:l.id,seriesName:l.name,dataIndex:c,value:p.y,box:{x:g[0]-b/2,y:g[1]-b/2,width:b,height:b},focusable:!0})}}}}}catch(e){s.e(e)}finally{s.f()}return a}function seriesSymbolSize(e){var t=e.option.symbolSize;return"number"==typeof t&&isFinite(t)?Math.max(8,t):"bar"===e.type?12:10}var Oe=["position:absolute","width:1px","height:1px","margin:-1px","padding:0","overflow:hidden","clip:rect(0 0 0 0)","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),Re=function(){function A11yMirror(e){_classCallCheck(this,A11yMirror),_defineProperty(this,"wrapper",null),_defineProperty(this,"live",null),_defineProperty(this,"tableEl",null),_defineProperty(this,"hoverHandler",null),_defineProperty(this,"options",{}),this.chart=e}return _createClass(A11yMirror,[{key:"listOptions",get:function get(){return this.options}},{key:"attached",get:function get(){return!!this.wrapper}},{key:"element",get:function get(){return this.wrapper}},{key:"attach",value:function attach(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=t||{};var r=this.chart.ice,n=this.chart.canvasElement,a=r&&r.root&&r.root.document;if(!a||!n||"function"!=typeof a.createElement||!n.parentNode)return!1;this.detach();var s=a.createElement("div");s.id="ice-chart-a11y-mirror-".concat(++A11yMirror.seq),s.setAttribute("style",Oe),s.setAttribute("data-ice-chart-a11y","mirror"),this.tableEl=a.createElement("table");var l=a.createElement("div");return l.setAttribute("role","status"),l.setAttribute("aria-live","polite"),s.appendChild(this.tableEl),s.appendChild(l),n.parentNode.appendChild(s),n.setAttribute("aria-describedby",s.id),n.getAttribute("aria-label")||n.setAttribute("aria-label",chartTitle(this.chart.norm)),this.wrapper=s,this.live=l,this.refresh(),this.hoverHandler=function(t){t&&e.announce("".concat(t.seriesName,",").concat(e.chart.formatAxisValue("x",t.xValue),",").concat(null===t.value?"无数据":e.chart.formatAxisValue("y",t.value)))},this.chart.on("item:hover",this.hoverHandler),!0}},{key:"detach",value:function detach(){this.hoverHandler&&(this.chart.off("item:hover",this.hoverHandler),this.hoverHandler=null);var e=this.chart.canvasElement;this.wrapper&&this.wrapper.parentNode&&this.wrapper.parentNode.removeChild(this.wrapper),e&&"function"==typeof e.removeAttribute&&e.removeAttribute("aria-describedby"),this.wrapper=null,this.live=null,this.tableEl=null}},{key:"refresh",value:function refresh(){var e=this.chart.ice&&this.chart.ice.root&&this.chart.ice.root.document;if(this.wrapper&&this.tableEl&&e){for(var t=buildDataTable(this.chart,this.options);this.tableEl.firstChild;)this.tableEl.removeChild(this.tableEl.firstChild);var r=e.createElement("caption");r.textContent=t.caption,this.tableEl.appendChild(r);var n,a=e.createElement("thead"),s=e.createElement("tr"),l=_createForOfIteratorHelper(t.columns);try{for(l.s();!(n=l.n()).done;){var h=n.value,u=e.createElement("th");u.setAttribute("scope","col"),u.textContent=h,s.appendChild(u)}}catch(e){l.e(e)}finally{l.f()}a.appendChild(s),this.tableEl.appendChild(a);var c,p=e.createElement("tbody"),v=_createForOfIteratorHelper(t.rows);try{for(v.s();!(c=v.n()).done;){for(var m=c.value,g=e.createElement("tr"),b=0;b<m.length;b++){var k=e.createElement(0===b?"th":"td");0===b&&k.setAttribute("scope","row"),k.textContent=m[b],g.appendChild(k)}p.appendChild(g)}}catch(e){v.e(e)}finally{v.f()}this.tableEl.appendChild(p)}}},{key:"announce",value:function announce(e){this.live&&(this.live.textContent=e)}}])}();_defineProperty(Re,"seq",0);var He={line:"趋势线",area:"面积趋势",bar:"柱形",scatter:"散点",pie:"扇形",radar:"雷达多边形",heatmap:"热力图单元",sankey:"桑基连线",funnel:"漏斗阶段",gauge:"仪表盘",liquid:"水位球",boxplot:"箱线图",waterfall:"瀑布柱",treemap:"矩形树图单元",graph:"关系图节点",function:"函数曲线",parametric:"参数曲线"};function layoutTreemap(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:h,a=[],s=Math.max(0,Number(r.gap)||2),l=void 0===r.depthFade?.18:Math.max(0,Math.min(1,Number(r.depthFade)));if(!Array.isArray(e)||!e.length)return a;var u=sumValues(e);if(!(u>0))return a;var c=0,p=function visit(e,t,r,n,h){if(!(t.width<=1||t.height<=1)){var v=e.map(function(e){return{node:e,value:nodeValue(e)}}).filter(function(e){return e.value>0});if(v.length){v.sort(function(e,t){return t.value-e.value});for(var m=v.reduce(function(e,t){return e+t.value},0),g=function squarify(e,t,r){var n=[],a=_objectSpread2({},t),s=e.slice(),l=t.width*t.height/r;if(!(l>0))return n;for(;s.length;){var h=Math.min(a.width,a.height);if(!(h>0))break;for(var u=[],c=0;s.length;){var p=s[0],v=c+p.value*l,m=u.length?worstRatio(u,c,h):1/0,g=worstRatio([].concat(u,[p]),v,h);if(u.length&&g>m)break;u.push(s.shift()),c=v}for(var b=a.width>=a.height,k=c/h,S=0,A=0,w=u;A<w.length;A++){var _=w[A],M=_.value*l/k,C=b?{x:a.x,y:a.y+S,width:k,height:M}:{x:a.x+S,y:a.y,width:M,height:k};n.push({item:_,box:C}),S+=M}a=b?{x:a.x+k,y:a.y,width:Math.max(0,a.width-k),height:a.height}:{x:a.x,y:a.y+k,width:a.width,height:Math.max(0,a.height-k)}}return n}(v,t,m),b=0;b<g.length;b++){var k=g[b],S=k.item,A=k.box,w=S.node.color||shade(h,r*l),_=Array.isArray(S.node.children)?S.node.children:[],M=_.length>0,C=c++,P=M&&A.height>32?16:0;if(a.push({id:C,name:S.node.name,depth:r,parent:n,value:S.value,ratio:S.value/u,rect:A,header:P,color:w,hasChildren:M}),M){var T={x:A.x+s,y:A.y+s+P,width:Math.max(0,A.width-2*s),height:Math.max(0,A.height-2*s-P)};p(_,T,r+1,C,w)}}}}};return p(e,t,0,-1,n[0]),a.filter(function(e){return 0===e.depth}).forEach(function(e,t){var r=n[t%n.length];e.color=r,recolor(a,e.id,r,n,l)}),a}function recolor(e,t,r,n,a){var s,l=_createForOfIteratorHelper(e);try{for(l.s();!(s=l.n()).done;){var h=s.value;h.parent===t&&(h.color=shade(r,h.depth*a),recolor(e,h.id,h.color,n,a))}}catch(e){l.e(e)}finally{l.f()}}function sumValues(e){var t,r=0,n=_createForOfIteratorHelper(e);try{for(n.s();!(t=n.n()).done;){r+=nodeValue(t.value)}}catch(e){n.e(e)}finally{n.f()}return r}function nodeValue(e){if(Array.isArray(e.children)&&e.children.length)return sumValues(e.children);var t=Number(e.value);return isFinite(t)&&t>0?t:0}function worstRatio(e,t,r){if(!(t>0&&r>0))return 1/0;var n,a=0,s=1/0,l=_createForOfIteratorHelper(e);try{for(l.s();!(n=l.n()).done;){var h=n.value;h.value>a&&(a=h.value),h.value<s&&(s=h.value)}}catch(e){l.e(e)}finally{l.f()}if(!(s>0))return 1/0;var u=t,c=r;return Math.max(c*c*a/(u*u),u*u/(c*c*s))}function shade(e,t){var r=function parseHex(e){if("string"!=typeof e)return null;var t=e.trim();if(0===t.indexOf("#"))return 3===(t=t.slice(1)).length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6!==t.length?null:[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)];var r=t.match(/rgba?\(([^)]+)\)/);if(r){var n=r[1].split(",").map(function(e){return parseFloat(e)});return[n[0]||0,n[1]||0,n[2]||0]}return null}(e);if(!r)return e;var n=Math.max(0,Math.min(1,t)),a=Math.round(r[0]+(255-r[0])*n),s=Math.round(r[1]+(255-r[1])*n),l=Math.round(r[2]+(255-r[2])*n);return"rgb(".concat(a,",").concat(s,",").concat(l,")")}var ze=10,Ve=20,Le=100,Ee=300,Be=310,je=400,We=450,Xe=500,Ge=600,Ue=620,Ke=640,Ye=700,qe=1;function isChartSnapshot(e){return!!e&&"object"===_typeof(e)&&!Array.isArray(e)&&!!e.option&&("version"in e||"view"in e||"hidden"in e)}function finiteOrNull(e){if(null==e||""===e)return null;var t=Number(e);return isFinite(t)?t:null}function mergeOptionPatch(e,t){var r=_objectSpread2(_objectSpread2({},e),t);return Array.isArray(t&&t.series)&&Array.isArray(e&&e.series)&&(r.series=e.series.map(function(e,r){var n=t.series.find(function(t){return t&&t.id&&e&&e.id&&t.id===e.id}),a=t.series[r],s=n||(a&&!a.id?a:void 0);return s?_objectSpread2(_objectSpread2({},e),s):e})),r}var $e=function(){function ICEChart(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(_classCallCheck(this,ICEChart),_defineProperty(this,"axisYList",[]),_defineProperty(this,"legend",null),_defineProperty(this,"titleComponent",null),_defineProperty(this,"tooltip",null),_defineProperty(this,"crosshair",null),_defineProperty(this,"highlight",null),_defineProperty(this,"brushComponent",null),_defineProperty(this,"dataZoomSlider",null),_defineProperty(this,"seriesComponents",[]),_defineProperty(this,"markLayer",null),_defineProperty(this,"marks",[]),_defineProperty(this,"markSeq",0),_defineProperty(this,"syncingMarks",!1),_defineProperty(this,"fullXDomain",[]),_defineProperty(this,"fullYDomain",[]),_defineProperty(this,"fullYDomains",[]),_defineProperty(this,"emitter",new De),_defineProperty(this,"viewState",{x:null,y:null,yAxes:[]}),_defineProperty(this,"autoYCurve",!1),_defineProperty(this,"hiddenIds",{}),_defineProperty(this,"hiddenSlices",{}),_defineProperty(this,"seriesSignature",""),_defineProperty(this,"axisSignature",""),_defineProperty(this,"resizeObserver",null),_defineProperty(this,"destroyed",!1),_defineProperty(this,"silenceDepth",0),_defineProperty(this,"__appliedEngineThemeKey",null),_defineProperty(this,"__offThemeFollow",null),_defineProperty(this,"a11yMirror",new Re(this)),_defineProperty(this,"virtualColumns",new Map),_defineProperty(this,"__virtualSourceVersion",1),_defineProperty(this,"domainTransition",null),_defineProperty(this,"domainFrameHandler",null),!e)throw new Error("[ice-chart] 初始化失败:缺少 canvas 元素或其 id。");this.chartOptions=n,this.option=t,this.ice=new l,this.ice.init(e,{renderMode:n.renderMode||"dirty-rect",dpr:n.dpr}),this.canvasEl=this.ice.canvasEl||e,this.registerTypes();var a=this.canvasRect();this.root=new s({left:0,top:0,width:a.width,height:a.height,origin:"top-left",fill:!1,stroke:!1,interactive:!1,draggable:!1,transformable:!1,linkable:!1,clipChildren:!0,zIndex:0}),this.ice.addChild(this.root),this.plotArea=new Y({left:0,top:0,width:1,height:1,zIndex:ze}),this.grid=new G({width:a.width,height:a.height,zIndex:Ve}),this.annotation=new K({width:a.width,height:a.height,zIndex:Be}),this.radarGrid=new te({width:a.width,height:a.height,zIndex:Ve+5}),this.polarGrid=new ie({width:a.width,height:a.height,zIndex:Ve+6}),this.axisX=new X({orientation:"x",width:a.width,height:a.height,zIndex:je}),this.axisYList=[new X({orientation:"y",width:a.width,height:a.height,zIndex:je,axisIndex:0,position:"left"})],this.legend=new q({width:a.width,height:a.height,zIndex:Xe}),this.titleComponent=new $({width:a.width,height:a.height,zIndex:We}),this.crosshair=new J({width:a.width,height:a.height,zIndex:Ge}),this.highlight=new Q({width:a.width,height:a.height,zIndex:Ue}),this.brushComponent=new ee({width:a.width,height:a.height,zIndex:Ke}),this.dataZoomSlider=new re({left:0,top:0,width:a.width,height:26,zIndex:Ke+5}),this.tooltip=new Z({width:a.width,height:a.height,zIndex:Ye}),this.root.addChildren([this.plotArea,this.grid,this.annotation,this.radarGrid,this.polarGrid,this.axisX].concat(_toConsumableArray(this.axisYList),[this.titleComponent,this.legend,this.crosshair,this.highlight,this.brushComponent,this.dataZoomSlider,this.tooltip])),this.controller=new Ne(this),this.applyOption(t,{animate:"enter",preserveView:!1}),this.controller.bind(),this.__offThemeFollow=this.ice.onThemeChange(function(e){"theme"!==e.kind||r.destroyed||r.option&&"auto"===r.option.theme&&r.rebuild(!1)}),n.autoResize&&this.observeResize()}return _createClass(ICEChart,[{key:"brush",get:function get(){return this.brushComponent}},{key:"setOption",value:function setOption(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.applyOption(e,{animate:void 0===t.animate||t.animate,preserveView:!1!==t.preserveView}),this}},{key:"getOption",value:function getOption(){return this.option}},{key:"expressionDiagnostics",value:function expressionDiagnostics(){var e,t=[],r=_createForOfIteratorHelper(this.norm.series);try{for(r.s();!(e=r.n()).done;){var n=e.value;n.expressionDiagnostics&&n.expressionDiagnostics.length&&t.push({seriesId:n.id,diagnostics:n.expressionDiagnostics})}}catch(e){r.e(e)}finally{r.f()}return t}},{key:"expressionErrors",value:function expressionErrors(){var e,t=[],r=_createForOfIteratorHelper(this.norm.series);try{for(r.s();!(e=r.n()).done;){var n=e.value;if(n.expressionDiagnostics){var a,s=_createForOfIteratorHelper(n.expressionDiagnostics);try{for(s.s();!(a=s.n()).done;){var l=a.value;"error"===l.severity&&t.push({seriesId:n.id,message:l.message})}}catch(e){s.e(e)}finally{s.f()}}}}catch(e){r.e(e)}finally{r.f()}return t}},{key:"annotationDiagnostics",value:function annotationDiagnostics(){return this.annotation?this.annotation.diagnostics.slice():[]}},{key:"annotationErrors",value:function annotationErrors(){return this.annotationDiagnostics().filter(function(e){return"error"===e.severity})}},{key:"setData",value:function setData(e,t){var r=(this.option.series||[]).map(function(e,t){return{item:e,index:t}}).find(function(t){return"number"==typeof e?t.index===e:t.item.id===e||t.item.name===e});if(!r)throw new Error("[ice-chart] 找不到系列:".concat(e));return r.item.data=t,this.applyOption(this.option,{animate:!0,preserveView:!0}),this.emit("data:change",{seriesId:r.item.id,seriesIndex:r.index}),this}},{key:"appendData",value:function appendData(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null==e)throw new Error("[ice-chart] appendData 需要系列 id / name / 下标。");var n=(this.option.series||[]).map(function(e,t){return{item:e,index:t}}).find(function(t){return"number"==typeof e?t.index===e:t.item.id===e||t.item.name===e});if(!n)throw new Error("[ice-chart] 找不到系列:".concat(e));var a=Array.isArray(t)?t:[];if(!a.length)return this;if(n.item.virtual)return this.appendToVirtualSeries(n.item,n.index,a,r);var s=n.item.data;if(void 0!==s&&!Array.isArray(s))throw new Error("[ice-chart] 列式输入({ x, y })不支持 appendData(系列 ".concat(n.item.name||n.item.id||n.index,"):请用 setData 重新给一份数据。"));var l=(s||[]).concat(a),h=Number(r.maxPoints);return n.item.data=isFinite(h)&&h>0&&l.length>h?l.slice(l.length-h):l,this.applyOption(this.option,{animate:!0===r.animate,preserveView:!0}),this.emit("data:change",{seriesId:n.item.id,seriesIndex:n.index}),this}},{key:"appendToVirtualSeries",value:function appendToVirtualSeries(e,t,r,n){var a=this.norm.series.find(function(r){return r.id===(e.id||"series-".concat(t))||r.index===t});if(!a)throw new Error("[ice-chart] appendData:找不到已归一化的系列「".concat(e.id||t,"」。"));if(a.grid)throw new Error("[ice-chart] 虚拟(列存)热力图是稠密矩阵,不支持 appendData(系列 ".concat(e.name||e.id||t,"):请用 setData 重新给一份数据。"));var s,l=Number(n.maxPoints),h=isFinite(l)&&l>0?Math.floor(l):0,u=this.virtualColumns.get(a.id);if(u&&"raw"in u){var c=appendRawItems(u.raw,r,h);if(this.virtualColumns.set(a.id,{raw:c}),c.capacity>0&&void 0!==a.option.data){var p=_objectSpread2(_objectSpread2({},a.option),{},{data:void 0}),v=this.option.series;if(Array.isArray(v)){var m=v.findIndex(function(e,t){return(e&&e.id)===a.id||t===a.index});m>=0&&(v[m]=p)}a.option=p}return this.applyOption(this.option,{animate:!0===n.animate,preserveView:!0}),this.emit("data:change",{seriesId:a.id,seriesIndex:a.index}),this}if(u&&"ring"in u)s=u.ring;else{var g=a.pointCount,b=Math.max(1,h||g);s=createRing(b);for(var k=g-Math.min(g,b);k<g;k++)ringAppend(s,[{x:Number(a.xValueAt(k)),y:a.yValueAt(k)}],0)}if(h&&h!==s.capacity){for(var S=createRing(h),A=Math.min(s.length,h),w=s.length-A;w<s.length;w++){var _=ringYAt(s,w);ringAppend(S,[{x:ringXAt(s,w),y:Number.isNaN(_)?null:_}],0)}s=S}return ringAppend(s,r.map(function(t){if(Array.isArray(t))return{x:finiteOrNull(t[0]),y:finiteOrNull(t[1])};if(t&&"object"===_typeof(t)){var r=e.xField||"x",n=e.yField||"y";return{x:finiteOrNull(void 0!==t[r]?t[r]:t.x),y:finiteOrNull(void 0!==t[n]?t[n]:t.value)}}return{x:void 0,y:finiteOrNull(t)}}),s.length?function ringLastX(e){if(!e.length)return 0;var t=ringXAt(e,e.length-1);return isFinite(t)?t:0}(s)+1:0),function refreshRingDomains(e){for(var t=1/0,r=-1/0,n=1/0,a=-1/0,s=!0,l=-1/0,h=0;h<e.length;h++){var u=ringXAt(e,h);if(isFinite(u)){u<t&&(t=u),u>r&&(r=u),u<l&&(s=!1),l=u;var c=ringYAt(e,h);Number.isNaN(c)||(c<n&&(n=c),c>a&&(a=c))}}e.xDomain=isFinite(t)?[t,r]:[0,1],e.yDomain=isFinite(n)?[n,a]:null,e.xMonotonic=s}(s),this.virtualColumns.set(a.id,{ring:s}),this.applyOption(this.option,{animate:!0===n.animate,preserveView:!0}),this.emit("data:change",{seriesId:a.id,seriesIndex:a.index}),this}},{key:"createVirtualSource",value:function createVirtualSource(e){var t=this,r="number"==typeof e?this.norm.series[e]:this.norm.series.find(function(t){return t.id===e||t.name===e});if(!r)throw new Error("[ice-chart] createVirtualSource:找不到系列「".concat(e,"」。"));if(!r.virtual)throw new Error("[ice-chart] createVirtualSource 只支持虚拟(列存)系列:普通系列本来就是真组件。");var a=this.seriesComponents.find(function(e){return e&&e.series&&e.series.id===r.id});if(!a)throw new Error("[ice-chart] createVirtualSource:系列「".concat(r.id,"」还没有渲染组件。"));var s=new Float64Array(4),l=function readHalo(){return t.norm&&t.norm.theme?t.norm.theme.labelHaloColor:r.color},h=function symbolSize(){var e=r.option,t=Number(e.symbolSize);return isFinite(t)&&t>0?t:8};return{count:r.pointCount,get version(){return function readVersion(){return t.__virtualSourceVersion}()},boxAt:function boxAt(e,t){var r=a.pixelAt(e);if(!r)return t[0]=NaN,t[1]=NaN,t[2]=NaN,void(t[3]=NaN);var n=h()/2;t[0]=r[0]-n,t[1]=r[1]-n,t[2]=r[0]+n,t[3]=r[1]+n},forEachInBox:function forEachInBox(e,t,r,n,s){for(var l=a.virtualIndexRange(e,r),h=l.from,u=l.to,c=Math.max(0,h);c<=u;c++){var p=a.pixelAt(c);p&&(p[1]<t||p[1]>n||s(c))}},hitTest:function hitTest(e,t){return a.hitTestIndex(e,t)},paint:function paint(e){return a.paintInto(e)},materialize:function materialize(e){var t=a.pixelAt(e);if(!t)return null;var u=h();s[0]=t[0],s[1]=t[1];var c=new n({left:t[0]-u/2,top:t[1]-u/2,outerRadius:u/2,innerRadius:u/5,spikes:5,style:{fillStyle:r.color,strokeStyle:l(),lineWidth:1}});return c.__iceChartDataIndex=e,c.__iceChartSeriesId=r.id,c}}}},{key:"setDomain",value:function setDomain(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"api";if(this.destroyed)return this;var n="x"!==e||"zoom"!==r&&"brush"!==r?t:this.guardInteractiveXWindow(t),a=this.clampDomain(e,n,r);if(!a)return this;"x"===e?this.viewState.x=a:this.viewState.y=a,this.rebuild(!1);var s=this.currentRange();return this.emit("pan"===r?"pan:change":"zoom:change",s),this}},{key:"numericXProbe",value:function numericXProbe(){var e,t=[],r=[],n=_createForOfIteratorHelper(this.norm.series);try{for(n.s();!(e=n.n()).done;){var a=e.value;if(!a.hidden){var s=storeDomainOf(a);if(s&&s.xMonotonic)r.push(a);else for(var l=0,h=a.pointCount;l<h;l++){var u=Number(a.xValueAt(l));isFinite(u)&&t.push(u)}}}}catch(e){n.e(e)}finally{n.f()}t.sort(function(e,t){return e-t});for(var c=[],p=0;p<t.length;p++)p>0&&t[p]===t[p-1]||c.push(t[p]);var v=function lowerBound(e,t,r){for(var n=0,a=t;n<a;){var s=n+a>>1;Number(e[s])<r?n=s+1:a=s}return n},m=function upperBound(e,t,r){for(var n=0,a=t;n<a;){var s=n+a>>1;Number(e[s])<=r?n=s+1:a=s}return n},g=function seriesLowerBound(e,t){for(var r=0,n=e.pointCount;r<n;){var a=r+n>>1;Number(e.xValueAt(a))<t?r=a+1:n=a}return r},b=function seriesUpperBound(e,t){for(var r=0,n=e.pointCount;r<n;){var a=r+n>>1;Number(e.xValueAt(a))<=t?r=a+1:n=a}return r};return{total:c.length+r.reduce(function(e,t){return e+t.pointCount},0),countIn:function countIn(e,t){for(var n=m(c,c.length,t)-v(c,c.length,e),a=0,s=r;a<s.length;a++){var l=s[a];n+=b(l,t)-g(l,e)}return n},leftOf:function leftOf(e){var t,n=v(c,c.length,e)-1;n>=0&&(t=c[n]);for(var a=0,s=r;a<s.length;a++){var l=s[a],h=g(l,e)-1;if(!(h<0)){var u=Number(l.xValueAt(h));(void 0===t||u>t)&&(t=u)}}return t},rightOf:function rightOf(e){var t,n=m(c,c.length,e);n<c.length&&(t=c[n]);for(var a=0,s=r;a<s.length;a++){var l=s[a],h=b(l,e);if(!(h>=l.pointCount)){var u=Number(l.xValueAt(h));(void 0===t||u<t)&&(t=u)}}return t}}}},{key:"guardInteractiveXWindow",value:function guardInteractiveXWindow(e){if("category"===this.norm.xAxis.type){var t=this.fullXDomain;if(t.length<2)return e;var r=t.indexOf(e[0]),n=t.indexOf(e[1]);return r<0&&n<0?e:(r<0&&(r=0),n<0&&(n=t.length-1),n-r>=1?e:(r>0?r-=1:n<t.length-1&&(n+=1),[t[r],t[n]]))}var a=this.numericXProbe();if(a.total<2)return e;var s=a.total>=3?2:1,l=Number(e[0]),h=Number(e[1]);if(!isFinite(l)||!isFinite(h)||h<=l)return e;for(var u=a.countIn(l,h),c=0;u<s&&c<4;){c+=1;var p=a.leftOf(l),v=a.rightOf(h);if(void 0===p&&void 0===v)break;(void 0===p?1/0:l-p)<=(void 0===v?1/0:v-h)?l=p:h=v,u=a.countIn(l,h)}return u>=s?[l,h]:e}},{key:"addMark",value:function addMark(e){var t=this,r=e.id||"mark-".concat(++this.markSeq);if(this.marks.some(function(e){return e.id===r}))throw new Error("[ice-chart] addMark:id「".concat(r,"」已经存在"));if(!e||!e.component)throw new Error("[ice-chart] addMark:必须提供 component(一个引擎图元实例)");var n=e.type||"point";if("point"!==n&&"xLine"!==n&&"yLine"!==n&&"xBand"!==n&&"yBand"!==n)throw new Error("[ice-chart] addMark:不支持的 type「".concat(String(n),"」"));var s={id:r,spec:_objectSpread2(_objectSpread2({},e),{},{id:r}),component:e.component,dragging:!1};return this.marks.push(s),this.ensureMarkLayer().addChild(e.component),"function"==typeof e.component.on&&e.component.on(a.AFTER_MOVE,function(e){if(!t.syncingMarks){var r=e&&isFinite(e.left)&&isFinite(e.top)?{left:Number(e.left),top:Number(e.top)}:void 0,a=t.markDataAt(s,r);"point"===n?(s.spec.x=a.xValue,s.spec.y=a.yValue):"xLine"===n||"xBand"===n?"xLine"===n?s.spec.x=a.xValue:s.spec.x0=a.xValue:"yLine"===n?s.spec.y=a.yValue:s.spec.y0=a.yValue,s.dragging=!0,t.syncMarks(),t.emit("mark:drag",a),"function"==typeof s.spec.onDrag&&s.spec.onDrag(a)}}),this.syncMarks(),this.markHandle(s)}},{key:"getMark",value:function getMark(e){var t=this.marks.find(function(t){return t.id===e});return t?this.markHandle(t):null}},{key:"getMarks",value:function getMarks(){var e=this;return this.marks.map(function(t){return e.markHandle(t)})}},{key:"removeMark",value:function removeMark(e){var t=this.marks.findIndex(function(t){return t.id===e});if(t<0)return!1;var r=_slicedToArray(this.marks.splice(t,1),1)[0];return this.markLayer&&r.component&&this.markLayer.removeChild(r.component),!0}},{key:"clearMarks",value:function clearMarks(){var e,t=_createForOfIteratorHelper(this.marks);try{for(t.s();!(e=t.n()).done;){var r=e.value;this.markLayer&&r.component&&this.markLayer.removeChild(r.component)}}catch(e){t.e(e)}finally{t.f()}this.marks=[]}},{key:"isMarkComponent",value:function isMarkComponent(e){return!!e&&this.marks.some(function(t){return t.component===e})}},{key:"finishMarkDrag",value:function finishMarkDrag(){var e,t=_createForOfIteratorHelper(this.marks);try{for(t.s();!(e=t.n()).done;){var r=e.value;r.dragging&&(r.dragging=!1,this.emit("mark:dragend",this.markDataAt(r)))}}catch(e){t.e(e)}finally{t.f()}}},{key:"ensureMarkLayer",value:function ensureMarkLayer(){if(this.markLayer)return this.markLayer;var e=this.layout?this.layout.canvas:this.canvasRect(),t=new s({left:0,top:0,width:e.width,height:e.height,origin:"top-left",fill:!1,stroke:!1,interactive:!1,draggable:!1,transformable:!1,linkable:!1,zIndex:Ee});return this.root.addChild(t),this.markLayer=t,t}},{key:"markHandle",value:function markHandle(e){var t=this,r={id:e.id,spec:e.spec,component:e.component,update:function update(n){return Object.assign(e.spec,n),t.syncMarks(),r},toData:function toData(){return t.markDataAt(e)},remove:function remove(){t.removeMark(e.id)}};return r}},{key:"markAxis",value:function markAxis(e){if(e.seriesId){var t=this.norm.series.find(function(t){return t.id===e.seriesId||t.name===e.seriesId});if(t)return this.norm.yAxes[t.axisIndex]||this.norm.yAxis}return this.norm.yAxes[0]||this.norm.yAxis}},{key:"markBox",value:function markBox(e,t){var r=e.type||"point",n=this.layout.plot,a=this.norm.xAxis.scale,s=this.markAxis(e),l=s&&s.scale,h=Number(e.dx)||0,u=Number(e.dy)||0,c=function px(e){return n.x+Number(a.map(e))+h},p=function py(e){return n.y+Number(l.map(e))+u},v=t.width||1,m=t.height||1;if("xLine"===r)return{left:c(e.x)-v/2,top:n.y+u,width:v,height:n.height};if("yLine"===r)return{left:n.x+h,top:p(e.y)-m/2,width:n.width,height:m};if("xBand"===r){var g=c(e.x0),b=c(e.x1);return{left:Math.min(g,b),top:n.y+u,width:Math.abs(b-g),height:n.height}}if("yBand"===r){var k=p(e.y0),S=p(e.y1);return{left:n.x+h,top:Math.min(k,S),width:n.width,height:Math.abs(S-k)}}var A=c(e.x),w=p(e.y);return{left:A-v/2,top:w-m/2,width:v,height:m,anchor:[A,w]}}},{key:"markDataAt",value:function markDataAt(e,t){var r,n,a=e.spec,s=a.type||"point",l=this.layout.plot,h=this.norm.xAxis.scale,u=this.markAxis(a),c=u&&u.scale,p=e.component.state||{},v=p.width||0,m=p.height||0,g=t?t.left:p.left,b=t?t.top:p.top;"point"===s?(r=g+v/2,n=b+m/2):"xLine"===s||"xBand"===s?(r=g+v/2,n=l.y+l.height/2):(r=l.x+l.width/2,n=b+m/2);var k=h&&"function"==typeof h.invert?h.invert(r-l.x):null,S=c&&"function"==typeof c.invert?Number(c.invert(n-l.y)):NaN;return{id:e.id,xValue:k,yValue:"xLine"!==s&&"xBand"!==s&&isFinite(S)?S:void 0,pixel:[r,n]}}},{key:"syncMarks",value:function syncMarks(){if(this.marks.length&&this.norm&&this.layout){var e=this.layout.plot;this.syncingMarks=!0;try{var t,r=_createForOfIteratorHelper(this.marks);try{for(r.s();!(t=r.n()).done;){var n=t.value,a=n.component.state||{},s=this.markBox(n.spec,{width:a.width||0,height:a.height||0});if([s.left,s.top,s.width,s.height].every(function(e){return isFinite(e)})){var l=!1!==n.spec.hideWhenOutOfView,h=s.anchor||[s.left+s.width/2,s.top+s.height/2],u=!(isFinite(h[0])&&isFinite(h[1]))||h[0]<e.x-s.width||h[0]>e.x+e.width+s.width||h[1]<e.y-s.height||h[1]>e.y+e.height+s.height,c=Math.round(s.left),p=Math.round(s.top),v=Math.max(1,Math.round(s.width)),m=Math.max(1,Math.round(s.height));a.left===c&&a.top===p||(n.component.setPosition(c,p),!0),a.width===v&&a.height===m||(n.component.setState({width:v,height:m}),!0),n.component.setState({display:!l||!u})}else n.component.setState({display:!1})}}catch(e){r.e(e)}finally{r.f()}}finally{this.syncingMarks=!1}this.markLayer&&this.markLayer.setState({width:this.layout.canvas.width,height:this.layout.canvas.height})}}},{key:"resetZoom",value:function resetZoom(){return this.viewState={x:null,y:null,yAxes:[]},this.rebuild(!0),this.emit("zoom:change",this.currentRange()),this}},{key:"toggleSeries",value:function toggleSeries(e,t){var r=this.norm.series.find(function(t){return t.id===e});if(!r)return this;var n=!!this.hiddenIds[e],a=void 0===t?!n:!t;return this.hiddenIds[e]=a,this.applyOption(this.option,{animate:!0,preserveView:!0}),this.emit("legend:toggle",{seriesId:e,seriesName:r.name,seriesIndex:r.index,selected:!a}),this}},{key:"isSeriesSelected",value:function isSeriesSelected(e){return!this.hiddenIds[e]}},{key:"toggleSlice",value:function toggleSlice(e,t,r){var n=this.norm.series.find(function(t){return t.id===e});if(!n||"pie"!==n.type&&"funnel"!==n.type)return this;var a="".concat(e,"#").concat(t),s=!!this.hiddenSlices[a],l=void 0===r?!s:!r;this.hiddenSlices[a]=l;var h=n.pointAt(t);return this.applyOption(this.option,{animate:!0,preserveView:!0}),this.emit("legend:toggle",{seriesId:e,seriesName:h&&h.name||"".concat(n.name," ").concat(t+1),seriesIndex:n.index,selected:!l,dataIndex:t}),this}},{key:"showHoverAt",value:function showHoverAt(e,t){var r=this.norm.series.find(function(t){return t.id===e});if(!r)return this;var n=this.controller.resolver.buildActiveItem(r,t);return n&&this.controller.setHover({kind:"item",item:n}),this}},{key:"showHoverAtValue",value:function showHoverAtValue(e){return this.controller.showHoverAtValue(e),this}},{key:"clearHover",value:function clearHover(){return this.controller.clearHover(),this}},{key:"getSelection",value:function getSelection(){return this.controller.getSelectedParams()}},{key:"clearSelection",value:function clearSelection(){return this.controller.clearSelection(),this}},{key:"getDomain",value:function getDomain(e){return"x"===e?this.norm.xAxis.domain.slice():this.norm.yAxis.domain.slice()}},{key:"getAxisDomain",value:function getAxisDomain(e){var t=this.norm.yAxes[e];return t?t.domain.slice():this.norm.yAxis.domain.slice()}},{key:"setAxisDomain",value:function setAxisDomain(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"api";if(0===e)return this.setDomain("y",t,r);if(this.destroyed)return this;var n=this.clampAxisDomain(e,t,r);return n?(this.viewState.yAxes[e]=n,this.rebuild(!1),this.emit("pan"===r?"pan:change":"zoom:change",this.currentRange()),this):this}},{key:"fullDomain",value:function fullDomain(e){return("x"===e?this.fullXDomain:this.fullYDomain).slice()}},{key:"canvasElement",get:function get(){return this.canvasEl}},{key:"getDataTable",value:function getDataTable(){return buildDataTable(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}},{key:"getA11yTree",value:function getA11yTree(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t="function"==typeof this.ice.getAccessibilityTree?this.ice.getAccessibilityTree():[];return[].concat(_toConsumableArray(t),_toConsumableArray(buildDataNodes(this,e)))}},{key:"attachA11yMirror",value:function attachA11yMirror(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.a11yMirror.attach(e)}},{key:"detachA11yMirror",value:function detachA11yMirror(){this.a11yMirror.detach()}},{key:"a11yMirrorAttached",get:function get(){return this.a11yMirror.attached}},{key:"announceA11y",value:function announceA11y(e){this.a11yMirror.announce(e)}},{key:"on",value:function on(e,t,r){return this.emitter.on(e,t,r),this}},{key:"once",value:function once(e,t,r){return this.emitter.once(e,t,r),this}},{key:"off",value:function off(e,t,r){return this.emitter.off(e,t,r),this}},{key:"emit",value:function emit(e,t){return!(this.silenceDepth>0)&&this.emitter.emit(e,t)}},{key:"silent",value:function silent(e){this.silenceDepth++;try{return e()}finally{this.silenceDepth--}}},{key:"resize",value:function resize(e,t){return this.destroyed?this:(this.ice.fitCanvasToDisplaySize(e,t),this.ice.canvasWidth>0&&this.ice.canvasHeight>0?(this.rebuild(!1),this):this)}},{key:"destroy",value:function destroy(){this.destroyed||(this.destroyed=!0,this.__offThemeFollow&&(this.__offThemeFollow(),this.__offThemeFollow=null),this.stopDomainTransition(),this.a11yMirror.detach(),this.controller.destroy(),this.resizeObserver&&"function"==typeof this.resizeObserver.disconnect&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.emitter.clear(),this.ice.destroy())}},{key:"nextFrame",value:function nextFrame(){var e=this;return new Promise(function(t){var r=e.ice.evtBus;if(r){var n=function handler(){r.off(a.ROUND_FINISH,n,null),t()};r.on(a.ROUND_FINISH,n,null),e.ice.dirty=!0}else t()})}},{key:"render",value:function render(){return this.ice.dirty=!0,this.nextFrame()}},{key:"formatAxisValue",value:function formatAxisValue(e,t){var r="x"===e?this.norm.xAxis:this.norm.yAxis,n=r.scale;if(!n)return String(t);var a=r.domain.indexOf(t);return formatTick(t,n,a<0?0:a,r.option.formatter)}},{key:"toDataURL",value:function toDataURL(e,t){return this.ice&&"function"==typeof this.ice.toDataURL?this.ice.toDataURL(e,t):""}},{key:"toBlob",value:function toBlob(e,t,r){this.ice&&"function"==typeof this.ice.toBlob?this.ice.toBlob(e,t,r):e(null)}},{key:"toJSON",value:function toJSON(){return{version:1,option:toSerializableOption(this.option),view:{x:this.viewState.x,y:this.viewState.y,yAxes:this.viewState.yAxes},hidden:_objectSpread2({},this.hiddenIds),hiddenSlices:_objectSpread2({},this.hiddenSlices)}}},{key:"toJSONString",value:function toJSONString(){return JSON.stringify(this.toJSON())}},{key:"fromJSONString",value:function fromJSONString(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=JSON.parse(e);return this.loadSnapshot(r,t),this}},{key:"fromJSONObject",value:function fromJSONObject(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.loadSnapshot(e,t),this}},{key:"loadSnapshot",value:function loadSnapshot(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e){var r="string"==typeof e?JSON.parse(e):e,n=r.option||r;if("number"==typeof r.version&&r.version>1)throw new Error("[ice-chart] 快照版本 ".concat(r.version," 高于当前实现支持的 ").concat(1,",请升级 ice-chart 后再还原。"));var a=(Array.isArray(n&&n.series)?n.series:[]).findIndex(function(e){return e&&e.virtual&&!e.data});if(a>=0)throw new Error("[ice-chart] 快照里的 series[".concat(a,"] 是虚拟(列存)系列,数据不在快照里,无法还原:请用 setData 重新给一份数据(虚拟化省内存的代价就是不进快照)。"));var s=t.optionPatch?mergeOptionPatch(n,t.optionPatch):n;this.hiddenIds=r.hidden||{},this.hiddenSlices=r.hiddenSlices||{};var l=r.view||{};this.viewState={x:l.x||null,y:l.y||null,yAxes:l.yAxes||[]},this.applyOption(s,{animate:!1,preserveView:!0})}}},{key:"applyOption",value:function applyOption(e,t){this.option=e;var r=this.norm?this.norm.yAxis.domain.slice():null,n=normalizeOption(e,{hiddenIds:this.hiddenIds,hiddenSlices:this.hiddenSlices,preferDark:isEngineThemeDark(this.ice),virtualColumns:this.virtualColumns});if("auto"!==e.theme){var a=JSON.stringify(n.theme);a!==this.__appliedEngineThemeKey&&(applyChartThemeToEngine(this.ice,n.theme),this.__appliedEngineThemeKey=a)}if(this.fullXDomain=n.xAxis.domain.slice(),this.fullYDomain=n.yAxis.domain.slice(),this.fullYDomains=n.yAxes.map(function(e){return e.domain.slice()}),this.autoYCurve=(e.series||[]).some(function(e){return!!e&&"function"===e.type}),!t.preserveView){this.viewState={x:null,y:null,yAxes:[]};var s=this.initialWindow(n);s&&(this.viewState.x=s)}if(this.hiddenIds=n.hiddenIds,this.hiddenSlices=n.hiddenSlices,this.rebuild("enter"===t.animate?"enter":!1!==t.animate&&"update"),"update"===("enter"===t.animate?"enter":!1!==t.animate&&"update")&&shouldAnimate()&&r&&this.norm&&"cartesian"===this.norm.kind&&2===this.norm.yAxis.domain.length){var l=this.norm.yAxis.domain;(Math.abs(Number(r[0])-Number(l[0]))>1e-9||Math.abs(Number(r[1])-Number(l[1]))>1e-9)&&this.startDomainTransition([Number(r[0]),Number(r[1])],[Number(l[0]),Number(l[1])])}}},{key:"initialWindow",value:function initialWindow(e){var t=e.option.dataZoom;if(!t||void 0===t.start&&void 0===t.end)return null;var r=clamp$2(Number(void 0===t.start?0:t.start)/100,0,1),n=clamp$2(Number(void 0===t.end?100:t.end)/100,0,1);if(r<=0&&n>=1)return null;var a=e.xAxis.domain;if("category"===e.xAxis.type){var s=a.length,l=clamp$2(Math.floor(r*s),0,Math.max(0,s-2)),h=clamp$2(Math.ceil(n*s)-1,l+1,s-1);return[a[l],a[h]]}var u=Number(a[0]),c=Number(a[1])-u;return[u+c*r,u+c*n]}},{key:"startDomainTransition",value:function startDomainTransition(e,t){var r=this;if(this.domainTransition={from:e,to:t},!this.domainFrameHandler){var n=this.ice.evtBus;n&&(this.domainFrameHandler=function(){return r.stepDomainTransition()},n.on(a.ICE_FRAME_EVENT,this.domainFrameHandler,this))}}},{key:"stepDomainTransition",value:function stepDomainTransition(){var e=this.domainTransition;if(e&&!this.destroyed){var t,r=0,n=_createForOfIteratorHelper(this.seriesComponents);try{for(n.s();!(t=n.n()).done;){var a=t.value,s=Number(a.state.progress);isFinite(s)&&s>r&&(r=s)}}catch(e){n.e(e)}finally{n.f()}if(r>=1)return this.domainTransition=null,this.stopDomainTransition(),void this.rebuild(!1);var l=e.to.map(function(t,n){var a=e.from[n];return isFinite(a)?a+(t-a)*r:t});this.rebuild(!1,l)}else this.stopDomainTransition()}},{key:"stopDomainTransition",value:function stopDomainTransition(){if(this.domainFrameHandler){var e=this.ice&&this.ice.evtBus;e&&e.off(a.ICE_FRAME_EVENT,this.domainFrameHandler,this),this.domainFrameHandler=null}}},{key:"rebuild",value:function rebuild(e,t){var r=this;if(!this.destroyed){var n=this.canvasRect(),a=this.fullYDomains.map(function(e,t){var n=0===t?r.viewState.y:r.viewState.yAxes[t];return n&&2===n.length?n:e}),s=normalizeOption(this.option,{hiddenIds:this.hiddenIds,hiddenSlices:this.hiddenSlices,preferDark:isEngineThemeDark(this.ice),virtualColumns:this.virtualColumns,xDomain:this.viewState.x&&2===this.viewState.x.length?[this.viewState.x[0],this.viewState.x[1]]:null,yDomain:!this.autoYCurve||this.viewState.y||t&&2===t.length?t&&2===t.length?[Number(t[0]),Number(t[1])]:a[0]&&2===a[0].length?[Number(a[0][0]),Number(a[0][1])]:null:null,yDomains:a.map(function(e){return(!r.autoYCurve||r.viewState.y||t&&2===t.length)&&e&&2===e.length?[Number(e[0]),Number(e[1])]:null})});if(this.norm=s,this.__virtualSourceVersion+=1,this.virtualColumns.size){var l,h=new Set,u=_createForOfIteratorHelper(s.series);try{for(u.s();!(l=u.n()).done;){var c=l.value;c.virtual&&h.add(c.id)}}catch(e){u.e(e)}finally{u.f()}for(var p=0,v=Array.from(this.virtualColumns.keys());p<v.length;p++){var m=v[p];h.has(m)||this.virtualColumns.delete(m)}}this.autoYCurve&&(this.fullYDomain=s.yAxis.domain.slice(),this.fullYDomains=s.yAxes.map(function(e){return e.domain.slice()})),this.layout=computeLayout(s,this.ice.ctx,n),this.buildScales(s),this.root.state.ariaLabel=chartTitle(s),this.syncComponents(!t&&e),this.syncMarks(),this.ice.dirty=!0,this.controller&&this.controller.refreshHover(),this.a11yMirror.attached&&this.a11yMirror.refresh()}}},{key:"buildScales",value:function buildScales(e){var t=this.layout.plot;e.xAxis.scale=createScale(e.xAxis.type,e.xAxis.domain,[0,Math.max(1,t.width)],{logBase:e.xAxis.option.logBase,categoryLookup:e.xAxis.categoryLookup});var r,n=_createForOfIteratorHelper(e.yAxes);try{for(n.s();!(r=n.n()).done;){var a=r.value;a.scale=createScale(a.type,a.domain,[Math.max(1,t.height),0],{logBase:a.option.logBase})}}catch(e){n.e(e)}finally{n.f()}}},{key:"syncComponents",value:function syncComponents(e){var t=this.norm,r=this.layout,n=r.canvas,a=r.plot,s=t.theme;this.root.state.width===n.width&&this.root.state.height===n.height||this.root.setState({width:n.width,height:n.height});var l=r.polar,h="cartesian"!==t.kind;this.plotArea.setState({left:a.x,top:a.y,width:a.width,height:a.height}),this.plotArea.setBackground("transparent"===s.backgroundColor?null:s.backgroundColor),this.grid.setState({width:n.width,height:n.height}),this.grid.setState({display:!h}),this.grid.xScale=t.xAxis.scale,this.grid.yScale=t.yAxis.scale;var u=r.xAxisLayout;this.grid.xTicks=u.ticks.filter(function(e,t){return!u.labels||""!==u.labels[t]}),this.grid.horizontal=t.yAxes.map(function(e,t){return{axis:e,axisLayout:r.yAxes[t],index:t}}).filter(function(e){return void 0===e.axis.option.showGrid?0===e.index:!1!==e.axis.option.showGrid}).map(function(e){return{scale:e.axis.scale,ticks:e.axisLayout.ticks,index:e.index}}),this.grid.plot=a,this.grid.grid=t.option.grid||{},this.grid.theme=s,this.grid.markDirty(),this.radarGrid.setState({width:n.width,height:n.height,display:"radar"===t.kind}),this.radarGrid.theme=s,this.radarGrid.coord="radar"===t.kind&&l&&t.radar?{polar:l,plot:a,indicators:t.radar.indicators.map(function(e,r){return{name:e.name,max:t.radarDomains[r]?t.radarDomains[r][1]:1}}),shape:t.radar.shape||"polygon",splitNumber:Math.max(1,Number(t.radar.splitNumber)||4)}:null,this.radarGrid.markDirty();var c=t.option.polarGrid,p="cartesian"===t.kind&&!!c&&"equal"===t.option.aspect;this.polarGrid.setState({width:n.width,height:n.height,display:p}),this.polarGrid.theme=s,this.polarGrid.layout=r,this.polarGrid.coord=p?{plot:a,xScale:t.xAxis.scale,yScale:t.yAxis.scale,options:!0===c?{}:c}:null,this.polarGrid.markDirty(),this.syncAxisComponents();for(var v=0;v<this.axisYList.length;v++){var m=this.axisYList[v];m.setState({width:n.width,height:n.height,display:!h}),m.layout=r,m.theme=s,m.axis=t.yAxes[v]||t.yAxis,m.axisIndex=v,m.position=t.yAxes[v]&&t.yAxes[v].position||"left",m.syncTicks(),m.markDirty()}var g=this.axisX;g.setState({width:n.width,height:n.height,display:!h}),g.layout=r,g.theme=s,g.axis=t.xAxis,g.syncTicks(),g.markDirty(),this.grid.axisX=this.axisX,this.grid.axisYList=this.axisYList,this.grid.syncTicks(),this.annotation.setState({width:n.width,height:n.height,display:!0}),this.annotation.plot=a,this.annotation.xAxis=t.xAxis,this.annotation.yAxes=t.yAxes,this.annotation.sync(t.option.annotation,{kind:t.kind,plot:a,xAxis:t.xAxis,yAxes:t.yAxes,theme:s}),this.legend&&(this.legend.setState({width:n.width,height:n.height}),this.legend.layout=r,this.legend.theme=s,this.legend.selectable=!1!==t.option.legend.selectable,this.legend.markDirty()),this.titleComponent&&(this.titleComponent.setState({width:n.width,height:n.height}),this.titleComponent.layout=r,this.titleComponent.theme=s,this.titleComponent.markDirty());for(var b=0,k=[this.crosshair,this.highlight,this.brushComponent,this.tooltip];b<k.length;b++){var S=k[b];S&&(S.setState({width:n.width,height:n.height}),S.theme=s,S.markDirty())}if(this.tooltip&&(this.tooltip.layout=r),this.crosshair){this.crosshair.layout=r,this.crosshair.option=t.option.crosshair||{};var A=Number(this.crosshair.option.followDuration);this.crosshair.followDuration=isFinite(A)&&A>=0?Math.min(400,A):90}if(this.crosshair&&this.crosshair.setState({display:!h}),this.brushComponent){var w=t.option.interaction&&t.option.interaction.brush;this.brushComponent.color=w&&!1!==w&&w.color?{fill:toAlpha(w.color,.16),stroke:w.color}:null}if(this.dataZoomSlider){var _=r.slider;if(_){this.dataZoomSlider.setState({left:_.x,top:_.y,width:_.width,height:_.height,display:!0});var M=_slicedToArray(this.domainFractions(),2),C=M[0],P=M[1];this.dataZoomSlider.setWindow(C,P)}else this.dataZoomSlider.setState({display:!1});this.dataZoomSlider.theme=s,this.dataZoomSlider.markDirty()}this.syncSeries(e)}},{key:"domainFractions",value:function domainFractions(){var e=this.fullXDomain,t=this.norm.xAxis.domain;if(!e||e.length<2||!t||t.length<2)return[0,1];if("category"===this.norm.xAxis.type){var r=e.length;if(r<=1)return[0,1];var n=Math.max(0,e.indexOf(t[0])),a=e.indexOf(t[t.length-1]);return[n/r,((a<0?r-1:a)+1)/r]}var s=Number(e[0]),l=Number(e[1])-s||1;return[(Number(t[0])-s)/l,(Number(t[1])-s)/l]}},{key:"setDomainFromFractions",value:function setDomainFromFractions(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"slider",n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("cartesian"!==this.norm.kind)return this;var a=_slicedToArray(this.domainFractions(),2),s=a[0],l=a[1];if(Math.abs(s-e)<1e-4&&Math.abs(l-t)<1e-4)return this;var h=this.fullXDomain;if("category"===this.norm.xAxis.type){var u=h.length;if(u<2)return this;var c=Math.round(e*u),p=Math.round(t*u)-1;c=Math.max(0,Math.min(u-1,c)),(p=Math.max(0,Math.min(u-1,p)))<=c&&(p=Math.min(u-1,c+1));var v=[h[c],h[p]];return this.setDomain("x",n?this.guardInteractiveXWindow(v):v,r)}var m=Number(h[0]),g=Number(h[1])-m,b=[m+g*e,m+g*t];return this.setDomain("x",n?this.guardInteractiveXWindow(b):b,r)}},{key:"syncAxisComponents",value:function syncAxisComponents(){var e=this.norm.yAxes,t=e.length,r=e.map(function(e){return e.position}).join("|");if(this.axisSignature!==r){var n,a=_createForOfIteratorHelper(this.axisYList);try{for(a.s();!(n=a.n()).done;){var s=n.value;this.root.removeChild(s)}}catch(e){a.e(e)}finally{a.f()}var l=this.layout.canvas;this.axisYList=e.map(function(e,t){return new X({orientation:"y",width:l.width,height:l.height,zIndex:je+t,axisIndex:t,position:e.position})}),this.root.addChildren(this.axisYList),this.axisSignature=r}for(;this.axisYList.length>t;){var h=this.axisYList.pop();this.root.removeChild(h)}}},{key:"syncSeries",value:function syncSeries(e){var t=this.norm,r=this.layout.plot,n=t.series.map(function(e){return"".concat(e.id,":").concat(e.type)}).join("|"),a=computeBarSlots(t.series);if(n!==this.seriesSignature){var s,l=_createForOfIteratorHelper(this.seriesComponents);try{for(l.s();!(s=l.n()).done;){var h=s.value;this.root.removeChild(h)}}catch(e){l.e(e)}finally{l.f()}this.seriesComponents=t.series.map(function(e,t){return createSeriesComponent(e,{left:r.x,top:r.y,width:r.width,height:r.height,zIndex:Le+t})}),this.root.addChildren(this.seriesComponents),this.seriesSignature=n}for(var u=0;u<this.seriesComponents.length;u++){var c=this.seriesComponents[u],p=t.series[u],v=!p.hidden,m=t.yAxes[p.axisIndex]||t.yAxis,g=this.layout.polar,b="pie"===p.type?{polar:g,plot:r,canvas:this.layout.canvas}:"radar"===p.type?{polar:g,plot:r,canvas:this.layout.canvas,domains:t.radarDomains}:"funnel"===p.type?{plot:r,canvas:this.layout.canvas,options:t.funnel||{}}:"gauge"===p.type?{polar:g,plot:r,canvas:this.layout.canvas,options:t.gauge||{}}:"liquid"===p.type?{polar:g,plot:r,canvas:this.layout.canvas,options:t.liquid||{}}:"treemap"===p.type?{plot:r,canvas:this.layout.canvas,layout:layoutTreemap(Array.isArray(p.option.data)?p.option.data:[],r,t.treemap||{},t.theme.colorPalette),options:t.treemap||{}}:"graph"===p.type&&t.graph?{plot:r,canvas:this.layout.canvas,layout:forceLayout(t.graph.nodes||[],t.graph.links||[],r,t.graph,t.theme.colorPalette),options:t.graph}:"sankey"===p.type&&t.sankey?{plot:r,canvas:this.layout.canvas,layout:layoutSankey(t.sankey.nodes||[],t.sankey.links||[],r,t.sankey,t.theme.colorPalette),options:t.sankey}:{plot:r,canvas:this.layout.canvas,xScale:t.xAxis.scale,yScale:m.scale,yAxisIndex:p.axisIndex,theme:t.theme};if(c.setState({left:r.x,top:r.y,width:r.width,height:r.height,display:v,zIndex:Le+u,interactive:v}),c.barSlot=a[p.id]||{index:0,count:1},c.chartTheme=t.theme,c.state.ariaLabel="".concat(p.name," 系列,共 ").concat(p.pointCount," 个数据点"),c.updateSeries(p,!!e&&!this.viewState.x,!!this.domainTransition),"pie"!==p.type&&"funnel"!==p.type||c.setHiddenSlices(hiddenSliceIndexes(t,p.id)),c.setCoord(b),c.markDirty(),e&&v){var k=t.option.animation;if(k&&!1!==k.enabled){var S=k["enter"===e?"enter":"update"];S&&this.playStage(c,_objectSpread2(_objectSpread2({},S),{},{kind:"enter"===e?"enter":"update"}))}}}}},{key:"playStage",value:function playStage(e,t){if(!shouldAnimate())return e.setAnimationStage(t),e.setState({progress:1}),void e.markDirty();e.setAnimationStage(t);var r=_objectSpread2({},e.props.animations||{});r.progress={from:0,to:1,duration:Math.max(1,Number(t.duration)||480),delay:Number(t.delay)||0,easing:t.easing||"easeOutCubic",startTime:void 0,finished:!1},e.props.animations=r,e.setState({progress:0}),this.ice.animationManager&&this.ice.animationManager.add(e)}},{key:"playEnter",value:function playEnter(e,t,r){this.playStage(e,{duration:t,easing:r,stagger:0})}},{key:"finishAnimations",value:function finishAnimations(){this.domainTransition=null,this.stopDomainTransition();var e,t=_createForOfIteratorHelper([].concat(_toConsumableArray(this.seriesComponents),[this.axisX],_toConsumableArray(this.axisYList),[this.grid,this.tooltip,this.crosshair]));try{for(t.s();!(e=t.n()).done;){var r=e.value;if(r){var n=r.props.animations;if(n)for(var a in n)0!==a.indexOf("__")&&n[a]&&(n[a].finished=!0);var s=!!n&&Object.keys(n).some(function(e){return 0===e.indexOf("__")});this.ice.animationManager&&!s&&this.ice.animationManager.remove(r),r.props&&r.props.animations&&r.props.animations.axisMorph&&r.setState({axisMorph:1}),Number(r.state.progress)<1&&r.setState({progress:1}),r.markDirty()}}}catch(e){t.e(e)}finally{t.f()}return this.ice.dirty=!0,this}},{key:"currentRange",value:function currentRange(){return{x:[this.norm.xAxis.domain[0],this.norm.xAxis.domain[this.norm.xAxis.domain.length-1]],y:[Number(this.norm.yAxis.domain[0]),Number(this.norm.yAxis.domain[1])]}}},{key:"clampDomain",value:function clampDomain(e,t,r){return"y"===e?this.clampAxisDomain(0,t,r):this.clampAxisDomain(-1,t,r)}},{key:"clampAxisDomain",value:function clampAxisDomain(e,t,r){var n=e<0?this.fullXDomain:this.fullYDomains[e];if(!n||n.length<2||!t||t.length<2)return null;var a=e<0?this.norm.xAxis:this.norm.yAxes[e];if(!a)return null;if("category"===a.type){var s=n,l=s.indexOf(t[0]),h=s.indexOf(t[1]);if(l<0&&h<0)return null;if(l<0||h<0){var u=Math.max(1,a.domain.length-1);h<0?(h=s.length-1,l=Math.max(0,h-u)):(l=0,h=Math.min(s.length-1,u))}if(l>h){var c=l;l=h,h=c}if(h-l<1)return null;if("zoom"===r||"brush"===r){var p=h-l+1,v=this.norm.option.interaction&&this.norm.option.interaction.zoom,m=clampBarCount(p,this.layout.plot.width,v&&!1!==v?v:void 0);if(m!==p){var g=(l+h)/2,b=Math.round(g-(m-1)/2);if(b=Math.max(0,Math.min(b,s.length-m)),l=Math.max(0,b),(h=Math.min(s.length-1,l+m-1))-l<1)return null}}return[s[l],s[h]]}var k=Number(n[0]),S=Number(n[1]),A=Number(t[0]),w=Number(t[1]);if(!isFinite(A)||!isFinite(w)||w<=A)return null;var _=.001*(S-k);if(w-A<_)return null;if("pan"===r){var M=.25*(w-A),C=A,P=w;return P<k+M&&(C+=k+M-P,P=k+M),C>S-M&&(P-=C-(S-M),C=S-M),[C,P]}var T=Math.max(k,A),I=Math.min(S,w);return I<=T||I-T<_?null:[T,I]}},{key:"canvasRect",value:function canvasRect(){var e=this.ice&&this.ice.dpr||1,t=(this.ice&&this.ice.canvasWidth?this.ice.canvasWidth:this.canvasEl?this.canvasEl.width:0)/e,r=(this.ice&&this.ice.canvasHeight?this.ice.canvasHeight:this.canvasEl?this.canvasEl.height:0)/e;return{x:0,y:0,width:Math.max(1,Math.round(t)),height:Math.max(1,Math.round(r))}}},{key:"observeResize",value:function observeResize(){var e=this,t="undefined"!=typeof window?window.ResizeObserver:null;if(t&&this.canvasEl){var r=this.canvasEl.parentNode||this.canvasEl;this.resizeObserver=new t(function(){e.resize()}),this.resizeObserver.observe(r)}}},{key:"registerTypes",value:function registerTypes(){for(var e=0,t=[["ice-chart:PlotArea",Y],["ice-chart:GridLines",G],["ice-chart:Annotation",K],["ice-chart:Axis",X],["ice-chart:Legend",q],["ice-chart:Title",$],["ice-chart:Tooltip",Z],["ice-chart:Crosshair",J],["ice-chart:Highlight",Q],["ice-chart:Brush",ee]];e<t.length;e++){var r=_slicedToArray(t[e],2),n=r[0],a=r[1];this.ice.registerType(n,a)}}}],[{key:"restore",value:function restore(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=new ICEChart(e,r.initialOption||{series:[]},r.chartOptions);return n.fromJSONObject(t,r),n}}])}();function computeBarSlots(e){var t,r=[],n={},a=_createForOfIteratorHelper(e);try{var s=function _loop(){var e=t.value;if("bar"!==e.type||e.hidden)return 1;var n=e.option.stack?"stack:".concat(e.option.stack):"single:".concat(e.id),a=r.find(function(e){return e.key===n});a||(a={key:n,members:[]},r.push(a)),a.members.push(e)};for(a.s();!(t=a.n()).done;)s()}catch(e){a.e(e)}finally{a.f()}for(var l=0;l<r.length;l++){var h,u=_createForOfIteratorHelper(r[l].members);try{for(u.s();!(h=u.n()).done;){n[h.value.id]={index:l,count:r.length}}}catch(e){u.e(e)}finally{u.f()}}return n}function hiddenSliceIndexes(e,t){var r=[],n=e.series.find(function(e){return e.id===t});if(!n)return r;for(var a=0;a<n.pointCount;a++){var s=n.pointAt(a);e.hiddenSlices["".concat(t,"#").concat(s.index)]&&r.push(s.index)}return r}function isEngineThemeDark(e){try{var t=function parseHexColor(e){if("string"!=typeof e)return null;var t=e.trim();if("#"!==t.charAt(0))return null;var r=t.slice(1);3===r.length&&(r=r[0]+r[0]+r[1]+r[1]+r[2]+r[2]);return 6!==r.length?null:[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16)]}(e&&e.getTheme&&e.getTheme().semantic.background);if(!t)return!1;var r=_slicedToArray(t.map(function(e){var t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}),3);return.2126*r[0]+.7152*r[1]+.0722*r[2]<.35}catch(e){return!1}}function toAlpha(e,t){if("string"!=typeof e)return"rgba(0,0,0,".concat(t,")");if(0===e.indexOf("#")){var r=e.slice(1);if(3===r.length&&(r=r[0]+r[0]+r[1]+r[1]+r[2]+r[2]),6!==r.length)return e;var n=parseInt(r.slice(0,2),16),a=parseInt(r.slice(2,4),16),s=parseInt(r.slice(4,6),16);return"rgba(".concat(n,",").concat(a,",").concat(s,",").concat(t,")")}return 0===e.indexOf("rgb(")?e.replace("rgb(","rgba(").replace(")",",".concat(t,")")):e}function createChart(e,t,r){return"string"==typeof t||isChartSnapshot(t)?$e.restore(e,t,{chartOptions:r}):new $e(e,t,r)}function linkCharts(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.axis||"x",a=!1!==r.hover,s=!1!==r.zoom,l=!1!==r.brush,h=[],u=null,c=_createForOfIteratorHelper(e);try{var p=function _loop(){var r=t.value,c=function onHover(t){if(a&&t){u=r;var n,s=_createForOfIteratorHelper(e);try{var l=function _loop2(){var e=n.value;e!==r&&e.silent(function(){return e.showHoverAtValue(t.xValue)})};for(s.s();!(n=s.n()).done;)l()}catch(e){s.e(e)}finally{s.f()}}},p=function onLeave(){if(a&&u===r){u=null;var t,n=_createForOfIteratorHelper(e);try{var s=function _loop3(){var e=t.value;e!==r&&e.silent(function(){return e.clearHover()})};for(n.s();!(t=n.n()).done;)s()}catch(e){n.e(e)}finally{n.f()}}},v=function onZoom(t){s&&t&&applyRange(e,r,t,n)},m=function onPan(t){s&&t&&applyRange(e,r,t,n)},g=function onBrush(t){l&&t&&applyRange(e,r,t,n)};r.on("item:hover",c),r.on("item:leave",p),r.on("zoom:change",v),r.on("pan:change",m),r.on("brush:end",g),h.push(function(){r.off("item:hover",c),r.off("item:leave",p),r.off("zoom:change",v),r.off("pan:change",m),r.off("brush:end",g)})};for(c.s();!(t=c.n()).done;)p()}catch(e){c.e(e)}finally{c.f()}return{charts:e,unlink:function unlink(){for(var e=0,t=h;e<t.length;e++){(0,t[e])()}h.length=0}}}function applyRange(e,t,r,n){if(("x"===n||"xy"===n)&&r.x){var a,s=_createForOfIteratorHelper(e);try{var l=function _loop4(){var e=a.value;e!==t&&e.silent(function(){return e.setDomain("x",r.x,"link")})};for(s.s();!(a=s.n()).done;)l()}catch(e){s.e(e)}finally{s.f()}}if(("y"===n||"xy"===n)&&r.y){var h,u=_createForOfIteratorHelper(e);try{var c=function _loop5(){var e=h.value;e!==t&&e.silent(function(){return e.setDomain("y",r.y,"link")})};for(u.s();!(h=u.n()).done;)c()}catch(e){u.e(e)}finally{u.f()}}}export{Re as A11yMirror,K as Annotation,se as AreaSeries,X as Axis,p as BOOTSTRAP_CHART_THEME,v as BOOTSTRAP_DARK_CHART_THEME,u as BOOTSTRAP_TOKENS,E as BandScale,oe as BarSeries,xe as BoxplotSeries,ee as Brush,j as ChartComponent,J as Crosshair,Se as CurveSeriesBase,g as DARK_CHART_THEME,z as DEFAULT_ANIMATION_STAGES,De as Emitter,P as ExpressionError,Ae as FunctionSeries,pe as FunnelSeries,me as GaugeSeries,ke as GraphSeries,G as GridLines,de as HeatmapSeries,Q as Highlight,Fe as HitResolver,$e as ICEChart,Ne as InteractionController,m as LIGHT_CHART_THEME,q as Legend,ae as LineSeries,L as LinearScale,Me as LiquidSeries,B as LogScale,we as ParametricSeries,ue as PieSeries,Y as PlotArea,te as RadarGrid,ce as RadarSeries,He as SERIES_ROLE_HINT,qe as SNAPSHOT_VERSION,fe as SankeySeries,le as ScatterSeries,ne as SeriesBase,C as TimeScale,$ as Title,Z as Tooltip,be as TreemapSeries,Oe as VISUALLY_HIDDEN_STYLE,ge as WaterfallSeries,applyChartThemeToEngine,buildDataNodes,buildDataTable,chartThemeToEnginePatch,chartTitle,clearCustomSeriesTypes,compileExpression,compileSampler,computeBarSlots,computeBoxplotSummary,computeLayout,createChart,createScale,createSeriesComponent,diagnoseExpression,errorsOf,evaluateExpression,forceLayout,formatNumberTick,formatTick,getMotionPreference,getSeriesTypeFactory,isBuiltinSeriesType,isChartSnapshot,layoutSankey,layoutTreemap,linkCharts,listSeriesTypes,mergeOptionPatch,mixColors,normalizeAnimation,normalizeAnnotation,normalizeOption,registerSeriesType,resolveAnnotation,resolveChartTheme,robustRange,roundRect,sampleFunctionCurve,sampleGraphLink,sampleLinkPath,sampleParametricCurve,setMotionPreference,shouldAnimate,toSerializableOption,unregisterSeriesType,warningsOf};