@webority/ui-elements 0.32.0 → 0.34.0

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.
@@ -63,6 +63,10 @@ var l = (e) => e instanceof Element && e.closest("input, textarea, select, butto
63
63
  ]) o.addEventListener(e, () => this._syncPlay());
64
64
  o.addEventListener("timeupdate", () => this._syncTime()), o.addEventListener("durationchange", () => this._syncTime()), o.addEventListener("volumechange", () => this._syncVolume()), o.addEventListener("ratechange", () => this._syncSpeed()), this._onKeyDown = (e) => this._keyDown(e), r.addEventListener("keydown", this._onKeyDown), this._syncPlay(), this._syncTime(), this._syncVolume(), this._syncSpeed(), this._syncCaptions();
65
65
  }
66
+ seekTo(e) {
67
+ let t = this.media.duration;
68
+ this.media.currentTime = Math.min(Math.max(e, 0), Number.isFinite(t) ? t : Infinity);
69
+ }
66
70
  togglePlay() {
67
71
  this.media.paused || this.media.ended ? this.media.play().catch((e) => {
68
72
  console.warn("[wui-file-viewer] play refused:", e?.message);
@@ -18,4 +18,4 @@ var WeborityChart=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value
18
18
  `||r===``)){var i=e.isSelected(r);ke(n,r)?n[r]=n[r]&&i:n[r]=i}}),n}function fV(e){e.registerAction(`legendToggleSelect`,`legendselectchanged`,ie(uV,`toggleSelected`)),e.registerAction(`legendAllSelect`,`legendselectall`,ie(uV,`allSelect`)),e.registerAction(`legendInverseSelect`,`legendinverseselect`,ie(uV,`inverseSelect`)),e.registerAction(`legendSelect`,`legendselected`,ie(uV,`select`)),e.registerAction(`legendUnSelect`,`legendunselected`,ie(uV,`unSelect`))}var pV=Yc(mV);function mV(e){var t=e.findComponents({mainType:`legend`});t&&t.length&&e.filterSeries(function(e){for(var n=0;n<t.length;n++)if(!t[n].isSelected(e.name))return!1;return!0})}function hV(e){e.registerComponentModel(eV),e.registerComponentView(iV),e.registerProcessor(e.PRIORITY.PROCESSOR.SERIES_FILTER,pV),e.registerSubTypeDefaulter(`legend`,function(){return`plain`}),fV(e)}var gV=function(e){i(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.setScrollDataIndex=function(e){this.option.scrollDataIndex=e},t.prototype.init=function(t,n,r){var i=m_(t);e.prototype.init.call(this,t,n,r),_V(this,t,i)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.call(this,t,n),_V(this,this.option,t)},t.type=`legend.scroll`,t.defaultOption=Dh(eV.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:`end`,pageFormatter:`{current}/{total}`,pageIcons:{horizontal:[`M0,0L12,-10L12,10z`,`M0,0L-12,-10L-12,10z`],vertical:[`M0,0L20,0L10,-20z`,`M0,0L20,0L10,20z`]},pageIconColor:Y.color.accent50,pageIconInactiveColor:Y.color.accent10,pageIconSize:15,pageTextStyle:{color:Y.color.tertiary},animationDurationUpdate:800}),t}(eV);function _V(e,t,n){var r=e.getOrient(),i=[1,1];i[r.index]=0,p_(t,n,{type:`box`,ignoreSize:!!i})}var vV=Bu,yV=[`width`,`height`],bV=[`x`,`y`],xV=function(e){i(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!0,n._currentIndex=0,n}return t.prototype.init=function(){e.prototype.init.call(this),this.group.add(this._containerGroup=new vV),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new vV)},t.prototype.resetInner=function(){e.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},t.prototype.renderInner=function(t,n,r,i,a,o,s){var c=this;e.prototype.renderInner.call(this,t,n,r,i,a,o,s);var l=this._controllerGroup,u=n.get(`pageIconSize`,!0),d=B(u)?u:[u,u];p(`pagePrev`,0);var f=n.getModel(`pageTextStyle`);l.add(new Uo({name:`pageText`,style:{text:`xx/xx`,fill:f.getTextColor(),font:f.getFont(),verticalAlign:`middle`,align:`center`},silent:!0})),p(`pageNext`,1);function p(e,t){var r=e+`DataIndex`,a=Sf(n.get(`pageIcons`,!0)[n.getOrient().name][t],{onclick:z(c._pageGo,c,r,n,i)},{x:-d[0]/2,y:-d[1]/2,width:d[0],height:d[1]});a.name=e,l.add(a)}},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getSelectorGroup(),s=e.getOrient().index,c=yV[s],l=bV[s],u=yV[1-s],d=bV[1-s];i&&r_(`horizontal`,o,e.get(`selectorItemGap`,!0));var f=e.get(`selectorButtonGap`,!0),p=o.getBoundingRect(),m=[-p.x,-p.y],h=D(n);i&&(h[c]=n[c]-p[c]-f);var g=this._layoutContentAndController(e,r,h,s,c,u,d,l);if(i){if(a===`end`)m[s]+=g[c]+f;else{var _=p[c]+f;m[s]-=_,g[l]-=_}g[c]+=p[c]+f,m[1-s]+=g[d]+g[u]/2-p[u]/2,g[u]=Math.max(g[u],p[u]),g[d]=Math.min(g[d],p[d]+m[1-s]),o.x=m[0],o.y=m[1],o.markRedraw()}return g},t.prototype._layoutContentAndController=function(e,t,n,r,i,a,o,s){var c=this.getContentGroup(),l=this._containerGroup,u=this._controllerGroup;r_(e.get(`orient`),c,e.get(`itemGap`),r?n.width:null,r?null:n.height),r_(`horizontal`,u,e.get(`pageButtonItemGap`,!0));var d=c.getBoundingRect(),f=u.getBoundingRect(),p=this._showController=d[i]>n[i],m=[-d.x,-d.y];t||(m[r]=c[s]);var h=[0,0],g=[-f.x,-f.y],_=W(e.get(`pageButtonGap`,!0),e.get(`itemGap`,!0));p&&(e.get(`pageButtonPosition`,!0)===`end`?g[r]+=n[i]-f[i]:h[r]+=f[i]+_),g[1-r]+=d[a]/2-f[a]/2,c.setPosition(m),l.setPosition(h),u.setPosition(g);var v={x:0,y:0};if(v[i]=p?n[i]:d[i],v[a]=Math.max(d[a],f[a]),v[o]=Math.min(0,f[o]+g[1-r]),l.__rectSize=n[i],p){var y={x:0,y:0};y[i]=Math.max(n[i]-f[i]-_,0),y[a]=v[a],l.setClipPath(new Ro({shape:y})),l.__rectSize=y[i]}else u.eachChild(function(e){e.attr({invisible:!0,silent:!0})});var b=this._getPageInfo(e);return b.pageIndex!=null&&Ud(c,{x:b.contentPosition[0],y:b.contentPosition[1]},p?e:null),this._updatePageInfoView(e,b),v},t.prototype._pageGo=function(e,t,n){var r=this._getPageInfo(t)[e];r!=null&&n.dispatchAction({type:`legendScroll`,scrollDataIndex:r,legendId:t.id})},t.prototype._updatePageInfoView=function(e,t){var n=this._controllerGroup;F([`pagePrev`,`pageNext`],function(r){var i=t[r+`DataIndex`]!=null,a=n.childOfName(r);a&&(a.setStyle(`fill`,i?e.get(`pageIconColor`,!0):e.get(`pageIconInactiveColor`,!0)),a.cursor=i?`pointer`:`default`)});var r=n.childOfName(`pageText`),i=e.get(`pageFormatter`),a=t.pageIndex,o=a==null?0:a+1,s=t.pageCount;r&&i&&r.setStyle(`text`,H(i)?i.replace(`{current}`,o==null?``:o+``).replace(`{total}`,s==null?``:s+``):i({current:o,total:s}))},t.prototype._getPageInfo=function(e){var t=e.get(`scrollDataIndex`,!0),n=this.getContentGroup(),r=this._containerGroup.__rectSize,i=e.getOrient().index,a=yV[i],o=bV[i],s=this._findTargetItemIndex(t),c=n.children(),l=c[s],u=c.length,d=+!!u,f={contentPosition:[n.x,n.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!l)return f;var p=v(l);f.contentPosition[i]=-p.s;for(var m=s+1,h=p,g=p,_=null;m<=u;++m)_=v(c[m]),(!_&&g.e>h.s+r||_&&!y(_,h.s))&&(h=g.i>h.i?g:_,h&&(f.pageNextDataIndex??=h.i,++f.pageCount)),g=_;for(var m=s-1,h=p,g=p,_=null;m>=-1;--m)_=v(c[m]),(!_||!y(g,_.s))&&h.i<g.i&&(g=h,f.pagePrevDataIndex??=h.i,++f.pageCount,++f.pageIndex),h=_;return f;function v(e){if(e){var t=e.getBoundingRect(),n=t[o]+e[o];return{s:n,e:n+t[a],i:e.__legendDataIndex}}}function y(e,t){return e.e>=t&&e.s<=t+r}},t.prototype._findTargetItemIndex=function(e){if(!this._showController)return 0;var t,n=this.getContentGroup(),r;return n.eachChild(function(n,i){var a=n.__legendDataIndex;r==null&&a!=null&&(r=i),a===e&&(t=i)}),t??r},t.type=`legend.scroll`,t}(iV);function SV(e){e.registerAction(`legendScroll`,`legendscroll`,function(e,t){var n=e.scrollDataIndex;n!=null&&t.eachComponent({mainType:`legend`,subType:`scroll`,query:e},function(e){e.setScrollDataIndex(n)})})}function CV(e){Rj(hV),e.registerComponentModel(gV),e.registerComponentView(xV),SV(e)}function wV(e){Rj(hV),Rj(CV)}var TV=function(e){i(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.inside`,t.defaultOption=Dh(jz.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(jz),EV=yc();function DV(e,t,n){EV(e).coordSysRecordMap.each(function(e){var r=e.dataZoomInfoMap.get(t.uid);r&&(r.getRange=n)})}function OV(e,t){for(var n=EV(e).coordSysRecordMap,r=n.keys(),i=0;i<r.length;i++){var a=r[i],o=n.get(a),s=o.dataZoomInfoMap;if(s){var c=t.uid;s.get(c)&&(s.removeKey(c),s.keys().length||kV(n,o))}}}function kV(e,t){if(t){e.removeKey(t.model.uid);var n=t.controller;n&&n.dispose()}}function AV(e,t){var n={model:t,containsPoint:ie(MV,t),dispatchAction:ie(jV,e),dataZoomInfoMap:null,controller:null},r=n.controller=new rN(e.getZr());return F([`pan`,`zoom`,`scrollMove`],function(e){r.on(e,function(t){var r=[];n.dataZoomInfoMap.each(function(i){if(t.isAvailableBehavior(i.model.option)){var a=(i.getRange||{})[e],o=a&&a(i.dzReferCoordSysInfo,n.model.mainType,n.controller,t);!i.model.get(`disabled`,!0)&&o&&r.push({dataZoomId:i.model.id,start:o[0],end:o[1]})}}),r.length&&n.dispatchAction(r)})}),n}function jV(e,t){e.isDisposed()||e.dispatchAction({type:`dataZoom`,animation:{easing:`cubicOut`,duration:100},batch:t})}function MV(e,t,n,r){return e.coordinateSystem.containPoint([n,r])}function NV(e,t,n){var r,i=`type_`,a={type_true:2,type_move:1,type_false:0,type_undefined:-1},o=!0,s,c;return e.each(function(e){var t=e.model,n=t.get(`disabled`,!0)?!1:!t.get(`zoomLock`,!0)||`move`;a[i+n]>a[i+r]&&(r=n),o&&=t.get(`preventDefaultMouseMove`,!0),s=W(t.get(`cursorGrab`,!0),s),c=W(t.get(`cursorGrabbing`,!0),c)}),{controlType:r,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!o,api:n,zInfo:{component:t.model},triggerInfo:{roamTrigger:null,isInSelf:t.containsPoint},cursorGrab:s,cursorGrabbing:c}}}function PV(e){e.registerUpdateLifecycle(`coordsys:aftercreate`,function(e,t){var n=EV(t),r=n.coordSysRecordMap||=G();r.each(function(e){e.dataZoomInfoMap=null}),e.eachComponent({mainType:`dataZoom`,subType:`inside`},function(e){F(Tz(e).infoList,function(n){var i=n.model.uid,a=r.get(i)||r.set(i,AV(t,n.model));(a.dataZoomInfoMap||=G()).set(e.uid,{dzReferCoordSysInfo:n,model:e,getRange:null})})}),r.each(function(e){var n=e.controller,i,a=e.dataZoomInfoMap;if(a){var o=a.keys()[0];o!=null&&(i=a.get(o))}if(!i){kV(r,e);return}var s=NV(a,e,t);n.enable(s.controlType,s.opt),Sw(e,`dispatchAction`,i.model.get(`throttle`,!0),`fixRate`)})})}var FV=function(e){i(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=`dataZoom.inside`,t}return t.prototype.render=function(t,n,r){if(e.prototype.render.apply(this,arguments),t.noTarget()){this._clear();return}this.range=t.getPercentRange(),DV(r,t,{pan:z(IV.pan,this),zoom:z(IV.zoom,this),scrollMove:z(IV.scrollMove,this)})},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){OV(this.api,this.dataZoomModel),this.range=null},t.type=`dataZoom.inside`,t}(Nz),IV={zoom:function(e,t,n,r){var i=this.range,a=i.slice(),o=e.axisModels[0];if(o){var s=RV[t](null,[r.originX,r.originY],o,n,e),c=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],l=Math.max(1/r.scale,0);a[0]=(a[0]-c)*l+c,a[1]=(a[1]-c)*l+c;var u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(zI(0,a,[0,100],0,u.minSpan,u.maxSpan),this.range=a,i[0]!==a[0]||i[1]!==a[1])return a}},pan:LV(function(e,t,n,r,i,a){var o=RV[r]([a.oldX,a.oldY],[a.newX,a.newY],t,i,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:LV(function(e,t,n,r,i,a){return RV[r]([0,0],[a.scrollDelta,a.scrollDelta],t,i,n).signal*(e[1]-e[0])*a.scrollDelta})};function LV(e){return function(t,n,r,i){var a=this.range,o=a.slice(),s=t.axisModels[0];if(s&&(zI(e(o,s,t,n,r,i),o,[0,100],`all`),this.range=o,a[0]!==o[0]||a[1]!==o[1]))return o}}var RV={grid:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem.getRect();return e||=[0,0],a.dim===`x`?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=a.inverse?-1:1),o},polar:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem,c=s.getRadiusAxis().getExtent(),l=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),n.mainType===`radiusAxis`?(o.pixel=t[0]-e[0],o.pixelLength=c[1]-c[0],o.pixelStart=c[0],o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?-1:1),o},singleAxis:function(e,t,n,r,i){var a=n.axis,o=i.model.coordinateSystem.getRect(),s={};return e||=[0,0],a.orient===`horizontal`?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=a.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=a.inverse?-1:1),s}};function zV(e){Rz(e),e.registerComponentModel(TV),e.registerComponentView(FV),PV(e)}var BV=function(e){i(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.slider`,t.layoutMode=`box`,t.defaultOption=Dh(jz.defaultOption,{show:!0,right:`ph`,top:`ph`,width:`ph`,height:`ph`,left:null,bottom:null,borderColor:Y.color.accent10,borderRadius:0,backgroundColor:Y.color.transparent,dataBackground:{lineStyle:{color:Y.color.accent30,width:.5},areaStyle:{color:Y.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:Y.color.accent40,width:.5},areaStyle:{color:Y.color.accent20,opacity:.3}},fillerColor:`rgba(135,175,274,0.2)`,handleIcon:`path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z`,handleSize:`100%`,handleStyle:{color:Y.color.neutral00,borderColor:Y.color.accent20},moveHandleSize:7,moveHandleIcon:`path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z`,moveHandleStyle:{color:Y.color.accent40,opacity:.5},showDetail:!0,showDataShadow:`auto`,realtime:!0,zoomLock:!1,textStyle:{color:Y.color.tertiary},brushSelect:!0,brushStyle:{color:Y.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:Y.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),t}(jz),VV=Ro,HV=1,UV=30,WV=7,GV=`horizontal`,KV=`vertical`,qV=5,JV=[`line`,`bar`,`candlestick`,`scatter`],YV={easing:`cubicOut`,duration:100,delay:0},XV=function(e){i(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._displayables={},n}return t.prototype.init=function(e,t){this.api=t,this._onBrush=z(this._onBrush,this),this._onBrushEnd=z(this._onBrushEnd,this)},t.prototype.render=function(t,n,r,i){if(e.prototype.render.apply(this,arguments),Sw(this,`_dispatchZoomAction`,t.get(`throttle`),`fixRate`),this._orient=t.getOrient(),t.get(`show`)===!1){this.group.removeAll();return}if(t.noTarget()){this._clear(),this.group.removeAll();return}(!i||i.type!==`dataZoom`||i.from!==this.uid)&&this._buildView(),this._updateView()},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){Cw(this,`_dispatchZoomAction`);var e=this.api.getZr();e.off(`mousemove`,this._onBrush),e.off(`mouseup`,this._onBrushEnd)},t.prototype._buildView=function(){var e=this.group;e.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var t=this._displayables.sliderGroup=new Bu;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),e.add(t),this._positionGroup()},t.prototype._resetLocation=function(){var e=this.dataZoomModel,t=this.api,n=e.get(`brushSelect`)?WV:0,r=l_(e,t).refContainer,i=this._findCoordRect(),a=e.get(`defaultLocationEdgeGap`,!0)||0,o=this._orient===GV?{right:r.width-i.x-i.width,top:r.height-UV-a-n,width:i.width,height:UV}:{right:a,top:i.y,width:UV,height:i.height},s=m_(e.option);F([`right`,`top`,`width`,`height`],function(e){s[e]===`ph`&&(s[e]=o[e])});var c=s_(s,r);this._location={x:c.x,y:c.y},this._size=[c.width,c.height],this._orient===KV&&this._size.reverse()},t.prototype._positionGroup=function(){var e=this.group,t=this._location,n=this._orient,r=this.dataZoomModel.getFirstTargetAxisModel(),i=r&&r.get(`inverse`),a=this._displayables.sliderGroup,o=(this._dataShadowInfo||{}).otherAxisInverse;a.attr(n===GV&&!i?{scaleY:o?1:-1,scaleX:1}:n===GV&&i?{scaleY:o?1:-1,scaleX:-1}:n===KV&&!i?{scaleY:o?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:o?-1:1,scaleX:-1,rotation:Math.PI/2});var s=e.getBoundingRect([a]),c=isNaN(s.x)?0:s.x,l=isNaN(s.y)?0:s.y;e.x=t.x-c,e.y=t.y-l,e.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var e=this.dataZoomModel,t=this._size,n=this._displayables.sliderGroup,r=e.get(`brushSelect`);n.add(new VV({silent:!0,shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:e.get(`backgroundColor`)},z2:-40}));var i=new VV({shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:`transparent`},z2:0,onclick:z(this._onClickPanel,this)}),a=this.api.getZr();r?(i.on(`mousedown`,this._onBrushStart,this),i.cursor=`crosshair`,a.on(`mousemove`,this._onBrush),a.on(`mouseup`,this._onBrushEnd)):(a.off(`mousemove`,this._onBrush),a.off(`mouseup`,this._onBrushEnd)),n.add(i)},t.prototype._renderDataShadow=function(){var e=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!e)return;var t=this._size,n=this._shadowSize||[],r=e.series,i=r.getRawData(),a=r.getShadowDim&&r.getShadowDim(),o=a&&i.getDimensionInfo(a)?r.getShadowDim():e.otherDim;if(o==null)return;var s=this._shadowPolygonPts,c=this._shadowPolylinePts;if(i!==this._shadowData||o!==this._shadowDim||t[0]!==n[0]||t[1]!==n[1]){var l=i.getDataExtent(e.thisDim),u=i.getDataExtent(o),d=(u[1]-u[0])*.3;u=[u[0]-d,u[1]+d];var f=[0,t[1]],p=[0,t[0]],m=[[t[0],0],[0,0]],h=[],g=p[1]/Math.max(1,i.count()-1),_=t[0]/(l[1]-l[0]),v=e.thisAxis.type===`time`,y=-g,b=Math.round(i.count()/t[0]),x;i.each([e.thisDim,o],function(e,t,n){if(b>0&&n%b){v||(y+=g);return}y=v?(+e-l[0])*_:y+g;var r=t==null||isNaN(t)||t===``,i=r?0:_s(t,u,f,!0);r&&!x&&n?(m.push([m[m.length-1][0],0]),h.push([h[h.length-1][0],0])):!r&&x&&(m.push([y,0]),h.push([y,0])),r||(m.push([y,i]),h.push([y,i])),x=r}),s=this._shadowPolygonPts=m,c=this._shadowPolylinePts=h}this._shadowData=i,this._shadowDim=o,this._shadowSize=[t[0],t[1]];var S=this.dataZoomModel;function C(e){var t=S.getModel(e?`selectedDataBackground`:`dataBackground`),n=new Bu,r=new pd({shape:{points:s},segmentIgnoreThreshold:1,style:t.getModel(`areaStyle`).getAreaStyle(),silent:!0,z2:-20}),i=new hd({shape:{points:c},segmentIgnoreThreshold:1,style:t.getModel(`lineStyle`).getLineStyle(),silent:!0,z2:-19});return n.add(r),n.add(i),n}for(var w=0;w<3;w++){var T=C(w===1);this._displayables.sliderGroup.add(T),this._displayables.dataShadowSegs.push(T)}},t.prototype._prepareDataShadowInfo=function(){var e=this.dataZoomModel,t=e.get(`showDataShadow`);if(t!==!1){var n,r=this.ecModel;return e.eachTargetAxis(function(i,a){F(e.getAxisProxy(i,a).getTargetSeriesModels(),function(e){if(!n&&!(t!==!0&&M(JV,e.get(`type`))<0)){var o=r.getComponent(Cz(i),a).axis,s=QV(i),c,l=e.coordinateSystem;s!=null&&l.getOtherAxis&&(c=l.getOtherAxis(o).inverse),s=e.getData().mapDimension(s),n={thisAxis:o,series:e,thisDim:e.getData().mapDimension(i),otherDim:s,otherAxisInverse:c}}},this)},this),n}},t.prototype._renderHandle=function(){var e=this.group,t=this._displayables,n=t.handles=[null,null],r=t.handleLabels=[null,null],i=this._displayables.sliderGroup,a=this._size,o=this.dataZoomModel,s=this.api,c=o.get(`borderRadius`)||0,l=o.get(`brushSelect`),u=t.filler=new VV({silent:l,style:{fill:o.get(`fillerColor`)},textConfig:{position:`inside`}});i.add(u),i.add(new VV({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:a[0],height:a[1],r:c},style:{stroke:o.get(`dataBackgroundColor`)||o.get(`borderColor`),lineWidth:HV,fill:Y.color.transparent}})),F([0,1],function(t){var a=o.get(`handleIcon`);!Mv[a]&&a.indexOf(`path://`)<0&&a.indexOf(`image://`)<0&&(a=`path://`+a);var s=Fv(a,-1,0,2,2,null,!0);s.attr({cursor:$V(this._orient),draggable:!0,drift:z(this._onDragMove,this,t),ondragend:z(this._onDragEnd,this),onmouseover:z(this._onOverDataInfoTriggerArea,this,!0),onmouseout:z(this._onOverDataInfoTriggerArea,this,!1),z2:5});var c=s.getBoundingRect(),l=o.get(`handleSize`);this._handleHeight=J(l,this._size[1]),this._handleWidth=c.width/c.height*this._handleHeight,s.setStyle(o.getModel(`handleStyle`).getItemStyle()),s.style.strokeNoScale=!0,s.rectHover=!0,s.ensureState(`emphasis`).style=o.getModel([`emphasis`,`handleStyle`]).getItemStyle(),au(s);var u=o.get(`handleColor`);u!=null&&(s.style.fill=u),i.add(n[t]=s);var d=o.getModel(`textStyle`),f=(o.get(`handleLabel`)||{}).show||!1;e.add(r[t]=new Uo({silent:!0,invisible:!f,style:Xf(d,{x:0,y:0,text:``,verticalAlign:`middle`,align:`center`,fill:d.getTextColor(),font:d.getFont()}),z2:10}))},this);var d=u;if(l){var f=J(o.get(`moveHandleSize`),a[1]),p=t.moveHandle=new Ro({style:o.getModel(`moveHandleStyle`).getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:a[1]-.5,height:f}}),m=f*.8,h=t.moveHandleIcon=Fv(o.get(`moveHandleIcon`),-m/2,-m/2,m,m,Y.color.neutral00,!0);h.silent=!0,h.y=a[1]+f/2-.5,p.ensureState(`emphasis`).style=o.getModel([`emphasis`,`moveHandleStyle`]).getItemStyle();var g=Math.min(a[1]/2,Math.max(f,10));d=t.moveZone=new Ro({invisible:!0,shape:{y:a[1]-g,height:f+g}}),d.on(`mouseover`,function(){s.enterEmphasis(p)}).on(`mouseout`,function(){s.leaveEmphasis(p)}),i.add(p),i.add(h),i.add(d)}d.attr({draggable:!0,cursor:`grab`,drift:z(this._onActualMoveZoneDrift,this),ondragstart:z(this._onActualMoveZoneDragStart,this),ondragend:z(this._onActualMoveZoneDragEnd,this),onmouseover:z(this._onOverDataInfoTriggerArea,this,!0),onmouseout:z(this._onOverDataInfoTriggerArea,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),t=this._getViewExtent();this._handleEnds=[_s(e[0],[0,100],t,!0),_s(e[1],[0,100],t,!0)]},t.prototype._updateInterval=function(e,t){var n=this.dataZoomModel,r=this._handleEnds,i=this._getViewExtent(),a=n.findRepresentativeAxisProxy().getMinMaxSpan(),o=[0,100];zI(t,r,i,n.get(`zoomLock`)?`all`:e,a.minSpan==null?null:_s(a.minSpan,o,i,!0),a.maxSpan==null?null:_s(a.maxSpan,o,i,!0));var s=this._range,c=this._range=Cs([_s(r[0],i,o,!0),_s(r[1],i,o,!0)]);return!s||s[0]!==c[0]||s[1]!==c[1]},t.prototype._updateView=function(e){var t=this._displayables,n=this._handleEnds,r=Cs(n.slice()),i=this._size;F([0,1],function(e){var r=t.handles[e],a=this._handleHeight;r.attr({scaleX:a/2,scaleY:a/2,x:n[e]+(e?-1:1),y:i[1]/2-a/2})},this),t.filler.setShape({x:r[0],y:0,width:r[1]-r[0],height:i[1]});var a={x:r[0],width:r[1]-r[0]};t.moveHandle&&(t.moveHandle.setShape(a),t.moveZone.setShape(a),t.moveZone.getBoundingRect(),t.moveHandleIcon&&t.moveHandleIcon.attr(`x`,a.x+a.width/2));for(var o=t.dataShadowSegs,s=[0,r[0],r[1],i[0]],c=0;c<o.length;c++){var l=o[c],u=l.getClipPath();u||(u=new Ro,l.setClipPath(u)),u.setShape({x:s[c],y:0,width:s[c+1]-s[c],height:i[1]})}this._updateDataInfo(e)},t.prototype._updateDataInfo=function(e){var t=this.dataZoomModel,n=this._displayables,r=n.handleLabels,i=this._orient,a=[``,``];if(t.get(`showDetail`)){var o=t.findRepresentativeAxisProxy(),s=o.getAxisModel().axis.scale;if(o){var c=this._range,l;if(e){var u={start:c[0],end:c[1]},d=kz(t,o);if(d){var f=d.calculateDataWindow(u).percentInverted;u={start:f[0],end:f[1]}}l=o.calculateDataWindow(u)}else l=o.getWindow();a=[ZV(t,0,l,s),ZV(t,1,l,s)]}}var p=Cs(this._handleEnds.slice());m.call(this,0),m.call(this,1);function m(e){var t=mf(n.handles[e].parent,this.group),o=gf(e===0?`right`:`left`,t),s=this._handleWidth/2+qV,c=hf([p[e]+(e===0?-s:s),this._size[1]/2],t);r[e].setStyle({x:c[0],y:c[1],verticalAlign:i===GV?`middle`:o,align:i===GV?o:`center`,text:a[e]})}},t.prototype._onOverDataInfoTriggerArea=function(e){this._isOverDataInfoTriggerArea=e,this._showDataInfo(e)},t.prototype._showDataInfo=function(e){var t=(this.dataZoomModel.get(`handleLabel`)||{}).show||!1,n=this.dataZoomModel.getModel([`emphasis`,`handleLabel`]).get(`show`)||!1,r=e||this._dragging?n:t,i=this._displayables,a=i.handleLabels;a[0].attr(`invisible`,!r),a[1].attr(`invisible`,!r),i.moveHandle&&this.api[r?`enterEmphasis`:`leaveEmphasis`](i.moveHandle,1)},t.prototype._onActualMoveZoneDrift=function(e,t,n){this.api.getZr().setCursorStyle(`grabbing`),this._onDragMove(`all`,e,t,n)},t.prototype._onActualMoveZoneDragStart=function(e){e.target.attr(`cursor`,`grabbing`),this._showDataInfo(!0)},t.prototype._onActualMoveZoneDragEnd=function(e){e.target.attr(`cursor`,`grab`),this._onDragEnd()},t.prototype._onDragMove=function(e,t,n,r){this._dragging=!0,dE(r.event);var i=this._displayables.sliderGroup.getLocalTransform(),a=hf([t,n],i,!0),o=this._updateInterval(e,a[0]),s=this.dataZoomModel.get(`realtime`);this._updateView(!s),o&&s&&this._dispatchZoomAction(!0)},t.prototype._onDragEnd=function(){this._dragging=!1,this._isOverDataInfoTriggerArea||this._showDataInfo(!1),!this.dataZoomModel.get(`realtime`)&&this._dispatchZoomAction(!1)},t.prototype._onClickPanel=function(e){var t=this._size,n=this._displayables.sliderGroup.transformCoordToLocal(e.offsetX,e.offsetY);if(!(n[0]<0||n[0]>t[0]||n[1]<0||n[1]>t[1])){var r=this._handleEnds,i=(r[0]+r[1])/2,a=this._updateInterval(`all`,n[0]-i);this._updateView(),a&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(e){var t=e.offsetX,n=e.offsetY;this._brushStart=new K(t,n),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(e){if(this._brushing){var t=this._displayables.brushRect;if(this._brushing=!1,t){t.attr(`ignore`,!0);var n=t.shape;if(!(+new Date-this._brushStartTime<200&&Math.abs(n.width)<5)){var r=this._getViewExtent(),i=[0,100],a=this._handleEnds=[n.x,n.x+n.width],o=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();zI(0,a,r,0,o.minSpan==null?null:_s(o.minSpan,i,r,!0),o.maxSpan==null?null:_s(o.maxSpan,i,r,!0)),this._range=Cs([_s(a[0],r,i,!0),_s(a[1],r,i,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(e){this._brushing&&(dE(e.event),this._updateBrushRect(e.offsetX,e.offsetY))},t.prototype._updateBrushRect=function(e,t){var n=this._displayables,r=this.dataZoomModel,i=n.brushRect;i||(i=n.brushRect=new VV({silent:!0,style:r.getModel(`brushStyle`).getItemStyle()}),n.sliderGroup.add(i)),i.attr(`ignore`,!1);var a=this._brushStart,o=this._displayables.sliderGroup,s=o.transformCoordToLocal(e,t),c=o.transformCoordToLocal(a.x,a.y),l=this._size;s[0]=Math.max(Math.min(l[0],s[0]),0),i.setShape({x:c[0],y:0,width:s[0]-c[0],height:l[1]})},t.prototype._dispatchZoomAction=function(e){var t=this._range;this.api.dispatchAction({type:`dataZoom`,from:this.uid,dataZoomId:this.dataZoomModel.id,animation:e?YV:null,start:t[0],end:t[1]})},t.prototype._findCoordRect=function(){var e,t=Tz(this.dataZoomModel).infoList;if(!e&&t.length){var n=t[0].model.coordinateSystem;e=n.getRect&&n.getRect()}if(!e){var r=this.api.getWidth(),i=this.api.getHeight();e={x:r*.2,y:i*.2,width:r*.6,height:i*.6}}return e},t.type=`dataZoom.slider`,t}(Nz);function ZV(e,t,n,r){var i=e.get(`labelFormatter`),a=e.get(`labelPrecision`);(a==null||a===`auto`)&&(a=n.valuePrecision);var o=n.value[t],s=o==null||isNaN(o)?``:Jy(r)||Ky(r)?r.getLabel({value:Math.round(o)}):isFinite(a)?Ss(o,a,!0):o+``;return V(i)?i(o,s):H(i)?i.replace(`{value}`,s):s}function QV(e){return{x:`y`,y:`x`,radius:`angle`,angle:`radius`}[e]}function $V(e){return e===`vertical`?`ns-resize`:`ew-resize`}function eH(e){e.registerComponentModel(BV),e.registerComponentView(XV),Rz(e)}function tH(e){Rj(zV),Rj(eH)}var nH={get:function(e,t,n){var r=D((rH[e]||{})[t]);return n&&B(r)?r[r.length-1]:r}},rH={color:{active:[`#006edd`,`#e0ffff`],inactive:[Y.color.transparent]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:[`circle`,`roundRect`,`diamond`],inactive:[`none`]},symbolSize:{active:[10,50],inactive:[0,0]}},iH=EF.mapVisual,aH=EF.eachVisual,oH=B,sH=F,cH=Cs,lH=_s,uH=function(e){i(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.stateList=[`inRange`,`outOfRange`],n.replacableOptionKeys=[`inRange`,`outOfRange`,`target`,`controller`,`color`],n.layoutMode={type:`box`,ignoreSize:!0},n.dataBound=[-1/0,1/0],n.targetVisuals={},n.controllerVisuals={},n}return t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n)},t.prototype.optionUpdated=function(e,t){var n=this.option;!t&&xB(n,e,this.replacableOptionKeys),this.textStyleModel=this.getModel(`textStyle`),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(e){var t=this.stateList;e=z(e,this),this.controllerVisuals=bB(this.option.controller,t,e),this.targetVisuals=bB(this.option.target,t,e)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var e=this,t=this.option.seriesTargets;if(t){var n=[];return sH(t,function(t){if(t.seriesIndex!=null)n.push(t.seriesIndex);else if(t.seriesId!=null){var r;e.ecModel.eachSeries(function(e){e.id===t.seriesId&&(r=e)}),r&&n.push(r.componentIndex)}}),n}var r=this.option.seriesId,i=this.option.seriesIndex;i==null&&r==null&&(i=`all`);var a=Tc(this.ecModel,`series`,{index:i,id:r},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return I(a,function(e){return e.componentIndex})},t.prototype.eachTargetSeries=function(e,t){F(this.getTargetSeriesIndices(),function(n){var r=this.ecModel.getSeriesByIndex(n);r&&e.call(t,r)},this)},t.prototype.isTargetSeries=function(e){var t=!1;return this.eachTargetSeries(function(n){n===e&&(t=!0)}),t},t.prototype.formatValueText=function(e,t,n){var r=this.option,i=r.precision,a=this.dataBound,o=r.formatter,s;n||=[`<`,`>`],B(e)&&(e=e.slice(),s=!0);var c=t?e:s?[l(e[0]),l(e[1])]:l(e);if(H(o))return o.replace(`{value}`,s?c[0]:c).replace(`{value2}`,s?c[1]:c);if(V(o))return s?o(e[0],e[1]):o(e);if(s)return e[0]===a[0]?n[0]+` `+c[1]:e[1]===a[1]?n[1]+` `+c[0]:c[0]+` - `+c[1];return c;function l(e){return e===a[0]?`min`:e===a[1]?`max`:(+e).toFixed(Math.min(i,20))}},t.prototype.resetExtent=function(){var e=this.option,t=cH([e.min,e.max]);this._dataExtent=t},t.prototype.getDimension=function(e){var t=this,n=this.option.seriesTargets;if(n){var r=ne(n,function(n){return n.seriesIndex!=null&&n.seriesIndex===e||n.seriesId!=null&&n.seriesId===t.ecModel.getSeriesByIndex(e).id});if(r)return r.dimension}return this.option.dimension},t.prototype.getDataDimensionIndex=function(e){var t=e.hostModel.seriesIndex,n=this.getDimension(t);if(n!=null)return e.getDimensionIndex(n);for(var r=e.dimensions,i=r.length-1;i>=0;i--){var a=r[i],o=e.getDimensionInfo(a);if(!o.isCalculationCoord)return o.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var e=this.ecModel,t=this.option,n={inRange:t.inRange,outOfRange:t.outOfRange},r=t.target||={},i=t.controller||={};O(r,n),O(i,n);var a=this.isCategory();o.call(this,r),o.call(this,i),s.call(this,r,`inRange`,`outOfRange`),c.call(this,i);function o(n){oH(t.color)&&!n.inRange&&(n.inRange={color:t.color.slice().reverse()}),n.inRange=n.inRange||{color:e.get(`gradientColor`)}}function s(e,t,n){var r=e[t],i=e[n];r&&!i&&(i=e[n]={},sH(r,function(e,t){if(EF.isValidType(t)){var n=nH.get(t,`inactive`,a);n!=null&&(i[t]=n,t===`color`&&!i.hasOwnProperty(`opacity`)&&!i.hasOwnProperty(`colorAlpha`)&&(i.opacity=[0,0]))}}))}function c(e){var t=(e.inRange||{}).symbol||(e.outOfRange||{}).symbol,n=(e.inRange||{}).symbolSize||(e.outOfRange||{}).symbolSize,r=this.get(`inactiveColor`),i=this.getItemSymbol()||`roundRect`;sH(this.stateList,function(o){var s=this.itemSize,c=e[o];c||=e[o]={color:a?r:[r]},c.symbol??=t&&D(t)||(a?i:[i]),c.symbolSize??=n&&D(n)||(a?s[0]:[s[0],s[0]]),c.symbol=iH(c.symbol,function(e){return e===`none`?i:e});var l=c.symbolSize;if(l!=null){var u=-1/0;aH(l,function(e){e>u&&(u=e)}),c.symbolSize=iH(l,function(e){return lH(e,[0,u],[0,s[0]],!0)})}},this)}},t.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get(`itemWidth`)),parseFloat(this.get(`itemHeight`))]},t.prototype.isCategory=function(){return!!this.option.categories},t.prototype.setSelected=function(e){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(e){return null},t.prototype.getVisualMeta=function(e){return null},t.type=`visualMap`,t.dependencies=[`series`],t.defaultOption={show:!0,z:4,min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:`vertical`,backgroundColor:Y.color.transparent,borderColor:Y.color.borderTint,contentColor:Y.color.theme[0],inactiveColor:Y.color.disabled,borderWidth:0,padding:Y.size.m,textGap:10,precision:0,textStyle:{color:Y.color.secondary}},t}(__),dH=function(e){i(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.autoPositionValues={left:1,right:1,top:1,bottom:1},n}return t.prototype.init=function(e,t){this.ecModel=e,this.api=t},t.prototype.render=function(e,t,n,r){if(this.visualMapModel=e,e.get(`show`)===!1){this.group.removeAll();return}this.doRender(e,t,n,r)},t.prototype.renderBackground=function(e){var t=this.visualMapModel,n=Wg(t.get(`padding`)||0),r=e.getBoundingRect();e.add(new Ro({z2:-1,silent:!0,shape:{x:r.x-n[3],y:r.y-n[0],width:r.width+n[3]+n[1],height:r.height+n[0]+n[2]},style:{fill:t.get(`backgroundColor`),stroke:t.get(`borderColor`),lineWidth:t.get(`borderWidth`)}}))},t.prototype.getControllerVisual=function(e,t,n){n||={};var r=n.forceState,i=this.visualMapModel,a={};t===`color`&&(a.color=i.get(`contentColor`));function o(e){return a[e]}function s(e,t){a[e]=t}var c=i.controllerVisuals[r||i.getValueState(e)];return F(EF.prepareVisualTypes(c),function(r){var i=c[r];n.convertOpacityToAlpha&&r===`opacity`&&(r=`colorAlpha`,i=c.__alphaForOpacity),EF.dependsOn(r,t)&&i&&i.applyVisual(e,o,s)}),a[t]},t.prototype.positionGroup=function(e){var t=this.visualMapModel,n=this.api,r=l_(t,n).refContainer;u_(e,t.getBoxLayoutParams(),r)},t.prototype.doRender=function(e,t,n,r){},t.type=`visualMap`,t}(_O),fH=[[`left`,`right`,`width`],[`top`,`bottom`,`height`]];function pH(e,t,n){var r=e.option,i=r.align;if(i!=null&&i!==`auto`)return i;for(var a={width:t.getWidth(),height:t.getHeight()},o=+(r.orient===`horizontal`),s=fH[o],c=[0,null,10],l={},u=0;u<3;u++)l[fH[1-o][u]]=c[u],l[s[u]]=u===2?n[0]:r[s[u]];var d=[[`x`,`width`,3],[`y`,`height`,0]][o],f=s_(l,a,r.padding);return s[(f.margin[d[2]]||0)+f[d[0]]+f[d[1]]*.5<a[d[1]]*.5?0:1]}function mH(e,t){return F(e||[],function(e){e.dataIndex!=null&&(e.dataIndexInside=e.dataIndex,e.dataIndex=null),e.highlightKey=`visualMap`+(t?t.componentIndex:``)}),e}var hH={type:`selectDataRange`,event:`dataRangeSelected`,update:`update`},gH=function(e,t){t.eachComponent({mainType:`visualMap`,query:e},function(t){t.setSelected(e.selected)})},_H=[{createOnAllSeries:!0,reset:function(e,t){var n=[];return t.eachComponent(`visualMap`,function(t){var r=e.pipelineContext;!t.isTargetSeries(e)||r&&r.large||n.push(SB(t.stateList,t.targetVisuals,z(t.getValueState,t),t.getDataDimensionIndex(e.getData())))}),n}},{createOnAllSeries:!0,reset:function(e,t){var n=e.getData(),r=[];t.eachComponent(`visualMap`,function(t){if(t.isTargetSeries(e)){var i=t.getVisualMeta(z(vH,null,e,t))||{stops:[],outerColors:[]},a=t.getDataDimensionIndex(n);a>=0&&(i.dimension=a,r.push(i))}}),e.getData().setVisual(`visualMeta`,r)}}];function vH(e,t,n,r){for(var i=t.targetVisuals[r],a=EF.prepareVisualTypes(i),o={color:ek(e.getData(),`color`)},s=0,c=a.length;s<c;s++){var l=a[s],u=i[l===`opacity`?`__alphaForOpacity`:l];u&&u.applyVisual(n,d,f)}return o.color;function d(e){return o[e]}function f(e,t){o[e]=t}}var yH=F;function bH(e){var t=e&&e.visualMap;B(t)||(t=t?[t]:[]),yH(t,function(e){if(e){xH(e,`splitList`)&&!xH(e,`pieces`)&&(e.pieces=e.splitList,delete e.splitList);var t=e.pieces;t&&B(t)&&yH(t,function(e){U(e)&&(xH(e,`start`)&&!xH(e,`min`)&&(e.min=e.start),xH(e,`end`)&&!xH(e,`max`)&&(e.max=e.end))})}})}function xH(e,t){return e&&e.hasOwnProperty&&e.hasOwnProperty(t)}var SH=!1;function CH(e){SH||(SH=!0,e.registerSubTypeDefaulter(`visualMap`,function(e){return!e.categories&&(!(e.pieces?e.pieces.length>0:e.splitNumber>0)||e.calculable)?`continuous`:`piecewise`}),e.registerAction(hH,gH),F(_H,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(bH))}var wH=function(e){i(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._pieceList=[],n}return t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var r=this._mode=this._determineMode();this._pieceList=[],TH[this._mode].call(this,this._pieceList),this._resetSelected(t,n);var i=this.option.categories;this.resetVisual(function(e,t){r===`categories`?(e.mappingMethod=`category`,e.categories=D(i)):(e.dataExtent=this.getExtent(),e.mappingMethod=`piecewise`,e.pieceList=I(this._pieceList,function(e){return e=D(e),t!==`inRange`&&(e.visual=null),e}))})},t.prototype.completeVisualOption=function(){var t=this.option,n={},r=EF.listVisualTypes(),i=this.isCategory();F(t.pieces,function(e){F(r,function(t){e.hasOwnProperty(t)&&(n[t]=1)})}),F(n,function(e,n){var r=!1;F(this.stateList,function(e){r=r||a(t,e,n)||a(t.target,e,n)},this),!r&&F(this.stateList,function(e){(t[e]||(t[e]={}))[n]=nH.get(n,e===`inRange`?`active`:`inactive`,i)})},this);function a(e,t,n){return e&&e[t]&&e[t].hasOwnProperty(n)}e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(e,t){var n=this.option,r=this._pieceList,i=(t?n:e).selected||{};if(n.selected=i,F(r,function(e,t){var n=this.getSelectedMapKey(e);i.hasOwnProperty(n)||(i[n]=!0)},this),n.selectedMode===`single`){var a=!1;F(r,function(e,t){var n=this.getSelectedMapKey(e);i[n]&&(a?i[n]=!1:a=!0)},this)}},t.prototype.getItemSymbol=function(){return this.get(`itemSymbol`)},t.prototype.getSelectedMapKey=function(e){return this._mode===`categories`?e.value+``:e.index+``},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var e=this.option;return e.pieces&&e.pieces.length>0?`pieces`:this.option.categories?`categories`:`splitNumber`},t.prototype.setSelected=function(e){this.option.selected=D(e)},t.prototype.getValueState=function(e){var t=EF.findPieceIndex(e,this._pieceList);return t==null?`outOfRange`:this.option.selected[this.getSelectedMapKey(this._pieceList[t])]?`inRange`:`outOfRange`},t.prototype.findTargetDataIndices=function(e){var t=[],n=this._pieceList;return this.eachTargetSeries(function(r){var i=[],a=r.getData();a.each(this.getDataDimensionIndex(a),function(t,r){EF.findPieceIndex(t,n)===e&&i.push(r)},this),t.push({seriesId:r.id,dataIndex:i})},this),t},t.prototype.getRepresentValue=function(e){var t;if(this.isCategory())t=e.value;else if(e.value!=null)t=e.value;else{var n=e.interval||[];t=n[0]===-1/0&&n[1]===1/0?0:(n[0]+n[1])/2}return t},t.prototype.getVisualMeta=function(e){if(this.isCategory())return;var t=[],n=[``,``],r=this;function i(i,a){var o=r.getRepresentValue({interval:i});a||=r.getValueState(o);var s=e(o,a);i[0]===-1/0?n[0]=s:i[1]===1/0?n[1]=s:t.push({value:i[0],color:s},{value:i[1],color:s})}var a=this._pieceList.slice();if(!a.length)a.push({interval:[-1/0,1/0]});else{var o=a[0].interval[0];o!==-1/0&&a.unshift({interval:[-1/0,o]}),o=a[a.length-1].interval[1],o!==1/0&&a.push({interval:[o,1/0]})}var s=-1/0;return F(a,function(e){var t=e.interval;t&&(t[0]>s&&i([s,t[0]],`outOfRange`),i(t.slice()),s=t[1])},this),{stops:t,outerColors:n}},t.type=`visualMap.piecewise`,t.defaultOption=Dh(uH.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:`auto`,itemWidth:20,itemHeight:14,itemSymbol:`roundRect`,pieces:null,categories:null,splitNumber:5,selectedMode:`multiple`,itemGap:10,hoverLink:!0}),t}(uH),TH={splitNumber:function(e){var t=this.option,n=Math.min(t.precision,20),r=this.getExtent(),i=t.splitNumber;i=Math.max(parseInt(i,10),1),t.splitNumber=i;for(var a=(r[1]-r[0])/i;+a.toFixed(n)!==a&&n<5;)n++;t.precision=n,a=+a.toFixed(n),t.minOpen&&e.push({interval:[-1/0,r[0]],close:[0,0]});for(var o=0,s=r[0];o<i;s+=a,o++){var c=o===i-1?r[1]:s+a;e.push({interval:[s,c],close:[1,1]})}t.maxOpen&&e.push({interval:[r[1],1/0],close:[0,0]}),Ls(e),F(e,function(e,t){e.index=t,e.text=this.formatValueText(e.interval)},this)},categories:function(e){var t=this.option;F(t.categories,function(t){e.push({text:this.formatValueText(t,!0),value:t})},this),EH(t,e)},pieces:function(e){var t=this.option;F(t.pieces,function(t,n){U(t)||(t={value:t});var r={text:``,index:n};if(t.label!=null&&(r.text=t.label),t.hasOwnProperty(`value`)){var i=r.value=t.value;r.interval=[i,i],r.close=[1,1]}else{for(var a=r.interval=[],o=r.close=[0,0],s=[1,0,1],c=[-1/0,1/0],l=[],u=0;u<2;u++){for(var d=[[`gte`,`gt`,`min`],[`lte`,`lt`,`max`]][u],f=0;f<3&&a[u]==null;f++)a[u]=t[d[f]],o[u]=s[f],l[u]=f===2;a[u]??(a[u]=c[u])}l[0]&&a[1]===1/0&&(o[0]=0),l[1]&&a[0]===-1/0&&(o[1]=0),a[0]===a[1]&&o[0]&&o[1]&&(r.value=a[0])}r.visual=EF.retrieveVisuals(t),e.push(r)},this),EH(t,e),Ls(e),F(e,function(e){var t=e.close,n=[[`<`,`≤`][t[1]],[`>`,`≥`][t[0]]];e.text=e.text||this.formatValueText(e.value==null?e.interval:e.value,!1,n)},this)}};function EH(e,t){var n=e.inverse;(e.orient===`vertical`?!n:n)&&t.reverse()}var DH=function(e){i(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.doRender=function(){var e=this.group;e.removeAll();var t=this.visualMapModel,n=t.get(`textGap`),r=t.textStyleModel,i=this._getItemAlign(),a=t.itemSize,o=this._getViewData(),s=o.endsText,c=pe(t.get(`showLabel`,!0),!s),l=!t.get(`selectedMode`);s&&this._renderEndsText(e,s[0],a,c,i),F(o.viewPieceList,function(o){var s=o.piece,u=new Bu;u.onclick=z(this._onItemClick,this,s),this._enableHoverLink(u,o.indexInModelPieceList);var d=t.getRepresentValue(s);if(this._createItemSymbol(u,d,[0,0,a[0],a[1]],l),c){var f=this.visualMapModel.getValueState(d),p=r.get(`align`)||i;u.add(new Uo({style:Xf(r,{x:p===`right`?-n:a[0]+n,y:a[1]/2,text:s.text,verticalAlign:r.get(`verticalAlign`)||`middle`,align:p,opacity:W(r.get(`opacity`),f===`outOfRange`?.5:1)}),silent:l}))}e.add(u)},this),s&&this._renderEndsText(e,s[1],a,c,i),r_(t.get(`orient`),e,t.get(`itemGap`)),this.renderBackground(e),this.positionGroup(e)},t.prototype._enableHoverLink=function(e,t){var n=this;e.on(`mouseover`,function(){return r(`highlight`)}).on(`mouseout`,function(){return r(`downplay`)});var r=function(e){var r=n.visualMapModel;r.option.hoverLink&&n.api.dispatchAction({type:e,batch:mH(r.findTargetDataIndices(t),r)})}},t.prototype._getItemAlign=function(){var e=this.visualMapModel,t=e.option;if(t.orient===`vertical`)return pH(e,this.api,e.itemSize);var n=t.align;return(!n||n===`auto`)&&(n=`left`),n},t.prototype._renderEndsText=function(e,t,n,r,i){if(t){var a=new Bu,o=this.visualMapModel.textStyleModel;a.add(new Uo({style:Xf(o,{x:r?i===`right`?n[0]:0:n[0]/2,y:n[1]/2,verticalAlign:`middle`,align:r?i:`center`,text:t})})),e.add(a)}},t.prototype._getViewData=function(){var e=this.visualMapModel,t=I(e.getPieceList(),function(e,t){return{piece:e,indexInModelPieceList:t}}),n=e.get(`text`),r=e.get(`orient`),i=e.get(`inverse`);return(r===`horizontal`?i:!i)?t.reverse():n&&=n.slice().reverse(),{viewPieceList:t,endsText:n}},t.prototype._createItemSymbol=function(e,t,n,r){var i=Fv(this.getControllerVisual(t,`symbol`),n[0],n[1],n[2],n[3],this.getControllerVisual(t,`color`));i.silent=r,e.add(i)},t.prototype._onItemClick=function(e){var t=this.visualMapModel,n=t.option,r=n.selectedMode;if(r){var i=D(n.selected),a=t.getSelectedMapKey(e);r===`single`||r===!0?(i[a]=!0,F(i,function(e,t){i[t]=t===a})):i[a]=!i[a],this.api.dispatchAction({type:`selectDataRange`,from:this.uid,visualMapId:this.visualMapModel.id,selected:i})}},t.type=`visualMap.piecewise`,t}(dH);function OH(e){e.registerComponentModel(wH),e.registerComponentView(DH),CH(e)}function kH(e){if(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].slice());return t}}function AH(e,t){var n=e.label,r=t&&t.getTextGuideLine();return{dataIndex:e.dataIndex,dataType:e.dataType,seriesIndex:e.seriesModel.seriesIndex,text:e.label.style.text,rect:e.hostRect,labelRect:e.rect,align:n.style.align,verticalAlign:n.style.verticalAlign,labelLinePoints:kH(r&&r.shape.points)}}var jH=[`align`,`verticalAlign`,`width`,`height`,`fontSize`],MH=new Kn,NH=yc(),PH=yc();function FH(e,t,n){for(var r=0;r<n.length;r++){var i=n[r];t[i]!=null&&(e[i]=t[i])}}var IH=[`x`,`y`,`rotation`],LH=function(){function e(){this._labelList=[],this._chartViewList=[]}return e.prototype.clearLabels=function(){this._labelList=[],this._chartViewList=[]},e.prototype._addLabel=function(e,t,n,r,i){var a=r.style,o=r.__hostTarget.textConfig||{},s=r.getComputedTransform(),c=r.getBoundingRect().plain();q.applyTransform(c,c,s),s?MH.setLocalTransform(s):(MH.x=MH.y=MH.rotation=MH.originX=MH.originY=0,MH.scaleX=MH.scaleY=1),MH.rotation=ro(MH.rotation);var l=r.__hostTarget,u;if(l){u=l.getBoundingRect().plain();var d=l.getComputedTransform();q.applyTransform(u,u,d)}var f=u&&l.getTextGuideLine();this._labelList.push({label:r,labelLine:f,seriesModel:n,dataIndex:e,dataType:t,layoutOptionOrCb:i,layoutOption:null,rect:c,hostRect:u,priority:u?u.width*u.height:0,defaultAttr:{ignore:r.ignore,labelGuideIgnore:f&&f.ignore,x:MH.x,y:MH.y,scaleX:MH.scaleX,scaleY:MH.scaleY,rotation:MH.rotation,style:{x:a.x,y:a.y,align:a.align,verticalAlign:a.verticalAlign,width:a.width,height:a.height,fontSize:a.fontSize},cursor:r.cursor,attachedPos:o.position,attachedRot:o.rotation}})},e.prototype.addLabelsOfSeries=function(e){var t=this;this._chartViewList.push(e);var n=e.__model,r=n.get(`labelLayout`);(V(r)||R(r).length)&&e.group.traverse(function(e){if(e.ignore)return!0;var i=e.getTextContent(),a=Xc(e);i&&!i.disableLabelLayout&&t._addLabel(a.dataIndex,a.dataType,n,i,r)})},e.prototype.updateLayoutConfig=function(e){var t=e.getWidth(),n=e.getHeight();function r(e,t){return function(){ET(e,t)}}for(var i=0;i<this._labelList.length;i++){var a=this._labelList[i],o=a.label,s=o.__hostTarget,c=a.defaultAttr,l=void 0;l=V(a.layoutOptionOrCb)?a.layoutOptionOrCb(AH(a,s)):a.layoutOptionOrCb,l||={},a.layoutOption=l;var u=Math.PI/180;s&&s.setTextConfig({local:!1,position:l.x!=null||l.y!=null?null:c.attachedPos,rotation:l.rotate==null?c.attachedRot:l.rotate*u,offset:[l.dx||0,l.dy||0]});var d=!1;if(l.x==null?(o.x=c.x,o.setStyle(`x`,c.style.x)):(o.x=J(l.x,t),o.setStyle(`x`,0),d=!0),l.y==null?(o.y=c.y,o.setStyle(`y`,c.style.y)):(o.y=J(l.y,n),o.setStyle(`y`,0),d=!0),l.labelLinePoints){var f=s.getTextGuideLine();f&&(f.setShape({points:l.labelLinePoints}),d=!1)}var p=NH(o);p.needsUpdateLabelLine=d,o.rotation=l.rotate==null?c.rotation:l.rotate*u,o.scaleX=c.scaleX,o.scaleY=c.scaleY;for(var m=0;m<jH.length;m++){var h=jH[m];o.setStyle(h,l[h]==null?c.style[h]:l[h])}if(l.draggable){if(o.draggable=!0,o.cursor=`move`,s){var g=a.seriesModel;a.dataIndex!=null&&(g=a.seriesModel.getData(a.dataType).getItemModel(a.dataIndex)),o.on(`drag`,r(s,g.getModel(`labelLine`)))}}else o.off(`drag`),o.cursor=c.cursor}},e.prototype.layout=function(e){var t=e.getWidth(),n=e.getHeight(),r=[];F(this._labelList,function(e){e.defaultAttr.ignore||r.push(DS({},e))});var i=L(r,function(e){return e.layoutOption.moveOverlap===`shiftX`}),a=L(r,function(e){return e.layoutOption.moveOverlap===`shiftY`});kS(i,0,0,t),kS(a,1,0,n);var o=L(r,function(e){return e.layoutOption.hideOverlap});AS(o),jS(o)},e.prototype.processLabelsOverall=function(){var e=this;F(this._chartViewList,function(t){var n=t.__model,r=t.ignoreLabelLineUpdate,i=n.isAnimationEnabled();t.group.traverse(function(t){if(t.ignore&&!t.forceLabelAnimation)return!0;var a=!r,o=t.getTextContent();!a&&o&&(a=NH(o).needsUpdateLabelLine),a&&e._updateLabelLine(t,n),i&&e._animateLabels(t,n)})})},e.prototype._updateLabelLine=function(e,t){var n=e.getTextContent(),r=Xc(e),i=r.dataIndex;if(n&&i!=null){var a=t.getData(r.dataType),o=a.getItemModel(i),s={},c=a.getItemVisual(i,`style`);c&&(s.stroke=c[a.getVisual(`drawType`)]);var l=o.getModel(`labelLine`);NT(e,PT(o),s),ET(e,l)}},e.prototype._animateLabels=function(e,t){var n=e.getTextContent(),r=e.getTextGuideLine();if(n&&(e.forceLabelAnimation||!n.ignore&&!n.invisible&&!e.disableLabelAnimation&&!Gd(e))){var i=NH(n),a=i.oldLayout,o=Xc(e),s=o.dataIndex,c={x:n.x,y:n.y,rotation:n.rotation},l=t.getData(o.dataType);if(a){n.attr(a);var u=e.prevStates;u&&(M(u,`select`)>=0&&n.attr(i.oldLayoutSelect),M(u,`emphasis`)>=0&&n.attr(i.oldLayoutEmphasis)),Ud(n,c,t,s)}else if(n.attr(c),!ap(n).valueAnimation){var d=W(n.style.opacity,1);n.style.opacity=0,Wd(n,{style:{opacity:d}},t,s)}if(i.oldLayout=c,n.states.select){var f=i.oldLayoutSelect={};FH(f,c,IH),FH(f,n.states.select,IH)}if(n.states.emphasis){var p=i.oldLayoutEmphasis={};FH(p,c,IH),FH(p,n.states.emphasis,IH)}sp(n,s,l,t,t)}if(r&&!r.ignore&&!r.invisible){var i=PH(r),a=i.oldLayout,m={points:r.shape.points};a?(r.attr({shape:a}),Ud(r,{shape:m},t)):(r.setShape(m),r.style.strokePercent=0,Wd(r,{style:{strokePercent:1}},t)),i.oldLayout=m}},e}(),RH=yc();function zH(e){e.registerUpdateLifecycle(`series:beforeupdate`,function(e,t,n){var r=RH(t).labelManager;r||=RH(t).labelManager=new LH,r.clearLabels()}),e.registerUpdateLifecycle(`series:layoutlabels`,function(e,t,n){var r=RH(t).labelManager;F(n.updatedSeries,function(e){r.addLabelsOfSeries(t.getViewOfSeriesModel(e))}),r.updateLayoutConfig(t),r.layout(t),r.processLabelsOverall()})}var BH=function(){function e(t,n){Fy(this,e.decoratedMethods),this._outOfBrk=Vy(null,n);var r=this._linear=Vy(null,n);Iy(this,r),this.breaks=t&&t.breaks||[]}return e.prototype.hasBreaks=function(){return!!this.breaks.length},e.prototype.calcNiceTickMultiple=function(e,t){for(var n=0;n<this.breaks.length;n++){var r=this.breaks[n];if(r.vmin<e&&e<r.vmax)return t(e,r.vmax)}return 0},e.decoratedMethods={needTransform:function(){return!this.breaks.length},getExtent:function(){return this._outOfBrk.getExtent()},getExtentUnsafe:function(e,t){return t==null||t===2?this._outOfBrk.getExtentUnsafe(e,null):this._linear.getExtentUnsafe(e,null)},setExtent:function(e,t){this.setExtent2(0,e,t)},setExtent2:function(e,t,n){Rc(t,n)&&(e===0&&WH(this,[t,n]),this._outOfBrk.setExtent2(e,t,n),this._linear.setExtent2(e,this.transformIn(t,null),this.transformIn(n,null)))},normalize:function(e){return this._linear.normalize(this.transformIn(e,null))},scale:function(e){return this.transformOut(this._linear.scale(e),null)},contain:function(e){return this._outOfBrk.contain(e)},transformIn:function(e,t){if(t&&t.depth===2)return e;for(var n=HH,r=UH,i=!0,a=0;a<this.breaks.length;a++){var o=this.breaks[a];if(e<=o.vmax){e>o.vmin?n+=o.vmin-r+(e-o.vmin)/(o.vmax-o.vmin)*o.gapReal:n+=e-r,r=o.vmax,i=!1;break}n+=o.vmin-r+o.gapReal,r=o.vmax}return i&&(n+=e-r),n},transformOut:function(e,t){if(t&&t.depth===2)return e;for(var n=HH,r=UH,i=!0,a=0,o=0;o<this.breaks.length;o++){var s=this.breaks[o],c=n+s.vmin-r,l=c+s.gapReal;if(e<=l){a=e>c?s.vmin+(e-c)/(l-c)*(s.vmax-s.vmin):r+e-n,r=s.vmax,i=!1;break}n=l,r=s.vmax}return i&&(a=r+e-n),a}},e}();function VH(e,t){return new BH(e,t)}var HH=0,UH=0;function WH(e,t){var n=0,r={tpAbs:{span:0,val:0},tpPrct:{span:0,val:0}},i=function(){return{has:!1,span:NaN,inExtFrac:NaN,val:NaN}},a={S:{tpAbs:i(),tpPrct:i()},E:{tpAbs:i(),tpPrct:i()}};F(e.breaks,function(e){var i=e.gapParsed;i.type===`tpPrct`&&(n+=i.val);var o=qH(e,t);if(o){var s=o.vmin!==e.vmin,c=o.vmax!==e.vmax,l=o.vmax-o.vmin;if(!(s&&c))if(s||c){var u=s?`S`:`E`;a[u][i.type].has=!0,a[u][i.type].span=l,a[u][i.type].inExtFrac=l/(e.vmax-e.vmin),a[u][i.type].val=i.val}else r[i.type].span+=l,r[i.type].val+=i.val}});var o=n*(0+(t[1]-t[0])+(r.tpAbs.val-r.tpAbs.span)+(a.S.tpAbs.has?(a.S.tpAbs.val-a.S.tpAbs.span)*a.S.tpAbs.inExtFrac:0)+(a.E.tpAbs.has?(a.E.tpAbs.val-a.E.tpAbs.span)*a.E.tpAbs.inExtFrac:0)-r.tpPrct.span-(a.S.tpPrct.has?a.S.tpPrct.span*a.S.tpPrct.inExtFrac:0)-(a.E.tpPrct.has?a.E.tpPrct.span*a.E.tpPrct.inExtFrac:0))/(1-r.tpPrct.val-(a.S.tpPrct.has?a.S.tpPrct.val*a.S.tpPrct.inExtFrac:0)-(a.E.tpPrct.has?a.E.tpPrct.val*a.E.tpPrct.inExtFrac:0));F(e.breaks,function(e){var t=e.gapParsed;t.type===`tpPrct`&&(e.gapReal=n===0?0:ss(o,0)*t.val/n),t.type===`tpAbs`&&(e.gapReal=t.val),e.gapReal??=0})}function GH(e,t,n,r,i,a){e!==`no`&&F(n,function(n){var o=qH(n,a);if(o)for(var s=t.length-1;s>=0;s--){var c=t[s],l=r(c),u=i*3/4;l>o.vmin-u&&l<o.vmax+u&&(e!==`preserve_extent_bound`||l!==a[0]&&l!==a[1])&&t.splice(s,1)}})}function KH(e,t,n,r){F(t,function(t){var i=qH(t,n);i&&(e.push({value:i.vmin,break:{type:`vmin`,parsedBreak:i},time:r?r(i):void 0}),e.push({value:i.vmax,break:{type:`vmax`,parsedBreak:i},time:r?r(i):void 0}))}),t.length&&e.sort(function(e,t){return e.value-t.value})}function qH(e,t){var n=ss(e.vmin,t[0]),r=os(e.vmax,t[1]);return n<r||n===r&&n>t[0]&&n<t[1]?{vmin:n,vmax:r,breakOption:e.breakOption,gapParsed:e.gapParsed,gapReal:e.gapReal}:null}function JH(e,t,n){var r=[];if(!e)return{breaks:r};function i(e,t){return e>=0&&e<.99999}F(e,function(e){if(!(!e||e.start==null||e.end==null)&&!e.isExpanded){var a={breakOption:D(e),vmin:t.parse(e.start),vmax:t.parse(e.end),gapParsed:{type:`tpAbs`,val:0},gapReal:null};if(e.gap!=null){var o=!1;if(H(e.gap)){var s=ve(e.gap);if(s.match(/%$/)){var c=parseFloat(s)/100;i(c,`Percent gap`)||(c=0),a.gapParsed.type=`tpPrct`,a.gapParsed.val=c,o=!0}}if(!o){var l=t.parse(e.gap);(!isFinite(l)||l<0)&&(l=0),a.gapParsed.type=`tpAbs`,a.gapParsed.val=l}}if(a.vmin===a.vmax&&(a.gapParsed.type=`tpAbs`,a.gapParsed.val=0),n&&n.noNegative&&F([`vmin`,`vmax`],function(e){a[e]<0&&(a[e]=0)}),a.vmin>a.vmax){var u=a.vmax;a.vmax=a.vmin,a.vmin=u}r.push(a)}}),r.sort(function(e,t){return e.vmin-t.vmin});var a=-1/0;return F(r,function(e,t){a>e.vmin&&(r[t]=null),a=e.vmax}),{breaks:L(r,function(e){return!!e})}}function YH(e,t){return XH(t)===XH(e)}function XH(e){return e.start+`_\0_`+e.end}function ZH(e,t,n){var r=[];F(e,function(e,n){var i=t(e);i&&i.type===`vmin`&&r.push([n])}),F(e,function(n,i){var a=t(n);if(a&&a.type===`vmax`){var o=ne(r,function(n){return YH(t(e[n[0]]).parsedBreak.breakOption,a.parsedBreak.breakOption)});o&&o.push(i)}});var i=[];return F(r,function(t){t.length===2&&i.push(n?t:[e[t[0]],e[t[1]]])}),i}function QH(e,t,n,r){if(t.break){var i=t.break.parsedBreak,a=ne(n,function(e){return YH(e.breakOption,t.break.parsedBreak.breakOption)}),o={lookup:r,depth:2},s={vmin:e.transformOut(i.vmin,o),vmax:e.transformOut(i.vmax,o),breakOption:i.breakOption,gapParsed:D(a.gapParsed),gapReal:i.gapReal};return{tickVal:s[t.break.type],vBreak:{type:t.break.type,parsedBreak:s}}}}function $H(e,t,n,r,i){i.original=JH(e,t,n);var a=i.transformed=JH(e,t,n),o=i.lookup;a.breaks=I(a.breaks,function(e,n){var i={depth:2},a=t.transformIn(e.vmin,i),s=t.transformIn(e.vmax,i),c={type:e.gapParsed.type,val:e.gapParsed.type===`tpAbs`?t.transformIn(e.vmin+e.gapParsed.val,i)-a:e.gapParsed.val};return o.from[r+n]=a,o.to[r+n]=e.vmin,o.from[r+n+1]=s,o.to[r+n+1]=e.vmax,{vmin:a,vmax:s,gapParsed:c,gapReal:e.gapReal,breakOption:e.breakOption}})}var eU={vmin:`start`,vmax:`end`};function tU(e,t){return t&&(e||={},e.break={type:eU[t.type],start:t.parsedBreak.vmin,end:t.parsedBreak.vmax}),e}function nU(){tg({createBreakScaleMapper:VH,pruneTicksByBreak:GH,addBreaksToTicks:KH,parseAxisBreakOption:JH,identifyAxisBreak:YH,serializeAxisBreakIdentifier:XH,retrieveAxisBreakPairs:ZH,getTicksBreakOutwardTransform:QH,parseAxisBreakOptionInwardTransform:$H,makeAxisLabelFormatterParamBreak:tU})}var rU=yc();function iU(e,t){var n=ne(e,function(e){return ng().identifyAxisBreak(e.parsedBreak.breakOption,t.breakOption)});return n||e.push(n={zigzagRandomList:[],parsedBreak:t,shouldRemove:!1}),n}function aU(e){F(e,function(e){return e.shouldRemove=!0})}function oU(e){for(var t=e.length-1;t>=0;t--)e[t].shouldRemove&&e.splice(t,1)}function sU(e,t,n,r,i){var a=n.axis;if(a.scale.isBlank()||!ng())return;var o=ng().retrieveAxisBreakPairs(a.scale.getTicks({breakTicks:`only_break`}),function(e){return e.break},!1);if(!o.length)return;var s=n.getModel(`breakArea`),c=s.get(`zigzagAmplitude`),l=s.get(`zigzagMinSpan`),u=s.get(`zigzagMaxSpan`);l=Math.max(2,l||0),u=Math.max(l,u||0);var d=s.get(`expandOnClick`),f=s.get(`zigzagZ`),p=s.getModel(`itemStyle`).getItemStyle(),m=p.stroke,h=p.lineWidth,g=p.lineDash,_=p.fill,v=new Bu({ignoreModelZ:!0}),y=a.isHorizontal(),b=rU(t).visualList||(rU(t).visualList=[]);aU(b);for(var x=function(e){var t=o[e][0].break.parsedBreak,r=[];r[0]=a.toGlobalCoord(a.dataToCoord(t.vmin,!0)),r[1]=a.toGlobalCoord(a.dataToCoord(t.vmax,!0)),r[1]<r[0]&&r.reverse();var s=iU(b,t);s.shouldRemove=!1;var c=new Bu;C(s.zigzagRandomList,c,r[0],r[1],y,t),d&&c.on(`click`,function(){var e={type:IS,breaks:[{start:t.breakOption.start,end:t.breakOption.end}]};e[a.dim+`AxisIndex`]=n.componentIndex,i.dispatchAction(e)}),c.silent=!d,v.add(c)},S=0;S<o.length;S++)x(S);e.add(v),oU(b);function C(e,t,n,i,a,o){var s={stroke:m,lineWidth:h,lineDash:g,fill:`none`},d=+!a,v=1-d,y=r[Qd[v]]+r[$d[v]];function b(e){var t=[],n=[];t[d]=n[d]=e,t[v]=r[Qd[v]],n[v]=y;var i={x1:t[0],y1:t[1],x2:n[0],y2:n[1]};return No(i,i,{lineWidth:1}),t[0]=i.x1,t[1]=i.y1,t[d]}n=b(n),i=b(i);for(var x=[],S=[],C=!0,w=r[Qd[v]],T=0;;T++){var E=w===r[Qd[v]],D=w>=y;D&&(w=y);var O=[],k=[];O[d]=n,k[d]=i,!E&&!D&&(O[d]+=C?-c:c,k[d]-=C?c:-c),O[v]=w,k[v]=w,x.push(O),S.push(k);var A=void 0;if(T<e.length?A=e[T]:(A=Math.random(),e.push(A)),w+=A*(u-l)+l,C=!C,D)break}var j=ng().serializeAxisBreakIdentifier(o.breakOption);if(t.add(new hd({anid:`break_a_`+j,shape:{points:x},style:s,z:f})),o.gapReal!==0){t.add(new hd({anid:`break_b_`+j,shape:{points:S},style:s,z:f}));var M=S.slice();M.reverse();var ee=x.concat(M);t.add(new pd({anid:`break_c_`+j,shape:{points:ee},style:{fill:_,opacity:p.opacity},z:f}))}}}function cU(e,t,n,r){var i=e.axis,a=n.transform;_e(r.style);var o=i.getExtent();i.inverse&&(o=o.slice(),o.reverse());var s=I(ng().retrieveAxisBreakPairs(i.scale.getTicks({breakTicks:`only_break`}),function(e){return e.break},!1),function(e){var t=e[0].break.parsedBreak,n=[i.dataToCoord(t.vmin,!0),i.dataToCoord(t.vmax,!0)];return n[0]>n[1]&&n.reverse(),{coordPair:n,brkId:ng().serializeAxisBreakIdentifier(t.breakOption)}});s.sort(function(e,t){return e.coordPair[0]-t.coordPair[0]});for(var c=o[0],l=null,u=0;u<s.length;u++){var d=s[u],f=Math.max(d.coordPair[0],o[0]),p=Math.min(d.coordPair[1],o[1]);c<=f&&m(c,f,l,d),c=p,l=d}c<=o[1]&&m(c,o[1],l,null);function m(e,n,i,o){function s(e,t){a&&(kt(e,e,a),kt(t,t,a))}function c(e,t){var n={x1:e[0],y1:e[1],x2:t[0],y2:t[1]};No(n,n,r.style),e[0]=n.x1,e[1]=n.y1,t[0]=n.x2,t[1]=n.y2}var l=[e,0],u=[n,0],d=[e,5],f=[n,5];s(l,d),c(l,d),s(u,f),c(u,f),c(l,u);var p=new vd(k({shape:{x1:l[0],y1:l[1],x2:u[0],y2:u[1]}},r));t.add(p),p.anid=`breakLine_`+(i?i.brkId:`\0`)+`_\0_`+(o?o.brkId:`\0`)}}function lU(e,t,n){if(ne(n,function(e){return!e}))return;var r=new K;if(!MS(n[0],n[1],r,{direction:-(e?t+Math.PI:t),touchThreshold:0,bidirectional:!1}))return;var i=ot();dt(i,i,-t);var a=I(n,function(e){return e.transform?lt(ot(),i,e.transform):i});function o(e){var t=n[0].localRect,r=new K(t[$d[e]]*a[0][0],t[$d[e]]*a[0][1]);return Math.abs(r.y)<1e-5}var s=.5;if(o(0)||o(1)){var c=I(n,function(e,t){var n=e.localRect.clone();return n.applyTransform(a[t]),n}),l=new K;l.copy(n[0].label).add(n[1].label).scale(.5),l.transform(i);var u=r.clone().transform(i),d=(c[0].x+c[1].x+(u.x>=0?c[0].width:c[1].width)+u.x)/2-l.x,f=Math.min(d,d-u.x),p=Math.max(d,d-u.x);s=(d-(p<0?p:f>0?f:0))/u.x}var m=new K,h=new K;K.scale(m,r,-s),K.scale(h,r,1-s),ES(n[0],m),ES(n[1],h)}function uU(e,t){var n={breaks:[]};return F(t.breaks,function(r){if(r){var i=ne(e.get(`breaks`,!0),function(e){return ng().identifyAxisBreak(e,r)});if(i){var a=t.type,o={isExpanded:!!i.isExpanded};i.isExpanded=a===`expandAxisBreak`?!0:a===`collapseAxisBreak`?!1:a===`toggleAxisBreak`?!i.isExpanded:i.isExpanded,n.breaks.push({start:i.start,end:i.end,isExpanded:!!i.isExpanded,old:o})}}}),n}function dU(){PS({adjustBreakLabelPair:lU,buildAxisBreakLine:cU,rectCoordBuildBreakAxis:sU,updateModelAxisBreak:uU})}function fU(e){WS(e),nU(),dU()}var pU=Math.sin,mU=Math.cos,hU=Math.PI,gU=Math.PI*2,_U=180/hU,vU=function(){function e(){}return e.prototype.reset=function(e){this._start=!0,this._d=[],this._str=``,this._p=10**(e||4)},e.prototype.moveTo=function(e,t){this._add(`M`,e,t)},e.prototype.lineTo=function(e,t){this._add(`L`,e,t)},e.prototype.bezierCurveTo=function(e,t,n,r,i,a){this._add(`C`,e,t,n,r,i,a)},e.prototype.quadraticCurveTo=function(e,t,n,r){this._add(`Q`,e,t,n,r)},e.prototype.arc=function(e,t,n,r,i,a){this.ellipse(e,t,n,n,0,r,i,a)},e.prototype.ellipse=function(e,t,n,r,i,a,o,s){var c=o-a,l=!s,u=Math.abs(c),d=ei(u-gU)||(l?c>=gU:-c>=gU),f=c>0?c%gU:c%gU+gU,p=!1;p=d?!0:!ei(u)&&f>=hU==!!l;var m=e+n*mU(a),h=t+r*pU(a);this._start&&this._add(`M`,m,h);var g=Math.round(i*_U);if(d){var _=1/this._p,v=(l?1:-1)*(gU-_);this._add(`A`,n,r,g,1,+l,e+n*mU(a+v),t+r*pU(a+v)),_>.01&&this._add(`A`,n,r,g,0,+l,m,h)}else{var y=e+n*mU(o),b=t+r*pU(o);this._add(`A`,n,r,g,+p,+l,y,b)}},e.prototype.rect=function(e,t,n,r){this._add(`M`,e,t),this._add(`l`,n,0),this._add(`l`,0,r),this._add(`l`,-n,0),this._add(`Z`)},e.prototype.closePath=function(){this._d.length>0&&this._add(`Z`)},e.prototype._add=function(e,t,n,r,i,a,o,s,c){for(var l=[],u=this._p,d=1;d<arguments.length;d++){var f=arguments[d];if(isNaN(f)){this._invalid=!0;return}l.push(Math.round(f*u)/u)}this._d.push(e+l.join(` `)),this._start=e===`Z`},e.prototype.generateStr=function(){this._str=this._invalid?``:this._d.join(``),this._d=[]},e.prototype.getStr=function(){return this._str},e}(),yU=`none`,bU=Math.round;function xU(e){var t=e.fill;return t!=null&&t!==yU}function SU(e){var t=e.stroke;return t!=null&&t!==yU}var CU=[`lineCap`,`miterLimit`,`lineJoin`],wU=I(CU,function(e){return`stroke-`+e.toLowerCase()});function TU(e,t,n,r){var i=t.opacity==null?1:t.opacity;if(n instanceof Ao){e(`opacity`,i);return}if(xU(t)){var a=Qr(t.fill);e(`fill`,a.color);var o=t.fillOpacity==null?a.opacity*i:t.fillOpacity*a.opacity*i;(r||o<1)&&e(`fill-opacity`,o)}else e(`fill`,yU);if(SU(t)){var s=Qr(t.stroke);e(`stroke`,s.color);var c=t.strokeNoScale?n.getLineScale():1,l=c?(t.lineWidth||0)/c:0,u=t.strokeOpacity==null?s.opacity*i:t.strokeOpacity*s.opacity*i,d=t.strokeFirst;if((r||l!==1)&&e(`stroke-width`,l),(r||d)&&e(`paint-order`,d?`stroke`:`fill`),(r||u<1)&&e(`stroke-opacity`,u),t.lineDash){var f=bk(n),p=f[0],m=f[1];p&&(m=bU(m||0),e(`stroke-dasharray`,p.join(`,`)),(m||r)&&e(`stroke-dashoffset`,m))}else r&&e(`stroke-dasharray`,yU);for(var h=0;h<CU.length;h++){var g=CU[h];if(r||t[g]!==xo[g]){var _=t[g]||xo[g];_&&e(wU[h],_)}}}else r&&e(`stroke`,yU)}var EU=`http://www.w3.org/2000/svg`,DU=`http://www.w3.org/1999/xlink`,OU=`http://www.w3.org/2000/xmlns/`,kU=`http://www.w3.org/XML/1998/namespace`,AU=`ecmeta_`;function jU(e){return document.createElementNS(EU,e)}function MU(e,t,n,r,i){return{tag:e,attrs:n||{},children:r,text:i,key:t}}function NU(e,t){var n=[];if(t)for(var r in t){var i=t[r],a=r;i!==!1&&(i!==!0&&i!=null&&(a+=`="`+i+`"`),n.push(a))}return`<`+e+` `+n.join(` `)+`>`}function PU(e){return`</`+e+`>`}function FU(e,t){t||={};var n=t.newline?`
19
19
  `:``;function r(e){var t=e.children,i=e.tag,a=e.attrs,o=e.text;return NU(i,a)+(i===`style`?o||``:Vh(o))+(t?``+n+I(t,function(e){return r(e)}).join(n)+n:``)+PU(i)}return r(e)}function IU(e,t,n){n||={};var r=n.newline?`
20
20
  `:``,i=` {`+r,a=r+`}`,o=I(R(e),function(t){return t+i+I(R(e[t]),function(n){return n+`:`+e[t][n]+`;`}).join(r)+a}).join(r),s=I(R(t),function(e){return`@keyframes `+e+i+I(R(t[e]),function(n){return n+i+I(R(t[e][n]),function(r){var i=t[e][n][r];return r===`d`&&(i=`path("`+i+`")`),r+`:`+i+`;`}).join(r)+a}).join(r)+a}).join(r);return!o&&!s?``:[`<![CDATA[`,o,s,`]]>`].join(r)}function LU(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function RU(e,t,n,r){return MU(`svg`,`root`,{width:e,height:t,xmlns:EU,"xmlns:xlink":DU,version:`1.1`,baseProfile:`full`,viewBox:r?`0 0 `+e+` `+t:!1},n)}var zU=0;function BU(){return zU++}var VU={cubicIn:`0.32,0,0.67,0`,cubicOut:`0.33,1,0.68,1`,cubicInOut:`0.65,0,0.35,1`,quadraticIn:`0.11,0,0.5,0`,quadraticOut:`0.5,1,0.89,1`,quadraticInOut:`0.45,0,0.55,1`,quarticIn:`0.5,0,0.75,0`,quarticOut:`0.25,1,0.5,1`,quarticInOut:`0.76,0,0.24,1`,quinticIn:`0.64,0,0.78,0`,quinticOut:`0.22,1,0.36,1`,quinticInOut:`0.83,0,0.17,1`,sinusoidalIn:`0.12,0,0.39,0`,sinusoidalOut:`0.61,1,0.88,1`,sinusoidalInOut:`0.37,0,0.63,1`,exponentialIn:`0.7,0,0.84,0`,exponentialOut:`0.16,1,0.3,1`,exponentialInOut:`0.87,0,0.13,1`,circularIn:`0.55,0,1,0.45`,circularOut:`0,0.55,0.45,1`,circularInOut:`0.85,0,0.15,1`},HU=`transform-origin`;function UU(e,t,n){var r=k({},e.shape);k(r,t),e.buildPath(n,r);var i=new vU;return i.reset(hi(e)),n.rebuildPath(i,1),i.generateStr(),i.getStr()}function WU(e,t){var n=t.originX,r=t.originY;(n||r)&&(e[HU]=n+`px `+r+`px`)}var GU={fill:`fill`,opacity:`opacity`,lineWidth:`stroke-width`,lineDashOffset:`stroke-dashoffset`};function KU(e,t){var n=t.zrId+`-ani-`+t.cssAnimIdx++;return t.cssAnims[n]=e,n}function qU(e,t,n){var r=e.shape.paths,i={},a,o;if(F(r,function(e){var t=LU(n.zrId);t.animation=!0,YU(e,{},t,!0);var r=t.cssAnims,s=t.cssNodes,c=R(r),l=c.length;if(l){o=c[l-1];var u=r[o];for(var d in u){var f=u[d];i[d]=i[d]||{d:``},i[d].d+=f.d||``}for(var p in s){var m=s[p].animation;m.indexOf(o)>=0&&(a=m)}}}),a){t.d=!1;var s=KU(i,n);return a.replace(o,s)}}function JU(e){return H(e)?VU[e]?`cubic-bezier(`+VU[e]+`)`:wr(e)?e:``:``}function YU(e,t,n,r){var i=e.animators,a=i.length,o=[];if(e instanceof Td){var s=qU(e,t,n);if(s)o.push(s);else if(!a)return}else if(!a)return;for(var c={},l=0;l<a;l++){var u=i[l],d=[u.getMaxTime()/1e3+`s`],f=JU(u.getClip().easing),p=u.getDelay();f?d.push(f):d.push(`linear`),p&&d.push(p/1e3+`s`),u.getLoop()&&d.push(`infinite`);var m=d.join(` `);c[m]=c[m]||[m,[]],c[m][1].push(u)}function h(i){var a=i[1],o=a.length,s={},c={},l={},u=`animation-timing-function`;function d(e,t,n){for(var r=e.getTracks(),i=e.getMaxTime(),a=0;a<r.length;a++){var o=r[a];if(o.needsAnimate()){var s=o.keyframes,c=o.propName;if(n&&(c=n(c)),c)for(var l=0;l<s.length;l++){var d=s[l],f=Math.round(d.time/i*100)+`%`,p=JU(d.easing),m=d.rawValue;(H(m)||oe(m))&&(t[f]=t[f]||{},t[f][c]=d.rawValue,p&&(t[f][u]=p))}}}}for(var f=0;f<o;f++){var p=a[f],m=p.targetName;m?m===`shape`&&d(p,c):!r&&d(p,s)}for(var h in s){var g={};Xn(g,e),k(g,s[h]);var _=gi(g),v=s[h][u];l[h]=_?{transform:_}:{},WU(l[h],g),v&&(l[h][u]=v)}var y,b=!0;for(var h in c){l[h]=l[h]||{};var x=!y,v=c[h][u];x&&(y=new Qa);var S=y.len();y.reset(),l[h].d=UU(e,c[h],y);var C=y.len();if(!x&&S!==C){b=!1;break}v&&(l[h][u]=v)}if(!b)for(var h in l)delete l[h].d;if(!r)for(var f=0;f<o;f++){var p=a[f],m=p.targetName;m===`style`&&d(p,l,function(e){return GU[e]})}for(var w=R(l),T=!0,E,f=1;f<w.length;f++){var D=w[f-1],O=w[f];if(l[D][HU]!==l[O][HU]){T=!1;break}E=l[D][HU]}if(T&&E){for(var h in l)l[h][HU]&&delete l[h][HU];t[HU]=E}if(L(w,function(e){return R(l[e]).length>0}).length)return KU(l,n)+` `+i[0]+` both`}for(var g in c){var s=h(c[g]);s&&o.push(s)}if(o.length){var _=n.zrId+`-cls-`+BU();n.cssNodes[`.`+_]={animation:o.join(`,`)},t.class=_}}function XU(e,t,n){if(!e.ignore)if(e.isSilent()){var r={"pointer-events":`none`};ZU(r,t,n,!0)}else{var i=e.states.emphasis&&e.states.emphasis.style?e.states.emphasis.style:{},a=i.fill;if(!a){var o=e.style&&e.style.fill,s=e.states.select&&e.states.select.style&&e.states.select.style.fill,c=e.currentStates.indexOf(`select`)>=0&&s||o;c&&(a=Xr(c))}var l=i.lineWidth;if(l){var u=!i.strokeNoScale&&e.transform?e.transform[0]:1;l/=u}var r={cursor:`pointer`};a&&(r.fill=a),i.stroke&&(r.stroke=i.stroke),l&&(r[`stroke-width`]=l),ZU(r,t,n,!0)}}function ZU(e,t,n,r){var i=JSON.stringify(e),a=n.cssStyleCache[i];a||(a=n.zrId+`-cls-`+BU(),n.cssStyleCache[i]=a,n.cssNodes[`.`+a+(r?`:hover`:``)]=e),t.class=t.class?t.class+` `+a:a}var QU=Math.round;function $U(e){return e&&H(e.src)}function eW(e){return e&&V(e.toDataURL)}function tW(e,t,n,r){TU(function(i,a){var o=i===`fill`||i===`stroke`;o&&pi(a)?gW(t,e,i,r):o&&ui(a)?_W(n,e,i,r):e[i]=a,o&&r.ssr&&a===`none`&&(e[`pointer-events`]=`visible`)},t,n,!1),hW(n,e,r)}function nW(e,t){var n=vD(t);n&&(n.each(function(t,n){t!=null&&(e[(`ecmeta_`+n).toLowerCase()]=t+``)}),t.isSilent()&&(e[AU+`silent`]=`true`))}function rW(e){return ei(e[0]-1)&&ei(e[1])&&ei(e[2])&&ei(e[3]-1)}function iW(e){return ei(e[4])&&ei(e[5])}function aW(e,t,n){if(t&&!(iW(t)&&rW(t))){var r=n?10:1e4;e.transform=rW(t)?`translate(`+QU(t[4]*r)/r+` `+QU(t[5]*r)/r+`)`:ri(t)}}function oW(e,t,n){for(var r=e.points,i=[],a=0;a<r.length;a++)i.push(QU(r[a][0]*n)/n),i.push(QU(r[a][1]*n)/n);t.points=i.join(` `)}function sW(e){return!e.smooth}function cW(e){var t=I(e,function(e){return typeof e==`string`?[e,e]:e});return function(e,n,r){for(var i=0;i<t.length;i++){var a=t[i],o=e[a[0]];o!=null&&(n[a[1]]=QU(o*r)/r)}}}var lW={circle:[cW([`cx`,`cy`,`r`])],polyline:[oW,sW],polygon:[oW,sW]};function uW(e){for(var t=e.animators,n=0;n<t.length;n++)if(t[n].targetName===`shape`)return!0;return!1}function dW(e,t){var n=e.style,r=e.shape,i=lW[e.type],a={},o=t.animation,s=`path`,c=e.style.strokePercent,l=t.compress&&hi(e)||4;if(i&&!t.willUpdate&&!(i[1]&&!i[1](r))&&!(o&&uW(e))&&!(c<1)){s=e.type;var u=10**l;i[0](r,a,u)}else{var d=!e.path||e.shapeChanged();e.path||e.createPathProxy();var f=e.path;d&&(f.beginPath(),e.buildPath(f,e.shape),e.pathUpdated());var p=f.getVersion(),m=e,h=m.__svgPathBuilder;(m.__svgPathVersion!==p||!h||c!==m.__svgPathStrokePercent)&&(h||=m.__svgPathBuilder=new vU,h.reset(l),f.rebuildPath(h,c),h.generateStr(),m.__svgPathVersion=p,m.__svgPathStrokePercent=c),a.d=h.getStr()}return aW(a,e.transform),tW(a,n,e,t),nW(a,e),t.animation&&YU(e,a,t),t.emphasis&&XU(e,a,t),MU(s,e.id+``,a)}function fW(e,t){var n=e.style,r=n.image;if(r&&!H(r)&&($U(r)?r=r.src:eW(r)&&(r=r.toDataURL())),r){var i=n.x||0,a=n.y||0,o=n.width,s=n.height,c={href:r,width:o,height:s};return i&&(c.x=i),a&&(c.y=a),aW(c,e.transform),tW(c,n,e,t),nW(c,e),t.animation&&YU(e,c,t),MU(`image`,e.id+``,c)}}function pW(e,t){var n=e.style,r=n.text;if(r!=null&&(r+=``),!(!r||isNaN(n.x)||isNaN(n.y))){var i=n.font||`12px sans-serif`,a=n.x||0,o=ai(n.y||0,mn(i),n.textBaseline),s={"dominant-baseline":`central`,"text-anchor":ii[n.textAlign]||n.textAlign};if(Yo(n)){var c=``,l=n.fontStyle,u=qo(n.fontSize);if(!parseFloat(u))return;var d=n.fontFamily||`sans-serif`,f=n.fontWeight;c+=`font-size:`+u+`;font-family:`+d+`;`,l&&l!==`normal`&&(c+=`font-style:`+l+`;`),f&&f!==`normal`&&(c+=`font-weight:`+f+`;`),s.style=c}else s.style=`font: `+i;return r.match(/\s/)&&(s[`xml:space`]=`preserve`),a&&(s.x=a),o&&(s.y=o),aW(s,e.transform),tW(s,n,e,t),nW(s,e),t.animation&&YU(e,s,t),MU(`text`,e.id+``,s,void 0,r)}}function mW(e,t){if(e instanceof wo)return dW(e,t);if(e instanceof Ao)return fW(e,t);if(e instanceof Eo)return pW(e,t)}function hW(e,t,n){var r=e.style;if(oi(r)){var i=si(e),a=n.shadowCache,o=a[i];if(!o){var s=e.getGlobalScale(),c=s[0],l=s[1];if(!c||!l)return;var u=r.shadowOffsetX||0,d=r.shadowOffsetY||0,f=r.shadowBlur,p=Qr(r.shadowColor),m=p.opacity,h=p.color,g=f/2/c,_=f/2/l,v=g+` `+_;o=n.zrId+`-s`+n.shadowIdx++,n.defs[o]=MU(`filter`,o,{id:o,x:`-100%`,y:`-100%`,width:`300%`,height:`300%`},[MU(`feDropShadow`,``,{dx:u/c,dy:d/l,stdDeviation:v,"flood-color":h,"flood-opacity":m})]),a[i]=o}t.filter=mi(o)}}function gW(e,t,n,r){var i=e[n],a,o={gradientUnits:i.global?`userSpaceOnUse`:`objectBoundingBox`};if(di(i))a=`linearGradient`,o.x1=i.x,o.y1=i.y,o.x2=i.x2,o.y2=i.y2;else if(fi(i))a=`radialGradient`,o.cx=W(i.x,.5),o.cy=W(i.y,.5),o.r=W(i.r,.5);else return;for(var s=i.colorStops,c=[],l=0,u=s.length;l<u;++l){var d=ni(s[l].offset)*100+`%`,f=s[l].color,p=Qr(f),m=p.color,h=p.opacity,g={offset:d};g[`stop-color`]=m,h<1&&(g[`stop-opacity`]=h),c.push(MU(`stop`,l+``,g))}var _=FU(MU(a,``,o,c)),v=r.gradientCache,y=v[_];y||(y=r.zrId+`-g`+r.gradientIdx++,v[_]=y,o.id=y,r.defs[y]=MU(a,y,o,c)),t[n]=mi(y)}function _W(e,t,n,r){var i=e.style[n],a=e.getBoundingRect(),o={},s=i.repeat,c=s===`no-repeat`,l=s===`repeat-x`,u=s===`repeat-y`,d;if(ci(i)){var f=i.imageWidth,p=i.imageHeight,m=void 0,h=i.image;if(H(h)?m=h:$U(h)?m=h.src:eW(h)&&(m=h.toDataURL()),typeof Image>`u`){var g=`Image width/height must been given explictly in svg-ssr renderer.`;_e(f,g),_e(p,g)}else if(f==null||p==null){var _=function(e,t){if(e){var n=e.elm,r=f||t.width,i=p||t.height;e.tag===`pattern`&&(l?(i=1,r/=a.width):u&&(r=1,i/=a.height)),e.attrs.width=r,e.attrs.height=i,n&&(n.setAttribute(`width`,r),n.setAttribute(`height`,i))}},v=rt(m,null,e,function(e){c||_(S,e),_(d,e)});v&&v.width&&v.height&&(f||=v.width,p||=v.height)}d=MU(`image`,`img`,{href:m,width:f,height:p}),o.width=f,o.height=p}else i.svgElement&&(d=D(i.svgElement),o.width=i.svgWidth,o.height=i.svgHeight);if(d){var y,b;c?y=b=1:l?(b=1,y=o.width/a.width):u?(y=1,b=o.height/a.height):o.patternUnits=`userSpaceOnUse`,y!=null&&!isNaN(y)&&(o.width=y),b!=null&&!isNaN(b)&&(o.height=b);var x=gi(i);x&&(o.patternTransform=x);var S=MU(`pattern`,``,o,[d]),C=FU(S),w=r.patternCache,T=w[C];T||(T=r.zrId+`-p`+r.patternIdx++,w[C]=T,o.id=T,S=r.defs[T]=MU(`pattern`,T,o,[d])),t[n]=mi(T)}}function vW(e,t,n){var r=n.clipPathCache,i=n.defs,a=r[e.id];if(!a){a=n.zrId+`-c`+n.clipPathIdx++;var o={id:a};r[e.id]=a,i[a]=MU(`clipPath`,a,o,[dW(e,n)])}t[`clip-path`]=mi(a)}function yW(e){return document.createTextNode(e)}function bW(e,t,n){e.insertBefore(t,n)}function xW(e,t){e.removeChild(t)}function SW(e,t){e.appendChild(t)}function CW(e){return e.parentNode}function wW(e){return e.nextSibling}function TW(e,t){e.textContent=t}var EW=58,DW=120,OW=MU(``,``);function kW(e){return e===void 0}function AW(e){return e!==void 0}function jW(e,t,n){for(var r={},i=t;i<=n;++i){var a=e[i].key;a!==void 0&&(r[a]=i)}return r}function MW(e,t){var n=e.key===t.key;return e.tag===t.tag&&n}function NW(e){var t,n=e.children,r=e.tag;if(AW(r)){var i=e.elm=jU(r);if(IW(OW,e),B(n))for(t=0;t<n.length;++t){var a=n[t];a!=null&&SW(i,NW(a))}else AW(e.text)&&!U(e.text)&&SW(i,yW(e.text))}else e.elm=yW(e.text);return e.elm}function PW(e,t,n,r,i){for(;r<=i;++r){var a=n[r];a!=null&&bW(e,NW(a),t)}}function FW(e,t,n,r){for(;n<=r;++n){var i=t[n];i!=null&&(AW(i.tag)?xW(CW(i.elm),i.elm):xW(e,i.elm))}}function IW(e,t){var n,r=t.elm,i=e&&e.attrs||{},a=t.attrs||{};if(i!==a){for(n in a){var o=a[n];i[n]!==o&&(o===!0?r.setAttribute(n,``):o===!1?r.removeAttribute(n):n===`style`?r.style.cssText=o:n.charCodeAt(0)===DW?n===`xmlns:xlink`||n===`xmlns`?r.setAttributeNS(OU,n,o):n.charCodeAt(3)===EW?r.setAttributeNS(kU,n,o):n.charCodeAt(5)===EW?r.setAttributeNS(DU,n,o):r.setAttribute(n,o):r.setAttribute(n,o))}for(n in i)n in a||r.removeAttribute(n)}}function LW(e,t,n){for(var r=0,i=0,a=t.length-1,o=t[0],s=t[a],c=n.length-1,l=n[0],u=n[c],d,f,p,m;r<=a&&i<=c;)o==null?o=t[++r]:s==null?s=t[--a]:l==null?l=n[++i]:u==null?u=n[--c]:MW(o,l)?(RW(o,l),o=t[++r],l=n[++i]):MW(s,u)?(RW(s,u),s=t[--a],u=n[--c]):MW(o,u)?(RW(o,u),bW(e,o.elm,wW(s.elm)),o=t[++r],u=n[--c]):MW(s,l)?(RW(s,l),bW(e,s.elm,o.elm),s=t[--a],l=n[++i]):(kW(d)&&(d=jW(t,r,a)),f=d[l.key],kW(f)?bW(e,NW(l),o.elm):(p=t[f],p.tag===l.tag?(RW(p,l),t[f]=void 0,bW(e,p.elm,o.elm)):bW(e,NW(l),o.elm)),l=n[++i]);(r<=a||i<=c)&&(r>a?(m=n[c+1]==null?null:n[c+1].elm,PW(e,m,n,i,c)):FW(e,t,r,a))}function RW(e,t){var n=t.elm=e.elm,r=e.children,i=t.children;e!==t&&(IW(e,t),kW(t.text)?AW(r)&&AW(i)?r!==i&&LW(n,r,i):AW(i)?(AW(e.text)&&TW(n,``),PW(n,null,i,0,i.length-1)):AW(r)?FW(n,r,0,r.length-1):AW(e.text)&&TW(n,``):e.text!==t.text&&(AW(r)&&FW(n,r,0,r.length-1),TW(n,t.text)))}function zW(e,t){if(MW(e,t))RW(e,t);else{var n=e.elm,r=CW(n);NW(t),r!==null&&(bW(r,t.elm,wW(n)),FW(r,[e],0,0))}return t}var BW=0,VW=function(){function e(e,t,n){if(this.type=`svg`,this.configLayer=HW(`configLayer`),this.storage=t,this._opts=n=k({},n),this.root=e,this._id=`zr`+BW++,this._oldVNode=RU(n.width,n.height),e&&!n.ssr){var r=this._viewport=document.createElement(`div`);r.style.cssText=`position:relative;overflow:hidden`;var i=this._svgDom=this._oldVNode.elm=jU(`svg`);IW(null,this._oldVNode),r.appendChild(i),e.appendChild(r)}this.resize(n.width,n.height)}return e.prototype.getType=function(){return this.type},e.prototype.getViewportRoot=function(){return this._viewport},e.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},e.prototype.getSvgDom=function(){return this._svgDom},e.prototype.refresh=function(){if(this.root){var e=this.renderToVNode({willUpdate:!0});e.attrs.style=`position:absolute;left:0;top:0;user-select:none`,zW(this._oldVNode,e),this._oldVNode=e}},e.prototype.renderOneToVNode=function(e){return mW(e,LU(this._id))},e.prototype.renderToVNode=function(e){e||={};var t=this.storage.getDisplayList(!0),n=this._width,r=this._height,i=LU(this._id);i.animation=e.animation,i.willUpdate=e.willUpdate,i.compress=e.compress,i.emphasis=e.emphasis,i.ssr=this._opts.ssr;var a=[],o=this._bgVNode=UW(n,r,this._backgroundColor,i);o&&a.push(o);var s=e.compress?null:this._mainVNode=MU(`g`,`main`,{},[]);this._paintList(t,i,s?s.children:a),s&&a.push(s);var c=I(R(i.defs),function(e){return i.defs[e]});if(c.length&&a.push(MU(`defs`,`defs`,{},c)),e.animation){var l=IU(i.cssNodes,i.cssAnims,{newline:!0});if(l){var u=MU(`style`,`stl`,{},[],l);a.push(u)}}return RU(n,r,a,e.useViewBox)},e.prototype.renderToString=function(e){return e||={},FU(this.renderToVNode({animation:W(e.cssAnimation,!0),emphasis:W(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:W(e.useViewBox,!0)}),{newline:!0})},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e},e.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},e.prototype._paintList=function(e,t,n){for(var r=e.length,i=[],a=0,o,s,c=0,l=0;l<r;l++){var u=e[l];if(!u.invisible){var d=u.__clipPaths,f=d&&d.length||0,p=s&&s.length||0,m=void 0;for(m=Math.max(f-1,p-1);m>=0&&!(d&&s&&d[m]===s[m]);m--);for(var h=p-1;h>m;h--)a--,o=i[a-1];for(var g=m+1;g<f;g++){var _={};vW(d[g],_,t);var v=MU(`g`,`clip-g-`+c++,_,[]);(o?o.children:n).push(v),i[a++]=v,o=v}s=d;var y=mW(u,t);y&&(o?o.children:n).push(y)}}},e.prototype.resize=function(e,t){var n=this._opts,r=this.root,i=this._viewport;if(e!=null&&(n.width=e),t!=null&&(n.height=t),r&&i&&(i.style.display=`none`,e=vk(r,0,n),t=vk(r,1,n),i.style.display=``),this._width!==e||this._height!==t){if(this._width=e,this._height=t,i){var a=i.style;a.width=e+`px`,a.height=t+`px`}if(ui(this._backgroundColor))this.refresh();else{var o=this._svgDom;o&&(o.setAttribute(`width`,e),o.setAttribute(`height`,t));var s=this._bgVNode&&this._bgVNode.elm;s&&(s.setAttribute(`width`,e),s.setAttribute(`height`,t))}}},e.prototype.getWidth=function(){return this._width},e.prototype.getHeight=function(){return this._height},e.prototype.dispose=function(){this.root&&(this.root.innerHTML=``),this._svgDom=this._viewport=this.storage=this._oldVNode=this._bgVNode=this._mainVNode=null},e.prototype.clear=function(){this._svgDom&&(this._svgDom.innerHTML=null),this._oldVNode=null},e.prototype.toDataURL=function(e){var t=this.renderToString(),n=`data:image/svg+xml;`;return e?(t=_i(t),t&&n+`base64,`+t):n+`charset=UTF-8,`+encodeURIComponent(t)},e}();function HW(e){return function(){}}function UW(e,t,n,r){var i;if(n&&n!==`none`)if(i=MU(`rect`,`bg`,{width:e,height:t,x:`0`,y:`0`}),pi(n))gW({fill:n},i.attrs,`fill`,r);else if(ui(n))_W({style:{fill:n},dirty:Ae,getBoundingRect:function(){return{width:e,height:t}}},i.attrs,`fill`,r);else{var a=Qr(n),o=a.color,s=a.opacity;i.attrs.fill=o,s<1&&(i.attrs[`fill-opacity`]=s)}return i}function WW(e){e.registerPainter(`svg`,VW)}function GW(e,t,n){var r=d.createCanvas(),i=t.getWidth(),a=t.getHeight(),o=r.style;return o&&(o.position=`absolute`,o.left=`0`,o.top=`0`,o.width=i+`px`,o.height=a+`px`,r.setAttribute(`data-zr-dom-id`,e)),r.width=i*n,r.height=a*n,r}function KW(e){return!e.__cursors.get(0)}function qW(e){var t=e.__cursors.get(0);return{startIdx:t?t.startIdx:0,endIdx:t?t.endIdx:0}}var JW=function(e){i(t,e);function t(t,n,r){var i=e.call(this)||this;i.motionBlur=!1,i.lastFrameAlpha=.7,i.dpr=1,i.virtual=!1,i.config={},i.zlevel=0,i.zlevel2=0,i.maxRepaintRectCount=5,i.__dirty=!0,i.__firstTimePaint=!0,i.__prevIdx={startIdx:0,endIdx:0};var a;r||=Ui,typeof t==`string`?a=GW(t,n,r):U(t)&&(a=t,t=a.id),i.id=t,i.dom=a;var o=a.style;return o&&(Oe(a),a.onselectstart=function(){return!1},o.padding=`0`,o.margin=`0`,o.borderWidth=`0`),i.painter=n,i.dpr=r,i}return t.prototype.afterBrush=function(){this.__prevIdx=qW(this)},t.prototype.initContext=function(){this.ctx=this.dom.getContext(`2d`),this.ctx.dpr=this.dpr},t.prototype.setUnpainted=function(){this.__firstTimePaint=!0},t.prototype.createBackBuffer=function(){var e=this.dpr;this.domBack=GW(`back-`+this.id,this.painter,e),this.ctxBack=this.domBack.getContext(`2d`),e!==1&&this.ctxBack.scale(e,e)},t.prototype.createRepaintRects=function(e,t,n,r){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var i=[],a=this.maxRepaintRectCount,o=!1,s=new q(0,0,0,0);function c(e){if(!(!e.isFinite()||e.isZero()))if(i.length===0){var t=new q(0,0,0,0);t.copy(e),i.push(t)}else{for(var n=!1,r=1/0,c=0,l=0;l<i.length;++l){var u=i[l];if(u.intersect(e)){var d=new q(0,0,0,0);d.copy(u),d.union(e),i[l]=d,n=!0;break}else if(o){s.copy(e),s.union(u);var f=e.width*e.height,p=u.width*u.height,m=s.width*s.height-f-p;m<r&&(r=m,c=l)}}if(o&&(i[c].union(e),n=!0),!n){var t=new q(0,0,0,0);t.copy(e),i.push(t)}o||=i.length>=a}}for(var l=qW(this),u=l.startIdx;u<l.endIdx;++u){var d=e[u];if(d){var f=d.shouldBePainted(n,r,!0,!0),p=d.__isRendered&&(d.__dirty&1||!f)?d.getPrevPaintRect():null;p&&c(p);var m=f&&(d.__dirty&1||!d.__isRendered)?d.getPaintRect():null;m&&c(m)}}for(var h=this.__prevIdx,u=h.startIdx;u<h.endIdx;++u){var d=t[u],f=d&&d.shouldBePainted(n,r,!0,!0);if(d&&(!f||!d.__zr)&&d.__isRendered){var p=d.getPrevPaintRect();p&&c(p)}}var g;do{g=!1;for(var u=0;u<i.length;){if(i[u].isZero()){i.splice(u,1);continue}for(var _=u+1;_<i.length;)i[u].intersect(i[_])?(g=!0,i[u].union(i[_]),i.splice(_,1)):_++;u++}}while(g);return this._paintRects=i,i},t.prototype.debugGetPaintRects=function(){return(this._paintRects||[]).slice()},t.prototype.resize=function(e,t){var n=this.dpr,r=this.dom,i=r.style,a=this.domBack;i&&(i.width=e+`px`,i.height=t+`px`),r.width=e*n,r.height=t*n,a&&(a.width=e*n,a.height=t*n,n!==1&&this.ctxBack.scale(n,n))},t.prototype.clear=function(e,t,n){var r=this.dom,i=this.ctx,a=r.width,o=r.height;t||=this.clearColor;var s=this.motionBlur&&!e,c=this.lastFrameAlpha,l=this.dpr,u=this;s&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation=`copy`,this.ctxBack.drawImage(r,0,0,a/l,o/l));var d=this.domBack;function f(e,n,r,a){if(i.clearRect(e,n,r,a),t&&t!==`transparent`){var o=void 0;ue(t)?(o=(t.global||t.__width===r&&t.__height===a)&&t.__canvasGradient||hk(i,t,{x:0,y:0,width:r,height:a}),t.__canvasGradient=o,t.__width=r,t.__height=a):de(t)&&(t.scaleX=t.scaleX||l,t.scaleY=t.scaleY||l,o=Dk(i,t,{dirty:function(){u.setUnpainted(),u.painter.refresh()}})),i.save(),i.fillStyle=o||t,i.fillRect(e,n,r,a),i.restore()}s&&(i.save(),i.globalAlpha=c,i.drawImage(d,e,n,r,a),i.restore())}!n||s?f(0,0,a,o):n.length&&F(n,function(e){f(e.x*l,e.y*l,e.width*l,e.height*l)})},t}(Vi),YW=1e5,XW=314159,ZW=void 0,QW=1,$W=2;function eG(e){return e?e.__builtin__?!0:!(typeof e.resize!=`function`||typeof e.refresh!=`function`):!1}function tG(e,t){var n=document.createElement(`div`);return n.style.cssText=[`position:relative`,`width:`+e+`px`,`height:`+t+`px`,`padding:0`,`margin:0`,`border-width:0`].join(`;`)+`;`,n}function nG(e,t,n,r){var i=new JW(e,t,t.dpr);return i.zlevel=n,i.zlevel2=r,i.__builtin__=!0,rG(i),i}function rG(e){e.__cursorStack=[],e.__cursors=G()}function iG(e){return e.startIdx=e.drawIdx=e.endIdx=e.endIdxNew=0,e.used=!1,e.first=e.last=NaN,e.notClearIdx=-1,e}function aG(e,t){var n=e.__cursors,r=+t;return n.get(r)||(e.__cursorStack.push(r),n.set(r,iG({key:r})))}function oG(e,t){for(var n=e.__cursorStack,r=0;r<n.length;r++)t(e.__cursors.get(n[r]))}function sG(e,t){var n=e.layers;return n[t]||(n[t]=[,,,])}function cG(e,t,n){for(var r=e.layerStack,i=0;i<r.length;i++){var a=r[i].zl,o=r[i].zl2,s=e.layers[a][o];(!n||(!(n&lG)||s.__builtin__)&&(!(n&uG)||!s.__builtin__)&&(!(n&dG)||s!==e.hoverlayer))&&t(s,a,o,i)}}var lG=1,uG=2,dG=4,fG=lG|dG,pG=function(){function e(e,t,n,r){this.type=`canvas`,this._prevDisplayList=[],this._layerConfig={},this._needsManuallyCompositing=!1,this.type=`canvas`,this._i={layerStack:[],layers:[]};var i=!e.nodeName||e.nodeName.toUpperCase()===`CANVAS`;if(this._opts=n=k({},n||{}),this.dpr=n.devicePixelRatio||Ui,this._singleCanvas=i,this.root=e,e.style&&(Oe(e),e.innerHTML=``),this.storage=t,this._prevDisplayList=[],i){var a=e,o=a.width,s=a.height;n.width!=null&&(o=n.width),n.height!=null&&(s=n.height),this.dpr=n.devicePixelRatio||1,a.width=o*this.dpr,a.height=s*this.dpr,this._width=o,this._height=s;var c=nG(a,this,XW,0);c.initContext(),this._insertLayer(c,XW,0,!0),this._domRoot=e}else{this._width=vk(e,0,n),this._height=vk(e,1,n);var l=this._domRoot=tG(this._width,this._height);e.appendChild(l)}}return e.prototype.getType=function(){return`canvas`},e.prototype.isSingleCanvas=function(){return this._singleCanvas},e.prototype.getViewportRoot=function(){return this._domRoot},e.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},e.prototype.refresh=function(e){var t=e&&!U(e)?{paintAll:!!e}:e||{},n=W(t.refresh,!0),r=W(t.refreshHover,!1);if(r&&(this._hoverLayerDirty=$W),!n)return r&&this._paintHoverList(this.storage.getDisplayList(!1)),this;var i=this.storage.getDisplayList(!0);this._updateLayerStatus(i,t.paintAll),this._redrawId=Math.random();var a=this._prevDisplayList;this._paintList(i,a,this._redrawId);var o=this._backgroundColor;return cG(this._i,function(e,t,n,r){e.refresh&&e.refresh(r===0?o:null)},uG),this._opts.useDirtyRect&&(this._prevDisplayList=i.slice()),this},e.prototype._paintHoverList=function(e){var t=this._i.hoverlayer,n=this._hoverLayerDirty;if(this._hoverLayerDirty=ZW,n!==ZW&&(!t&&n===$W&&(t=this._i.hoverlayer=this._ensureLayer(YW)),t)){t.clear();for(var r={inHover:!0,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{}},i,a=0,o=e.length;a<o;a++){var s=e[a];if(s.__inHover){i||(i=t.ctx,i.save());var c=s.__hoverStyle,l=void 0;c&&(l=s.style,s.style=c),Kk(i,s,r),c&&(s.style=l)}}i&&(qk(i,r),i.restore())}},e.prototype.getHoverLayer=function(){return this._ensureLayer(YW)},e.prototype.paintOne=function(e,t){Gk(e,t)},e.prototype._paintList=function(e,t,n){if(this._redrawId===n){var r=this._doPaintList(e,t);if(this._needsManuallyCompositing&&this._compositeManually(),r)cG(this._i,function(e){e.afterBrush&&e.afterBrush()},fG),this._paintHoverList(e);else{var i=this;HE(function(){i._paintList(e,t,n)})}}},e.prototype._compositeManually=function(){var e=this._ensureLayer(XW).ctx,t=this._domRoot.width,n=this._domRoot.height;e.clearRect(0,0,t,n),cG(this._i,function(r){r.virtual&&e.drawImage(r.dom,0,0,t,n)},lG)},e.prototype._doPaintList=function(e,t){var n=this,r=!0;return cG(this._i,function(i){var a=!1;if(oG(i,function(e){(e.drawIdx<e.endIdx||e.notClearIdx>=0)&&(a=!0)}),!(!a&&!i.__dirty)){var o=n._opts.useDirtyRect&&!KW(i)?i.createRepaintRects(e,t,n._width,n._height):null,s=n._i.layerStack[0],c=!0;if(i.__dirty){c=!1,i.__dirty=!1;var l=i.zlevel===s.zl&&i.zlevel2===s.zl2?n._backgroundColor:null;i.clear(!1,l,o)}oG(i,function(t){var a=n._paintPerCursor(i,t,e,o,c);r&&=a})}},fG),Ne.wxa&&cG(this._i,function(e){e&&e.ctx&&e.ctx.draw&&e.ctx.draw()}),r},e.prototype._paintPerCursor=function(e,t,n,r,i){var a=e.ctx;if(r)if(!r.length)t.drawIdx=t.endIdx;else for(var o=this.dpr,s=0;s<r.length;++s){var c=r[s];a.save(),a.beginPath(),a.rect(c.x*o,c.y*o,c.width*o,c.height*o),a.clip(),this._paintPerCursorInRect(e,t,n,c,i),a.restore()}else a.save(),this._paintPerCursorInRect(e,t,n,null,i),a.restore();return t.drawIdx>=t.endIdx},e.prototype._paintPerCursorInRect=function(e,t,n,r,i){for(var a={inHover:!1,allClipped:!1,prevEl:null,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{contentRetained:i}},o=e.ctx,s=KW(e),c=s&&d.getTime(),l=t.drawIdx,u=t.notClearIdx,f=u>=0?Math.min(u,l):l;f<t.endIdx;f++){var p=n[f];if(!(f<l&&!p.notClear)){if(p.__inHover&&(this._hoverLayerDirty=$W),r!=null){var m=p.getPaintRect();m&&m.intersect(r)&&(Kk(o,p,a),p.setPrevPaintRect(m))}else Kk(o,p,a);if(s&&d.getTime()-c>15){f++;break}}}qk(o,a),t.drawIdx=Math.max(f,l)},e.prototype.getLayer=function(e,t){return this._ensureLayer(e,0,t)},e.prototype._ensureLayer=function(e,t,n){t||=0;var r=this._singleCanvas;r&&!this._needsManuallyCompositing&&(e=XW,t=0);var i=sG(this._i,e)[t];return i||(i=nG(`zr_`+e+`.`+t,this,e,t),this._layerConfig[e]&&O(i,this._layerConfig[e],!0),(n||r&&e!==XW)&&(i.virtual=!0),this._insertLayer(i,e,t,!1),i.initContext()),i},e.prototype.insertLayer=function(e,t){this._insertLayer(t,e,0,!1)},e.prototype._insertLayer=function(e,t,n,r){var i=this._i,a=i.layers,o=i.layerStack,s=this._domRoot,c=null;if(!(a[t]&&a[t][n])&&eG(e)){for(var l=o.length,u=0;u<l&&(o[u].zl<t||o[u].zl===t&&o[u].zl2<n);)u++;if(u>0&&(c=sG(i,o[u-1].zl)[o[u-1].zl2]),o.splice(u,0,{zl:t,zl2:n}),sG(i,t)[n]=e,!r&&!e.virtual)if(c){var d=c.dom;d.nextSibling?s.insertBefore(e.dom,d.nextSibling):s.appendChild(e.dom)}else s.firstChild?s.insertBefore(e.dom,s.firstChild):s.appendChild(e.dom);e.painter||=this}},e.prototype.eachLayer=function(e,t){return cG(this._i,function(n,r){e.call(t,n,r)})},e.prototype.eachBuiltinLayer=function(e,t){return cG(this._i,function(n,r){e.call(t,n,r)},lG)},e.prototype.eachOtherLayer=function(e,t){return cG(this._i,function(n,r){e.call(t,n,r)},uG)},e.prototype.getLayers=function(){var e={};return cG(this._i,function(t,n,r){e[t.id]=t}),e},e.prototype._updateLayerStatus=function(e,t){var n=this;if(n._singleCanvas)for(var r=1;r<e.length;r++){var i=e[r];if(i.zlevel!==e[r-1].zlevel||i.incremental){n._needsManuallyCompositing=!0;break}}cG(n._i,function(e){e.__dirty=!1,oG(e,function(e){e.used=!1,e.endIdxNew=0,e.notClearIdx=-1})},fG);for(var a,o=null,s=null,c=!1,l=0,u=e.length;l<u;l++){var i=e[l],d=i.zlevel,f=i.incremental,p=void 0;if(a!==d&&(a=d,c=!1),f?(c=!0,p=1):p=c?2:0,(!o||d!==o.zlevel||p!==o.zlevel2)&&(o=n._ensureLayer(d,p),s=null,!o.__builtin__)){E(`ZLevel `+d+` has been used by unknown layer `+o.id);continue}if((!s||f!==s.key)&&(s=aG(o,f),!s.used))if(s.used=!0,!t&&s.first===i.id){var m=l-s.startIdx;s.startIdx=l,s.drawIdx+=m,s.endIdx+=m}else o.__dirty=!0,s.first=i.id,s.startIdx=s.drawIdx=l,s.endIdx=l+1;s.endIdxNew=l+1,i.__dirty&1&&!i.__inHover&&((!f||!i.notClear&&l<s.drawIdx)&&(o.__dirty=!0),f&&i.notClear&&s.notClearIdx<0&&(s.notClearIdx=l))}cG(n._i,function(t){for(var r=t.__cursorStack,i=t.__cursors,a=r.length-1;a>=0;a--){var o=i.get(r[a]);if(!o.used)t.__dirty=!0,i.removeKey(r[a]),r.splice(a,1);else{var s=o.endIdxNew;(KW(t)?s<o.drawIdx:s!==o.endIdx||!s||e[s-1].id!==o.last)&&(t.__dirty=!0),o.endIdx=o.endIdxNew,o.last=s?e[s-1].id:NaN}}t.__dirty&&(oG(t,function(e){e.drawIdx=e.startIdx}),n._hoverLayerDirty===ZW&&(n._hoverLayerDirty=QW))},fG)},e.prototype.clear=function(){return cG(this._i,function(e){e.clear(),rG(e)},lG),this},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e,cG(this._i,function(e){e.setUnpainted()})},e.prototype.configLayer=function(e,t){if(t){var n=this._layerConfig;n[e]?O(n[e],t,!0):n[e]=t,cG(this._i,function(e,t){O(e,n[t],!0)})}},e.prototype.delLayer=function(e){for(var t=this._i.layerStack,n=this._i.layers,r=t.length-1;r>=0;r--){var i=t[r];if(i.zl===e){var a=n[e][i.zl2];if(a.__builtin__)continue;if(t.splice(r,1),n[e][i.zl2]=void 0,!a.virtual){var o=a.dom.parentNode;o&&o.removeChild(a.dom)}}}},e.prototype.resize=function(e,t){if(this._domRoot.style){var n=this._domRoot;n.style.display=`none`;var r=this._opts,i=this.root;e!=null&&(r.width=e),t!=null&&(r.height=t),e=vk(i,0,r),t=vk(i,1,r),n.style.display=``,(this._width!==e||t!==this._height)&&(n.style.width=e+`px`,n.style.height=t+`px`,cG(this._i,function(n){n.resize(e,t)}),this.refresh({paintAll:!0})),this._width=e,this._height=t}else{if(e==null||t==null)return;this._width=e,this._height=t,this._ensureLayer(XW).resize(e,t)}return this},e.prototype.clearLayer=function(e){F(this._i.layers[e],function(e){e&&!e.__builtin__&&e.clear()})},e.prototype.dispose=function(){this.root.innerHTML=``,this.root=this.storage=this._domRoot=this._i=null},e.prototype.getRenderedCanvas=function(e){if(e||={},this._singleCanvas&&!this._compositeManually)return this._i.layers[XW][0].dom;var t=new JW(`image`,this,e.pixelRatio||this.dpr);t.initContext(),t.clear(!1,e.backgroundColor||this._backgroundColor);var n=t.ctx;if(e.pixelRatio<=this.dpr){this.refresh();var r=t.dom.width,i=t.dom.height;cG(this._i,function(e){e.__builtin__?n.drawImage(e.dom,0,0,r,i):e.renderToCanvas&&(n.save(),e.renderToCanvas(n),n.restore())})}else{for(var a={inHover:!1,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{}},o=this.storage.getDisplayList(!0),s=0,c=o.length;s<c;s++){var l=o[s];Kk(n,l,a)}qk(n,a)}return t.dom},e.prototype.getWidth=function(){return this._width},e.prototype.getHeight=function(){return this._height},e}();function mG(e){e.registerPainter(`canvas`,pG)}var hG=[`number`,`currency`,`percent`,`compact`,`duration`,`date`],gG=[`INR`],_G=[`rupees`,`paise`],vG=[`ms`,`s`,`min`,`h`],yG=[`day`,`month`,`year`,`datetime`,`time`],bG=`−`,xG=`₹`,SG=330*60*1e3,CG=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wG=[[1e7,`Cr`],[1e5,`L`],[1e3,`K`]],TG=(e,t)=>Number.isInteger(e)&&e>=0&&e<=20?e:t,EG=new Map,DG=e=>(EG.has(e)||EG.set(e,new Intl.NumberFormat(`en-IN`,{minimumFractionDigits:0,maximumFractionDigits:e})),EG.get(e)),OG=new Map,kG=e=>(OG.has(e)||OG.set(e,new Intl.NumberFormat(`en-IN`,{minimumFractionDigits:e,maximumFractionDigits:e})),OG.get(e)),AG=e=>typeof e==`number`&&Number.isFinite(e),jG=e=>e<0&&!Object.is(Math.abs(e),0)?bG:``,MG=(e,t)=>t===`paise`?e/100:e;function NG(e,{decimals:t}={}){if(!AG(e))return`-`;let n=DG(TG(t,2)).format(Math.abs(e));return n===`0`?`0`:jG(e)+n}function PG(e,{unit:t=`rupees`,decimals:n}={}){if(!AG(e))return`-`;let r=MG(e,t),i=kG(TG(n,0)).format(Math.abs(r));return(Number(i.replace(/,/g,``))===0?``:jG(r))+xG+i}var FG=e=>e>0&&e<.1?Math.min(20,1-Math.floor(Math.log10(e))):2;function IG(e,{currency:t,unit:n=`rupees`}={}){if(!AG(e))return`-`;let r=t?MG(e,n):e,i=t?xG:``,a=Math.abs(r),o=wG.findIndex(([e])=>a>=e);if(o===-1){let e=DG(FG(a)).format(a);if(e!==`1,000`)return(e===`0`?``:jG(r))+i+e;o=wG.length-1}let[s,c]=wG[o],l=a/s,u=l>=100?0:l>=10?1:2,d=Number(l.toFixed(u));return d>=100&&o>0&&(--o,[s,c]=wG[o],l=a/s,u=l>=100?0:l>=10?1:2,d=Number(l.toFixed(u))),`${jG(r)}${i}${DG(u).format(d)} ${c}`}function LG(e,{decimals:t}={}){return AG(e)?`${NG(e*100,{decimals:TG(t,1)})}%`:`-`}function RG(e,{unit:t=`s`}={}){if(!AG(e))return`-`;let n={ms:1,s:1e3,min:6e4,h:36e5}[t]??1e3,r=Math.abs(e*n),i=jG(e);if(Math.round(r)<1e3)return`${i}${DG(0).format(r)} ms`;let a=r/1e3;if(a<10)return`${i}${DG(1).format(a)}s`;let o=Math.round(a);if(o<60)return`${i}${o}s`;let s=e=>String(e).padStart(2,`0`),c=Math.floor(o/60);if(c<60)return`${i}${c}m ${s(o%60)}s`;let l=Math.floor(c/60);return`${i}${DG(0).format(l)}h ${s(c%60)}m`}function zG(e){if(e instanceof Date)return e.getTime();if(AG(e))return e;if(typeof e!=`string`)return NaN;let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(t){let[e,n,r]=[Number(t[1]),Number(t[2]),Number(t[3])],i=new Date(Date.UTC(2e3,n-1,r));return i.setUTCFullYear(e),i.getUTCFullYear()===e&&i.getUTCMonth()===n-1&&i.getUTCDate()===r?i.getTime()-SG:NaN}return Date.parse(e)}function BG(e){let t=new Date(e+SG);return{year:t.getUTCFullYear(),month:t.getUTCMonth(),day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes()}}function VG(e,{pattern:t=`day`}={}){let n=zG(e);if(!Number.isFinite(n))return`-`;let r=BG(n),i=e=>String(e).padStart(2,`0`),a=`${i(r.day)}-${CG[r.month]}-${r.year}`,o=`${i(r.hour)}:${i(r.minute)}`;switch(t){case`month`:return`${CG[r.month]}-${r.year}`;case`year`:return String(r.year);case`datetime`:return`${a} ${o}`;case`time`:return o;default:return a}}function HG(e){let t=zG(e);if(!Number.isFinite(t))return`-`;let n=BG(t);return`${String(n.day).padStart(2,`0`)}-${CG[n.month]}`}function Z(e,t){if(e==null||e===``)return`-`;let n=t?.style;if(n===`date`)return VG(e,t);if(typeof e!=`number`)return String(e);switch(n){case`currency`:return PG(e,t);case`percent`:return LG(e,t);case`compact`:return IG(e,t);case`duration`:return RG(e,t);default:return NG(e,t)}}function UG(e){let t=e?.style;return t===`currency`?{style:`compact`,currency:e.currency??`INR`,unit:e.unit}:!t||t===`number`?{style:`compact`}:e}var WG=[`line`,`area`,`column`,`bar`,`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`,`multiples`],GG=[`none`,`stacked`,`percent`],KG=[`category`,`time`,`value`],qG=[`auto`,`svg`,`canvas`],JG=[`ready`,`loading`,`empty`,`error`],YG=[`chart`,`table`],XG=8,ZG=6,QG=`Other`,$G=`No data to show for this chart.`,eK=`This chart couldn't load. Try again in a moment.`,tK=`This chart has more series than it can show clearly.`,nK=`This chart has more groups than it can show clearly.`,rK={line:`Line chart`,area:`Area chart`,column:`Column chart`,bar:`Bar chart`,donut:`Donut chart`,heatmap:`Heatmap`,calendar:`Calendar heatmap`,funnel:`Funnel chart`,gauge:`Gauge`,waterfall:`Waterfall chart`,treemap:`Treemap`,sankey:`Sankey diagram`,scatter:`Scatter plot`,bubble:`Bubble chart`,multiples:`Small multiples`},iK=[`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`],aK=e=>iK.includes(e),oK=[`area`,`column`,`bar`],sK=[`line`,`area`,`column`,`bar`,`multiples`],cK={line:[`category`,`time`],area:[`category`,`time`],column:[`category`,`time`],bar:[`category`,`time`],multiples:[`category`,`time`],calendar:[`time`],scatter:[`value`],bubble:[`value`]},lK={group:[`heatmap`,`treemap`,`scatter`,`bubble`],to:[`sankey`],size:[`bubble`],trend:[`scatter`,`bubble`],zoom:[`line`,`area`],bands:[`gauge`]},uK={gauge:240,calendar:200,treemap:340,sankey:340},dK=100,fK=72,pK=32,mK=[`type`,`title`,`description`,`data`,`x`,`series`,`group`,`to`,`size`,`trend`,`zoom`,`bands`,`stack`,`y`,`target`,`height`,`state`,`emptyText`,`errorText`,`renderer`],hK=[`key`,`kind`,`format`,`label`],gK=[`key`,`label`,`format`],_K=[`key`,`label`],vK=[`key`,`label`,`format`],yK=[`upTo`,`label`],bK=[`label`,`format`,`min`,`max`],xK=[`value`,`label`],SK=[`style`,`currency`,`unit`,`decimals`,`pattern`],CK=new Set;function wK(e){CK.has(e)||(CK.add(e),console.warn(`[@webority/ui-elements] <wui-chart> ${e}`))}var TK=e=>e.map(e=>`"${e}"`).join(` | `);function EK(e,t,n){t==null||n.includes(t)||wK(`received ${e}="${String(t)}", which is not one of ${TK(n)}. The chart uses its default instead.`)}function DK(e,t,n){for(let r of Object.keys(t))if(!n.includes(r)){if(/^(y2|secondary)/i.test(r)){wK(`ignores ${e}.${r}: a chart has one value axis by design. Show the second measure as its own chart.`);continue}wK(`ignores the unknown key ${e}.${r}. Known keys: ${n.join(`, `)}.`)}}function OK(e,t){if(t!=null){if(typeof t!=`object`){wK(`expects ${e} to be an object such as { style: "currency" }.`);return}if(DK(e,t,SK),EK(`${e}.style`,t.style,hG),EK(`${e}.currency`,t.currency,gG),t.unit!=null){let n=t.style===`duration`?vG:_G;EK(`${e}.unit`,t.unit,n)}EK(`${e}.pattern`,t.pattern,yG),t.decimals!=null&&!(Number.isInteger(t.decimals)&&t.decimals>=0&&t.decimals<=20)&&wK(`received ${e}.decimals=${String(t.decimals)}, which is not a whole number from 0 to 20. The chart uses its default instead.`)}}var kK=e=>typeof e==`number`&&Number.isFinite(e),AK=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function jK(e){let t=(e,t=eK)=>(console.error(`[@webority/ui-elements] <wui-chart> ${e}`),{spec:null,problem:t});if(!AK(e))return t('has no spec: set the `spec` property or add a <script type="application/json"> child.');if(DK(`spec`,e,mK),EK(`type`,e.type,WG),!WG.includes(e.type))return t(`cannot draw type "${String(e.type)}".`);let n=e.type;(typeof e.title!=`string`||!e.title.trim())&&wK("needs a `title`: it names the chart for screen readers and names exported files.");for(let[t,r]of Object.entries(lK))e[t]!=null&&!r.includes(n)&&wK(`ignores spec.${t} on a ${n} chart: it applies to ${r.join(`, `)}.`);let r=AK(e.x)?e.x:{};DK(`spec.x`,r,hK);let i=cK[n]??[`category`];EK(`x.kind`,r.kind,KG),KG.includes(r.kind)&&!i.includes(r.kind)&&wK(`ignores x.kind="${r.kind}" on a ${n} chart: it takes ${TK(i)}.`),OK(`x.format`,r.format),typeof r.key!=`string`&&n!==`gauge`&&wK("needs `x.key`, the column holding each row's x value or slice name.");let a=AK(e.y)?e.y:{};DK(`spec.y`,a,bK),OK(`y.format`,a.format);let o=Array.isArray(e.series)?e.series.filter(AK):[];for(let[e,t]of o.entries())DK(`spec.series[${e}]`,t,gK),OK(`series[${e}].format`,t.format),typeof t.key!=`string`&&wK(`needs series[${e}].key, the column holding that series' values.`);if(o.length===0)return t(`has no series to draw.`);let s=o.map(e=>e.key).filter(e=>typeof e==`string`),c=s.find((e,t)=>s.indexOf(e)!==t);if(c!==void 0)return t(`has two series with the key "${c}": each series needs its own key.`);if(o.length>8)return t(`refuses ${o.length} series: 8 is the most that stay distinguishable. Fold the smallest into an Other series, or split the chart.`,tK);let l=aK(n);if(l&&o.length>1){let e=n===`donut`?`Compare parts across groups with a percent-stacked column instead.`:`Show the other measures as their own charts, or use small multiples.`;wK(`draws one series as a ${n}; it got ${o.length} and shows the first. ${e}`)}let u=(e,t,n,r)=>t==null?null:AK(t)?(DK(e,t,n),typeof t.key==`string`?(OK(`${e}.format`,t.format),{key:t.key,label:typeof t.label==`string`?t.label:``,format:t.format}):(wK(`needs ${e}.key, the column holding ${r}.`),null)):(wK(`expects ${e} to be an object such as { key: "column" }.`),null),d=lK.group.includes(n)?u(`spec.group`,e.group,_K,`each row's group`):null,f=n===`sankey`?u(`spec.to`,e.to,_K,`where each flow ends`):null,p=n===`bubble`?u(`spec.size`,e.size,vK,`each bubble's size`):null;if((n===`heatmap`||n===`treemap`)&&!d)return t(`needs \`group.key\` to draw a ${n}: the column holding each ${n===`heatmap`?`row`:`parent`}.`);if(n===`sankey`&&!f)return t("needs `to.key` to draw a sankey: the column holding where each flow ends.");if(n===`bubble`&&!p)return t("needs `size.key` to draw a bubble chart: the column holding each bubble's size.");let m=oK.includes(n)?GG:[`none`];EK(`stack`,e.stack,m),EK(`state`,e.state,JG),EK(`renderer`,e.renderer,qG),e.target!=null&&(AK(e.target)&&DK(`spec.target`,e.target,xK),(!AK(e.target)||!kK(e.target.value))&&wK("ignores a `target` without a numeric `value`.")),e.trend!=null&&typeof e.trend!=`boolean`&&wK("expects `trend` to be true or false."),e.zoom!=null&&typeof e.zoom!=`boolean`&&wK("expects `zoom` to be true or false.");let h=[];if(n===`gauge`&&e.bands!=null){let t=Array.isArray(e.bands)?e.bands.filter(AK):[];for(let e of t)DK(`spec.bands[]`,e,yK);h=t.filter(e=>kK(e.upTo)&&typeof e.label==`string`&&e.label).map(e=>({upTo:e.upTo,label:e.label})).sort((e,t)=>e.upTo-t.upTo),(!Array.isArray(e.bands)||h.length!==t.length)&&wK("ignores a gauge band without a numeric `upTo` and a `label`.")}let g=a.format??o[0].format,_=(l?o.slice(0,1):o).map(e=>({key:e.key,label:typeof e.label==`string`&&e.label?e.label:String(e.key),format:e.format??g})),v=i.includes(r.kind)?r.kind:i[0],y=Array.isArray(e.data)?e.data.filter(AK):[],b=-1,x=null;n===`donut`&&y.length>6&&(x=y,{data:y,otherIndex:b}=PK(y,r.key,_[0].key),wK(`draws at most 6 donut slices; the smallest ${e.data.length-5} are shown as "${QG}". Send fewer rows, or use a bar chart for many parts.`));let S=_[0].key,C=(e,t)=>{let n=y.filter(e);n.length!==y.length&&wK(`leaves out ${y.length-n.length} row(s) ${t}.`),y=n},w=e=>e!=null&&e!==``,T=e=>kK(e)&&e>0;if(v===`time`&&sK.includes(n)&&C(e=>Number.isFinite(zG(e[r.key])),`without a readable date`),n===`gauge`&&y.length>1)wK(`draws one value as a gauge; it got ${y.length} rows and shows the first.`),y=y.slice(0,1);else if(n===`scatter`||n===`bubble`){C(e=>kK(e[r.key])&&kK(e[S])&&(n!==`bubble`||T(e[p.key])),`without a number for x and y (and a positive size)`);let e=new Set(d?y.map(e=>String(e[d.key]??``)):[]);if(e.size>3)return t(`refuses ${e.size} colour groups on a ${n} chart: 3 is the most that stay tellable apart. Keep the three that matter and fold the rest into one, or split the chart.`,nK)}else if(n===`calendar`)C(e=>Number.isFinite(zG(e[r.key])),`without a readable date`);else if(n===`heatmap`)C(e=>w(e[r.key])&&w(e[d.key]),`without a column or a row`);else if(n===`treemap`){C(e=>w(e[r.key])&&w(e[d.key])&&T(e[S]),`without a name, a parent and a positive size`);let e=new Set(y.map(e=>String(e[d.key])));if(e.size>8)return t(`refuses ${e.size} parents in a treemap: 8 is the most that keep their own colour. Fold the smallest into one, or split the chart.`,nK)}else if(n===`sankey`){C(e=>w(e[r.key])&&w(e[f.key])&&T(e[S]),`without a start, an end and a positive size`);let e=MK(y,r.key,f.key);if(e)return t(e.reason,e.text)}else if(n===`waterfall`){let e=NK(y,S);if(e?.refuse)return t(e.refuse);e&&wK(e.warn)}let E=kK(e.height)&&e.height>0?e.height:null;if(n===`multiples`){let e=fK*_.length+pK;E!=null&&E<e&&(wK(`needs at least ${e}px of height for ${_.length} small charts; it got ${E}px and draws at ${e}px.`),E=e),E??=dK*_.length+40}return E??=uK[n]??320,{problem:null,spec:{type:n,title:typeof e.title==`string`?e.title.trim():``,description:typeof e.description==`string`?e.description:``,data:y,allData:x??y,x:{key:r.key,kind:v,format:r.format??(v===`time`?{style:`date`}:v===`value`?{style:`number`}:void 0),label:r.label??``},series:_,group:d,to:f,size:p,trend:lK.trend.includes(n)&&e.trend===!0,zoom:lK.zoom.includes(n)?(e.zoom??y.length>5e3)===!0:!1,bands:h,stack:m.includes(e.stack)?e.stack:`none`,y:{label:a.label??``,format:g,min:kK(a.min)?a.min:void 0,max:kK(a.max)?a.max:void 0},target:AK(e.target)&&kK(e.target.value)?{value:e.target.value,label:String(e.target.label??``)}:null,height:E,state:JG.includes(e.state)?e.state:`ready`,emptyText:typeof e.emptyText==`string`&&e.emptyText?e.emptyText:$G,errorText:typeof e.errorText==`string`&&e.errorText?e.errorText:eK,renderer:qG.includes(e.renderer)?e.renderer:`auto`,otherIndex:b}}}function MK(e,t,n){let r=e.map(e=>[String(e[t]),String(e[n])]),i=new Map;for(let[e,t]of r)i.has(e)||i.set(e,0),i.set(t,(i.get(t)??0)+1);let a=[...i].filter(([,e])=>e===0).map(([e])=>e);if(a.length>8)return{reason:`refuses ${a.length} flow starts in a sankey: 8 is the most that keep their own colour. Fold the smallest into one, or split the chart.`,text:nK};let o=0;for(;a.length;){let e=a.pop();o+=1;for(let[t,n]of r)t===e&&(i.set(n,i.get(n)-1),i.get(n)===0&&a.push(n))}return o<i.size?{reason:`cannot draw a sankey whose flows loop back on themselves.`,text:eK}:null}function NK(e,t){let n=e.map(e=>kK(e[t])?e[t]:0),r=n[n.length-1]??0,i=n[0]??0,a=i;for(let e of n.slice(1,-1))i+=e,a=Math.min(a,i);return a<0||n.length>1&&r<0?{refuse:`cannot draw a waterfall whose running total goes below zero.`}:n.length>2&&Math.abs(r-i)>.5?{warn:`draws the waterfall's closing total (${r}) as given, though the opening total plus the steps is ${i}.`}:null}function PK(e,t,n){let r=new Set(e.map((e,t)=>({i:t,v:kK(e[n])?e[n]:0})).sort((e,t)=>t.v-e.v).slice(0,5).map(e=>e.i)),i=e.reduce((e,t,i)=>r.has(i)||!kK(t[n])?e:e+t[n],0),a=e.filter((e,t)=>r.has(t)),o=new Set(a.map(e=>String(e[t]))),s=QG;for(let e=2;o.has(s);e+=1)s=`${QG} (${e})`;return a.push({[t]:s,[n]:i}),{data:a,otherIndex:a.length-1}}function Q(e,t,n){let r=e.data[n]?.[t];return kK(r)?r:null}function FK(e){return e.type===`gauge`||e.series.some(t=>e.data.some((n,r)=>Q(e,t.key,r)!=null))}function $(e,t){let n=e.data[t]?.[e.x.key];return n==null||n===``?`-`:e.x.format?Z(n,e.x.format):String(n)}function IK(e,t){return zG(e.data[t]?.[e.x.key])}function LK(e,t){let n=e.group?e.data[t]?.[e.group.key]:null;return n==null||n===``?`-`:String(n)}function RK(e,t){let n=e.to?e.data[t]?.[e.to.key]:null;return n==null||n===``?`-`:String(n)}var zK=e=>[...new Set(e)];function BK(e){return e.group?zK(e.data.map((t,n)=>LK(e,n))):[]}function VK(e){return aK(e.type)?e.data.length:e.data.length*e.series.length}function HK(e){return e.renderer===`auto`?VK(e)>5e3?`canvas`:`svg`:e.renderer}function UK(e){switch(e.type){case`donut`:return e.data.map((t,n)=>$(e,n));case`scatter`:case`bubble`:return BK(e);case`line`:case`area`:case`column`:case`bar`:return e.series.map(e=>e.key);default:return[]}}function WK(e){return[`line`,`area`,`column`,`bar`].includes(e.type)?e.series.map(e=>e.label):UK(e)}function GK(e,t,n){return e.type===`donut`?n.has($(e,t)):(e.type===`scatter`||e.type===`bubble`)&&e.group?n.has(LK(e,t)):!1}function KK(e,t){return e.data.map((n,r)=>{let i=e.series.filter(e=>!t.has(e.key)).reduce((t,n)=>t+Math.abs(Q(e,n.key,r)??0),0);return Object.fromEntries(e.series.map(t=>[t.key,i&&Q(e,t.key,r)!=null?Q(e,t.key,r)/i:null]))})}var qK=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function JK(e){return`${qK[new Date(e+SG).getUTCDay()]}, ${VG(e)}`}var YK=e=>e.reduce((e,t)=>t<e?t:e,1/0),XK=e=>e.reduce((e,t)=>t>e?t:e,-1/0),ZK=(e,t)=>e.data.map((n,r)=>Q(e,t,r)).filter(e=>e!=null),QK=(e,t)=>t?Z(e/t,{style:`percent`}):`-`;function $K(e,t){let n=e.filter(kK);if(!n.length)return[];let r=YK(n),i=XK(n),a=[t[1],t[2],t[3],t[5],t[6]];if(r===i)return[{from:r,to:i,colour:a[2]}];let o=(i-r)/a.length;return a.map((e,t)=>({from:r+o*t,to:t===a.length-1?i:r+o*(t+1),colour:e}))}function eq(e,t){if(t==null||!e.length)return;let n=e.length-1,r=e.findIndex((e,r)=>t>=e.from&&(r===n?t<=e.to:t<e.to));return e[r<0?n:r].colour}function tq(e,t){return Array.from({length:e},(n,r)=>t[e===1?6:Math.round(6-r*4/(e-1))])}function nq(e,t){return e.bands.find(e=>t<=e.upTo)??e.bands[e.bands.length-1]??null}var rq=(e,t)=>t==null?`-`:nq(e,t).label;function iq(e){return{min:e.y.min??0,max:e.y.max??100}}function aq(e){let t=e.series[0].key,n=e.data.length-1,r=0;return e.data.map((i,a)=>{let o=Q(e,t,a)??0,s=a===0||a===n,c=s?0:r,l=s?o:r+o;return a===0?r=o:s||(r=l),{index:a,total:s,value:o,from:c,to:l,level:s?o:l}})}function oq(e,t){let n=e.series[0].key,r=e.data.map(t=>({from:String(t[e.x.key]),to:String(t[e.to.key]),value:t[n]})),i=new Map;for(let e of r)i.has(e.from)||i.set(e.from,[]),i.set(e.to,[...i.get(e.to)??[],e]);let a=new Map,o=0;for(let[e,n]of i)n.length||a.set(e,t[o++%t.length]);let s=[...a.keys()],c=new Map([...i].filter(([,e])=>e.length).map(([e,t])=>[e,t.length]));for(;s.length;){let e=s.shift();for(let t of r.filter(t=>t.from===e)){if(c.set(t.to,c.get(t.to)-1),c.get(t.to)>0)continue;let e=i.get(t.to).reduce((e,t)=>t.value>e.value?t:e);a.set(t.to,a.get(e.from)),s.push(t.to)}}return a}function sq(e){let t=e.series[0].key,n=new Map(BK(e).map(e=>[e,0]));return e.data.forEach((r,i)=>n.set(LK(e,i),n.get(LK(e,i))+r[t])),n}function cq(e,t,n){let{palette:r,neutral:i,seq:a}=n,o=e.series[0].key;switch(e.type){case`donut`:return dq(e,t,n);case`funnel`:return tq(e.data.length,a)[t];case`heatmap`:case`calendar`:return eq($K(ZK(e,o),a),Q(e,o,t));case`gauge`:return r[0];case`waterfall`:{let n=aq(e)[t];return n.total?r[0]:n.value>=0?r[2]:r[7]}case`treemap`:return r[[...sq(e).keys()].indexOf(LK(e,t))%r.length];case`sankey`:return oq(e,r).get(String(e.data[t][e.x.key]));case`scatter`:case`bubble`:return r[Math.max(0,BK(e).indexOf(LK(e,t)))];default:return r[0]??i}}function lq(e,t,n,r){let i=e.series[0],a=Q(e,i.key,t),o=()=>cq(e,t,r);switch(e.type){case`donut`:{let r=e.data.reduce((t,r,a)=>t+(n.has($(e,a))?0:Q(e,i.key,a)??0),0);return{title:$(e,t),rows:[{color:o(),label:i.label,value:Z(a,i.format)},{label:`Share`,value:r&&a!=null?Z(a/r,{style:`percent`}):`-`}],foot:``}}case`heatmap`:return{title:`${LK(e,t)}, ${$(e,t)}`,rows:[{color:o(),label:i.label,value:Z(a,i.format)}],foot:``};case`calendar`:return{title:JK(IK(e,t)),rows:[{color:o(),label:i.label,value:Z(a,i.format)}],foot:``};case`funnel`:{let n=Q(e,i.key,0),r=t?Q(e,i.key,t-1):null,s=[{color:o(),label:i.label,value:Z(a,i.format)}];return t&&s.push({label:`Of previous step`,value:QK(a,r)}),s.push({label:`Of ${$(e,0)}`,value:QK(a,n)}),{title:$(e,t),rows:s,foot:``}}case`gauge`:{let{min:n,max:r}=iq(e),s=a==null?null:nq(e,a),c=[{color:o(),label:i.label,value:Z(a,i.format)}];return c.push({label:`Scale`,value:`${Z(n,i.format)} to ${Z(r,i.format)}`}),s&&c.push({label:`Band`,value:s.label}),{title:e.data[t]?.[e.x.key]==null?i.label:$(e,t),rows:c,foot:``}}case`waterfall`:{let n=aq(e)[t],r=aq(e)[0].value,a=n.total?[{color:o(),label:i.label,value:Z(n.value,i.format)}]:[{color:o(),label:`Change`,value:uq(n.value,i.format)},{label:`Running total`,value:Z(n.level,i.format)}],s=!n.total&&r?`${uq(n.value/r*100,{style:`number`,decimals:2},`%`)} of opening`:``;return{title:$(e,t),rows:a,foot:s}}case`treemap`:{let n=LK(e,t),r=sq(e).get(n);return{title:`${n} / ${$(e,t)}`,rows:[{color:o(),label:i.label,value:Z(a,i.format)},{label:`Share of ${n}`,value:QK(a,r)}],foot:``}}case`sankey`:{let n=String(e.data[t][e.x.key]),r=e.data.reduce((t,r,a)=>String(r[e.x.key])===n?t+(Q(e,i.key,a)??0):t,0);return{title:`${n} to ${RK(e,t)}`,rows:[{color:o(),label:i.label,value:Z(a,i.format)},{label:`Share of ${n}`,value:QK(a,r)}],foot:``}}case`scatter`:case`bubble`:{let n=[{color:o(),label:e.x.label||String(e.x.key),value:$(e,t)},{label:i.label,value:Z(a,i.format)}];return e.size&&n.push({label:e.size.label||String(e.size.key),value:Z(e.data[t][e.size.key],e.size.format)}),{title:e.group?LK(e,t):i.label,rows:n,foot:``}}default:break}let s=e.stack===`percent`?KK(e,n)[t]:null,c=e.series.map((e,t)=>({s:e,i:t})).filter(({s:e})=>!n.has(e.key)),l=c.map(({s:n,i})=>{let a=Q(e,n.key,t),o=Z(a,n.format);return{color:e.type===`multiples`?r.palette[0]:r.palette[i],line:e.type===`line`||e.type===`multiples`,label:n.label,value:s&&a!=null?`${o} (${Z(s[n.key],{style:`percent`})})`:o}}),u=``;if(e.stack!==`none`&&c.length>1&&(u=`Total ${Z(c.reduce((n,{s:r})=>n+(Q(e,r.key,t)??0),0),c[0].s.format)}`),e.target&&c.length===1){let n=Q(e,c[0].s.key,t);if(n!=null){let t=n-e.target.value,r=e.target.label||`target`;u=`${t>=0?`Above`:`Below`} ${r} by ${Z(Math.abs(t),c[0].s.format)}`}}return{title:$(e,t),rows:l,foot:u}}function uq(e,t,n=``){let r=`${Z(Math.abs(e),t)}${n}`;return e>0?`+${r}`:e<0?`−${r}`:r}function dq(e,t,n){return t===e.otherIndex?n.neutral:n.palette[t%n.palette.length]}function fq(e){let t=(e,t)=>{let n=document.createElement(`div`);return n.className=e,t!=null&&(n.textContent=t),n},n=t(`wui-chart-tooltip-body`);e.title&&n.append(t(`wui-chart-tooltip-title`,e.title));for(let r of e.rows){let e=t(`wui-chart-tooltip-row`);if(r.color){let t=document.createElement(`span`);t.className=r.line?`wui-chart-tooltip-swatch wui-chart-tooltip-swatch-line`:`wui-chart-tooltip-swatch`,t.style.background=r.color,e.append(t)}let i=document.createElement(`span`);i.className=`wui-chart-tooltip-label`,i.textContent=r.label;let a=document.createElement(`span`);a.className=`wui-chart-tooltip-value`,a.textContent=r.value,e.append(i,a),n.append(e)}return e.foot&&n.append(t(`wui-chart-tooltip-foot`,e.foot)),n}function pq(e){let t=[e.title,...e.rows.map(e=>`${e.label} ${e.value}`)];return e.foot&&t.push(e.foot),t.filter(Boolean).join(`. `)}function mq(e){return e.x.label?e.x.label:{gauge:`Measure`,funnel:`Stage`,waterfall:`Step`,sankey:`From`,scatter:`X`,bubble:`X`}[e.type]??(e.x.kind===`time`?`Date`:`Category`)}function hq(e){let t=e.allData&&e.allData!==e.data?{...e,data:e.allData}:e,n=t.series[0],r=(e,r=n)=>Z(Q(t,r.key,e),r.format),i=(e,n,r=n.length)=>({caption:t.title,head:e,rows:n.slice(0,500),total:r,truncated:r>500}),a=t.data.map((e,t)=>t);switch(t.type){case`heatmap`:{let e=zK(a.map(e=>$(t,e))),n=BK(t),o=new Map(a.map(e=>[`${LK(t,e)}\u0000${$(t,e)}`,r(e)]));return i([t.group.label||`Row`,...e],n.map(t=>({head:t,cells:e.map(e=>o.get(`${t}\u0000${e}`)??`-`)})))}case`funnel`:{let e=Q(t,n.key,0);return i([mq(t),n.label,`Of previous step`,`Of ${$(t,0)}`],a.map(i=>({head:$(t,i),cells:[r(i),i?QK(Q(t,n.key,i),Q(t,n.key,i-1)):`-`,QK(Q(t,n.key,i),e)]})))}case`gauge`:return i([mq(t),n.label,...t.bands.length?[`Band`]:[]],a.map(e=>({head:t.data[e][t.x.key]==null?n.label:$(t,e),cells:[r(e),...t.bands.length?[rq(t,Q(t,n.key,e))]:[]]})));case`waterfall`:return i([mq(t),`Change`,`Running total`],aq(t).map(e=>({head:$(t,e.index),cells:[e.total?`-`:uq(e.value,n.format),Z(e.level,n.format)]})));case`treemap`:{let e=sq(t);return i([t.group.label||`Group`,t.x.label||`Item`,n.label,`Share of group`],a.map(i=>({head:LK(t,i),cells:[$(t,i),r(i),QK(Q(t,n.key,i),e.get(LK(t,i)))]})))}case`sankey`:return i([mq(t),t.to.label||`To`,n.label],a.map(e=>({head:$(t,e),cells:[RK(t,e),r(e)]})));case`scatter`:case`bubble`:return i([mq(t),n.label,...t.size?[t.size.label||t.size.key]:[],...t.group?[t.group.label||`Group`]:[]],a.map(e=>({head:$(t,e),cells:[r(e),...t.size?[Z(t.data[e][t.size.key],t.size.format)]:[],...t.group?[LK(t,e)]:[]]})));default:break}let o=t.type===`donut`,s=o?t.data.reduce((e,r,i)=>e+(Q(t,n.key,i)??0),0):0,c=[mq(t),...t.series.map(e=>e.label)];return o&&c.push(`Share`),i(c,a.slice(0,500).map(e=>{let i=t.series.map(t=>r(e,t));if(o){let r=Q(t,n.key,e);i.push(s&&r!=null?Z(r/s,{style:`percent`}):`-`)}return{head:$(t,e),cells:i}}),t.data.length)}function gq(e){switch(e?.style){case`currency`:case`compact`:return e.currency||e.style===`currency`?` (${e.currency??`INR`})`:``;case`percent`:return` (%)`;case`duration`:return` (${e.unit??`s`})`;default:return``}}function _q(e,t){return e==null?e:t?.unit===`paise`?e/100:t?.style===`percent`?Number((e*100).toPrecision(12)):e}function vq(e){let t=e.allData&&e.allData!==e.data?{...e,data:e.allData}:e,n=e=>{if(e==null)return``;let t=String(e);return typeof e==`string`&&/^[=+\-@\t\r]/.test(t)&&(t=`'${t}`),/[",\r\n]/.test(t)?`"${t.replace(/"/g,`""`)}"`:t},r={head:t.x.label||t.x.key,value:e=>{let n=e[t.x.key];return t.x.kind===`time`?VG(n,{pattern:t.x.format?.pattern??`day`}):n}},i=t.series.map(e=>({head:`${e.label}${gq(e.format)}`,value:t=>_q(kK(t[e.key])?t[e.key]:null,e.format)})),a=t.group?{head:t.group.label||t.group.key,value:e=>e[t.group.key]}:null,o;switch(t.type){case`heatmap`:o=[r,a,...i];break;case`treemap`:o=[a,r,...i];break;case`sankey`:o=[r,{head:t.to.label||t.to.key,value:e=>e[t.to.key]},...i];break;case`bubble`:o=[r,...i,{head:`${t.size.label||t.size.key}${gq(t.size.format)}`,value:e=>_q(e[t.size.key],t.size.format)},...a?[a]:[]];break;case`scatter`:o=[r,...i,...a?[a]:[]];break;case`gauge`:o=typeof t.x.key==`string`?[r,...i]:i;break;default:o=[r,...i]}let s=[o.map(e=>n(e.head)).join(`,`)];for(let e of t.data)s.push(o.map(t=>n(t.value(e))).join(`,`));return`${s.join(`\r
21
- `)}`}function yq(e){return(e?.title??``).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/(^-|-$)/g,``)||`chart`}var bq=(e,t,n)=>{if(!t.length)return null;let r=YK(t),i=XK(t);return r===i?`${e} is ${Z(r,n)}.`:`${e} runs from ${Z(r,n)} to ${Z(i,n)}.`};function xq(e){let t=[];e.description&&t.push(e.description.replace(/\.?\s*$/,`.`));let n=e.data.length,r=e.series[0],i=ZK(e,r.key),a=i.reduce((e,t)=>e+t,0),o=()=>e.data.reduce((t,n,i)=>(Q(e,r.key,i)??-1/0)>(Q(e,r.key,t)??-1/0)?i:t,0),s=()=>e.data.reduce((t,n,i)=>(Q(e,r.key,i)??1/0)<(Q(e,r.key,t)??1/0)?i:t,0);switch(e.type){case`donut`:{let i=o();return t.push(`${rK.donut} of ${r.label} in ${n} parts, ${Z(a,r.format)} in all.`),n&&a&&t.push(`${$(e,i)} is the largest, at ${Z(Q(e,r.key,i)/a,{style:`percent`})}.`),t.join(` `)}case`heatmap`:if(t.push(`${rK.heatmap} of ${r.label} by ${e.group.label||`row`} and ${e.x.label||`column`}, ${n} cells.`),i.length){let n=o(),r=s();t.push(`Highest is ${Sq(e,n)} at ${LK(e,n)}, ${$(e,n)}; lowest is ${Sq(e,r)} at ${LK(e,r)}, ${$(e,r)}.`)}return t.join(` `);case`calendar`:return t.push(`${rK.calendar} of ${r.label}, ${n} ${n===1?`day`:`days`}${n>1?`, from ${$(e,0)} to ${$(e,n-1)}`:``}.`),i.length&&t.push(`Highest is ${Sq(e,o())} on ${$(e,o())}; lowest is ${Sq(e,s())} on ${$(e,s())}.`),t.join(` `);case`funnel`:return t.push(`${rK.funnel} of ${r.label} in ${n} stages.`),n>1&&t.push(`${$(e,0)} is ${Sq(e,0)} and ${$(e,n-1)} is ${Sq(e,n-1)}, ${QK(Q(e,r.key,n-1),Q(e,r.key,0))} of the start.`),t.join(` `);case`gauge`:{let n=Q(e,r.key,0),{min:i,max:a}=iq(e),o=n==null?null:nq(e,n);return t.push(`${rK.gauge}: ${r.label} is ${Z(n,r.format)} on a scale from ${Z(i,r.format)} to ${Z(a,r.format)}${o?`, in the ${o.label} band`:``}.`),t.join(` `)}case`waterfall`:{let i=aq(e);if(t.push(`${rK.waterfall} of ${r.label}.`),n>1){let a=i.filter(e=>!e.total);t.push(`It opens at ${Z(i[0].value,r.format)} and closes at ${Z(i[n-1].value,r.format)}.`);let o=a.reduce((e,t)=>t.value>(e?.value??0)?t:e,null),s=a.reduce((e,t)=>t.value<(e?.value??0)?t:e,null);o&&t.push(`The largest rise is ${$(e,o.index)}, ${uq(o.value,r.format)}.`),s&&t.push(`The largest fall is ${$(e,s.index)}, ${uq(s.value,r.format)}.`)}return t.join(` `)}case`treemap`:{let i=sq(e);if(!i.size)return`${rK.treemap} of ${r.label}: no items.`;let[o,s]=[...i].reduce((e,t)=>t[1]>e[1]?t:e);return t.push(`${rK.treemap} of ${r.label}: ${n} items in ${i.size} groups, ${Z(a,r.format)} in all.`),t.push(`${o} is the largest group, at ${QK(s,a)}.`),t.join(` `)}case`sankey`:{let i=zK(e.data.flatMap(t=>[String(t[e.x.key]),String(t[e.to.key])])),a=o();return t.push(`${rK.sankey} of ${r.label}: ${n} flows between ${i.length} places.`),t.push(`The largest flow is ${$(e,a)} to ${RK(e,a)}, ${Sq(e,a)}.`),t.join(` `)}case`scatter`:case`bubble`:{let a=BK(e);t.push(`${rK[e.type]} of ${r.label} against ${e.x.label||e.x.key}, ${n} points${a.length?` in ${a.length} groups: ${a.join(`, `)}`:``}.`);let o=e.data.map(t=>t[e.x.key]).filter(kK);for(let n of[bq(e.x.label||String(e.x.key),o,e.x.format),bq(r.label,i,r.format)])n&&t.push(n);return t.join(` `)}default:break}let c=e.stack===`percent`?`, stacked to 100%`:e.stack===`stacked`?`, stacked`:``;t.push(`${rK[e.type]} of ${e.series.map(e=>e.label).join(`, `)}${c}${e.type===`multiples`?`, sharing one x axis`:``}.`),n&&t.push(`${n} ${n===1?`point`:`points`}, ${n>1?`from ${$(e,0)} to ${$(e,n-1)}`:$(e,0)}.`);for(let n of e.series){let r=bq(n.label,ZK(e,n.key),n.format);r&&t.push(r)}return t.join(` `)}var Sq=(e,t)=>Z(Q(e,e.series[0].key,t),e.series[0].format);function Cq(e){return e.stack===`percent`?{style:`percent`,decimals:0}:UG(e.y.format)}var wq=864e5,Tq={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},Eq=[`donut`,`funnel`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`];function Dq(e,t){let n=e.data.map((e,t)=>t).filter(n=>!GK(e,n,t));if(e.type!==`scatter`&&e.type!==`bubble`)return n;let r=t=>e.data[t][e.x.key];return n.sort((e,t)=>r(e)-r(t)||e-t)}function Oq(e){let t=zK(e.data.map((t,n)=>$(e,n))),n=BK(e),r=new Map(e.data.map((r,i)=>[`${t.indexOf($(e,i))},${n.indexOf(LK(e,i))}`,i]));return{columns:t.length,rows:n.length,at:r,position:r=>[t.indexOf($(e,r)),n.indexOf(LK(e,r))]}}function kq(e,t,n,r){if(n===`Escape`)return null;let i=e.data.length;if(!i)return t;if(e.type===`gauge`)return n in Tq||n===`Home`||n===`End`?{index:0,series:0}:t;if(e.type===`heatmap`||e.type===`calendar`)return Aq(e,t,n);let a=Eq.includes(e.type),o=e.series.map((e,t)=>r.has(e.key)?-1:t).filter(e=>e>=0),s=a?Dq(e,r):null;if(a?!s.length:!o.length)return t;let c=t??{index:a?s[0]:0,series:a?0:o[0]};if(t==null&&n in Tq)return c;if(a){let e=Math.max(0,s.indexOf(c.index));return n===`Home`?{index:s[0],series:0}:n===`End`?{index:s[s.length-1],series:0}:n in Tq?{index:s[(e+Tq[n]+s.length)%s.length],series:0}:t}if(n===`Home`)return{...c,index:0};if(n===`End`)return{...c,index:i-1};if(!(n in Tq))return t;if(e.type===`bar`?n===`ArrowUp`||n===`ArrowDown`:n===`ArrowLeft`||n===`ArrowRight`)return{...c,index:Math.min(i-1,Math.max(0,c.index+Tq[n]))};let l=Math.max(0,o.indexOf(c.series)),u=e.type===`bar`?Tq[n]:-Tq[n];return{...c,series:o[Math.min(o.length-1,Math.max(0,l+u))]}}function Aq(e,t,n){let r=e.data.length,i=e.type===`calendar`,a=i?e.data.map((e,t)=>t).sort((t,n)=>IK(e,t)-IK(e,n)):null,o=i?null:Oq(e),s=t??{index:i?a[0]:0,series:0};if(t==null&&n in Tq)return s;if(n===`Home`)return{index:i?a[0]:0,series:0};if(n===`End`)return{index:i?a[r-1]:r-1,series:0};if(!(n in Tq))return t;if(i){let t=n===`ArrowDown`||n===`ArrowUp`?Tq[n]:Tq[n]*7,r=t=>Math.floor((IK(e,t)+SG)/wq),i=r(s.index),o=a.filter(e=>t>0?r(e)>i:r(e)<i);if(!o.length)return{index:s.index,series:0};let c=i+t;return{index:o.reduce((e,t)=>Math.abs(r(t)-c)<Math.abs(r(e)-c)?t:e),series:0}}let[c,l]=o.position(s.index),[u,d]=n===`ArrowLeft`||n===`ArrowRight`?[Tq[n],0]:[0,Tq[n]];return{index:o.at.get(`${c+u},${l+d}`)??s.index,series:0}}Rj([fx,nT,QT,DL,RI,DI,ZF,bL,QM,qR,_B,wV,QB,vz,ez,OH,tH,TB,fU,zH,WW,mG]);var jq=[`series`,`graphic`,`grid`,`xAxis`,`yAxis`,`title`,`visualMap`,`calendar`,`dataZoom`],Mq=e=>String(e).replace(/[{}]/g,e=>e===`{`?`{`:`}`);function Nq(e,t,n,r){let i=UG(e);if(i.style!==`compact`||!Number.isFinite(t)||!Number.isFinite(n))return i;let a=(n-t)/r;if(!(a>0)||a>=Math.max(Math.abs(t),Math.abs(n))*.02)return i;let o=Math.min(6,Math.max(0,Math.ceil(-Math.log10(a))));return i.currency?{style:`currency`,currency:i.currency,unit:i.unit,decimals:o}:{style:`number`,decimals:o}}var Pq=(e,t)=>{let n=e.filter(e=>e!=null&&Number.isFinite(e));return[Math.min(...t?[0,...n]:n),Math.max(...t?[0,...n]:n)]},Fq=24,Iq=4;function Lq(e){let t=String(e??``).trim(),n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t);if(n){let e=n[1].length===3?[...n[1]].map(e=>e+e).join(``):n[1];return[0,2,4].map(t=>Number.parseInt(e.slice(t,t+2),16))}let r=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(t);return r?r.slice(1,4).map(Number):null}function Rq(e,t){let n=Lq(e);return n?`rgba(${n.join(`,`)},${t})`:String(e??``).trim()}function zq(e,t,n){let r=Lq(e),i=Lq(t);return r&&i?`rgb(${r.map((e,t)=>Math.round(e+(i[t]-e)*n)).join(`,`)})`:e}var Bq=e=>e.map(e=>e/255).map(e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4).reduce((e,t,n)=>e+t*[.2126,.7152,.0722][n],0),Vq=(e,t)=>(Math.max(e,t)+.05)/(Math.min(e,t)+.05);function Hq(e,t){let n=Lq(e),r=Lq(t.text),i=Lq(t.surface);return!n||!r||!i||Vq(Bq(n),Bq(r))>=Vq(Bq(n),Bq(i))?t.text:t.surface}var Uq=(e,t)=>({type:`linear`,x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:Rq(e,t)},{offset:1,color:Rq(e,0)}]}),Wq=e=>e+SG;function Gq(e){let t=e.x.format?.pattern;return e=>{let n=e-SG;if(t===`month`||t===`year`)return VG(n,{pattern:t});let r=BG(n);return r.hour||r.minute?VG(n,{pattern:`time`}):HG(n)}}function Kq(e,t,n){let r=Iq,i=e=>n?e?[r,0,0,r]:[0,r,r,0]:e?[0,0,r,r]:[r,r,0,0];return e.data.map((n,r)=>{let a={};if(e.stack===`none`){for(let t of e.series)a[t.key]=i((Q(e,t.key,r)??0)<0);return a}let o=null,s=null;for(let n of e.series){let i=Q(e,n.key,r);t.has(n.key)||i==null||i===0||(i>0?o=n.key:s=n.key)}for(let t of e.series)a[t.key]=t.key===o?i(!1):t.key===s?i(!0):0;return a})}function qq(e,t,n,r){let i=n.width<576,a=r.animation!==!1&&!t.reducedMotion&&VK(e)<=5e3,o=UK(e),s=Object.fromEntries(o.map(e=>[e,!r.hidden.has(e)])),c={palette:t.palette,neutral:t.neutral,seq:t.seq},l={backgroundColor:t.surface,borderColor:t.grid,borderWidth:1,padding:[10,12],confine:!0,className:`wui-chart-tooltip`,extraCssText:`box-shadow:${t.shadow};border-radius:10px;`,textStyle:{fontFamily:t.font,color:t.textBody,fontSize:12},transitionDuration:a?.25:0},u={backgroundColor:`transparent`,animation:a,animationDuration:1e3,animationEasing:`cubicOut`,animationDurationUpdate:650,animationEasingUpdate:`cubicInOut`,textStyle:{fontFamily:t.font,color:t.label},color:t.palette,legend:{show:!1,data:o,selected:s}},d={base:u,tooltipBase:l,colours:c,compact:i,animate:a},f=jJ[e.type];if(f)return f(e,t,n,r,d);let p=e.type===`bar`,m=e.x.kind===`time`,h=e.stack===`percent`?KK(e,r.hidden):null,g=p||e.type===`column`?Kq(e,r.hidden,p):null,_=e.series.length===1,v=r.renderer===`canvas`,[y,b]=Pq(e.series.flatMap(t=>e.data.map((n,r)=>Q(e,t.key,r))),!0),x=e.stack===`percent`?Cq(e):Nq(e.y.format,e.y.min??y,e.y.max??b,i?3:4),S=h?.some(e=>Object.values(e).some(e=>e!=null&&e<0))?-1:0,C=e.series.findIndex(e=>!r.hidden.has(e.key)),w={type:m?`time`:`category`,boundaryGap:!m&&(e.type===`column`||p),inverse:p,axisLine:{show:!0,lineStyle:{color:t.axis}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{color:t.label,fontSize:11,margin:12,hideOverlap:!0,...m?{formatter:Gq(e)}:{}},...m?{}:{data:e.data.map((t,n)=>$(e,n))}},T={type:`value`,splitNumber:i?3:4,min:e.stack===`percent`?S:e.y.min,max:e.stack===`percent`?1:e.y.max,interval:e.stack===`percent`?.25:void 0,axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:t.grid,type:`solid`,width:1}},axisLabel:{color:t.label,fontSize:11,formatter:e=>Z(e,x)},...e.y.label?{name:e.y.label,nameLocation:`end`,nameGap:12,nameTextStyle:{color:t.label,fontSize:11,align:p?`right`:`left`}}:{}},E=e.zoom,D=_&&e.type!==`column`&&!p&&!i,O=e.series.map((n,r)=>{let o=t.palette[r],s=e.data.some((t,r)=>Q(e,n.key,r)!=null&&Q(e,n.key,r-1)==null&&Q(e,n.key,r+1)==null),c=t=>{let r=Q(e,n.key,t),i=h?h[t][n.key]:r;return m?[Wq(IK(e,t)),i]:i},l={id:n.key,name:n.key,stack:e.stack===`none`?void 0:`total`,emphasis:{focus:_?`none`:`series`,blurScope:`coordinateSystem`},blur:{itemStyle:{opacity:.22},lineStyle:{opacity:.22},areaStyle:{opacity:.08}}};if(e.type===`line`||e.type===`area`){let n=e.type===`area`?_||e.stack!==`none`?t.dark?.34:.22:.1:0;return{...l,type:`line`,data:e.data.map((e,t)=>c(t)),smooth:.35,connectNulls:!1,symbol:`circle`,showSymbol:s,symbolSize:8,sampling:v?`lttb`:void 0,lineStyle:{width:2,color:o,..._&&!v?{shadowColor:Rq(o,.35),shadowBlur:10,shadowOffsetY:6}:{}},itemStyle:{color:o,borderColor:t.surface,borderWidth:2},areaStyle:n?{color:Uq(o,n)}:void 0,endLabel:D?{show:!0,formatter:e=>Z(Array.isArray(e.value)?e.value[1]:e.value,x),color:o,fontWeight:600,fontSize:12,distance:8,fontFamily:t.font,valueAnimation:a}:void 0,markLine:r===C?Jq(e,t,!1,a):void 0}}return{...l,type:`bar`,barMaxWidth:Fq,barCategoryGap:i?`28%`:`38%`,itemStyle:{color:o,borderColor:t.surface,borderWidth:e.stack===`none`?0:1},animationDelay:a?e=>e*45+r*110:0,data:e.data.map((e,t)=>({value:c(t),itemStyle:{borderRadius:g[t][n.key]}})),markLine:r===C?Jq(e,t,p,a):void 0}});return{...u,useUTC:m,grid:{left:4,right:D?64:i?8:16,top:e.y.label?28:12,bottom:E?44:4,outerBoundsMode:`same`},dataZoom:E?OJ(e,t,t.palette[0],r.zoom):void 0,tooltip:{...l,trigger:`axis`,axisPointer:e.type===`line`||e.type===`area`?{type:`line`,lineStyle:{color:t.axis}}:{type:`shadow`,shadowStyle:{color:Rq(t.neutral,t.dark?.12:.1)}},formatter:t=>fq(lq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,c))},xAxis:p?T:w,yAxis:p?w:T,series:O}}function Jq(e,t,n,r){if(!e.target)return;let i=e.series[0].format;return{silent:!0,symbol:`none`,animation:r,lineStyle:{color:t.label,type:[5,4],width:1},label:{position:`insideEndTop`,formatter:()=>[e.target.label,Z(e.target.value,i)].filter(Boolean).join(` `),color:t.textMuted,fontSize:11,fontFamily:t.font,backgroundColor:t.surface,padding:[2,6],borderRadius:4},data:[n?{xAxis:e.target.value}:{yAxis:e.target.value}]}}function Yq(e,t,n,r,{base:i,tooltipBase:a,colours:o,compact:s}){let c=e.series[0],l=e.data.map((t,n)=>$(e,n)),u=e.data.reduce((t,n,i)=>t+(r.hidden.has(l[i])?0:Q(e,c.key,i)??0),0);return{...i,tooltip:{...a,trigger:`item`,formatter:t=>fq(lq(e,t.dataIndex,r.hidden,o))},graphic:[{type:`group`,left:`center`,top:`middle`,silent:!0,children:[{type:`text`,style:{text:Z(u,UG(c.format)),x:0,y:-10,align:`center`,verticalAlign:`middle`,fill:t.text,fontSize:s?18:22,fontWeight:650,fontFamily:t.font}},{type:`text`,style:{text:`Total`,x:0,y:14,align:`center`,verticalAlign:`middle`,fill:t.label,fontSize:12,fontFamily:t.font}}]}],series:[{id:c.key,name:c.key,type:`pie`,radius:s?[`50%`,`70%`]:[`54%`,`72%`],center:[`50%`,`50%`],padAngle:1.6,minAngle:3,startAngle:90,avoidLabelOverlap:!0,itemStyle:{borderRadius:6,borderColor:t.surface,borderWidth:2},animationType:`expansion`,animationDuration:1100,label:s?{show:!1}:{show:!0,position:`outside`,color:t.label,fontFamily:t.font,fontSize:11.5,lineHeight:16,formatter:e=>`${e.name}\n${Z(e.percent/100,{style:`percent`,decimals:0})}`},labelLine:{length:10,length2:8,smooth:.2,lineStyle:{color:t.axis}},labelLayout:{hideOverlap:!0},emphasis:{scale:!0,scaleSize:6,itemStyle:{shadowBlur:16,shadowColor:`rgba(0,0,0,0.18)`}},data:e.data.map((t,n)=>({name:l[n],value:Q(e,c.key,n)??0,itemStyle:{color:dq(e,n,o)}}))}]}}var Xq=e=>[...new Set(e)],Zq=(e,t)=>e.data.map((n,r)=>Q(e,t,r));function Qq(e,t){return{...e,trigger:`item`,formatter:e=>t(e)}}var $q=(e,t,n={})=>({type:`category`,data:t,axisLine:{lineStyle:{color:e.axis}},axisTick:{show:!1},axisLabel:{color:e.label,fontSize:11,margin:12,hideOverlap:!0},...n}),eJ=(e,t,n={})=>({type:`value`,splitNumber:4,axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:e.grid,type:`solid`,width:1}},axisLabel:{color:e.label,fontSize:11,formatter:t},...n});function tJ(e,t,n){return{type:`piecewise`,orient:`horizontal`,right:4,bottom:0,pieces:t.map((e,n)=>({gte:e.from,[n===t.length-1?`lte`:`lt`]:e.to,color:e.colour})),itemWidth:11,itemHeight:11,itemGap:3,itemSymbol:`roundRect`,showLabel:!1,text:[`More`,`Less`],textGap:8,selectedMode:!1,textStyle:{color:e.label,fontSize:11,fontFamily:e.font},...n}}function nJ(e,t,n,r,i){let a=e.series[0],o=Xq(e.data.map((t,n)=>$(e,n))),s=BK(e),c=$K(Zq(e,a.key),t.seq);return{...i.base,grid:{left:4,right:4,top:8,bottom:40,outerBoundsMode:`same`},tooltip:Qq(i.tooltipBase,t=>fq(lq(e,t.dataIndex,r.hidden,i.colours))),xAxis:$q(t,o,{axisLine:{show:!1},splitArea:{show:!1}}),yAxis:$q(t,s,{inverse:!0,axisLine:{show:!1}}),visualMap:tJ(t,c),series:[{type:`heatmap`,data:e.data.map((t,n)=>[o.indexOf($(e,n)),s.indexOf(LK(e,n)),Q(e,a.key,n)??`-`]),itemStyle:{borderColor:t.surface,borderWidth:2,borderRadius:4},emphasis:{itemStyle:{borderColor:t.text,borderWidth:1.5}},progressive:0,animationDuration:800}]}}var rJ=7*864e5,iJ=e=>{let t=BG(e);return`${t.year}-${String(t.month+1).padStart(2,`0`)}-${String(t.day).padStart(2,`0`)}`};function aJ(e,t){let n=e.data.map((t,n)=>IK(e,n)).filter(Number.isFinite),r=oJ(n),i=sJ(n),a=Math.ceil((i-r)/rJ)+1,o=Math.floor((t.height-62)/7),s=Math.max(cJ,Math.min(lJ,o,Math.floor((t.width-44)/a))),c=Math.max(1,Math.floor((t.width-44)/s));return{cell:s,from:a>c?i-(c-1)*rJ:r,to:i}}var oJ=e=>e.reduce((e,t)=>t<e?t:e,1/0),sJ=e=>e.reduce((e,t)=>t>e?t:e,-1/0),cJ=9,lJ=24;function uJ(e,t,n,r,i){let a=e.series[0],{cell:o,from:s,to:c}=aJ(e,n),l=$K(Zq(e,a.key),t.seq);return{...i.base,tooltip:Qq(i.tooltipBase,t=>fq(lq(e,t.dataIndex,r.hidden,i.colours))),visualMap:tJ(t,l,{right:4}),calendar:{range:[iJ(s),iJ(c)],top:24,left:34,cellSize:[o,o],splitLine:{show:!1},itemStyle:{color:t.seq[0],borderColor:t.surface,borderWidth:o<16?2:3},dayLabel:{firstDay:1,nameMap:[``,`Mon`,``,`Wed`,``,`Fri`,``],color:t.label,fontSize:10,fontFamily:t.font,margin:8},monthLabel:{color:t.label,fontSize:11,fontFamily:t.font,margin:8},yearLabel:{show:!1}},series:[{type:`heatmap`,coordinateSystem:`calendar`,data:e.data.map((t,n)=>[iJ(IK(e,n)),Q(e,a.key,n)??`-`]),itemStyle:{borderRadius:3,borderColor:t.surface,borderWidth:2},emphasis:{itemStyle:{borderColor:t.text,borderWidth:1.5}}}]}}function dJ(e,t,n,r,i){let a=e.series[0],o=tq(e.data.length,t.seq),s=Q(e,a.key,0);return{...i.base,tooltip:Qq(i.tooltipBase,t=>fq(lq(e,t.dataIndex,r.hidden,i.colours))),series:[{type:`funnel`,sort:`none`,gap:3,left:0,right:0,top:4,bottom:4,minSize:`38%`,maxSize:`100%`,funnelAlign:`center`,animationDuration:900,itemStyle:{borderColor:t.surface,borderWidth:0,borderRadius:6},emphasis:{itemStyle:{shadowBlur:14,shadowColor:`rgba(0,0,0,0.18)`}},label:{show:!0,position:`inside`,fontFamily:t.font,lineHeight:17},data:e.data.map((n,r)=>{let i=Hq(o[r],t),c=Q(e,a.key,r),l=r?`${QK(c,Q(e,a.key,r-1))} of previous step`:`${QK(c,s)} of ${Mq($(e,0))}`;return{name:$(e,r),value:c??0,itemStyle:{color:o[r]},label:{formatter:`{n|${Mq($(e,r))}} {v|${Mq(Z(c,a.format))}}\n{p|${r?l:`first stage`}}`,rich:{n:{color:i,fontSize:12.5,fontWeight:500,fontFamily:t.font},v:{color:i,fontSize:13,fontWeight:700,fontFamily:t.font},p:{color:Rq(i,.78),fontSize:11,fontFamily:t.font}}}}})}]}}function fJ(e,t,n,r,i){let a=e.series[0],{min:o,max:s}=iq(e),c=Q(e,a.key,0),l=c??o,u=c==null?null:nq(e,c),d=t.palette[0],f=s-o||1,p=e.bands.length?e.bands.map((e,n)=>[Math.min(1,Math.max(0,(e.upTo-o)/f)),t.seq[1+Math.min(n,3)]]):[[1,t.grid]];return e.bands.length&&p[p.length-1][0]<1&&p.push([1,t.grid]),{...i.base,tooltip:Qq(i.tooltipBase,()=>fq(lq(e,0,r.hidden,i.colours))),series:[{type:`gauge`,startAngle:215,endAngle:-35,min:o,max:s,radius:`96%`,center:[`50%`,`58%`],splitNumber:10,pointer:{show:!1},anchor:{show:!1},progress:{show:c!=null,width:14,roundCap:!0,itemStyle:{color:d,shadowBlur:i.animate?12:0,shadowColor:Rq(d,.35)}},axisLine:{roundCap:!0,lineStyle:{width:14,color:p}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{show:!1},title:{offsetCenter:[0,`30%`],color:t.label,fontSize:12.5,fontFamily:t.font},detail:{valueAnimation:i.animate,offsetCenter:[0,`-4%`],fontFamily:t.font,formatter:e=>`{v|${Mq(c==null?Z(null):Z(e,a.format))}}{u|/${Mq(Z(s,a.format))}}${u?`\n{s|${Mq(u.label)}}`:``}`,rich:{v:{fontSize:36,fontWeight:650,color:t.text,fontFamily:t.font,padding:[0,2,0,0]},u:{fontSize:14,color:t.label,fontFamily:t.font,padding:[12,0,0,0]},s:{fontSize:12,color:t.label,fontFamily:t.font,padding:[8,0,0,0]}}},data:[{value:l,name:e.data[0]?.[e.x.key]==null?a.label:$(e,0)}]}]}}function pJ(e){let t=sJ(e.map(e=>e.level).concat(e.map(e=>e.from),e.map(e=>e.to))),n=oJ(e.filter(e=>!e.total).map(e=>Math.min(e.from,e.to)).concat(e.filter(e=>e.total).map(e=>e.value))),r=sJ(e.filter(e=>!e.total).map(e=>Math.abs(e.value)));if(!(t>0)||!(n>t*.4)||!(r<t*.15))return null;let i=10**Math.floor(Math.log10(t))/10,a=Math.round(t*.08/i)*i,o=Math.floor(n*.965/i)*i;return o>a?{start:a,end:o}:null}function mJ(e,t,n,r,i){let a=e.series[0],o=aq(e),s=Cq(e),c=pJ(o),l=t=>cq(e,t.index,i.colours),u=o.map(t=>$(e,t.index));return{...i.base,grid:{left:4,right:8,top:28,bottom:4,outerBoundsMode:`same`},tooltip:{...i.tooltipBase,trigger:`axis`,axisPointer:{type:`shadow`,shadowStyle:{color:Rq(t.neutral,.1)}},formatter:t=>fq(lq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,i.colours))},xAxis:$q(t,u,{axisLabel:{color:t.label,fontSize:i.compact?10:11,margin:12,interval:0,width:Math.max(40,Math.floor((n.width-40)/u.length)),overflow:`break`}}),yAxis:eJ(t,e=>Z(e,s),{min:0,splitNumber:5,...c?{breaks:[{start:c.start,end:c.end,gap:`6%`}],breakArea:{show:!0,itemStyle:{color:t.surface,borderColor:t.axis,borderWidth:1,borderType:`solid`,opacity:1},zigzagAmplitude:3,zigzagZ:200}}:{}}),series:[{type:`line`,step:`end`,data:o.map(e=>e.level),symbol:`none`,silent:!0,z:1,lineStyle:{color:t.axis,width:1},tooltip:{show:!1},animation:!1,emphasis:{disabled:!0}},{type:`bar`,stack:`w`,data:o.map(e=>Math.min(e.from,e.to)),silent:!0,itemStyle:{color:`transparent`},emphasis:{disabled:!0},tooltip:{show:!1},barMaxWidth:48},{name:a.key,type:`bar`,stack:`w`,z:3,barMaxWidth:48,barCategoryGap:`34%`,itemStyle:{borderRadius:5},emphasis:{itemStyle:{shadowBlur:10,shadowColor:`rgba(0,0,0,0.15)`}},animationDelay:i.animate?e=>e*140:0,label:{show:!0,position:`top`,distance:6,fontFamily:t.font,fontSize:i.compact?10.5:12,fontWeight:600,color:t.text,formatter:e=>{let t=o[e.dataIndex];return t.total?Z(t.value,s):uq(t.value,s)}},data:o.map(e=>({value:Math.abs(e.to-e.from),itemStyle:{color:l(e)}}))}]}}function hJ(e){let t=e.series[0].key;return BK(e).map(n=>({name:n,rows:e.data.map((e,t)=>t).filter(t=>LK(e,t)===n).sort((n,r)=>Q(e,t,r)-Q(e,t,n)||n-r)}))}function gJ(e,t,n,r,i){let a=e.series[0],o=sq(e),s=[...o.values()].reduce((e,t)=>e+t,0),c=e=>e/s*n.width*n.height*.82>5200,l=hJ(e).map(({name:n,rows:r},i)=>{let s=o.get(n),l=t.palette[i%t.palette.length],u=Hq(l,t);return{name:n,value:s,itemStyle:{color:l,borderColor:l},upperLabel:{color:u,formatter:`{n|${Mq(n)}} {v|${Mq(Z(s,a.format))}}`,rich:{n:{fontWeight:600,fontSize:12,color:u,fontFamily:t.font},v:{fontSize:12,color:Rq(u,.8),fontFamily:t.font}}},children:r.map((n,r)=>{let i=zq(l,t.surface,Math.min(.55,r*.14)),o=Hq(i,t),s=Q(e,a.key,n);return{name:$(e,n),value:s,row:n,itemStyle:{color:i},label:{show:c(s),formatter:`{n|${Mq($(e,n))}}\n{v|${Mq(Z(s,a.format))}}`,rich:{n:{color:o,fontSize:12,fontWeight:500,fontFamily:t.font,lineHeight:16},v:{color:Rq(o,.82),fontSize:11.5,fontFamily:t.font}}}}})}});return{...i.base,tooltip:Qq(i.tooltipBase,t=>t.data?.row==null?fq({title:t.name,rows:[{color:t.color,label:a.label,value:Z(t.value,a.format)},{label:`Share of all`,value:QK(t.value,s)}],foot:``}):fq(lq(e,t.data.row,r.hidden,i.colours))),series:[{type:`treemap`,roam:!1,nodeClick:!1,breadcrumb:{show:!1},left:0,right:0,top:0,bottom:0,animationDurationUpdate:700,label:{show:!0,position:`insideTopLeft`,padding:[8,10],overflow:`truncate`,fontFamily:t.font},upperLabel:{show:!0,height:28,padding:[0,10],fontFamily:t.font},levels:[{itemStyle:{borderWidth:0,gapWidth:4,borderColor:t.surface}},{itemStyle:{borderWidth:3,gapWidth:2,borderRadius:8}},{itemStyle:{borderWidth:0,gapWidth:0,borderRadius:5},emphasis:{itemStyle:{borderColor:t.text,borderWidth:0}}}],data:l}]}}function _J(e){let t=e.data.map(t=>[String(t[e.x.key]),String(t[e.to.key])]),n=new Map(t.flatMap(([e,t])=>[[e,0],[t,0]]));for(let e=0;e<n.size;e+=1)for(let[e,r]of t)n.set(r,Math.max(n.get(r),n.get(e)+1));return n}function vJ(e,t,n,r,i){let a=e.series[0],o=oq(e,t.palette),s=_J(e),c=sJ([...s.values()]),l=new Map,u=new Map;e.data.forEach((t,n)=>{let r=Q(e,a.key,n)??0;l.set(String(t[e.x.key]),(l.get(String(t[e.x.key]))??0)+r),u.set(String(t[e.to.key]),(u.get(String(t[e.to.key]))??0)+r)});let d=e=>u.get(e)??l.get(e)??0,f=e=>({position:e,color:t.text,fontFamily:t.font,fontSize:i.compact?11:12,formatter:e=>`{n|${Mq(e.name)}}\n{v|${Z(d(e.name),{style:`compact`})}}`,rich:{n:{color:t.textBody,fontSize:i.compact?11:12,fontFamily:t.font,lineHeight:15},v:{color:t.label,fontSize:11,fontFamily:t.font}}});return{...i.base,tooltip:Qq(i.tooltipBase,t=>fq(t.dataType===`edge`?lq(e,t.dataIndex,r.hidden,i.colours):{title:t.name,rows:[{color:t.color,label:a.label,value:Z(d(t.name),a.format)}],foot:``})),series:[{type:`sankey`,left:0,right:0,top:6,bottom:6,nodeWidth:10,nodeGap:i.compact?10:14,nodeAlign:`justify`,draggable:!1,layoutIterations:64,animationDuration:1200,emphasis:{focus:`adjacency`,lineStyle:{opacity:.55}},itemStyle:{borderWidth:0,borderRadius:3},lineStyle:{curveness:.5},levels:Array.from({length:c+1},(e,t)=>({depth:t,label:f(t===c&&c>0?`left`:`right`)})),data:[...s.keys()].map(e=>({name:e,itemStyle:{color:o.get(e)}})),links:e.data.map(n=>({source:String(n[e.x.key]),target:String(n[e.to.key]),value:n[a.key],lineStyle:{color:o.get(String(n[e.x.key])),opacity:t.dark?.32:.26}}))}]}}function yJ(e){let t=e.length,n=e.reduce((e,t)=>e+t[0],0)/t,r=e.reduce((e,t)=>e+t[1],0)/t,i=e.reduce((e,t)=>e+(t[0]-n)**2,0);if(!t||!i)return null;let a=e.reduce((e,t)=>e+(t[0]-n)*(t[1]-r),0)/i,o=oJ(e.map(e=>e[1])),s=sJ(e.map(e=>e[1])),c=e=>{let t=r+a*(e-n);return t<o?[e+(o-t)/a,o]:t>s?[e+(s-t)/a,s]:[e,t]};return[c(oJ(e.map(e=>e[0]))),c(sJ(e.map(e=>e[0])))]}var bJ=44,xJ=28,SJ=8;function CJ(e,t,n,r,i){let a=e.series[0],o=BK(e),s=e.type===`bubble`,c=sJ(s?e.data.map(t=>t[e.size.key]):[]),l=e=>Math.max(SJ,(i.compact?xJ:bJ)*Math.sqrt(e/c)),u=t=>e.data.map((e,t)=>t).filter(n=>!e.group||LK(e,n)===t),d=(e.group?o:[null]).filter(e=>e==null||!r.hidden.has(e)).flatMap(e=>u(e)),f=e.trend?yJ(d.map(t=>[e.data[t][e.x.key],Q(e,a.key,t)])):null,p=e.data.map(t=>t[e.x.key]),m=e.data.map((t,n)=>Q(e,a.key,n)),[h,g]=Pq(p,!1),[_,v]=Pq(m,!1),y=Nq(e.y.format,e.y.min??_,e.y.max??v,4),b=Nq(e.x.format,h,g,4),x=(e.group?o:[null]).map((n,r)=>({name:n??a.key,type:`scatter`,symbolSize:s?e=>l(e[2]):i.compact?8:10,itemStyle:{color:Rq(t.palette[r],.85),borderColor:t.surface,borderWidth:1.5},emphasis:{focus:`series`,scale:1.5,itemStyle:{color:t.palette[r]}},blur:{itemStyle:{opacity:.15}},animationDelay:i.animate?e=>e*6+r*120:0,data:u(n).map(t=>({value:[e.data[t][e.x.key],Q(e,a.key,t),...s?[e.data[t][e.size.key]]:[]],row:t}))}));return f&&x.push({name:`Trend`,type:`line`,data:f,symbol:`none`,silent:!0,z:1,tooltip:{show:!1},lineStyle:{color:t.label,width:1.5,type:[6,4]},emphasis:{disabled:!0},endLabel:{show:!0,formatter:`Trend`,color:t.label,fontSize:11,fontFamily:t.font,offset:[-30,-12]}}),{...i.base,grid:{left:4,right:16,top:e.y.label?28:12,bottom:e.x.label?24:4,outerBoundsMode:`same`},tooltip:Qq(i.tooltipBase,t=>t.data?.row==null?``:fq(lq(e,t.data.row,r.hidden,i.colours))),xAxis:eJ(t,e=>Z(e,b),{scale:!0,splitLine:{show:!1},axisLine:{show:!0,lineStyle:{color:t.axis}},...e.x.label?{name:e.x.label,nameLocation:`middle`,nameGap:28,nameTextStyle:{color:t.label,fontSize:11,fontFamily:t.font}}:{}}),yAxis:eJ(t,e=>Z(e,y),{min:e.y.min,max:e.y.max,...e.y.label?{name:e.y.label,nameLocation:`end`,nameGap:12,nameTextStyle:{color:t.label,fontSize:11,fontFamily:t.font,align:`left`}}:{}}),series:x}}var wJ=32,TJ=8,EJ=26;function DJ(e,t,n,r,i){let a=e.x.kind===`time`,o=e.series.length,s=(n.height-6-EJ)/o,c=s-wJ-TJ,l=t.palette[0],u=e.data.map((t,n)=>$(e,n)),d=e.series.flatMap((n,r)=>{let i=Zq(e,n.key).filter(e=>e!=null).pop();return[{text:n.label,left:0,top:6+r*s,textStyle:{fontSize:12.5,fontWeight:600,color:t.text,fontFamily:t.font}},{text:`Latest ${Z(i,n.format)}`,right:8,top:7+r*s,textStyle:{fontSize:12,fontWeight:500,color:t.label,fontFamily:t.font}}]}),f=(t,n)=>{let r=Q(e,t.key,n);return a?[Wq(IK(e,n)),r]:r};return{...i.base,useUTC:a,title:d,grid:e.series.map((e,t)=>({left:52,right:8,top:6+t*s+wJ,height:c})),axisPointer:{link:[{xAxisIndex:`all`}],lineStyle:{color:t.axis},label:{show:!1}},tooltip:{...i.tooltipBase,trigger:`axis`,axisPointer:{type:`line`,lineStyle:{color:t.axis}},formatter:t=>fq(lq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,i.colours))},xAxis:e.series.map((n,r)=>({...a?{type:`time`}:$q(t,u,{boundaryGap:!1}),gridIndex:r,axisLine:{lineStyle:{color:r===o-1?t.axis:t.grid}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{show:r===o-1,color:t.label,fontSize:11,hideOverlap:!0,margin:10,...a?{formatter:Gq(e)}:{}}})),yAxis:e.series.map((n,r)=>{let[i,a]=Pq(Zq(e,n.key),!1),o=Nq(n.format,e.y.min??i,e.y.max??a,2);return eJ(t,e=>Z(e,o),{gridIndex:r,splitNumber:2,scale:e.y.min==null,min:e.y.min,max:e.y.max,axisLabel:{color:t.label,fontSize:10.5,formatter:e=>Z(e,o)}})}),series:e.series.map((n,r)=>({id:n.key,name:n.key,type:`line`,xAxisIndex:r,yAxisIndex:r,data:e.data.map((e,t)=>f(n,t)),smooth:.3,symbol:`circle`,showSymbol:!1,symbolSize:7,lineStyle:{width:1.75,color:l},itemStyle:{color:l,borderColor:t.surface,borderWidth:2},areaStyle:{color:Uq(l,t.dark?.26:.16)},animationDelay:i.animate?r*160:0,emphasis:{disabled:!0}}))}}function OJ(e,t,n,r){let i=r?.start??(e.data.length>5e3?70:0),a=r?.end??100;return[{type:`inside`,start:i,end:a},{type:`slider`,start:i,end:a,height:26,bottom:8,left:52,right:12,borderColor:`transparent`,backgroundColor:t.grid,borderRadius:6,fillerColor:Rq(n,t.dark?.22:.12),handleStyle:{color:t.surface,borderColor:t.axis},moveHandleSize:0,brushSelect:!1,dataBackground:{lineStyle:{color:t.axis,width:.75},areaStyle:{color:Rq(t.neutral,.15)}},selectedDataBackground:{lineStyle:{color:n,width:.75},areaStyle:{color:Rq(n,.18)}},textStyle:{color:t.label,fontSize:11,fontFamily:t.font}}]}function kJ(e,t,n){switch(e.type){case`scatter`:case`bubble`:{if(!e.group)return{seriesIndex:0,dataIndex:n};let t=LK(e,n),r=e.data.map((e,t)=>t).filter(n=>LK(e,n)===t);return{seriesIndex:BK(e).indexOf(t),dataIndex:r.indexOf(n)}}case`waterfall`:return{seriesIndex:2,dataIndex:n};case`sankey`:return{seriesIndex:0,dataIndex:n,dataType:`edge`,tip:!1};case`treemap`:{let t=1;for(let r of hJ(e)){let e=r.rows.indexOf(n);if(e>=0)return{seriesIndex:0,dataIndex:t+1+e};t+=1+r.rows.length}return{seriesIndex:0,dataIndex:n}}case`gauge`:case`donut`:case`heatmap`:case`calendar`:case`funnel`:return{seriesIndex:0,dataIndex:n};default:return{seriesIndex:t,dataIndex:n}}}function AJ(e,t){switch(e.type){case`scatter`:case`bubble`:return t.data?.row==null?null:{series:0,row:t.data.row};case`treemap`:return t.data?.row==null?null:{series:0,row:t.data.row};case`sankey`:return t.dataType===`edge`?{series:0,row:t.dataIndex}:null;case`waterfall`:return t.seriesIndex===2?{series:0,row:t.dataIndex}:null;case`line`:case`area`:case`column`:case`bar`:case`multiples`:return{series:t.seriesIndex,row:t.dataIndex};default:return{series:0,row:t.dataIndex}}}var jJ={donut:Yq,heatmap:nJ,calendar:uJ,funnel:dJ,gauge:fJ,waterfall:mJ,treemap:gJ,sankey:vJ,scatter:CJ,bubble:CJ,multiples:DJ};function MJ(e,t,n,r,{pixelRatio:i=2}={}){let a=document.createElement(`div`);a.style.cssText=`position:fixed;left:-10000px;top:0;width:${n.width}px;height:${n.height}px;`,document.body.append(a);let o=vj(a,null,{renderer:`canvas`,devicePixelRatio:i,width:n.width,height:n.height});try{return o.setOption(qq(e,t,n,{...r,renderer:`canvas`,animation:!1})),o.getDataURL({type:`png`,pixelRatio:i,backgroundColor:t.surface})}finally{o.dispose(),a.remove()}}function NJ(e,{renderer:t}){let n=vj(e,null,{renderer:t}),r=!1,i=null;return{renderer:t,render(e,t,a,o,{replace:s=!1}={}){let c=r&&!s?n.getOption()?.dataZoom?.[0]:null,l=Number.isFinite(c?.start)&&Number.isFinite(c?.end)?{start:c.start,end:c.end}:null,u=qq(e,t,a,{...o,zoom:l});i=e,n.setOption(u,s||!r?{notMerge:!0}:{replaceMerge:jq}),r=!0},focusPoint(e,t){let{tip:r=!0,...a}=kJ(i,e,t);n.dispatchAction({type:`downplay`}),n.dispatchAction({type:`highlight`,...a}),r&&n.dispatchAction({type:`showTip`,...a})},clearFocus(){n.dispatchAction({type:`hideTip`}),n.dispatchAction({type:`downplay`})},resize(){n.resize()},onSelect(e){n.on(`click`,t=>{if(t.componentType!==`series`)return;let n=AJ(i,t);n&&e({seriesIndex:n.series,dataIndex:n.row})})},onFinished(e){n.on(`finished`,e)},dispose(){n.dispose()}}}var PJ=typeof HTMLElement>`u`?class{}:HTMLElement,FJ=`wui-chart:select`,IJ=`wui-chart:legend-change`,LJ=`wui-chart:ready`,RJ=[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`Escape`],zJ=`(prefers-color-scheme: dark)`,BJ=`(prefers-reduced-motion: reduce)`,VJ=e=>typeof window.matchMedia==`function`?window.matchMedia(e):null,HJ=!1;function UJ(e){let t=getComputedStyle(e),n=e=>t.getPropertyValue(e).trim(),r=e.closest(`[data-bs-theme], [data-theme]`)??document.documentElement,i=r.getAttribute(`data-bs-theme`)||r.getAttribute(`data-theme`),a={palette:[1,2,3,4,5,6,7,8].map(e=>n(`--wui-chart-${e}`)),seq:[0,1,2,3,4,5,6].map(e=>n(`--wui-chart-seq-${e}`)),neutral:n(`--wui-chart-neutral`),grid:n(`--wui-chart-grid`),axis:n(`--wui-chart-axis`),label:n(`--wui-chart-label`),surface:n(`--color-surface`),text:n(`--color-text`),textBody:n(`--color-text-body`),textMuted:n(`--color-text-muted`),shadow:n(`--wui-shadow-overlay`),font:t.fontFamily,dark:i===`dark`||i===`auto`&&!!VJ(zJ)?.matches,reducedMotion:!!VJ(BJ)?.matches};return!a.palette[0]&&!HJ&&(HJ=!0,console.warn(`[@webority/ui-elements] <wui-chart> found no --wui-chart-* colours: load @webority/theme on the page.`)),a}var WJ=new Set,GJ=null;function KJ(e){if(WJ.add(e),GJ)return;let t=()=>{for(let e of WJ)e._themeChanged()},n=new MutationObserver(t);n.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`,`data-bs-theme`,`class`]});let r=new MutationObserver(t);r.observe(document.documentElement,{attributes:!0,subtree:!0,attributeFilter:[`data-theme`,`data-bs-theme`]});let i=[VJ(zJ),VJ(BJ)].filter(Boolean);for(let e of i)e.addEventListener?.(`change`,t);GJ=()=>{n.disconnect(),r.disconnect();for(let e of i)e.removeEventListener?.(`change`,t);GJ=null}}function qJ(e){WJ.delete(e),WJ.size||GJ?.()}function JJ(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,document.body.append(n),n.click(),n.remove()}var YJ=(e,t,n)=>{let r=document.createElement(e);return t&&(r.className=t),n!=null&&(r.textContent=n),r},XJ=0,ZJ=class extends PJ{static get observedAttributes(){return[`view`]}constructor(){super(),XJ+=1,this.uid=`wui-chart-${XJ}`,this._spec=null,this._normal=null,this._hidden=new Set,this._focus=null}get spec(){return this._spec}set spec(e){this._spec=e??null,this._normal=null,this._clearFocus(),this._parts&&this._update()}get view(){return this.getAttribute(`view`)===`table`?`table`:`chart`}set view(e){this.setAttribute(`view`,String(e??`chart`))}connectedCallback(){if(Object.hasOwn(this,`spec`)){let e=this.spec;delete this.spec,this._spec=e??null}this._spec??=this._readScript(),this._spec==null&&!this.querySelector(`:scope > script[type='application/json']`)&&(this._awaitingSpec=!0,queueMicrotask(()=>{this._awaitingSpec=!1,this._parts&&this._update()})),this._build(),KJ(this),this._theme=UJ(this),this._width=this.clientWidth,this._resizeObserver=new ResizeObserver(()=>this._resized()),this._resizeObserver.observe(this),typeof IntersectionObserver==`function`?(this._visible=!1,this._intersection=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(this._intersection.disconnect(),this._visible=!0,this._update())},{threshold:.05}),this._intersection.observe(this)):this._visible=!0,this._update()}disconnectedCallback(){qJ(this),this._resizeObserver?.disconnect(),this._intersection?.disconnect(),this._engine?.dispose(),this._engine=null,this._drawn=!1,this._parts=null}attributeChangedCallback(e,t,n){t===n||!this._parts||(EK(`view`,n,YG),this._update())}toCsv(){let{spec:e}=this._normalized();return e?vq(e):``}toPng(){let{spec:e}=this._normalized();return e?MJ(e,this._theme??UJ(this),this._size(e),{hidden:this._hidden,renderer:HK(e)}):``}exportCsv(e){let t=URL.createObjectURL(new Blob([this.toCsv()],{type:`text/csv;charset=utf-8`}));JJ(t,e??`${yq(this._normalized().spec)}.csv`),setTimeout(()=>URL.revokeObjectURL(t),2e3)}exportPng(e){let t=this.toPng();t&&JJ(t,e??`${yq(this._normalized().spec)}.png`)}_readScript(){let e=this.querySelector(`:scope > script[type="application/json"]`);if(!e)return null;try{return JSON.parse(e.textContent)}catch(e){return console.error(`[@webority/ui-elements] <wui-chart> could not read its JSON spec:`,e?.message),null}}_normalized(){return this._normal??=jK(this._spec),this._normal}_build(){let e=YJ(`div`,`wui-chart-legend`);e.setAttribute(`role`,`group`),e.setAttribute(`aria-label`,`Legend`),e.hidden=!0,e.addEventListener(`click`,e=>{let t=e.target.closest?.(`.wui-chart-legend-item`);t&&this._toggle(t.dataset.key)});let t=YJ(`div`,`wui-chart-surface`);t.tabIndex=0,t.setAttribute(`role`,`group`),t.setAttribute(`aria-roledescription`,`chart`),t.addEventListener(`keydown`,e=>this._onKey(e)),t.addEventListener(`blur`,()=>this._clearFocus());let n=YJ(`div`,`wui-chart-canvas`);n.setAttribute(`aria-hidden`,`true`),t.append(n);let r=YJ(`div`,`wui-chart-state`);r.setAttribute(`role`,`status`),r.hidden=!0;let i=YJ(`div`,`wui-chart-table-wrap visually-hidden`),a=YJ(`p`,`visually-hidden`);a.id=`${this.uid}-summary`;let o=YJ(`div`,`visually-hidden`);o.setAttribute(`aria-live`,`polite`),this.replaceChildren(e,t,r,i,a,o),this.setAttribute(`role`,`figure`),this.setAttribute(`aria-describedby`,a.id),this._parts={legend:e,surface:t,canvas:n,state:r,tableWrap:i,summary:a,live:o},this._legendSignature=null,this._tableSpec=null}_size(e){return{width:this._parts?.surface.clientWidth||this.clientWidth||800,height:e.height}}_update(){if(!this._parts||this._awaitingSpec&&this._spec==null)return;let{spec:e,problem:t}=this._normalized(),n=this._parts,r=t?`error`:e.state===`ready`&&(!e.data.length||!FK(e))?`empty`:e.state,i=`${e?.height??320}px`,a=this.view===`table`,o=e&&(r===`ready`||r===`loading`&&this._drawn),s=r===`loading`&&o;if(this.setAttribute(`aria-label`,e?.title||`Chart`),r===`loading`?this.setAttribute(`aria-busy`,`true`):this.removeAttribute(`aria-busy`),this.setAttribute(`data-state`,r),n.surface.setAttribute(`aria-label`,`${e?.title||`Chart`}: use the arrow keys to read the values`),n.summary.textContent=e?xq(e):``,e){if(!s){let t=new Set(UK(e));for(let e of this._hidden)t.has(e)||this._hidden.delete(e)}this._renderTable(e)}else n.tableWrap.replaceChildren();s||this._renderLegend(e,o&&!a),this._renderState(r,t??(r===`error`?e.errorText:e?.emptyText),i,o);let c=n.surface.hidden&&o&&!a;n.surface.hidden=!o||a,n.surface.style.height=i,n.tableWrap.className=a&&e?`wui-chart-table-wrap`:`wui-chart-table-wrap visually-hidden`,n.tableWrap.style.height=a&&e?i:``,a&&e?(n.tableWrap.tabIndex=0,n.tableWrap.setAttribute(`role`,`region`),n.tableWrap.setAttribute(`aria-label`,`${e.title||`Chart`} data`)):(n.tableWrap.removeAttribute(`tabindex`),n.tableWrap.removeAttribute(`role`),n.tableWrap.removeAttribute(`aria-label`)),c&&this._engine?.resize(),r===`ready`&&!a&&this._visible&&this._draw()}_renderState(e,t,n,r){let i=this._parts.state,a=!r&&e!==`ready`;if(i.hidden=!a,!a){i.replaceChildren();return}i.style.height=n,e===`loading`?i.replaceChildren(YJ(`div`,`skeleton wui-chart-skeleton`),YJ(`span`,`visually-hidden`,`Loading chart`)):i.replaceChildren(YJ(`p`,`wui-chart-state-text`,t))}_colour(e,t){return e.type===`donut`?cq(e,t,this._theme):this._theme.palette[t]}_renderLegend(e,t){let n=this._parts.legend,r=e?UK(e):[],i=!!e&&t&&r.length>=2;if(n.hidden=!i,!i)return;let a=WK(e),o=r.map((t,n)=>this._colour(e,n)),s=JSON.stringify([e.type,r,a,o]);s!==this._legendSignature&&(this._legendSignature=s,n.replaceChildren(...r.map((t,n)=>{let r=YJ(`button`,`wui-chart-legend-item`);r.type=`button`,r.dataset.key=t;let i=YJ(`span`,e.type===`line`?`wui-chart-legend-swatch wui-chart-legend-swatch-line`:`wui-chart-legend-swatch`);return i.style.background=o[n],r.append(i,YJ(`span`,`wui-chart-legend-label`,a[n])),r})));for(let e of n.children)e.setAttribute(`aria-pressed`,String(!this._hidden.has(e.dataset.key)))}_renderTable(e){if(this._tableSpec===e)return;this._tableSpec=e;let t=hq(e),n=YJ(`table`,`wui-chart-table`);n.append(YJ(`caption`,`visually-hidden`,t.caption));let r=YJ(`tr`);t.head.forEach((e,t)=>{let n=YJ(`th`,t?`wui-chart-num`:null,e);n.scope=`col`,r.append(n)});let i=YJ(`thead`);i.append(r),n.append(i);let a=YJ(`tbody`);for(let e of t.rows){let t=YJ(`tr`),n=YJ(`th`,null,e.head);n.scope=`row`,t.append(n,...e.cells.map(e=>YJ(`td`,`wui-chart-num`,e))),a.append(t)}n.append(a);let o=[n];t.truncated&&o.push(YJ(`p`,`wui-chart-table-note`,`Showing the first ${t.rows.length} of ${t.total} rows. Download the CSV for all of them.`)),this._parts.tableWrap.replaceChildren(...o)}_draw(){let{spec:e}=this._normalized(),t=HK(e),n=e.type!==this._drawnType;this._engine&&this._engine.renderer!==t&&(this._engine.dispose(),this._engine=null);let r=`${e.height}px`,i=this._parts.canvas.style.height!==r;this._parts.canvas.style.height=r,i&&this._engine?.resize(),this._engine||(this._engine=NJ(this._parts.canvas,{renderer:t}),this._engine.onSelect(({seriesIndex:e,dataIndex:t})=>this._select(e,t)),this._engine.onFinished(()=>{this._announcedReady||(this._announcedReady=!0,this.dispatchEvent(new CustomEvent(LJ,{bubbles:!0,detail:{renderer:t}})))}),n=!0),this._engine.render(e,this._theme,this._size(e),{hidden:this._hidden,renderer:t},{replace:n}),this._drawnType=e.type,this._drawn=!0}_themeChanged(){if(!this._parts)return;let e=UJ(this);JSON.stringify(e)!==JSON.stringify(this._theme)&&(this._theme=e,this._update())}_resized(){let e=this.clientWidth;e!==this._width&&(this._width=e,!(!this._engine||!this._drawn)&&(this._parts.surface.hidden||this._engine.resize(),this._update()))}_toggle(e){let{spec:t}=this._normalized();if(!t||e==null)return;this._hidden.has(e)?this._hidden.delete(e):this._hidden.add(e),this._clearFocus(),this._update();let n=Object.fromEntries(UK(t).map(e=>[e,!this._hidden.has(e)]));this.dispatchEvent(new CustomEvent(IJ,{bubbles:!0,detail:{visible:n}}))}_onKey(e){let{spec:t}=this._normalized();if(!t||!this._engine||this.view===`table`||e.altKey||e.ctrlKey||e.metaKey)return;if(e.key===`Enter`){if(!this._focus)return;e.preventDefault(),this._select(this._focus.series,this._focus.index);return}if(!RJ.includes(e.key)||e.key===`Escape`&&!this._focus)return;e.preventDefault();let n=kq(t,this._focus,e.key,this._hidden);if(!n){this._clearFocus();return}this._focus=n,this._engine.focusPoint(n.series,n.index),this._announce(pq(lq(t,n.index,this._hidden,this._theme)))}_announce(e){let t=this._parts.live;t.textContent=e===t.textContent?`${e}\u00a0`:e}_clearFocus(){this._focus&&(this._focus=null,this._engine?.clearFocus(),this._parts&&(this._parts.live.textContent=``))}_select(e,t){let{spec:n}=this._normalized(),r=n?.series[aK(n.type)?0:e];if(!r)return;let i=n.data[t]??null;this.dispatchEvent(new CustomEvent(FJ,{bubbles:!0,detail:{series:r.key,label:r.label,x:i?.[n.x.key]??null,value:Q(n,r.key,t),row:i,index:t}}))}};return typeof customElements<`u`&&!customElements.get(`wui-chart`)&&customElements.define(`wui-chart`,ZJ),e.CHART_STATES=JG,e.CHART_TYPES=WG,e.CHART_VIEWS=YG,e.MAX_SERIES=XG,e.MAX_SLICES=ZG,e.RENDERERS=qG,e.STACK_MODES=GG,e.WuiChart=ZJ,e.X_KINDS=KG,e.formatValue=Z,e.normalizeSpec=jK,e})({});
21
+ `)}`}function yq(e){return(e?.title??``).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/(^-|-$)/g,``)||`chart`}var bq=(e,t,n)=>{if(!t.length)return null;let r=YK(t),i=XK(t);return r===i?`${e} is ${Z(r,n)}.`:`${e} runs from ${Z(r,n)} to ${Z(i,n)}.`};function xq(e){let t=[];e.description&&t.push(e.description.replace(/\.?\s*$/,`.`));let n=e.data.length,r=e.series[0],i=ZK(e,r.key),a=i.reduce((e,t)=>e+t,0),o=()=>e.data.reduce((t,n,i)=>(Q(e,r.key,i)??-1/0)>(Q(e,r.key,t)??-1/0)?i:t,0),s=()=>e.data.reduce((t,n,i)=>(Q(e,r.key,i)??1/0)<(Q(e,r.key,t)??1/0)?i:t,0);switch(e.type){case`donut`:{let i=o();return t.push(`${rK.donut} of ${r.label} in ${n} parts, ${Z(a,r.format)} in all.`),n&&a&&t.push(`${$(e,i)} is the largest, at ${Z(Q(e,r.key,i)/a,{style:`percent`})}.`),t.join(` `)}case`heatmap`:if(t.push(`${rK.heatmap} of ${r.label} by ${e.group.label||`row`} and ${e.x.label||`column`}, ${n} cells.`),i.length){let n=o(),r=s();t.push(`Highest is ${Sq(e,n)} at ${LK(e,n)}, ${$(e,n)}; lowest is ${Sq(e,r)} at ${LK(e,r)}, ${$(e,r)}.`)}return t.join(` `);case`calendar`:return t.push(`${rK.calendar} of ${r.label}, ${n} ${n===1?`day`:`days`}${n>1?`, from ${$(e,0)} to ${$(e,n-1)}`:``}.`),i.length&&t.push(`Highest is ${Sq(e,o())} on ${$(e,o())}; lowest is ${Sq(e,s())} on ${$(e,s())}.`),t.join(` `);case`funnel`:return t.push(`${rK.funnel} of ${r.label} in ${n} stages.`),n>1&&t.push(`${$(e,0)} is ${Sq(e,0)} and ${$(e,n-1)} is ${Sq(e,n-1)}, ${QK(Q(e,r.key,n-1),Q(e,r.key,0))} of the start.`),t.join(` `);case`gauge`:{let n=Q(e,r.key,0),{min:i,max:a}=iq(e),o=n==null?null:nq(e,n);return t.push(`${rK.gauge}: ${r.label} is ${Z(n,r.format)} on a scale from ${Z(i,r.format)} to ${Z(a,r.format)}${o?`, in the ${o.label} band`:``}.`),t.join(` `)}case`waterfall`:{let i=aq(e);if(t.push(`${rK.waterfall} of ${r.label}.`),n>1){let a=i.filter(e=>!e.total);t.push(`It opens at ${Z(i[0].value,r.format)} and closes at ${Z(i[n-1].value,r.format)}.`);let o=a.reduce((e,t)=>t.value>(e?.value??0)?t:e,null),s=a.reduce((e,t)=>t.value<(e?.value??0)?t:e,null);o&&t.push(`The largest rise is ${$(e,o.index)}, ${uq(o.value,r.format)}.`),s&&t.push(`The largest fall is ${$(e,s.index)}, ${uq(s.value,r.format)}.`)}return t.join(` `)}case`treemap`:{let i=sq(e);if(!i.size)return`${rK.treemap} of ${r.label}: no items.`;let[o,s]=[...i].reduce((e,t)=>t[1]>e[1]?t:e);return t.push(`${rK.treemap} of ${r.label}: ${n} items in ${i.size} groups, ${Z(a,r.format)} in all.`),t.push(`${o} is the largest group, at ${QK(s,a)}.`),t.join(` `)}case`sankey`:{let i=zK(e.data.flatMap(t=>[String(t[e.x.key]),String(t[e.to.key])])),a=o();return t.push(`${rK.sankey} of ${r.label}: ${n} flows between ${i.length} places.`),t.push(`The largest flow is ${$(e,a)} to ${RK(e,a)}, ${Sq(e,a)}.`),t.join(` `)}case`scatter`:case`bubble`:{let a=BK(e);t.push(`${rK[e.type]} of ${r.label} against ${e.x.label||e.x.key}, ${n} points${a.length?` in ${a.length} groups: ${a.join(`, `)}`:``}.`);let o=e.data.map(t=>t[e.x.key]).filter(kK);for(let n of[bq(e.x.label||String(e.x.key),o,e.x.format),bq(r.label,i,r.format)])n&&t.push(n);return t.join(` `)}default:break}let c=e.stack===`percent`?`, stacked to 100%`:e.stack===`stacked`?`, stacked`:``;t.push(`${rK[e.type]} of ${e.series.map(e=>e.label).join(`, `)}${c}${e.type===`multiples`?`, sharing one x axis`:``}.`),n&&t.push(`${n} ${n===1?`point`:`points`}, ${n>1?`from ${$(e,0)} to ${$(e,n-1)}`:$(e,0)}.`);for(let n of e.series){let r=bq(n.label,ZK(e,n.key),n.format);r&&t.push(r)}return t.join(` `)}var Sq=(e,t)=>Z(Q(e,e.series[0].key,t),e.series[0].format);function Cq(e){return e.stack===`percent`?{style:`percent`,decimals:0}:UG(e.y.format)}var wq=864e5,Tq={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},Eq=[`donut`,`funnel`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`];function Dq(e,t){let n=e.data.map((e,t)=>t).filter(n=>!GK(e,n,t));if(e.type!==`scatter`&&e.type!==`bubble`)return n;let r=t=>e.data[t][e.x.key];return n.sort((e,t)=>r(e)-r(t)||e-t)}function Oq(e){let t=zK(e.data.map((t,n)=>$(e,n))),n=BK(e),r=new Map(e.data.map((r,i)=>[`${t.indexOf($(e,i))},${n.indexOf(LK(e,i))}`,i]));return{columns:t.length,rows:n.length,at:r,position:r=>[t.indexOf($(e,r)),n.indexOf(LK(e,r))]}}function kq(e,t,n,r){if(n===`Escape`)return null;let i=e.data.length;if(!i)return t;if(e.type===`gauge`)return n in Tq||n===`Home`||n===`End`?{index:0,series:0}:t;if(e.type===`heatmap`||e.type===`calendar`)return Aq(e,t,n);let a=Eq.includes(e.type),o=e.series.map((e,t)=>r.has(e.key)?-1:t).filter(e=>e>=0),s=a?Dq(e,r):null;if(a?!s.length:!o.length)return t;let c=t??{index:a?s[0]:0,series:a?0:o[0]};if(t==null&&n in Tq)return c;if(a){let e=Math.max(0,s.indexOf(c.index));return n===`Home`?{index:s[0],series:0}:n===`End`?{index:s[s.length-1],series:0}:n in Tq?{index:s[(e+Tq[n]+s.length)%s.length],series:0}:t}if(n===`Home`)return{...c,index:0};if(n===`End`)return{...c,index:i-1};if(!(n in Tq))return t;if(e.type===`bar`?n===`ArrowUp`||n===`ArrowDown`:n===`ArrowLeft`||n===`ArrowRight`)return{...c,index:Math.min(i-1,Math.max(0,c.index+Tq[n]))};let l=Math.max(0,o.indexOf(c.series)),u=e.type===`bar`?Tq[n]:-Tq[n];return{...c,series:o[Math.min(o.length-1,Math.max(0,l+u))]}}function Aq(e,t,n){let r=e.data.length,i=e.type===`calendar`,a=i?e.data.map((e,t)=>t).sort((t,n)=>IK(e,t)-IK(e,n)):null,o=i?null:Oq(e),s=t??{index:i?a[0]:0,series:0};if(t==null&&n in Tq)return s;if(n===`Home`)return{index:i?a[0]:0,series:0};if(n===`End`)return{index:i?a[r-1]:r-1,series:0};if(!(n in Tq))return t;if(i){let t=n===`ArrowDown`||n===`ArrowUp`?Tq[n]:Tq[n]*7,r=t=>Math.floor((IK(e,t)+SG)/wq),i=r(s.index),o=a.filter(e=>t>0?r(e)>i:r(e)<i);if(!o.length)return{index:s.index,series:0};let c=i+t;return{index:o.reduce((e,t)=>Math.abs(r(t)-c)<Math.abs(r(e)-c)?t:e),series:0}}let[c,l]=o.position(s.index),[u,d]=n===`ArrowLeft`||n===`ArrowRight`?[Tq[n],0]:[0,Tq[n]];return{index:o.at.get(`${c+u},${l+d}`)??s.index,series:0}}Rj([fx,nT,QT,DL,RI,DI,ZF,bL,QM,qR,_B,wV,QB,vz,ez,OH,tH,TB,fU,zH,WW,mG]);var jq=[`series`,`graphic`,`grid`,`xAxis`,`yAxis`,`title`,`visualMap`,`calendar`,`dataZoom`],Mq=e=>String(e).replace(/[{}]/g,e=>e===`{`?`{`:`}`);function Nq(e,t,n,r){let i=UG(e);if(i.style!==`compact`||!Number.isFinite(t)||!Number.isFinite(n))return i;let a=(n-t)/r;if(!(a>0)||a>=Math.max(Math.abs(t),Math.abs(n))*.02)return i;let o=Math.min(6,Math.max(0,Math.ceil(-Math.log10(a))));return i.currency?{style:`currency`,currency:i.currency,unit:i.unit,decimals:o}:{style:`number`,decimals:o}}var Pq=(e,t)=>{let n=e.filter(e=>e!=null&&Number.isFinite(e));return[Math.min(...t?[0,...n]:n),Math.max(...t?[0,...n]:n)]},Fq=24,Iq=4,Lq=.6,Rq=(e,t)=>String(e).length*t*Lq;function zq(e){let t=String(e??``).trim(),n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t);if(n){let e=n[1].length===3?[...n[1]].map(e=>e+e).join(``):n[1];return[0,2,4].map(t=>Number.parseInt(e.slice(t,t+2),16))}let r=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(t);return r?r.slice(1,4).map(Number):null}function Bq(e,t){let n=zq(e);return n?`rgba(${n.join(`,`)},${t})`:String(e??``).trim()}function Vq(e,t,n){let r=zq(e),i=zq(t);return r&&i?`rgb(${r.map((e,t)=>Math.round(e+(i[t]-e)*n)).join(`,`)})`:e}var Hq=e=>e.map(e=>e/255).map(e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4).reduce((e,t,n)=>e+t*[.2126,.7152,.0722][n],0),Uq=(e,t)=>(Math.max(e,t)+.05)/(Math.min(e,t)+.05);function Wq(e,t){let n=zq(e),r=zq(t.text),i=zq(t.surface);return!n||!r||!i||Uq(Hq(n),Hq(r))>=Uq(Hq(n),Hq(i))?t.text:t.surface}var Gq=(e,t)=>({type:`linear`,x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:Bq(e,t)},{offset:1,color:Bq(e,0)}]}),Kq=e=>e+SG;function qq(e){let t=e.x.format?.pattern;return e=>{let n=e-SG;if(t===`month`||t===`year`)return VG(n,{pattern:t});let r=BG(n);return r.hour||r.minute?VG(n,{pattern:`time`}):HG(n)}}function Jq(e,t,n){let r=Iq,i=e=>n?e?[r,0,0,r]:[0,r,r,0]:e?[0,0,r,r]:[r,r,0,0];return e.data.map((n,r)=>{let a={};if(e.stack===`none`){for(let t of e.series)a[t.key]=i((Q(e,t.key,r)??0)<0);return a}let o=null,s=null;for(let n of e.series){let i=Q(e,n.key,r);t.has(n.key)||i==null||i===0||(i>0?o=n.key:s=n.key)}for(let t of e.series)a[t.key]=t.key===o?i(!1):t.key===s?i(!0):0;return a})}function Yq(e,t,n,r){let i=n.width<576,a=r.animation!==!1&&!t.reducedMotion&&VK(e)<=5e3,o=UK(e),s=Object.fromEntries(o.map(e=>[e,!r.hidden.has(e)])),c={palette:t.palette,neutral:t.neutral,seq:t.seq},l={backgroundColor:t.surface,borderColor:t.grid,borderWidth:1,padding:[10,12],confine:!0,className:`wui-chart-tooltip`,extraCssText:`box-shadow:${t.shadow};border-radius:10px;`,textStyle:{fontFamily:t.font,color:t.textBody,fontSize:12},transitionDuration:a?.25:0},u={backgroundColor:`transparent`,animation:a,animationDuration:1e3,animationEasing:`cubicOut`,animationDurationUpdate:650,animationEasingUpdate:`cubicInOut`,textStyle:{fontFamily:t.font,color:t.label},color:t.palette,legend:{show:!1,data:o,selected:s}},d={base:u,tooltipBase:l,colours:c,compact:i,animate:a},f=IJ[e.type];if(f)return f(e,t,n,r,d);let p=e.type===`bar`,m=e.x.kind===`time`,h=e.stack===`percent`?KK(e,r.hidden):null,g=p||e.type===`column`?Jq(e,r.hidden,p):null,_=e.series.length===1,v=r.renderer===`canvas`,[y,b]=Pq(e.series.flatMap(t=>e.data.map((n,r)=>Q(e,t.key,r))),!0),x=e.stack===`percent`?Cq(e):Nq(e.y.format,e.y.min??y,e.y.max??b,i?3:4),S=h?.some(e=>Object.values(e).some(e=>e!=null&&e<0))?-1:0,C=e.series.findIndex(e=>!r.hidden.has(e.key)),w={type:m?`time`:`category`,boundaryGap:!m&&(e.type===`column`||p),inverse:p,axisLine:{show:!0,lineStyle:{color:t.axis}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{color:t.label,fontSize:11,margin:12,hideOverlap:!0,...m?{formatter:qq(e)}:{}},...m?{}:{data:e.data.map((t,n)=>$(e,n))}},T={type:`value`,splitNumber:i?3:4,min:e.stack===`percent`?S:e.y.min,max:e.stack===`percent`?1:e.y.max,interval:e.stack===`percent`?.25:void 0,axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:t.grid,type:`solid`,width:1}},axisLabel:{color:t.label,fontSize:11,formatter:e=>Z(e,x)},...e.y.label?{name:e.y.label,nameLocation:`end`,nameGap:12,nameTextStyle:{color:t.label,fontSize:11,align:p?`right`:`left`}}:{}},E=e.zoom,D=_&&e.type!==`column`&&!p&&!i,O=e.series.map((n,r)=>{let o=t.palette[r],s=e.data.some((t,r)=>Q(e,n.key,r)!=null&&Q(e,n.key,r-1)==null&&Q(e,n.key,r+1)==null),c=t=>{let r=Q(e,n.key,t),i=h?h[t][n.key]:r;return m?[Kq(IK(e,t)),i]:i},l={id:n.key,name:n.key,stack:e.stack===`none`?void 0:`total`,emphasis:{focus:_?`none`:`series`,blurScope:`coordinateSystem`},blur:{itemStyle:{opacity:.22},lineStyle:{opacity:.22},areaStyle:{opacity:.08}}};if(e.type===`line`||e.type===`area`){let n=e.type===`area`?_||e.stack!==`none`?t.dark?.34:.22:.1:0;return{...l,type:`line`,data:e.data.map((e,t)=>c(t)),smooth:.35,connectNulls:!1,symbol:`circle`,showSymbol:s,symbolSize:8,sampling:v?`lttb`:void 0,lineStyle:{width:2,color:o,..._&&!v?{shadowColor:Bq(o,.35),shadowBlur:10,shadowOffsetY:6}:{}},itemStyle:{color:o,borderColor:t.surface,borderWidth:2},areaStyle:n?{color:Gq(o,n)}:void 0,endLabel:D?{show:!0,formatter:e=>Z(Array.isArray(e.value)?e.value[1]:e.value,x),color:o,fontWeight:600,fontSize:12,distance:8,fontFamily:t.font,valueAnimation:a}:void 0,markLine:r===C?Xq(e,t,!1,a):void 0}}return{...l,type:`bar`,barMaxWidth:Fq,barCategoryGap:i?`28%`:`38%`,itemStyle:{color:o,borderColor:t.surface,borderWidth:e.stack===`none`?0:1},animationDelay:a?e=>e*45+r*110:0,data:e.data.map((e,t)=>({value:c(t),itemStyle:{borderRadius:g[t][n.key]}})),markLine:r===C?Xq(e,t,p,a):void 0}});return{...u,useUTC:m,grid:{left:4,right:D?64:i?8:16,top:e.y.label?28:12,bottom:E?44:4,outerBoundsMode:`same`},dataZoom:E?NJ(e,t,t.palette[0],r.zoom):void 0,tooltip:{...l,trigger:`axis`,axisPointer:e.type===`line`||e.type===`area`?{type:`line`,lineStyle:{color:t.axis}}:{type:`shadow`,shadowStyle:{color:Bq(t.neutral,t.dark?.12:.1)}},formatter:t=>fq(lq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,c))},xAxis:p?T:w,yAxis:p?w:T,series:O}}function Xq(e,t,n,r){if(!e.target)return;let i=e.series[0].format;return{silent:!0,symbol:`none`,animation:r,lineStyle:{color:t.label,type:[5,4],width:1},label:{position:`insideEndTop`,formatter:()=>[e.target.label,Z(e.target.value,i)].filter(Boolean).join(` `),color:t.textMuted,fontSize:11,fontFamily:t.font,backgroundColor:t.surface,padding:[2,6],borderRadius:4},data:[n?{xAxis:e.target.value}:{yAxis:e.target.value}]}}function Zq(e,t,n,r,{base:i,tooltipBase:a,colours:o,compact:s}){let c=e.series[0],l=e.data.map((t,n)=>$(e,n)),u=e.data.reduce((t,n,i)=>t+(r.hidden.has(l[i])?0:Q(e,c.key,i)??0),0);return{...i,tooltip:{...a,trigger:`item`,formatter:t=>fq(lq(e,t.dataIndex,r.hidden,o))},graphic:[{type:`group`,left:`center`,top:`middle`,silent:!0,children:[{type:`text`,style:{text:Z(u,UG(c.format)),x:0,y:-10,align:`center`,verticalAlign:`middle`,fill:t.text,fontSize:s?18:22,fontWeight:650,fontFamily:t.font}},{type:`text`,style:{text:`Total`,x:0,y:14,align:`center`,verticalAlign:`middle`,fill:t.label,fontSize:12,fontFamily:t.font}}]}],series:[{id:c.key,name:c.key,type:`pie`,radius:s?[`50%`,`70%`]:[`54%`,`72%`],center:[`50%`,`50%`],padAngle:1.6,minAngle:3,startAngle:90,avoidLabelOverlap:!0,itemStyle:{borderRadius:6,borderColor:t.surface,borderWidth:2},animationType:`expansion`,animationDuration:1100,label:s?{show:!1}:{show:!0,position:`outside`,color:t.label,fontFamily:t.font,fontSize:11.5,lineHeight:16,formatter:e=>`${e.name}\n${Z(e.percent/100,{style:`percent`,decimals:0})}`},labelLine:{length:10,length2:8,smooth:.2,lineStyle:{color:t.axis}},labelLayout:{hideOverlap:!0},emphasis:{scale:!0,scaleSize:6,itemStyle:{shadowBlur:16,shadowColor:`rgba(0,0,0,0.18)`}},data:e.data.map((t,n)=>({name:l[n],value:Q(e,c.key,n)??0,itemStyle:{color:dq(e,n,o)}}))}]}}var Qq=e=>[...new Set(e)],$q=(e,t)=>e.data.map((n,r)=>Q(e,t,r));function eJ(e,t){return{...e,trigger:`item`,formatter:e=>t(e)}}var tJ=(e,t,n={})=>({type:`category`,data:t,axisLine:{lineStyle:{color:e.axis}},axisTick:{show:!1},axisLabel:{color:e.label,fontSize:11,margin:12,hideOverlap:!0},...n}),nJ=(e,t,n={})=>({type:`value`,splitNumber:4,axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:e.grid,type:`solid`,width:1}},axisLabel:{color:e.label,fontSize:11,formatter:t},...n});function rJ(e,t,n){return{type:`piecewise`,orient:`horizontal`,right:4,bottom:0,pieces:t.map((e,n)=>({gte:e.from,[n===t.length-1?`lte`:`lt`]:e.to,color:e.colour})),itemWidth:11,itemHeight:11,itemGap:3,itemSymbol:`roundRect`,showLabel:!1,text:[`More`,`Less`],textGap:8,selectedMode:!1,textStyle:{color:e.label,fontSize:11,fontFamily:e.font},...n}}function iJ(e,t,n,r,i){let a=e.series[0],o=Qq(e.data.map((t,n)=>$(e,n))),s=BK(e),c=$K($q(e,a.key),t.seq);return{...i.base,grid:{left:4,right:4,top:8,bottom:40,outerBoundsMode:`same`},tooltip:eJ(i.tooltipBase,t=>fq(lq(e,t.dataIndex,r.hidden,i.colours))),xAxis:tJ(t,o,{axisLine:{show:!1},splitArea:{show:!1}}),yAxis:tJ(t,s,{inverse:!0,axisLine:{show:!1}}),visualMap:rJ(t,c),series:[{type:`heatmap`,data:e.data.map((t,n)=>[o.indexOf($(e,n)),s.indexOf(LK(e,n)),Q(e,a.key,n)??`-`]),itemStyle:{borderColor:t.surface,borderWidth:2,borderRadius:4},emphasis:{itemStyle:{borderColor:t.text,borderWidth:1.5}},progressive:0,animationDuration:800}]}}var aJ=7*864e5,oJ=e=>{let t=BG(e);return`${t.year}-${String(t.month+1).padStart(2,`0`)}-${String(t.day).padStart(2,`0`)}`};function sJ(e,t){let n=e.data.map((t,n)=>IK(e,n)).filter(Number.isFinite),r=cJ(n),i=lJ(n),a=Math.ceil((i-r)/aJ)+1,o=Math.floor((t.height-62)/7),s=Math.max(uJ,Math.min(dJ,o,Math.floor((t.width-44)/a))),c=Math.max(1,Math.floor((t.width-44)/s));return{cell:s,from:a>c?i-(c-1)*aJ:r,to:i}}var cJ=e=>e.reduce((e,t)=>t<e?t:e,1/0),lJ=e=>e.reduce((e,t)=>t>e?t:e,-1/0),uJ=9,dJ=24;function fJ(e,t,n,r,i){let a=e.series[0],{cell:o,from:s,to:c}=sJ(e,n),l=$K($q(e,a.key),t.seq);return{...i.base,tooltip:eJ(i.tooltipBase,t=>fq(lq(e,t.dataIndex,r.hidden,i.colours))),visualMap:rJ(t,l,{right:4}),calendar:{range:[oJ(s),oJ(c)],top:24,left:34,cellSize:[o,o],splitLine:{show:!1},itemStyle:{color:t.seq[0],borderColor:t.surface,borderWidth:o<16?2:3},dayLabel:{firstDay:1,nameMap:[``,`Mon`,``,`Wed`,``,`Fri`,``],color:t.label,fontSize:10,fontFamily:t.font,margin:8},monthLabel:{color:t.label,fontSize:11,fontFamily:t.font,margin:8},yearLabel:{show:!1}},series:[{type:`heatmap`,coordinateSystem:`calendar`,data:e.data.map((t,n)=>[oJ(IK(e,n)),Q(e,a.key,n)??`-`]),itemStyle:{borderRadius:3,borderColor:t.surface,borderWidth:2},emphasis:{itemStyle:{borderColor:t.text,borderWidth:1.5}}}]}}function pJ(e,t,n,r,i){let a=e.series[0],o=tq(e.data.length,t.seq),s=Q(e,a.key,0);return{...i.base,tooltip:eJ(i.tooltipBase,t=>fq(lq(e,t.dataIndex,r.hidden,i.colours))),series:[{type:`funnel`,sort:`none`,gap:3,left:0,right:0,top:4,bottom:4,minSize:`38%`,maxSize:`100%`,funnelAlign:`center`,animationDuration:900,itemStyle:{borderColor:t.surface,borderWidth:0,borderRadius:6},emphasis:{itemStyle:{shadowBlur:14,shadowColor:`rgba(0,0,0,0.18)`}},label:{show:!0,position:`inside`,fontFamily:t.font,lineHeight:17},data:e.data.map((n,r)=>{let i=Wq(o[r],t),c=Q(e,a.key,r),l=r?`${QK(c,Q(e,a.key,r-1))} of previous step`:`${QK(c,s)} of ${Mq($(e,0))}`;return{name:$(e,r),value:c??0,itemStyle:{color:o[r]},label:{formatter:`{n|${Mq($(e,r))}} {v|${Mq(Z(c,a.format))}}\n{p|${r?l:`first stage`}}`,rich:{n:{color:i,fontSize:12.5,fontWeight:500,fontFamily:t.font},v:{color:i,fontSize:13,fontWeight:700,fontFamily:t.font},p:{color:Bq(i,.78),fontSize:11,fontFamily:t.font}}}}})}]}}function mJ(e,t,n,r,i){let a=e.series[0],{min:o,max:s}=iq(e),c=Q(e,a.key,0),l=c??o,u=c==null?null:nq(e,c),d=t.palette[0],f=s-o||1,p=e.bands.length?e.bands.map((e,n)=>[Math.min(1,Math.max(0,(e.upTo-o)/f)),t.seq[1+Math.min(n,3)]]):[[1,t.grid]];return e.bands.length&&p[p.length-1][0]<1&&p.push([1,t.grid]),{...i.base,tooltip:eJ(i.tooltipBase,()=>fq(lq(e,0,r.hidden,i.colours))),series:[{type:`gauge`,startAngle:215,endAngle:-35,min:o,max:s,radius:`96%`,center:[`50%`,`58%`],splitNumber:10,pointer:{show:!1},anchor:{show:!1},progress:{show:c!=null,width:14,roundCap:!0,itemStyle:{color:d,shadowBlur:i.animate?12:0,shadowColor:Bq(d,.35)}},axisLine:{roundCap:!0,lineStyle:{width:14,color:p}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{show:!1},title:{offsetCenter:[0,`30%`],color:t.label,fontSize:12.5,fontFamily:t.font},detail:{valueAnimation:i.animate,offsetCenter:[0,`-4%`],fontFamily:t.font,formatter:e=>`{v|${Mq(c==null?Z(null):Z(e,a.format))}}{u|/${Mq(Z(s,a.format))}}${u?`\n{s|${Mq(u.label)}}`:``}`,rich:{v:{fontSize:36,fontWeight:650,color:t.text,fontFamily:t.font,padding:[0,2,0,0]},u:{fontSize:14,color:t.label,fontFamily:t.font,padding:[12,0,0,0]},s:{fontSize:12,color:t.label,fontFamily:t.font,padding:[8,0,0,0]}}},data:[{value:l,name:e.data[0]?.[e.x.key]==null?a.label:$(e,0)}]}]}}function hJ(e){let t=lJ(e.map(e=>e.level).concat(e.map(e=>e.from),e.map(e=>e.to))),n=cJ(e.filter(e=>!e.total).map(e=>Math.min(e.from,e.to)).concat(e.filter(e=>e.total).map(e=>e.value))),r=lJ(e.filter(e=>!e.total).map(e=>Math.abs(e.value)));if(!(t>0)||!(n>t*.4)||!(r<t*.15))return null;let i=10**Math.floor(Math.log10(t))/10,a=Math.round(t*.08/i)*i,o=Math.floor(n*.965/i)*i;return o>a?{start:a,end:o}:null}var gJ=4,_J=72;function vJ(e,t,n,r){let i=r?10:11,a=r?10.5:12,o=Math.floor(n/Math.max(1,e.length)-gJ);return{nameSize:i,valueSize:a,category:lJ(e.flatMap(e=>String(e).split(/\s+/)).map(e=>Rq(e,i)))<=o?{interval:0,width:o,overflow:`break`}:{interval:0,rotate:45,width:_J,overflow:`truncate`,hideOverlap:!0},showValues:t.every(e=>Rq(e,a)<=o)}}function yJ(e,t,n,r,i){let a=e.series[0],o=aq(e),s=Cq(e),c=hJ(o),l=t=>cq(e,t.index,i.colours),u=o.map(t=>$(e,t.index)),d=o.map(e=>e.total?Z(e.value,s):uq(e.value,s)),f=o.flatMap(e=>[e.from,e.to]),p=Math.max(Rq(Z(lJ(f),s),11),Rq(Z(cJ(f),s),11))+8,m=vJ(u,d,n.width-p-12,i.compact);return{...i.base,grid:{left:4,right:8,top:28,bottom:4,outerBoundsMode:`same`},tooltip:{...i.tooltipBase,trigger:`axis`,axisPointer:{type:`shadow`,shadowStyle:{color:Bq(t.neutral,.1)}},formatter:t=>fq(lq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,i.colours))},xAxis:tJ(t,u,{axisLabel:{color:t.label,fontSize:m.nameSize,margin:12,...m.category}}),yAxis:nJ(t,e=>Z(e,s),{min:0,splitNumber:5,...c?{breaks:[{start:c.start,end:c.end,gap:`6%`}],breakArea:{show:!0,itemStyle:{color:t.surface,borderColor:t.axis,borderWidth:1,borderType:`solid`,opacity:1},zigzagAmplitude:3,zigzagZ:200}}:{}}),series:[{type:`line`,step:`end`,data:o.map(e=>e.level),symbol:`none`,silent:!0,z:1,lineStyle:{color:t.axis,width:1},tooltip:{show:!1},animation:!1,emphasis:{disabled:!0}},{type:`bar`,stack:`w`,data:o.map(e=>Math.min(e.from,e.to)),silent:!0,itemStyle:{color:`transparent`},emphasis:{disabled:!0},tooltip:{show:!1},barMaxWidth:48},{name:a.key,type:`bar`,stack:`w`,z:3,barMaxWidth:48,barCategoryGap:`34%`,itemStyle:{borderRadius:5},emphasis:{itemStyle:{shadowBlur:10,shadowColor:`rgba(0,0,0,0.15)`}},animationDelay:i.animate?e=>e*140:0,label:{show:m.showValues,position:`top`,distance:6,fontFamily:t.font,fontSize:m.valueSize,fontWeight:600,color:t.text,formatter:e=>d[e.dataIndex]},data:o.map(e=>({value:Math.abs(e.to-e.from),itemStyle:{color:l(e)}}))}]}}function bJ(e){let t=e.series[0].key;return BK(e).map(n=>({name:n,rows:e.data.map((e,t)=>t).filter(t=>LK(e,t)===n).sort((n,r)=>Q(e,t,r)-Q(e,t,n)||n-r)}))}function xJ(e,t,n,r,i){let a=e.series[0],o=sq(e),s=[...o.values()].reduce((e,t)=>e+t,0),c=(e,t)=>{let r=e/s*n.width*n.height*.82;return r>5200&&Math.max(Rq(t[0],12),Rq(t[1],11.5))+20<=Math.sqrt(r)},l=bJ(e).map(({name:n,rows:r},i)=>{let s=o.get(n),l=t.palette[i%t.palette.length],u=Wq(l,t);return{name:n,value:s,itemStyle:{color:l,borderColor:l},upperLabel:{color:u,formatter:`{n|${Mq(n)}} {v|${Mq(Z(s,a.format))}}`,rich:{n:{fontWeight:600,fontSize:12,color:u,fontFamily:t.font},v:{fontSize:12,color:Bq(u,.8),fontFamily:t.font}}},children:r.map((n,r)=>{let i=Vq(l,t.surface,Math.min(.55,r*.14)),o=Wq(i,t),s=Q(e,a.key,n);return{name:$(e,n),value:s,row:n,itemStyle:{color:i},label:{show:c(s,[$(e,n),Z(s,a.format)]),formatter:`{n|${Mq($(e,n))}}\n{v|${Mq(Z(s,a.format))}}`,rich:{n:{color:o,fontSize:12,fontWeight:500,fontFamily:t.font,lineHeight:16},v:{color:Bq(o,.82),fontSize:11.5,fontFamily:t.font}}}}})}});return{...i.base,tooltip:eJ(i.tooltipBase,t=>t.data?.row==null?fq({title:t.name,rows:[{color:t.color,label:a.label,value:Z(t.value,a.format)},{label:`Share of all`,value:QK(t.value,s)}],foot:``}):fq(lq(e,t.data.row,r.hidden,i.colours))),series:[{type:`treemap`,roam:!1,nodeClick:!1,breadcrumb:{show:!1},left:0,right:0,top:0,bottom:0,animationDurationUpdate:700,label:{show:!0,position:`insideTopLeft`,padding:[8,10],overflow:`truncate`,fontFamily:t.font},upperLabel:{show:!0,height:28,padding:[0,10],fontFamily:t.font},levels:[{itemStyle:{borderWidth:0,gapWidth:4,borderColor:t.surface}},{itemStyle:{borderWidth:3,gapWidth:2,borderRadius:8}},{itemStyle:{borderWidth:0,gapWidth:0,borderRadius:5},emphasis:{itemStyle:{borderColor:t.text,borderWidth:0}}}],data:l}]}}function SJ(e){let t=e.data.map(t=>[String(t[e.x.key]),String(t[e.to.key])]),n=new Map(t.flatMap(([e,t])=>[[e,0],[t,0]]));for(let e=0;e<n.size;e+=1)for(let[e,r]of t)n.set(r,Math.max(n.get(r),n.get(e)+1));return n}function CJ(e,t,n,r,i){let a=e.series[0],o=oq(e,t.palette),s=SJ(e),c=lJ([...s.values()]),l=new Map,u=new Map;e.data.forEach((t,n)=>{let r=Q(e,a.key,n)??0;l.set(String(t[e.x.key]),(l.get(String(t[e.x.key]))??0)+r),u.set(String(t[e.to.key]),(u.get(String(t[e.to.key]))??0)+r)});let d=e=>u.get(e)??l.get(e)??0,f=e=>({position:e,color:t.text,fontFamily:t.font,fontSize:i.compact?11:12,formatter:e=>`{n|${Mq(e.name)}}\n{v|${Z(d(e.name),{style:`compact`})}}`,rich:{n:{color:t.textBody,fontSize:i.compact?11:12,fontFamily:t.font,lineHeight:15},v:{color:t.label,fontSize:11,fontFamily:t.font}}});return{...i.base,tooltip:eJ(i.tooltipBase,t=>fq(t.dataType===`edge`?lq(e,t.dataIndex,r.hidden,i.colours):{title:t.name,rows:[{color:t.color,label:a.label,value:Z(d(t.name),a.format)}],foot:``})),series:[{type:`sankey`,left:0,right:0,top:6,bottom:6,nodeWidth:10,nodeGap:i.compact?10:14,nodeAlign:`justify`,draggable:!1,layoutIterations:64,animationDuration:1200,emphasis:{focus:`adjacency`,lineStyle:{opacity:.55}},itemStyle:{borderWidth:0,borderRadius:3},lineStyle:{curveness:.5},levels:Array.from({length:c+1},(e,t)=>({depth:t,label:f(t===c&&c>0?`left`:`right`)})),data:[...s.keys()].map(e=>({name:e,itemStyle:{color:o.get(e)}})),links:e.data.map(n=>({source:String(n[e.x.key]),target:String(n[e.to.key]),value:n[a.key],lineStyle:{color:o.get(String(n[e.x.key])),opacity:t.dark?.32:.26}}))}]}}function wJ(e){let t=e.length,n=e.reduce((e,t)=>e+t[0],0)/t,r=e.reduce((e,t)=>e+t[1],0)/t,i=e.reduce((e,t)=>e+(t[0]-n)**2,0);if(!t||!i)return null;let a=e.reduce((e,t)=>e+(t[0]-n)*(t[1]-r),0)/i,o=cJ(e.map(e=>e[1])),s=lJ(e.map(e=>e[1])),c=e=>{let t=r+a*(e-n);return t<o?[e+(o-t)/a,o]:t>s?[e+(s-t)/a,s]:[e,t]};return[c(cJ(e.map(e=>e[0]))),c(lJ(e.map(e=>e[0])))]}var TJ=44,EJ=28,DJ=8;function OJ(e,t,n,r,i){let a=e.series[0],o=BK(e),s=e.type===`bubble`,c=lJ(s?e.data.map(t=>t[e.size.key]):[]),l=e=>Math.max(DJ,(i.compact?EJ:TJ)*Math.sqrt(e/c)),u=t=>e.data.map((e,t)=>t).filter(n=>!e.group||LK(e,n)===t),d=(e.group?o:[null]).filter(e=>e==null||!r.hidden.has(e)).flatMap(e=>u(e)),f=e.trend?wJ(d.map(t=>[e.data[t][e.x.key],Q(e,a.key,t)])):null,p=e.data.map(t=>t[e.x.key]),m=e.data.map((t,n)=>Q(e,a.key,n)),[h,g]=Pq(p,!1),[_,v]=Pq(m,!1),y=Nq(e.y.format,e.y.min??_,e.y.max??v,4),b=Nq(e.x.format,h,g,4),x=(e.group?o:[null]).map((n,r)=>({name:n??a.key,type:`scatter`,symbolSize:s?e=>l(e[2]):i.compact?8:10,itemStyle:{color:Bq(t.palette[r],.85),borderColor:t.surface,borderWidth:1.5},emphasis:{focus:`series`,scale:1.5,itemStyle:{color:t.palette[r]}},blur:{itemStyle:{opacity:.15}},animationDelay:i.animate?e=>e*6+r*120:0,data:u(n).map(t=>({value:[e.data[t][e.x.key],Q(e,a.key,t),...s?[e.data[t][e.size.key]]:[]],row:t}))}));return f&&x.push({name:`Trend`,type:`line`,data:f,symbol:`none`,silent:!0,z:1,tooltip:{show:!1},lineStyle:{color:t.label,width:1.5,type:[6,4]},emphasis:{disabled:!0},endLabel:{show:!0,formatter:`Trend`,color:t.label,fontSize:11,fontFamily:t.font,offset:[-30,-12]}}),{...i.base,grid:{left:4,right:16,top:e.y.label?28:12,bottom:e.x.label?24:4,outerBoundsMode:`same`},tooltip:eJ(i.tooltipBase,t=>t.data?.row==null?``:fq(lq(e,t.data.row,r.hidden,i.colours))),xAxis:nJ(t,e=>Z(e,b),{scale:!0,splitLine:{show:!1},axisLine:{show:!0,lineStyle:{color:t.axis}},...e.x.label?{name:e.x.label,nameLocation:`middle`,nameGap:28,nameTextStyle:{color:t.label,fontSize:11,fontFamily:t.font}}:{}}),yAxis:nJ(t,e=>Z(e,y),{min:e.y.min,max:e.y.max,...e.y.label?{name:e.y.label,nameLocation:`end`,nameGap:12,nameTextStyle:{color:t.label,fontSize:11,fontFamily:t.font,align:`left`}}:{}}),series:x}}var kJ=32,AJ=8,jJ=26;function MJ(e,t,n,r,i){let a=e.x.kind===`time`,o=e.series.length,s=(n.height-6-jJ)/o,c=s-kJ-AJ,l=t.palette[0],u=e.data.map((t,n)=>$(e,n)),d=e.series.flatMap((n,r)=>{let i=$q(e,n.key).filter(e=>e!=null).pop();return[{text:n.label,left:0,top:6+r*s,textStyle:{fontSize:12.5,fontWeight:600,color:t.text,fontFamily:t.font}},{text:`Latest ${Z(i,n.format)}`,right:8,top:7+r*s,textStyle:{fontSize:12,fontWeight:500,color:t.label,fontFamily:t.font}}]}),f=(t,n)=>{let r=Q(e,t.key,n);return a?[Kq(IK(e,n)),r]:r};return{...i.base,useUTC:a,title:d,grid:e.series.map((e,t)=>({left:52,right:8,top:6+t*s+kJ,height:c})),axisPointer:{link:[{xAxisIndex:`all`}],lineStyle:{color:t.axis},label:{show:!1}},tooltip:{...i.tooltipBase,trigger:`axis`,axisPointer:{type:`line`,lineStyle:{color:t.axis}},formatter:t=>fq(lq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,i.colours))},xAxis:e.series.map((n,r)=>({...a?{type:`time`}:tJ(t,u,{boundaryGap:!1}),gridIndex:r,axisLine:{lineStyle:{color:r===o-1?t.axis:t.grid}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{show:r===o-1,color:t.label,fontSize:11,hideOverlap:!0,margin:10,...a?{formatter:qq(e)}:{}}})),yAxis:e.series.map((n,r)=>{let[i,a]=Pq($q(e,n.key),!1),o=Nq(n.format,e.y.min??i,e.y.max??a,2);return nJ(t,e=>Z(e,o),{gridIndex:r,splitNumber:2,scale:e.y.min==null,min:e.y.min,max:e.y.max,axisLabel:{color:t.label,fontSize:10.5,formatter:e=>Z(e,o)}})}),series:e.series.map((n,r)=>({id:n.key,name:n.key,type:`line`,xAxisIndex:r,yAxisIndex:r,data:e.data.map((e,t)=>f(n,t)),smooth:.3,symbol:`circle`,showSymbol:!1,symbolSize:7,lineStyle:{width:1.75,color:l},itemStyle:{color:l,borderColor:t.surface,borderWidth:2},areaStyle:{color:Gq(l,t.dark?.26:.16)},animationDelay:i.animate?r*160:0,emphasis:{disabled:!0}}))}}function NJ(e,t,n,r){let i=r?.start??(e.data.length>5e3?70:0),a=r?.end??100;return[{type:`inside`,start:i,end:a},{type:`slider`,start:i,end:a,height:26,bottom:8,left:52,right:12,borderColor:`transparent`,backgroundColor:t.grid,borderRadius:6,fillerColor:Bq(n,t.dark?.22:.12),handleStyle:{color:t.surface,borderColor:t.axis},moveHandleSize:0,brushSelect:!1,dataBackground:{lineStyle:{color:t.axis,width:.75},areaStyle:{color:Bq(t.neutral,.15)}},selectedDataBackground:{lineStyle:{color:n,width:.75},areaStyle:{color:Bq(n,.18)}},textStyle:{color:t.label,fontSize:11,fontFamily:t.font}}]}function PJ(e,t,n){switch(e.type){case`scatter`:case`bubble`:{if(!e.group)return{seriesIndex:0,dataIndex:n};let t=LK(e,n),r=e.data.map((e,t)=>t).filter(n=>LK(e,n)===t);return{seriesIndex:BK(e).indexOf(t),dataIndex:r.indexOf(n)}}case`waterfall`:return{seriesIndex:2,dataIndex:n};case`sankey`:return{seriesIndex:0,dataIndex:n,dataType:`edge`,tip:!1};case`treemap`:{let t=1;for(let r of bJ(e)){let e=r.rows.indexOf(n);if(e>=0)return{seriesIndex:0,dataIndex:t+1+e};t+=1+r.rows.length}return{seriesIndex:0,dataIndex:n}}case`gauge`:case`donut`:case`heatmap`:case`calendar`:case`funnel`:return{seriesIndex:0,dataIndex:n};default:return{seriesIndex:t,dataIndex:n}}}function FJ(e,t){switch(e.type){case`scatter`:case`bubble`:return t.data?.row==null?null:{series:0,row:t.data.row};case`treemap`:return t.data?.row==null?null:{series:0,row:t.data.row};case`sankey`:return t.dataType===`edge`?{series:0,row:t.dataIndex}:null;case`waterfall`:return t.seriesIndex===2?{series:0,row:t.dataIndex}:null;case`line`:case`area`:case`column`:case`bar`:case`multiples`:return{series:t.seriesIndex,row:t.dataIndex};default:return{series:0,row:t.dataIndex}}}var IJ={donut:Zq,heatmap:iJ,calendar:fJ,funnel:pJ,gauge:mJ,waterfall:yJ,treemap:xJ,sankey:CJ,scatter:OJ,bubble:OJ,multiples:MJ};function LJ(e,t,n,r,{pixelRatio:i=2}={}){let a=document.createElement(`div`);a.style.cssText=`position:fixed;left:-10000px;top:0;width:${n.width}px;height:${n.height}px;`,document.body.append(a);let o=vj(a,null,{renderer:`canvas`,devicePixelRatio:i,width:n.width,height:n.height});try{return o.setOption(Yq(e,t,n,{...r,renderer:`canvas`,animation:!1})),o.getDataURL({type:`png`,pixelRatio:i,backgroundColor:t.surface})}finally{o.dispose(),a.remove()}}function RJ(e,{renderer:t}){let n=vj(e,null,{renderer:t}),r=!1,i=null;return{renderer:t,render(e,t,a,o,{replace:s=!1}={}){let c=r&&!s?n.getOption()?.dataZoom?.[0]:null,l=Number.isFinite(c?.start)&&Number.isFinite(c?.end)?{start:c.start,end:c.end}:null,u=Yq(e,t,a,{...o,zoom:l});i=e,n.setOption(u,s||!r?{notMerge:!0}:{replaceMerge:jq}),r=!0},focusPoint(e,t){let{tip:r=!0,...a}=PJ(i,e,t);n.dispatchAction({type:`downplay`}),n.dispatchAction({type:`highlight`,...a}),r&&n.dispatchAction({type:`showTip`,...a})},clearFocus(){n.dispatchAction({type:`hideTip`}),n.dispatchAction({type:`downplay`})},resize(){n.resize()},onSelect(e){n.on(`click`,t=>{if(t.componentType!==`series`)return;let n=FJ(i,t);n&&e({seriesIndex:n.series,dataIndex:n.row})})},onFinished(e){n.on(`finished`,e)},dispose(){n.dispose()}}}var zJ=typeof HTMLElement>`u`?class{}:HTMLElement,BJ=`wui-chart:select`,VJ=`wui-chart:legend-change`,HJ=`wui-chart:ready`,UJ=[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`Escape`],WJ=`(prefers-color-scheme: dark)`,GJ=`(prefers-reduced-motion: reduce)`,KJ=e=>typeof window.matchMedia==`function`?window.matchMedia(e):null,qJ=!1;function JJ(e){let t=getComputedStyle(e),n=e=>t.getPropertyValue(e).trim(),r=e.closest(`[data-bs-theme], [data-theme]`)??document.documentElement,i=r.getAttribute(`data-bs-theme`)||r.getAttribute(`data-theme`),a={palette:[1,2,3,4,5,6,7,8].map(e=>n(`--wui-chart-${e}`)),seq:[0,1,2,3,4,5,6].map(e=>n(`--wui-chart-seq-${e}`)),neutral:n(`--wui-chart-neutral`),grid:n(`--wui-chart-grid`),axis:n(`--wui-chart-axis`),label:n(`--wui-chart-label`),surface:n(`--color-surface`),text:n(`--color-text`),textBody:n(`--color-text-body`),textMuted:n(`--color-text-muted`),shadow:n(`--wui-shadow-overlay`),font:t.fontFamily,dark:i===`dark`||i===`auto`&&!!KJ(WJ)?.matches,reducedMotion:!!KJ(GJ)?.matches};return!a.palette[0]&&!qJ&&(qJ=!0,console.warn(`[@webority/ui-elements] <wui-chart> found no --wui-chart-* colours: load @webority/theme on the page.`)),a}var YJ=new Set,XJ=null;function ZJ(e){if(YJ.add(e),XJ)return;let t=()=>{for(let e of YJ)e._themeChanged()},n=new MutationObserver(t);n.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`,`data-bs-theme`,`class`]});let r=new MutationObserver(t);r.observe(document.documentElement,{attributes:!0,subtree:!0,attributeFilter:[`data-theme`,`data-bs-theme`]});let i=[KJ(WJ),KJ(GJ)].filter(Boolean);for(let e of i)e.addEventListener?.(`change`,t);XJ=()=>{n.disconnect(),r.disconnect();for(let e of i)e.removeEventListener?.(`change`,t);XJ=null}}function QJ(e){YJ.delete(e),YJ.size||XJ?.()}function $J(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,document.body.append(n),n.click(),n.remove()}var eY=(e,t,n)=>{let r=document.createElement(e);return t&&(r.className=t),n!=null&&(r.textContent=n),r},tY=0,nY=class extends zJ{static get observedAttributes(){return[`view`]}constructor(){super(),tY+=1,this.uid=`wui-chart-${tY}`,this._spec=null,this._normal=null,this._hidden=new Set,this._focus=null}get spec(){return this._spec}set spec(e){this._spec=e??null,this._normal=null,this._clearFocus(),this._parts&&this._update()}get view(){return this.getAttribute(`view`)===`table`?`table`:`chart`}set view(e){this.setAttribute(`view`,String(e??`chart`))}connectedCallback(){if(Object.hasOwn(this,`spec`)){let e=this.spec;delete this.spec,this._spec=e??null}this._spec??=this._readScript(),this._spec==null&&!this.querySelector(`:scope > script[type='application/json']`)&&(this._awaitingSpec=!0,queueMicrotask(()=>{this._awaitingSpec=!1,this._parts&&this._update()})),this._build(),ZJ(this),this._theme=JJ(this),this._width=this.clientWidth,this._resizeObserver=new ResizeObserver(()=>this._resized()),this._resizeObserver.observe(this),typeof IntersectionObserver==`function`?(this._visible=!1,this._intersection=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(this._intersection.disconnect(),this._visible=!0,this._update())},{threshold:.05}),this._intersection.observe(this)):this._visible=!0,this._update()}disconnectedCallback(){QJ(this),this._resizeObserver?.disconnect(),this._intersection?.disconnect(),this._engine?.dispose(),this._engine=null,this._drawn=!1,this._parts=null}attributeChangedCallback(e,t,n){t===n||!this._parts||(EK(`view`,n,YG),this._update())}toCsv(){let{spec:e}=this._normalized();return e?vq(e):``}toPng(){let{spec:e}=this._normalized();return e?LJ(e,this._theme??JJ(this),this._size(e),{hidden:this._hidden,renderer:HK(e)}):``}exportCsv(e){let t=URL.createObjectURL(new Blob([this.toCsv()],{type:`text/csv;charset=utf-8`}));$J(t,e??`${yq(this._normalized().spec)}.csv`),setTimeout(()=>URL.revokeObjectURL(t),2e3)}exportPng(e){let t=this.toPng();t&&$J(t,e??`${yq(this._normalized().spec)}.png`)}_readScript(){let e=this.querySelector(`:scope > script[type="application/json"]`);if(!e)return null;try{return JSON.parse(e.textContent)}catch(e){return console.error(`[@webority/ui-elements] <wui-chart> could not read its JSON spec:`,e?.message),null}}_normalized(){return this._normal??=jK(this._spec),this._normal}_build(){let e=eY(`div`,`wui-chart-legend`);e.setAttribute(`role`,`group`),e.setAttribute(`aria-label`,`Legend`),e.hidden=!0,e.addEventListener(`click`,e=>{let t=e.target.closest?.(`.wui-chart-legend-item`);t&&this._toggle(t.dataset.key)});let t=eY(`div`,`wui-chart-surface`);t.tabIndex=0,t.setAttribute(`role`,`group`),t.setAttribute(`aria-roledescription`,`chart`),t.addEventListener(`keydown`,e=>this._onKey(e)),t.addEventListener(`blur`,()=>this._clearFocus());let n=eY(`div`,`wui-chart-canvas`);n.setAttribute(`aria-hidden`,`true`),t.append(n);let r=eY(`div`,`wui-chart-state`);r.setAttribute(`role`,`status`),r.hidden=!0;let i=eY(`div`,`wui-chart-table-wrap visually-hidden`),a=eY(`p`,`visually-hidden`);a.id=`${this.uid}-summary`;let o=eY(`div`,`visually-hidden`);o.setAttribute(`aria-live`,`polite`),this.replaceChildren(e,t,r,i,a,o),this.setAttribute(`role`,`figure`),this.setAttribute(`aria-describedby`,a.id),this._parts={legend:e,surface:t,canvas:n,state:r,tableWrap:i,summary:a,live:o},this._legendSignature=null,this._tableSpec=null}_size(e){return{width:this._parts?.surface.clientWidth||this.clientWidth||800,height:e.height}}_update(){if(!this._parts||this._awaitingSpec&&this._spec==null)return;let{spec:e,problem:t}=this._normalized(),n=this._parts,r=t?`error`:e.state===`ready`&&(!e.data.length||!FK(e))?`empty`:e.state,i=`${e?.height??320}px`,a=this.view===`table`,o=e&&(r===`ready`||r===`loading`&&this._drawn),s=r===`loading`&&o;if(this.setAttribute(`aria-label`,e?.title||`Chart`),r===`loading`?this.setAttribute(`aria-busy`,`true`):this.removeAttribute(`aria-busy`),this.setAttribute(`data-state`,r),n.surface.setAttribute(`aria-label`,`${e?.title||`Chart`}: use the arrow keys to read the values`),n.summary.textContent=e?xq(e):``,e){if(!s){let t=new Set(UK(e));for(let e of this._hidden)t.has(e)||this._hidden.delete(e)}this._renderTable(e)}else n.tableWrap.replaceChildren();s||this._renderLegend(e,o&&!a),this._renderState(r,t??(r===`error`?e.errorText:e?.emptyText),i,o);let c=n.surface.hidden&&o&&!a;n.surface.hidden=!o||a,n.surface.style.height=i,n.tableWrap.className=a&&e?`wui-chart-table-wrap`:`wui-chart-table-wrap visually-hidden`,n.tableWrap.style.height=a&&e?i:``,a&&e?(n.tableWrap.tabIndex=0,n.tableWrap.setAttribute(`role`,`region`),n.tableWrap.setAttribute(`aria-label`,`${e.title||`Chart`} data`)):(n.tableWrap.removeAttribute(`tabindex`),n.tableWrap.removeAttribute(`role`),n.tableWrap.removeAttribute(`aria-label`)),c&&this._engine?.resize(),r===`ready`&&!a&&this._visible&&this._draw()}_renderState(e,t,n,r){let i=this._parts.state,a=!r&&e!==`ready`;if(i.hidden=!a,!a){i.replaceChildren();return}i.style.height=n,e===`loading`?i.replaceChildren(eY(`div`,`skeleton wui-chart-skeleton`),eY(`span`,`visually-hidden`,`Loading chart`)):i.replaceChildren(eY(`p`,`wui-chart-state-text`,t))}_colour(e,t){return e.type===`donut`?cq(e,t,this._theme):this._theme.palette[t]}_renderLegend(e,t){let n=this._parts.legend,r=e?UK(e):[],i=!!e&&t&&r.length>=2;if(n.hidden=!i,!i)return;let a=WK(e),o=r.map((t,n)=>this._colour(e,n)),s=JSON.stringify([e.type,r,a,o]);s!==this._legendSignature&&(this._legendSignature=s,n.replaceChildren(...r.map((t,n)=>{let r=eY(`button`,`wui-chart-legend-item`);r.type=`button`,r.dataset.key=t;let i=eY(`span`,e.type===`line`?`wui-chart-legend-swatch wui-chart-legend-swatch-line`:`wui-chart-legend-swatch`);return i.style.background=o[n],r.append(i,eY(`span`,`wui-chart-legend-label`,a[n])),r})));for(let e of n.children)e.setAttribute(`aria-pressed`,String(!this._hidden.has(e.dataset.key)))}_renderTable(e){if(this._tableSpec===e)return;this._tableSpec=e;let t=hq(e),n=eY(`table`,`wui-chart-table`);n.append(eY(`caption`,`visually-hidden`,t.caption));let r=eY(`tr`);t.head.forEach((e,t)=>{let n=eY(`th`,t?`wui-chart-num`:null,e);n.scope=`col`,r.append(n)});let i=eY(`thead`);i.append(r),n.append(i);let a=eY(`tbody`);for(let e of t.rows){let t=eY(`tr`),n=eY(`th`,null,e.head);n.scope=`row`,t.append(n,...e.cells.map(e=>eY(`td`,`wui-chart-num`,e))),a.append(t)}n.append(a);let o=[n];t.truncated&&o.push(eY(`p`,`wui-chart-table-note`,`Showing the first ${t.rows.length} of ${t.total} rows. Download the CSV for all of them.`)),this._parts.tableWrap.replaceChildren(...o)}_draw(){let{spec:e}=this._normalized(),t=HK(e),n=e.type!==this._drawnType;this._engine&&this._engine.renderer!==t&&(this._engine.dispose(),this._engine=null);let r=`${e.height}px`,i=this._parts.canvas.style.height!==r;this._parts.canvas.style.height=r,i&&this._engine?.resize(),this._engine||(this._engine=RJ(this._parts.canvas,{renderer:t}),this._engine.onSelect(({seriesIndex:e,dataIndex:t})=>this._select(e,t)),this._engine.onFinished(()=>{this._announcedReady||(this._announcedReady=!0,this.dispatchEvent(new CustomEvent(HJ,{bubbles:!0,detail:{renderer:t}})))}),n=!0),this._engine.render(e,this._theme,this._size(e),{hidden:this._hidden,renderer:t},{replace:n}),this._drawnType=e.type,this._drawn=!0}_themeChanged(){if(!this._parts)return;let e=JJ(this);JSON.stringify(e)!==JSON.stringify(this._theme)&&(this._theme=e,this._update())}_resized(){let e=this.clientWidth;e!==this._width&&(this._width=e,!(!this._engine||!this._drawn)&&(this._parts.surface.hidden||this._engine.resize(),this._update()))}_toggle(e){let{spec:t}=this._normalized();if(!t||e==null)return;this._hidden.has(e)?this._hidden.delete(e):this._hidden.add(e),this._clearFocus(),this._update();let n=Object.fromEntries(UK(t).map(e=>[e,!this._hidden.has(e)]));this.dispatchEvent(new CustomEvent(VJ,{bubbles:!0,detail:{visible:n}}))}_onKey(e){let{spec:t}=this._normalized();if(!t||!this._engine||this.view===`table`||e.altKey||e.ctrlKey||e.metaKey)return;if(e.key===`Enter`){if(!this._focus)return;e.preventDefault(),this._select(this._focus.series,this._focus.index);return}if(!UJ.includes(e.key)||e.key===`Escape`&&!this._focus)return;e.preventDefault();let n=kq(t,this._focus,e.key,this._hidden);if(!n){this._clearFocus();return}this._focus=n,this._engine.focusPoint(n.series,n.index),this._announce(pq(lq(t,n.index,this._hidden,this._theme)))}_announce(e){let t=this._parts.live;t.textContent=e===t.textContent?`${e}\u00a0`:e}_clearFocus(){this._focus&&(this._focus=null,this._engine?.clearFocus(),this._parts&&(this._parts.live.textContent=``))}_select(e,t){let{spec:n}=this._normalized(),r=n?.series[aK(n.type)?0:e];if(!r)return;let i=n.data[t]??null;this.dispatchEvent(new CustomEvent(BJ,{bubbles:!0,detail:{series:r.key,label:r.label,x:i?.[n.x.key]??null,value:Q(n,r.key,t),row:i,index:t}}))}};return typeof customElements<`u`&&!customElements.get(`wui-chart`)&&customElements.define(`wui-chart`,nY),e.CHART_STATES=JG,e.CHART_TYPES=WG,e.CHART_VIEWS=YG,e.MAX_SERIES=XG,e.MAX_SLICES=ZG,e.RENDERERS=qG,e.STACK_MODES=GG,e.WuiChart=nY,e.X_KINDS=KG,e.formatValue=Z,e.normalizeSpec=jK,e})({});