@visactor/vchart 2.0.13-alpha.2 → 2.0.13-alpha.3

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.
@@ -19,4 +19,4 @@
19
19
  *
20
20
  * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors.
21
21
  * Released under the MIT license
22
- */let gQ=class t extends KJ{constructor(e){super(N({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),u=this.options.createCanvas({width:1,height:1}),d=u.getContext("2d",{willReadFrequently:!0});d.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=d.measureText(a).width,g=Math.max(r,d.measureText("m").width,d.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),y=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=y*this.gridSize;const _=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;u.setAttribute("width",""+A),u.setAttribute("height",""+k),d.scale(1,1),d.translate(A/2,k/2),d.rotate(-h),d.font=l+" "+o+" "+r.toString(10)+"px "+c,d.fillStyle="#000",d.textBaseline="middle",d.fillText(a,_,b);const C=d.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const M=[];let T,w=S;const D=[x/2,S/2,x/2,S/2],E=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(C[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),t<D[3]&&(D[3]=t),t>D[1]&&(D[1]=t),e<D[0]&&(D[0]=e),void(e>D[2]&&(D[2]=e))}};for(;w--;)for(T=x;T--;)E(w,T,M);return{datum:t,occupied:M,bounds:D,gw:S,gh:x,fillTextOffsetX:_,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t<this.ngx;t++)for(let i=0;i<this.ngy;i++)this.grid[t][i]&&e++;return e/t}canFitText(t,e,i,s,n){let r=n.length;for(;r--;){const i=t+n[r][0],s=e+n[r][1];if(i>=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),rt(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(f(e)){const i=nQ(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=sQ(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=GJ(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};gQ.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class fQ extends KJ{constructor(t){super(N({},fQ.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e<i;e++)if(mQ(t,this.result[e]))return!1;return!0}getTextInfo(t,e){const i={datum:t,fontSize:this.getTextFontSize(t),fontWeight:this.getTextFontWeight(t),fontStyle:this.getTextFontStyle(t),fontFamily:this.getTextFontFamily(t),angle:this.getTextRotate(t,e),text:this.getText(t)+"",x:this.center[0],y:this.center[1]},s=this.options.getTextBounds(i);return i.width=s.width(),i.height=s.height(),i.top=this.center[1]-i.height+.21*i.height,i.left=this.center[0]-i.width/2,i}layoutWord(t){const e=this.getTextInfo(this.data[t],t);let i=2*Math.PI,s=0,n=e.left,r=e.top;const a=e.width,o=e.height;let l=1,h=this.fit(e);for(;!h&&s<this.maxRadius;)s+=.5,l=this.shape(s/this.maxRadius*2*Math.PI),i+=.5*(this.options.random?this.random()>.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;i<t.length&&(this.layoutWord(i),i++,this.progressiveIndex=i,!this.exceedTime()););return this.result}}function mQ(t,e){return!(t.left+t.width<e.left||t.top+t.height<e.top||t.left>e.left+e.width||t.top>e.top+e.height)}fQ.defaultOptions={enlarge:!1};const vQ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},yQ=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return gt.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?_Q(t.fontFamily):"sans-serif",u=t.fontStyle?_Q(t.fontStyle):"normal",d=t.fontWeight?_Q(t.fontWeight):"normal",p=t.rotate?_Q(t.rotate):0,g=_Q(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?_Q(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",y=null!==(r=t.shrink)&&void 0!==r&&r,_=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,S=t.randomVisible,k=t.as?Object.assign(Object.assign({},vQ),t.as):vQ,C=t.depth_3d,M=t.postProjection;let T=t.fontSize?_Q(t.fontSize):14;const w=t.fontSizeRange;if(w&&!A(T)){const t=T,e=xQ(SQ(t,l),w);T=i=>e(t(i))}let D=ZJ;"fast"===t.layoutType?D=fQ:"grid"===t.layoutType&&(D=gQ);const E=new D(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:u,fontWeight:d,fontSize:T,shrink:y,clip:b,enlarge:_,minFontSize:x,random:S,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r<a;r++)n=e[r],s=n.datum,s[k.x]=n.x,s[k.y]=n.y,s[k.fontFamily]=n.fontFamily,s[k.fontSize]=n.fontSize,s[k.fontStyle]=n.fontStyle,s[k.fontWeight]=n.fontWeight,s[k.angle]=n.angle,"StereographicProjection"===M&&AQ(h,n,s,k,C),t.dataIndexKey&&(s[t.dataIndexKey]=`${r}`),i.push(s);return i}}));return E.layout(l,{width:h[0],height:h[1]}),t.progressiveStep>0||t.progressiveTime>0?{progressive:E}:E.output()},_Q=t=>_(t)||A(t)||u(t)||b(t)?t:e=>e[t.field],bQ=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),xQ=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=bQ(t[0]),n=bQ(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(bQ(t)-r)/(a-r)*(e[1]-e[0])+e[0]},SQ=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;a<n;++a)r=ht(t(e[a])),r<i&&(i=r),r>s&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function AQ(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l<Math.PI/2?1:-1)*Math.pow(Math.min(l-Math.PI/2,1),2)/5,{x:i*Math.sin(l)*Math.cos(o)+s.x,y:i*Math.cos(l)+s.y,z:i*Math.sin(l)*Math.sin(o)+s.z}}(t[0],t[1],r,{x:r,y:r,z:null!=n?n:r},e);i[s.x]=a.x,i[s.y]=a.y,i[s.z]=a.z}var kQ;t.WORDCLOUD_SHAPE_HOOK_EVENT=void 0,(kQ=t.WORDCLOUD_SHAPE_HOOK_EVENT||(t.WORDCLOUD_SHAPE_HOOK_EVENT={})).BEFORE_WORDCLOUD_SHAPE_LAYOUT="beforeWordcloudShapeLayout",kQ.AFTER_WORDCLOUD_SHAPE_LAYOUT="afterWordcloudShapeLayout",kQ.AFTER_WORDCLOUD_SHAPE_DRAW="afterWordcloudShapeDraw";const CQ=t=>/^[\u4e00-\u9fa5]+$/.test(t),MQ=(t,e)=>{if(d(t))return 0;let i=0;for(const e of t)CQ(e)?i+=1:i+=.53;return i};function TQ(t,e,i){const{stepFactor:s,importantWordCount:n,globalShinkLimit:r}=e,{size:a,segmentation:{regions:o},tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:u,shapeRatio:d}=i,p=l.getContext("2d",{willReadFrequently:!0}),g=PQ(i);let f=g.slice(0);const m=e.fontSizeShrinkFactor;let v=null,y=1,_=1;const b=n;let x=0;t.length>b&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;e<o.length;e++){const i=o[e],{words:n,center:c,maxR:u,ratio:d}=i;let b=!1;for(let e=0;e<n.length;e++){BQ(l,p,t,e);const i=n[e];if(i.x=c[0],i.y=c[1],!i.skip&&i.hasText&&i.sprite&&wQ(f,i,u,d,a,h,s))i.hasPlaced=!0;else{if(!i.skip&&i.weight>x&&_>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==v&&(v=e,y=_),_*=m,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*m})),f=g.slice(0),b=!0;break}if(!i.skip&&i.datum[Symbol.for("vGrammar_id")]===v){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/_})),i.skip=!0,_=y,v=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i<e.textLayoutTimes;i++){const i=t.filter((t=>(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=Math.max(~~(t.fontSize*e.fontSizeShrinkFactor),e.minFontSize)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t<i.length;t++){const e=i[t];BQ(l,p,i,t),e.x=c[0],e.y=c[1],e.hasText&&wQ(f,e,u,d,a,h,s)&&(e.hasPlaced=!0)}}e.board=f}function wQ(t,e,i,s,n,r,a){const o=e.x,l=e.y,h=function(t){return function(e){return[t*(e*=.1)*Math.cos(e),e*Math.sin(e)]}}(s),c=1*a;let u,d,p,g=-c;for(;u=h(g+=c);){const{wordSize:s,bounds:{dTop:a,dBottom:h,dLeft:c,dRight:g}}=e;if(d=u[0],p=u[1],Math.min(Math.abs(d),Math.abs(p))>=i)break;if(e.x=~~(o+d),e.y=~~(l+p),!(e.x-c<0||e.x+g>n[0]||e.y-a<0||e.y+h>n[1]||EQ(e,t,r)))return DQ(e,t,r),!0}return!1}function DQ(t,e,i){const{wordSize:s}=t,n=t.sprite,r=s[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=s[1];let u,d=(t.y-(s[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t<c;t++){for(let i=0;i<r;i++)e[d+i]|=n[t*r+i];d+=a}else for(let t=0;t<c;t++){u=0;for(let i=0;i<=r;i++)e[d+i]|=u<<h|(i<r?(u=n[t*r+i])>>>l:0);d+=a}}function EQ(t,e,i){const{sprite:s,wordSize:n}=t,r=i[0]>>5,a=n[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=n[1];let u,d=(t.y-(n[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t<c;t++){for(let i=0;i<a;i++)if(e[d+i]&s[t*a+i])return!0;d+=r}else for(let t=0;t<c;t++){u=0;for(let i=0;i<=a;i++)if((u<<h|(i<a?(u=s[t*a+i])>>>l:0))&e[d+i])return!0;d+=r}return!1}function BQ(t,e,i,s){if(i[s].sprite||0===i[s].fontSize)return;const n=2048,r=Math.PI/180,a=i.length;t.width=n,t.height=2048,e.clearRect(0,0,n,2048),e.textAlign="center";let o,l,h=0,c=0,u=0,d=0;const p=s;for(--s;++s<a;){const t=i[s],a=Math.max(t.fontSize,2);if(e.save(),e.font=t.fontStyle+" "+t.fontWeight+" "+a+"px "+t.fontFamily,o=e.measureText(t.text+"m").width+2*t.padding,l=2*a+2*t.padding,0!==t.rotate){const e=Math.sin(t.rotate*r),i=Math.cos(t.rotate*r),s=o*i,n=o*e,a=l*i,h=l*e;o=Math.max(Math.abs(s+h),Math.abs(s-h)),l=~~Math.max(Math.abs(n+a),Math.abs(n-a))}if(o=o+31>>5<<5,l=Math.ceil(l),l>u&&(u=l),h+o>=n&&(h=0,c+=u,u=l),c+l>=2048){if(0===c){t.hasText=!1;continue}break}c+l>=d&&(d=c+l),e.translate(h+(o>>1),c+(l>>1)),0!==t.rotate&&e.rotate(t.rotate*r),e.fillText(t.text,0,0),t.padding&&(e.lineWidth=2*t.padding,e.strokeText(t.text,0,0)),e.restore(),t.LT=[h,c],t.wordSize=[o,l],t.hasText=!0,h+=o}if(0===d)return;const g=e.getImageData(0,0,n,d).data;let f,m;for(;--s>=p;){const t=i[s];if(!t.hasText){t.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:e=[0,0],wordSize:r}=t;[h,c]=e;const a=r[0]>>5,o=new Array(a*r[1]).fill(0);let[l,u,d,p]=[1/0,-1/0,1/0,-1/0];for(m=0;m<r[1];m++){let t;for(f=0;f<r[0];f++)if(g[4*((c+m)*n+(h+f))+3]>0){const e=1<<31-f%32;o[a*m+(f>>5)]|=e,f<d&&(d=f),f>p&&(p=f),t|=e}t&&(m<l&&(l=m),m>u&&(u=m))}t.bounds={dTop:(r[1]>>1)-l,dBottom:u-(r[1]>>1),dLeft:(r[0]>>1)-d,dRight:p-(r[0]>>1)},t.sprite=o,delete t.LT}}function PQ(t){const{segmentation:{labels:e},boardSize:i,size:s}=t,n=i[0]>>5,r=new Array(n*s[1]).fill(0);for(let t=0;t<s[1];t++)for(let i=0;i<s[0];i++)if(0===e[t*s[0]+i]){const e=1<<31-i%32;r[n*t+(i>>5)]|=e}if(i[0]>s[0]){const t=(1<<i[0]-s[0])-1;for(let e=0;e<s[1];e++)r[n*e+n-1]|=t}return r}function RQ(t,e,i){(function(t,e){const{segmentation:{regions:i}}=e;let s=-1/0,n=0,r=0;i.forEach(((t,e)=>{const i=t.area;i>s&&(s=i,r=e),n+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/n*t.length),o=i/s;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),a<t.length&&(i[r].wordsNum+=t.length-a);let o=r;const l=i.map((t=>t.regionNum));t.forEach((t=>{let e=0,s=0;t.regionIndex=-1;do{if(l[o]>0&&t.weight<=i[o].regionWeight){t.regionIndex=o,i[o].words.push(t),l[o]--,o=(o+1)%i.length;break}o=(o+1)%i.length,e++,s++,s>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),s=0)}while(-1===t.regionIndex&&e<3*i.length);-1===t.regionIndex&&(t.regionIndex=r,i[r].words.push(t),l[r]--)})),i.forEach((t=>{t.words.sort(((t,e)=>e.weight-t.weight))}))})(t,i),"ensureMapping"===e.layoutMode?TQ(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:s,stepFactor:n,importantWordCount:r}=e,{segmentation:{regions:a},tempCanvas:o,boardSize:l,shapeCenter:h,shapeMaxR:c,shapeRatio:u}=i,d=o.getContext("2d",{willReadFrequently:!0}),p=PQ(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,m=Math.min(r,t.length);let v=0;t.length>m&&(v=t.sort(((t,e)=>e.weight-t.weight))[m-1].weight);let y=0,_=1,b=!1;for(let r=0;r<a.length;r++){const h=a[r],{words:c,center:u,maxR:x,ratio:S}=h;let A=!1;for(let r=0;r<c.length;r++){BQ(o,d,t,r);const a=c[r];if(a.x=u[0],a.y=u[1],a.hasText&&a.sprite&&wQ(g,a,x,S,s,l,n)){if(a.hasPlaced=!0,a.weight>=v&&y++,y>=m&&!b){_*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),A=!0,y=0;break}}else{if(a.weight>=v&&_>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),_/=f,b=!0,g=p.slice(0),A=!0;break}if(a.weight>=v)return TQ(t,e,i)}}A&&(r=-1)}for(let i=0;i<e.textLayoutTimes;i++){const i=t.filter((t=>(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=Math.max(~~(t.fontSize*e.fontSizeShrinkFactor),e.minFontSize)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t<i.length;t++){const e=i[t];BQ(o,d,i,t),e.x=h[0],e.y=h[1],e.hasText&&wQ(g,e,c,u,s,l,n)&&(e.hasPlaced=!0)}}e.board=g}(t,e,i):function(t,e,i){const{size:s,stepFactor:n}=e,{segmentation:{regions:r},tempCanvas:a,boardSize:o,shapeCenter:l,shapeMaxR:h,shapeRatio:c}=i,u=PQ(i),d=a.getContext("2d",{willReadFrequently:!0});for(const e of r){const{words:i,center:r,maxR:l,ratio:h}=e;for(let e=0;e<i.length;e++){BQ(a,d,t,e);const c=i[e];c.x=r[0],c.y=r[1],c.hasText&&c.sprite&&wQ(u,c,l,h,s,o,n)&&(c.hasPlaced=!0)}}for(let i=0;i<e.textLayoutTimes;i++){const i=t.filter((t=>(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=Math.max(~~(t.fontSize*e.fontSizeShrinkFactor),e.minFontSize)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t<i.length;t++){const e=i[t];BQ(a,d,i,t),e.x=l[0],e.y=l[1],e.hasText&&wQ(u,e,h,c,s,o,n)&&(e.hasPlaced=!0)}}e.board=u}(t,e,i);const s=function(t,e,i){const{size:s,fillingTimes:n,fillingXStep:r,fillingYStep:a,getFillingFontStyle:o,getFillingFontWeight:l,getFillingFontFamily:h,fillingInitialFontSize:c,fillingDeltaFontSize:u,fillingInitialOpacity:d,fillingDeltaOpacity:p,fillingRotateList:g,getFillingPadding:f,random:m,board:v,minFillFontSize:y}=e,{boardSize:_,shapeBounds:b,tempCanvas:x,randomGenerator:S}=i,A=x.getContext("2d",{willReadFrequently:!0});let k=c,C=d;const M=[];for(let t=0;t<n;t++)T(k,C),k=Math.max(k>u?k-u:u,y),C=C>p?C-p:p;return M;function T(e,i){const n=t.map((t=>{const{text:s,color:n,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:s,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:n,fillingColor:r,hasPlaced:a,datum:c}}));w(n);let c=0;const{x1:u,y1:d,x2:p,y2:y}=b,[k,C]=[u+~~(S()*r*2),d+~~(S()*a*2)];for(let t=C;t<=y;t+=a)for(let e=k;e<=p;e+=r){BQ(x,A,n,c);const i=n[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===n.length&&(c=0,m&&w(n));continue}const{dTop:l,dBottom:h,dLeft:u,dRight:d}=a;i.x-u<0||i.x+d>s[0]||i.y-l<0||i.y+h>s[1]||i.hasText&&i.sprite&&!EQ(i,v,_)&&(DQ(i,v,_),M.push(Object.assign({},i)),++c===n.length&&(c=0,m&&w(n)))}}function w(t){return t.sort((()=>S()-.5))}}(t,e,i),n=[],r=[];for(let e=0;e<t.length;e++)t[e].hasPlaced?r.push(t[e]):n.push(t[e]);return n.forEach((t=>t.visible=!1)),{fillingWords:s,successedWords:r,failedWords:n}}function LQ(t,e){return t&&(M(t)||w(t)||t.startsWith("<svg"))?new Promise(((i,s)=>{var n;const r=e({image:t}),a=null===(n=r.resources)||void 0===n?void 0:n.get(t);a&&"success"===a.state&&a.data?i(a.data):(r.successCallback=()=>{var e;if(r){const n=null===(e=r.resources)||void 0===e?void 0:e.get(t);n&&"success"===n.state&&n.data?i(n.data):s(new Error("image load failed: "+t))}else s(new Error("image load failed: "+t))},r.failCallback=()=>{s(new Error("image load failed: "+t))})})):null}function IQ(t,e){return Promise.allSettled(t.map((t=>LQ(t,e))))}const OQ={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"};const FQ=(t,e,i,s)=>{var n,r,a,o;const{colorMode:l,getColor:h,getFillingColor:c}=e,{sameColorList:u}=i;let d,p,g=e.colorList,f=i.fillingColorList;if("ordinal"===l){const e=t.map((t=>h(t)));if(d=t=>(new GI).domain(e).range(g).scale(t),c&&((null===(n=s.colorField)||void 0===n?void 0:n.field)!==(null===(r=s.fillingColorField)||void 0===r?void 0:r.field)||!u)){const e=t.map((t=>c(t)));p=t=>(new GI).domain(e).range(f).scale(t)}}else{1===g.length&&(g=[g[0],g[0]]);const e=(new fO).domain(HQ(h,t)).range(g);if(d=t=>e.scale(t),c&&((null===(a=s.colorField)||void 0===a?void 0:a.field)!==(null===(o=s.fillingColorField)||void 0===o?void 0:o.field)||!u)){1===f.length&&(f=[f[0],f[0]]);const e=(new fO).domain(HQ(c,t)).range(f);p=t=>e.scale(t)}}Object.assign(e,{colorScale:d,fillingColorScale:p})},zQ=(t,e,i)=>{let{fontSizeRange:s}=e;const{getFontSize:n,getText:r}=e;let a;if(n){if(n&&s){const e=(new bO).domain(HQ(n,t)).range(s);a=t=>e.scale(n(t))}else if(n&&u(n)&&!s){const e=.5,[o,l]=HQ(n,t),h=t.map((t=>({text:r(t),value:n(t),weight:l===o?1:(n(t)-o)/(l-o)}))),c=jQ(h,i,!0);s=[~~(e*c),~~c];const u=(new bO).domain(HQ(n,t)).range(s);a=t=>u.scale(n(t))}}else{const e=t.map((t=>({text:r(t)}))),s=jQ(e,i,!1);a="function"==typeof(o=s)?o:function(){return o}}var o;Object.assign(e,{getFontSize:n,fontSizeRange:s,fontSizeScale:a})},jQ=(t,e,i)=>{const s=e.shapeArea,n=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(s)/12),o=t.reduce(((t,e)=>{const s=MQ(e.text);return s<a?t+s*(i?(.5+.5*e.weight)**2:1):t}),0);if(0===o)return 12;let l=20;if(1===r.length)l=Math.sqrt(n*(s/(1.7*o)));else{const t=[];for(let e=0;e<r.length;e++){const i=r[e].area,a=r[e].ratio,l=i/s;if(l<.1)continue;const h=l*(o*(a<1?2.7-a:1.7)),c=Math.sqrt(n*(i/h));t.push(c)}l=t.length?Math.min(...t):Math.sqrt(n*(s/(1.7*o)))}return l};const HQ=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;a<n;++a)r=ht(t(e[a])),r<i&&(i=r),r>s&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]},NQ=(t,e,i)=>{if(!t.size||d(t.size[0])||d(t.size[1])||t.size[0]<=0||t.size[1]<=0)return gt.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];if(t.size=[Math.ceil(t.size[0]),Math.ceil(t.size[1])],t.shape||gt.getInstance().error("WordcloudShape shape must be specified."),t.text||gt.getInstance().error("WordcloudShape text must be specified."),t.onBeforeLayout&&t.onBeforeLayout(),!e||0===e.length)return[];const s=new class{constructor(t){this.progressiveResult=[],this.options=t}layout(t){this.data=t;const e=this.options,i={shapeUrl:e.shape,size:e.size,ratio:e.ratio||.8,tempCanvas:void 0,boardSize:[0,0],random:!1,randomGenerator:void 0},s=this.options.createCanvas({width:e.size[0],height:e.size[1]}),n=s.getContext("2d",{willReadFrequently:!0});n.textAlign="center",n.textBaseline="middle",i.tempCanvas=s;const r=e.size[0]+31>>5<<5;if(i.boardSize=[r,e.size[1]],i.random?i.randomGenerator=Math.random:i.randomGenerator=te(),this.segmentationInput=i,_(i.shapeUrl)){i.isEmptyPixel=sQ(void 0,void 0,this.options.createCanvas);const t=LQ(i.shapeUrl,this.options.createImage);t?(this.isImageFinished=!1,this.isLayoutFinished=!1,t.then((t=>{this.isImageFinished=!0;const s=this.options.createCanvas({width:e.size[0],height:e.size[1],dpr:1});i.maskCanvas=s;const n=s.getContext("2d");e.removeWhiteBorder&&dQ(t,s,i.isEmptyPixel);const r=pQ(t,e.size);n.clearRect(0,0,e.size[0],e.size[1]),n.drawImage(t,r.x,r.y,r.width,r.height),this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i.maskCanvas)})).catch((t=>{this.isImageFinished=!0}))):(this.isImageFinished=!0,this.isLayoutFinished=!0)}else if(i.shapeUrl&&("text"===i.shapeUrl.type||"geometric"===i.shapeUrl.type)){i.isEmptyPixel=sQ(i.shapeUrl.backgroundColor,void 0,this.options.createCanvas);const t=nQ(i.shapeUrl,e.size[0],e.size[1],void 0,!1,this.options.createCanvas);i.maskCanvas=t,this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(t),this.doLayout(),this.isImageFinished=!0,this.isLayoutFinished=!0}}canAnimate(){return!0}unfinished(){return!this.isLayoutFinished}output(){return this.progressiveResult}progressiveRun(){this.isImageFinished&&!this.isLayoutFinished&&(this.segmentationInput.maskCanvas&&this.doLayout(),this.isLayoutFinished=!0)}progressiveOutput(){return this.progressiveResult}doLayout(){var t,e,i,s,n,r,a,o,l,h,c,u,d,p,g,f,m,v,y,_,b;const x=this.segmentationInput,S=uQ(x);if(!S.segmentation.regions.length)return;const A=this.options,k=this.data,C=A.colorMode||"ordinal",M={getText:ne(A.text),getFontSize:ne(A.fontSize),fontSizeRange:A.fontSizeRange,colorMode:C,getColor:A.colorField?ne(A.colorField):ne(A.text),getFillingColor:ne(A.fillingColorField),colorList:A.colorList||("ordinal"===C?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:ne(A.colorHexField),getFontFamily:ne(A.fontFamily||"sans-serif"),rotateList:A.rotateList||[0],getPadding:ne(A.padding||1),getFontStyle:ne(A.fontStyle||"normal"),getFontWeight:ne(A.fontWeight||"normal"),getFontOpacity:A.fontOpacity?ne(A.fontOpacity):()=>1};zQ(k,M,S);const T={size:A.size,ratio:A.ratio||.8,shapeUrl:A.shape,random:void 0===A.random||A.random,textLayoutTimes:null!==(t=A.textLayoutTimes)&&void 0!==t?t:3,removeWhiteBorder:A.removeWhiteBorder,layoutMode:null!==(e=A.layoutMode)&&void 0!==e?e:"default",fontSizeShrinkFactor:null!==(i=A.fontSizeShrinkFactor)&&void 0!==i?i:.8,stepFactor:null!==(s=A.stepFactor)&&void 0!==s?s:1,importantWordCount:null!==(n=A.importantWordCount)&&void 0!==n?n:10,globalShinkLimit:A.globalShinkLimit||.2,fontSizeEnlargeFactor:null!==(r=A.fontSizeEnlargeFactor)&&void 0!==r?r:1.5,fillingRatio:null!==(a=A.fillingRatio)&&void 0!==a?a:.7,fillingTimes:null!==(o=A.fillingTimes)&&void 0!==o?o:4,fillingXStep:A.fillingXRatioStep?Math.max(Math.floor(A.size[0]*A.fillingXRatioStep),1):null!==(l=A.fillingXStep)&&void 0!==l?l:4,fillingYStep:A.fillingYRatioStep?Math.max(Math.floor(A.size[1]*A.fillingYRatioStep),1):null!==(h=A.fillingYStep)&&void 0!==h?h:4,fillingInitialFontSize:A.fillingInitialFontSize,fillingDeltaFontSize:A.fillingDeltaFontSize,fillingInitialOpacity:null!==(c=A.fillingInitialOpacity)&&void 0!==c?c:.8,fillingDeltaOpacity:null!==(u=A.fillingDeltaOpacity)&&void 0!==u?u:.05,getFillingFontFamily:ne(A.fillingFontFamily||"sans-serif"),getFillingFontStyle:ne(A.fillingFontStyle||"normal"),getFillingFontWeight:ne(A.fillingFontWeight||"normal"),getFillingPadding:ne(null!==(d=A.fillingPadding)&&void 0!==d?d:.4),fillingRotateList:null!==(p=A.fillingRotateList)&&void 0!==p?p:[0,90],fillingDeltaFontSizeFactor:null!==(g=A.fillingDeltaFontSizeFactor)&&void 0!==g?g:.2,fillingColorList:A.fillingColorList||["#537EF5"],sameColorList:!1,minInitFontSize:null!==(f=A.minInitFontSize)&&void 0!==f?f:10,minFontSize:null!==(m=A.minFontSize)&&void 0!==m?m:4,minFillFontSize:null!==(v=A.minFillFontSize)&&void 0!==v?v:2},w=((t,e)=>{if(1===e.length&&"#537EF5"===e[0])return!0;if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0})(M.colorList,T.fillingColorList);T.sameColorList=w,FQ(k,M,T,A),function(t,e,i,s){const{getText:n}=e;let{fillingInitialFontSize:r,fillingDeltaFontSize:a}=i;const{fillingRatio:o}=i,l=Math.ceil(Math.sqrt(s.shapeArea)/4);if(!r||!a){const e=o/100,h=t.reduce(((t,e)=>{const i=MQ(n(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*s.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(k,M,T,S);const{getText:D,getFontFamily:E,getFontStyle:B,getFontWeight:P,getPadding:R,getColor:L,getFillingColor:I,getColorHex:O,fontSizeScale:F,colorScale:z,fillingColorScale:j,getFontOpacity:H,rotateList:N}=M,U=k.map((t=>{var e,i;return{x:0,y:0,weight:0,text:D(t),fontFamily:E(t),fontWeight:P(t),fontStyle:B(t),rotate:N[~~(x.randomGenerator()*N.length)],fontSize:Math.max(T.minInitFontSize,~~F(t)),opacity:H(t),padding:R(t),color:O&&O(t)||z&&z(L(t))||"black",fillingColor:!I||(null===(e=A.colorField)||void 0===e?void 0:e.field)===(null===(i=A.fillingColorField)||void 0===i?void 0:i.field)&&w?void 0:O&&O(t)||j&&j(I(t))||"black",datum:t,visible:!0,hasPlaced:!1}})),V=et(U.map((t=>t.fontSize)));U.forEach((t=>t.weight=t.fontSize/V)),U.sort(((t,e)=>e.weight-t.weight));const{fillingWords:W,successedWords:G,failedWords:Y}=RQ(U,T,S),X=null!==(_=null===(y=A.text)||void 0===y?void 0:y.field)&&void 0!==_?_:"textKey",$=null!==(b=A.dataIndexKey)&&void 0!==b?b:"defaultDataIndexKey",K=A.as?Object.assign(Object.assign({},OQ),A.as):OQ;let q,Z;const J=[];for(let t=0;t<U.length;++t)q=U[t],Z=q.datum,Z[K.x]=q.x,Z[K.y]=q.y,Z[K.fontFamily]=q.fontFamily,Z[K.fontSize]=q.fontSize,Z[K.fontStyle]=q.fontStyle,Z[K.fontWeight]=q.fontWeight,Z[K.angle]=$e(q.rotate),Z[K.opacity]=q.opacity,Z[K.visible]=q.visible,Z[K.isFillingWord]=!1,Z[K.color]=q.color,Z[$]=`${q.text}_${t}_keyword`,J.push(Z);const Q=[];W.forEach(((t,e)=>{var i,s;const n=Object.assign({},t.datum);n[K.x]=t.x,n[K.y]=t.y,n[K.fontFamily]=t.fontFamily,n[K.fontSize]=t.fontSize,n[K.fontStyle]=t.fontStyle,n[K.fontWeight]=t.fontWeight,n[K.angle]=$e(t.rotate),n[K.opacity]=t.opacity,n[K.visible]=t.visible,n[K.isFillingWord]=!0,n[K.color]=I?(null===(i=A.colorField)||void 0===i?void 0:i.field)===(null===(s=A.fillingColorField)||void 0===s?void 0:s.field)&&w?t.color:t.fillingColor:T.fillingColorList[~~(x.randomGenerator()*T.fillingColorList.length)],n[X]=t.text,n[$]=`${t.text}_${e}_fillingWords`,Q.push(n)})),this.options.onLayoutFinished&&this.options.onLayoutFinished({successedWords:G,failedWords:Y}),this.progressiveResult=J.concat(Q)}release(){this.segmentationInput=null,this.data=null,this.progressiveResult=null,this.options=null}}(t);return s.layout(e),s.unfinished()?{progressive:s}:s.output()};var UQ;function VQ(t,e){t.aspectRatio>1?(t.width=e,t.height=~~(e/t.aspectRatio)):(t.height=e,t.width=~~(e*t.aspectRatio))}!function(t){t.BEFORE_IMAGECLOUD_LAYOUT="beforeImagecloudLayout",t.AFTER_IMAGECLOUD_LAYOUT="afterImagecloudLayout",t.AFTER_IMAGECLOUD_DRAW="afterImagecloudDraw"}(UQ||(UQ={}));class WQ{constructor(t){this.progressiveResult=[],this.imageCollageList=[],this.options=t}preProcess(){const{imageConfig:t={},weight:e}=this.options,{padding:i=0}=t;let s=this.imageCollageList;return s.forEach(((t,s)=>{!1===t.valid?(t.x=-10,t.y=-10,t.width=0,t.height=0,t.opacity=0):(t.padding=i,t.weight=ne(e)(this.data[s]),t.datum=this.data[s])})),s=s.filter((t=>!1!==t.valid)).sort(((t,e)=>e.weight-t.weight)),s}onImageCollageInputReady(t){t.forEach(((t,e)=>{if("fulfilled"===t.status){const i=t.value,{width:s,height:n}=i;this.imageCollageList.push(Object.assign({},this.data[e],{aspectRatio:s/n}))}else this.imageCollageList.push(Object.assign({},this.data[e],{valid:!1}))}))}layout(t){this.data=t,this.loadSegmentationInput(),this.loadImageCollageInput()}loadSegmentationInput(){var t,e,i,s,n,r;const a=this.options,o=a.size,l={shapeUrl:null!==(t=a.mask)&&void 0!==t?t:{type:"geometric",shape:"rect"},size:o,ratio:a.ratio||.8,tempCanvas:void 0,boardSize:[0,0],random:!1,randomGenerator:void 0,blur:null===(e=a.maskConfig)||void 0===e?void 0:e.edgeBlur},h=this.options.createCanvas({width:o[0],height:o[1]}),c=h.getContext("2d",{willReadFrequently:!0});c.textAlign="center",c.textBaseline="middle",l.tempCanvas=h;const u=o[0]+31>>5<<5;if(l.boardSize=[u,o[1]],l.random?l.randomGenerator=Math.random:l.randomGenerator=te(),this.segmentationInput=l,_(l.shapeUrl)){l.isEmptyPixel=sQ(void 0,{threshold:null!==(s=null===(i=a.maskConfig)||void 0===i?void 0:i.threshold)&&void 0!==s?s:200,invert:null===(n=a.maskConfig)||void 0===n?void 0:n.invert},this.options.createCanvas);const t=LQ(l.shapeUrl,this.options.createImage);t?(this.isMaskImageFinished=!1,this.isLayoutFinished=!1,t.then((t=>{var e,i;this.isMaskImageFinished=!0;const s=a.size,n=this.options.createCanvas({width:s[0],height:s[1],dpr:1});l.maskCanvas=n;const r=n.getContext("2d");(null===(e=a.maskConfig)||void 0===e?void 0:e.removeWhiteBorder)&&dQ(t,n,l.isEmptyPixel);const o=pQ(t,s);let h;r.clearRect(0,0,s[0],s[1]),r.drawImage(t,o.x,o.y,o.width,o.height),this.segmentationOutput=uQ(this.segmentationInput),"masked"===(null===(i=this.options.layoutConfig)||void 0===i?void 0:i.placement)&&(h=this.generateTransparentMaskCanvas(t,s)),this.segmentationOutput.transparentMaskCanvas=h,this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(n,h)})).catch((t=>{this.isMaskImageFinished=!0}))):(this.isMaskImageFinished=!0,this.isLayoutFinished=!0)}else if(l.shapeUrl&&("text"===l.shapeUrl.type||"geometric"===l.shapeUrl.type)){l.isEmptyPixel=sQ(l.shapeUrl.backgroundColor,void 0,this.options.createCanvas),"text"!==l.shapeUrl.type&&"geometric"!==l.shapeUrl.type||l.shapeUrl.backgroundColor||(l.shapeUrl.backgroundColor="rgba(255,255,255,255)");const t=nQ(l.shapeUrl,o[0],o[1],void 0,null===(r=a.maskConfig)||void 0===r?void 0:r.invert,this.options.createCanvas);l.maskCanvas=t,this.segmentationOutput=uQ(this.segmentationInput),this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(t,t),this.isMaskImageFinished=!0}}loadImageCollageInput(){const t=IQ(this.data.map((t=>ne(this.options.image)(t))),this.options.createImage);t?t.then((t=>{this.onImageCollageInputReady(t),this.isImagesFinished=!0})).catch((t=>{this.isImagesFinished=!0,this.isLayoutFinished=!0,gt.getInstance().error("image load failed",t)})):(this.isImagesFinished=!0,this.isLayoutFinished=!0)}canAnimate(){return!0}unfinished(){return!this.isLayoutFinished}output(){return this.progressiveResult}progressiveRun(){if(this.isImagesFinished&&this.isMaskImageFinished&&!this.isLayoutFinished){const t=this.preProcess(),e=this.doLayout(t);this.options&&this.options.onLayoutEnd&&this.options.onLayoutEnd(e),this.progressiveResult=this.processOutput(e),this.isLayoutFinished=!0}}progressiveOutput(){return this.progressiveResult}release(){this.segmentationInput=null,this.data=null,this.progressiveResult=null,this.options=null}calculateImageSize(t,e={},i=.45){const{imageSizeRange:s,padding:n=0}=e,r=A(e.imageSize)?e.imageSize:se(e.imageSize),a=this.options.size;if(r||s)if(r&&!u(r))t.forEach((t=>VQ(t,r)));else if(s){const e=(new bO).domain(oe(t,(t=>t.weight))).range(s);t.forEach((t=>VQ(t,~~e.scale(t.weight))))}else if(r&&u(r)&&!s){const e=.5,[s,r]=oe(t,(t=>t.weight)),o=t.reduce(((t,i)=>{const n=i.aspectRatio,a=(i.weight-s)/(r-s);return t+(n>1?1/n:n)*(e+(1-e)*a)**2}),0),l=~~Math.sqrt(i*a[0]*a[1]/o),h=[~~(e*l)-2*n<0?1:~~(e*l)-2*n,~~l-2*n<0?1:~~l-2*n],c=(new bO).domain(oe(t,(t=>t.weight))).range(h);t.forEach((t=>VQ(t,~~c.scale(t.weight))))}else console.warn("image cloud imageSize error");else{const e=t.reduce(((t,e)=>{const i=e.aspectRatio;return t+(i>1?1/i:i)}),0);let s=~~Math.sqrt(i*a[0]*a[1]/e);s=s-2*n<0?1:s-2*n,t.forEach((t=>VQ(t,s)))}return t}generateTransparentMaskCanvas(t,e){var i;const s=this.options.createCanvas({width:e[0],height:e[1],dpr:1}),n=s.getContext("2d");this.segmentationOutput.transparentMaskCanvas=s,(null===(i=this.options.maskConfig)||void 0===i?void 0:i.removeWhiteBorder)&&dQ(t,s,this.segmentationInput.isEmptyPixel);const r=n.createImageData(e[0],e[1]),a=this.segmentationOutput.segmentation.labels;for(let t=0;t<a.length;t++){const e=0===a[t]?255:0,i=255*a[t],s=4*t;r.data[s]=e,r.data[s+1]=e,r.data[s+2]=e,r.data[s+3]=i}return n.clearRect(0,0,e[0],e[1]),n.fillStyle="rgba(255,255,255,0)",n.fillRect(0,0,e[0],e[1]),n.putImageData(r,0,0),s}processOutput(t){var e;const i=null===(e=this.options)||void 0===e?void 0:e.as;return i&&Object.keys(i).forEach((e=>{t.forEach((t=>{t[i[e]]=t[e],delete t[e]}))})),t}}class GQ extends WQ{preProcess(){const t=super.preProcess(),{imageConfig:e={},ratio:i=.45}=this.options;return this.calculateImageSize(t,e,i)}tryPlaceImage(t,e,i,s,n,r=1){const[a,o]=e,l=a/2,h=o/2,c=Math.sqrt(l**2+h**2),u=qJ[i](e);let d,p,g=-r;const{segmentation:f}=s,{labels:m}=f;for(;([d,p]=u(g+=r))&&!(Math.min(Math.abs(d),Math.abs(p))>=c);)if(d-=t.width/2,p-=t.height/2,t.visible=!0,t.x=~~(l+d),t.y=~~(h+p),t._left=t.x+t.padding,t._top=t.y+t.padding,t._leftWithoutPadding=t.x,t._topWithoutPadding=t.y,YQ(t,n)){const{x:e,y:i,width:s,height:n}=t;let r=!1;for(let t=0;t<s;t++){for(let s=0;s<n&&i+t<=o;s++)if(!(e+s>a||m[(i+t)*a+(e+s)])){r=!0;break}if(r)break}if(!r){const e=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x,y:t.y+t.height},{x:t.x+t.width,y:t.y+t.height}];let i=!0;for(const t of e)if(!m[t.y*a+t.x]){i=!1;break}if(!i)continue;return!0}}return!1}doLayout(t){var e;const{segmentationOutput:i}=this,{layoutConfig:s={}}=this.options,n=this.options.size,{spiralType:r="archimedean",fillingTimes:a=4,minFillingImageSize:o=10}=s,l=[],h=Object.keys(t[0]).find((t=>t.includes("VGRAMMAR")));for(const e of t)e._widthWithPadding=e.width+2*e.padding,e._heightWithPadding=e.height+2*e.padding,e.frequency=1,this.tryPlaceImage(e,n,r,i,l)&&l.push(e);const c=it(l,((t,e)=>t.width-e.width)).width,u=it(l,((t,e)=>t.height-e.height)).height,d=[];for(let s=0;s<a;s++){const a=.5*c-1*s,p=.5*u-1*s;for(const s of t){const t=Object.assign({},s,{visible:!0});VQ(t,Math.max(o,t.aspectRatio>1?a:p)),t._widthWithPadding=t.width+2*t.padding,t._heightWithPadding=t.height+2*t.padding,this.tryPlaceImage(t,n,r,i,[...d,...l],.5)&&(s._tempFrequency=(null!==(e=s._tempFrequency)&&void 0!==e?e:s.frequency)+1,t.frequency=s._tempFrequency,t.distance=Math.sqrt(Math.pow(t.x-n[0]/2,2)+Math.pow(t.y-n[1]/2,2)),t[h]=`${t[h]}_${t.frequency}`,d.push(t))}}return[...l,...d].filter((t=>t.visible))}}function YQ(t,e){for(let i=0;i<e.length;i++)if(XQ(t,e[i]))return!1;return!0}function XQ(t,e){return!(t._leftWithoutPadding+t._widthWithPadding<e._leftWithoutPadding||t._topWithoutPadding+t._heightWithPadding<e._topWithoutPadding||t._leftWithoutPadding>e._leftWithoutPadding+e._widthWithPadding||t._topWithoutPadding>e._topWithoutPadding+e._heightWithPadding)}function $Q(t){const{imageConfig:e={},size:i,ratio:s=.1,layoutConfig:n={}}=t,{padding:r=0,imageSize:a}=e,[o,l]=i;let h;h=a||Math.min(o,l)*s-2*r,h<0&&(h=1);const{rectAspectRatio:c=1}=n;let u,d;c>1?(u=h,d=h/c):(d=h,u=h*c);const p=Math.ceil(l/(d+r)),g=Math.ceil(o/(u+r)),f=o/2,m=l/2,v=new Array(g*p);for(let t=0;t<p;t++)for(let e=0;e<g;e++){const i=e*(u+r)+u/2,s=t*(d+r)+d/2;v[t*g+e]={centerX:i,centerY:s,x:i-u/2,y:s-d/2,row:t,col:e,distance:Math.sqrt(Math.pow(i-f,2)+Math.pow(s-m,2))}}return{context:Object.assign({},n,{cellWidth:u,cellHeight:d,cellInfo:v,cellCount:v.length,cellType:"rect",cellPixelCount:u*d,eachPixel:(t,e)=>{const{x:i,y:s}=t;for(let t=0;t<u;t++)for(let n=0;n<d&&s+t<=l;n++)i+n>o||e((~~s+t)*o+(~~i+n))},clipPath:`M${-u/2} ${-d/2} L${u/2} ${-d/2} L${u/2} ${d/2} L${-u/2} ${d/2} Z`}),imageLength:h}}const KQ={rect:$Q,circle:function(t){const{imageConfig:e={},size:i,ratio:s=.1,layoutConfig:n={}}=t,{padding:r=0,imageSize:a=0}=e,[o,l]=i,h=o/2,c=l/2;let u=0;u=a?a/2:Math.min(o,l)*s/2,u-r<=0&&(u=r+1);const d=2*u,p=Math.sqrt(3)/2*d+r,g=[];let f=0;for(let t=0;t*p-u<l;t++){const e=t*p,i=t%2==0?0:u;for(let s=-1;s*(d+r)+i-u<o;s++){const n=s*(d+r)+i+u;g[f++]={centerX:n,centerY:e,x:n-u,y:e-u,row:t,col:s,distance:Math.sqrt(Math.pow(n-h,2)+Math.pow(e-c,2))}}}let m=0;const v=u*u;for(let t=0;t<d;t++)for(let e=0;e<d;e++){const i=t-u,s=e-u;i*i+s*s<=v&&m++}return{context:Object.assign({},n,{cellWidth:d,cellHeight:d,cellInfo:g,cellCount:g.length,cellType:"circle",cellPixelCount:m,eachPixel:(t,e)=>{const{x:i,y:s}=t;for(let t=0;t<d;t++)for(let n=0;n<d;n++){if(t+i<0||t+i>o||n+s>l||n+s<0)continue;const r=t-u,a=n-u;r*r+a*a<=v&&e((~~s+t)*o+(~~i+n))}},clipPath:"M 1 0 A 1 1 0 1 0 -1 0 A 1 1 0 1 0 1 0 Z"}),imageLength:d}},hexagonal:function(t){const{imageConfig:e={},size:i,ratio:s=.1,layoutConfig:n={}}=t,{padding:r=0,imageSize:a}=e,[o,l]=i,h=o/2,c=l/2;let u;u=a?a/2:Math.min(o,l)*s/2,u-r<=0&&(u=r+1);const d=[],p=2*Math.PI/6;for(let t=0;t<6;t++){const e=p*t;d.push({x:(u-r/2)*Math.cos(e),y:(u-r/2)*Math.sin(e)})}const g=2*u,f=Math.sin(Math.PI/6)*g,m=Math.sqrt(3)*f,v=g-f/2,y=Math.cos(Math.PI/6)*g,_=y/2,b=Math.floor(l/m),x=Math.floor(o/f),S=[];for(let t=-1;t<=b+1;t++)for(let e=-1;e<=x;e++){const i=e*v,s=t*y+(e%2?_:0);S.push({centerX:i,centerY:s,x:i-f,y:s-f,row:t,col:e,distance:Math.sqrt(Math.pow(i-h,2)+Math.pow(s-c,2))})}let A=0;const k=[];for(let t=0;t<=m;t++)for(let e=0;e<=2*f;e++){const i=e-f,s=t-m/2,n=Math.abs(i),r=Math.abs(s);n<=f&&r<=m/2&&2*r+n*Math.sqrt(3)<=m?(A++,k.push(!0)):k.push(!1)}return{context:Object.assign({},n,{cellHexSideLength:f,cellHexPoints:d,cellHeight:m,cellWidth:2*f,cellInfo:S,cellCount:S.length,cellType:"hexagonal",cellPixelCount:A,eachPixel:(t,e)=>{const{x:i,y:s}=t;let n=0;for(let t=0;t<=m;t++)for(let r=0;r<=2*f;r++)k[n++]&&e((~~s+t)*o+(~~i+r))},clipPath:"M 1 0 L 0.5 0.866 L -0.5 0.866 L -1 0 L -0.5 -0.866 L 0.5 -0.866 Z"}),imageLength:g-r}}};let qQ=class extends WQ{preProcess(){var t;const e=super.preProcess(),{layoutConfig:i={}}=this.options,{cellType:s="rect"}=i,n=(null!==(t=KQ[s])&&void 0!==t?t:KQ.rect)(this.options),{context:r,imageLength:a}=n;return e.forEach((t=>function(t,e){t.aspectRatio>1?(t.height=e,t.width=~~(e*t.aspectRatio)):(t.width=e,t.height=~~(e/t.aspectRatio))}(t,a))),r.cellInfo.sort(((t,e)=>t.distance-e.distance)),this.layoutContext=r,e}doLayout(t){const{cellWidth:e,cellHeight:i,cellInfo:s,cellCount:n,clipPath:r,eachPixel:a,cellPixelCount:o}=this.layoutContext;if(0===t.length||0===n||0===e||0===i||0===s.length)return void(this.isLayoutFinished=!0);const{segmentationOutput:l}=this,{layoutConfig:h={}}=this.options,{placement:c="default"}=h;if("edge"===c||"default"===c){const{segmentation:t}=l,{labels:e}=t;s.forEach((t=>{let i=0;a(t,(t=>{e[t]&&i++})),t.intersectPixels=i}))}const u=t.length,d=t=>{const{intersectPixels:e}=t;return"default"===c?e>=.45*o:"edge"!==c||e>.1*o&&e<o};for(let e=0;e<u;e++){const i=t[e],n=s[e];n&&(i.x=n.centerX-i.width/2,i.y=n.centerY-i.height/2,i.clipConfig={shape:r},i.frequency=1,i.visible=d(n),i.cell=V(n,["image"]),i.distance=n.distance,n.image=i)}const p=Object.keys(t[0]).find((t=>t.includes("VGRAMMAR")));if(u<n)for(let e=u;e<n;e++){const i=t[e-u],n=s[e];if(n){const e=Object.assign({},i);e.x=n.centerX-e.width/2,e.y=n.centerY-e.height/2,e.frequency+=1,e[p]=`${e[p]}_${e.frequency}`,e.visible=d(n),e.distance=n.distance,e.cell=V(n,["image"]),n.image=e,t.push(e)}}return t.filter((t=>t.visible))}};class ZQ extends WQ{preProcess(){const t=super.preProcess(),{imageConfig:e={},ratio:i=.1}=this.options,s=$Q;return this.layoutContext=s(Object.assign({},this.options,{imageConfig:{imageSize:null}})).context,this.layoutContext.cellInfo.sort(((t,e)=>t.distance-e.distance)),this.calculateImageSize(t,e,i)}doLayout(t){const{segmentationOutput:e}=this,{cellWidth:i,cellHeight:s,cellInfo:n,cellCount:r,eachPixel:a,cellPixelCount:o}=this.layoutContext;if(0===t.length||0===r||0===i||0===s||0===n.length)return void(this.isLayoutFinished=!0);const{layoutConfig:l={}}=this.options,h=this.options.size,{placement:c="default",maxAngle:u=Math.PI/180*45}=l;if("edge"===c||"default"===c){const{segmentation:t}=e,{labels:i}=t;n.forEach((t=>{let e=0;a(t,(t=>{i[t]&&e++})),t.intersectPixels=e}))}const d=t.length,p=Math.sqrt(Math.pow(h[0],2)+Math.pow(h[1],2)),g=t=>{const{intersectPixels:e}=t;return"default"===c?e>.5*o:"edge"!==c||e>.1*o&&e<o};for(let e=0;e<d;e++){const i=t[e],s=n[e];s&&(i.x=s.centerX-i.width/2,i.y=s.centerY-i.height/2,i.visible=g(s),i.cell=`${s.row}_${s.col}`,i.angle=Math.random()*(2*u)-u,i.anchor=[i.x+i.width/2,i.y+i.height/2],i.zIndex=p-s.distance,i.distance=s.distance,i.frequency=1,s.image=i)}const f=Object.keys(t[0]).find((t=>t.includes("VGRAMMAR")));if(d<r)for(let e=d;e<r;e++){const i=t[e-d],s=n[e];if(s){const e=Object.assign({},i);e.x=s.centerX-e.width/2,e.y=s.centerY-e.height/2,e.anchor=[e.x+e.width/2,e.y+e.height/2],e.angle=Math.random()*(2*u)-u,e.frequency+=1,e[f]=`${e[f]}_${e.frequency}`,e.visible=g(s),e.cell=`${s.row}_${s.col}`,e.distance=s.distance,e.zIndex=p-s.distance,s.image=e,t.push(e)}}return t.filter((t=>t.visible))}}class JQ extends BZ{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.wordCloud}}JQ.type=t.SeriesTypeEnum.wordCloud;const QQ=()=>{wH.registerGrammarTransform("wordcloud",{transform:yQ}),UK(),wH.registerAnimation("wordCloud",((t,e)=>({appear:PZ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:CV.disappear.duration}}))),wH.registerSeries(JQ.type,JQ)},t0=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:u,asLastValue:d,asCurrentValue:p,asNextValue:g,heightVisual:f=!1,isCone:m=!0,range:v}=e,y=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),_=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:_,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:y];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),y=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),_=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=C(_*v)&&0!==v?_/v:0,S=C(v*y)&&0!==y?v/y:0;d&&(t[d]=y),g&&(t[g]=_),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:_/b[1]),u&&(t[u]=0===e?1:y/b[1]),p&&(t[p]=v)})),n},e0=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},i0=`${ZH}_FUNNEL_TRANSFORM_RATIO`,s0=`${ZH}_FUNNEL_REACH_RATIO`,n0=`${ZH}_FUNNEL_HEIGHT_RATIO`,r0=`${ZH}_FUNNEL_VALUE_RATIO`,a0=`${ZH}_FUNNEL_LAST_VALUE_RATIO`,o0=`${ZH}_FUNNEL_NEXT_VALUE_RATIO`,l0=`${ZH}_FUNNEL_LAST_VALUE`,h0=`${ZH}_FUNNEL_CURRENT_VALUE`,c0=`${ZH}_FUNNEL_NEXT_VALUE`,u0=`${ZH}_FUNNEL_TRANSFORM_LEVEL`;class d0 extends cW{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[s0])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return g(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class p0 extends dV{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class g0 extends p0{constructor(){super(...arguments),this.type=g0.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}g0.type="polygon";const f0=()=>{wH.registerMark(g0.type,g0),FE(),TE(),IV(),wH.registerGraphicComponent("polygon",dy)},m0=Object.assign(Object.assign({},SW),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class v0 extends zW{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class y0 extends jW{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=v0,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;iU(this._dataSet,"funnel",t0),iU(this._dataSet,"funnelTransform",e0);const t=new Th(this._dataSet,{name:`${ZH}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new oV(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:h0,asTransformRatio:i0,asReachRatio:s0,asHeightRatio:n0,asValueRatio:r0,asNextValueRatio:o0,asLastValueRatio:a0,asLastValue:l0,asNextValue:c0,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:u0}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},y0.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:LW(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},y0.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(y0.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(y0.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new d0(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>g(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),u(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;g(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&mA(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&mA(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*jj(s0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(EW(null===(s=wH.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),BW("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(EW(wH.getAnimationInKey("fadeInOut")(),BW(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(EW(wH.getAnimationInKey("funnel")({},o),BW(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(EW(null===(a=wH.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),BW("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[a0])/2:this._getSecondaryAxisLength(t[r0])/2,n=this._getSecondaryAxisLength(t[r0])/2):(s=this._getSecondaryAxisLength(t[r0])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[o0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[u0])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return g(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[iN]===t[iN]));if(!g(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(A(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,u=c?c.x2-c.x1:0,d=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,u);return"center"===this._funnelAlign&&(p/=2),p-d-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const u=this.getCategoryField(),d=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[u])===t[u]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[u])===t[u]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==d?void 0:d.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_<this._minLabelLineWidth&&(_=y-this._minLabelLineWidth),v=m):(y=this._getPolygonCenter(i).y+s/2+e,_=!1!==f.alignLabel?(null==d?void 0:d.y1)-e:y+e,m=this._getPolygonCenter(i).x,_-y<this._minLabelLineWidth&&(_=y+this._minLabelLineWidth),v=m),{x1:m,x2:v,y1:y,y2:_}}const b=this.getPoints(t),x=(Math.abs(b[0].x-b[1].x)+Math.abs(b[2].x-b[3].x))/2,S=(null==g?void 0:g.x2)-(null==g?void 0:g.x1)||0,A=null!==(c=f.spaceWidth)&&void 0!==c?c:5;return"right"===this._spec.outerLabel.position||"left"===this._funnelAlign?(m=this._getPolygonCenter(b).x+Math.max(S/2,x/2)+A,v=!1!==f.alignLabel?(null==d?void 0:d.x1)-A:m+A,y=this._getPolygonCenter(b).y,v-m<this._minLabelLineWidth&&(v=m+this._minLabelLineWidth),_=y):(m=this._getPolygonCenter(b).x-Math.max(S/2,x/2)-A,v=!1!==f.alignLabel?(null==d?void 0:d.x2)+A:m-A,y=this._getPolygonCenter(b).y,m-v<this._minLabelLineWidth&&(v=m-this._minLabelLineWidth),_=y),{x1:m,x2:v,y1:y,y2:_}}_computeMaxSize(){var t;const e=this._isHorizontal()?this.getLayoutRect().height:this.getLayoutRect().width;return uH(null!==(t=this._spec.maxSize)&&void 0!==t?t:"80%",e)}_computeMinSize(){var t;const e=this._isHorizontal()?this.getLayoutRect().height:this.getLayoutRect().width;return uH(null!==(t=this._spec.minSize)&&void 0!==t?t:0,e)}_isHorizontal(){return"left"===this._funnelOrient||"right"===this._funnelOrient}_isReverse(){return"bottom"===this._funnelOrient||"right"===this._funnelOrient}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._funnelMark]}}y0.type=t.SeriesTypeEnum.funnel,y0.mark=m0,y0.builtInTheme={funnel:PH},y0.transformerConstructor=v0;const _0=()=>{f0(),UK(),Q$(),wH.registerSeries(y0.type,y0),wH.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},TV))),wH.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:LR,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),DV()},b0=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},x0=t=>{const e=t.filter((t=>t.context.diffState===JU.update)),i=it(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},S0=(t,e,i)=>{if(R(t))return[e,i];const s=it(t.map((t=>1*t.getFinalAttribute().startAngle))),n=et(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},A0=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=x0(i.parent.children),a=S0(r,s,n);return b0(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=x0(i.parent.children),a=S0(r,s,n);return b0(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),k0=t=>{const e=it(t.map((t=>1*t.getFinalAttribute().startAngle))),i=et(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},C0=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=x0(i.parent.children),a=k0(r);return b0(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=x0(i.parent.children),a=k0(r);return b0(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),M0=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},T0=(t,e={})=>{if(!t)return[];const i=[];return OZ(t,i,e),i},w0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new dJ(i).layout(t,{width:s,height:n})};class D0 extends cW{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var E0;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(E0||(E0={}));const B0=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(d(n))return t;if(i.type===E0.DrillDown){return J(IN(t,n,s,"children"))}if(i.type===E0.DrillUp){const e=ON(t,n,s,"children");if(e)return J(e)}return t};class P0{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=I$(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;iU(t,"drillFilter",B0),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(d(t.datum)||d(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!b(e)||R(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:E0.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:E0.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!b(r)||R(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:E0.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:E0.DrillUp},model:this}),r}}const R0=Object.assign(Object.assign({},SW),{sunburst:{name:"sunburst",type:"arc"}}),L0=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:fW,operations:["max","min","values"]}),t.push({key:mW,operations:["values"]}),t),I0={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class O0 extends nq{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:mW),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:iN},getRawData:()=>this.getRawData()}),this._startAngle=$e(this._spec.startAngle),this._endAngle=$e(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),iU(this._dataSet,"sunburstLayout",w0),iU(this._dataSet,"flatten",T0),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[g(this._centerX)?this._centerX:this.getLayoutRect().width/2,g(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return L0(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(iU(t.dataSet,"addVChartProperty",sW),t.transform({type:"addVChartProperty",options:{beforeCall:bW.bind(this),call:xW}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(O0.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){d(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(g(this._offsetX)?this._offsetX:0),y:t=>t.y+(g(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(O0.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return f(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(g(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(g(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new D0(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(J(this.__innerRadius))[0],outerRadius:this._computeRadius(J(this.__outerRadius))[0],startAngle:J(this._startAngle)[0],endAngle:J(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(EW(null===(e=wH.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),BW(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(EW(null===(e=wH.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),BW(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return b(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}O0.type=t.SeriesTypeEnum.sunburst,O0.mark=R0,O0.builtInTheme={sunburst:I0},Z(O0,P0);const F0=()=>{wH.registerSeries(O0.type,O0),mq(),UK(),DV(),wH.registerAnimation("sunburst",((t,e)=>({appear:M0(0,e),enter:A0(t),exit:C0(t),disappear:{duration:CV.disappear.duration}})))},z0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new JZ(i).layout(t,{width:s,height:n})};class j0 extends cW{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const H0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},N0=Object.assign(Object.assign({},SW),{circlePacking:{name:"circlePacking",type:"arc"}});class U0 extends VW{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:mW),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:iN},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();d(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),iU(this._dataSet,"circlePackingLayout",z0),iU(this._dataSet,"flatten",T0),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(iU(t.dataSet,"addVChartProperty",sW),t.transform({type:"addVChartProperty",options:{beforeCall:bW.bind(this),call:xW}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(U0.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){d(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(U0.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return L0(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new j0(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(EW(null===(i=wH.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),BW(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(EW(null===(e=wH.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),BW(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}U0.type=t.SeriesTypeEnum.circlePacking,U0.mark=N0,U0.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},Z(U0,P0);const V0=()=>{wH.registerSeries(U0.type,U0),mq(),UK(),wV(),wH.registerAnimation("circlePacking",((t,e)=>({appear:H0(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:CV.disappear.duration}})))},W0=(t,e,i)=>{e.forEach((e=>{d(e[i])||t.add(e[i]),e.children&&e.children.length>0&&W0(t,e.children,i)}))},G0=t=>{var e;if(!t||!b(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},Y0=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new oJ(e),r=[];return r.push(n.layout(s,i)),r},X0=t=>{var e,i;return t&&b(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},$0=t=>{var e,i;return t&&b(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class K0 extends cW{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(A(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const q0=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),Z0=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:q0(t),J0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class Q0 extends cR{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class t1 extends cR{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const e1=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),u=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),u=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=u(t.y0-n/2),l=u(t.y1-n/2)):"end"===t.align?(o=u(t.y0+t.thickness/2-n),l=u(t.y1+t.thickness/2-n)):(o=u(t.y0-t.thickness/2),l=u(t.y1-t.thickness/2));const d=u(o+n),p=u(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${u(l-n/2)}L${u(a+n)},${u((l+p)/2)}L${a},${u(p+n/2)}`:"",m=t.startArrow&&g?`L${r},${u(d+n/2)}L${u(r-n)},${u((o+d)/2)}L${r},${u(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${d}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${d}L${r},${d}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${d},${r},${d}${m}Z`},i1=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),u=t=>t;!1!==t.round&&(u=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=u(t.x0-n/2),l=u(t.x1-n/2)):"end"===t.align?(o=u(t.x0+t.thickness/2-n),l=u(t.x1+t.thickness/2-n)):(o=u(t.x0-t.thickness/2),l=u(t.x1-t.thickness/2));const d=u(o+n),p=u(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${u(l-n/2)},${a}L${u((l+p)/2)},${u(a+n)}L${u(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${u(d+n/2)},${r}L${u((d+o)/2)},${u(r-n)}L${u(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${d},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${d},${h}L${d},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${d},${h},${d},${r}${m}Z`};class s1 extends AK{constructor(){super(...arguments),this.type=s1.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?i1:e1,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}s1.type="linkPath";const n1=Object.assign(Object.assign({},SW),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class r1 extends zW{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const a1=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class o1 extends VW{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.sankey,this.transformerConstructor=r1,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new ss,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(g(a))return a;if(g(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(g(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=A(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=VN(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=VN(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=VN(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),a1(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=VN(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=VN(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=VN(t),u=(null==c?void 0:c.parents)?"parents":"source";if(J(c[u]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=VN(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(J(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;r<n;r++){const n=i[r].key,a=i[r+1]?i[r+1].key:s.key,o=e.value,l=t.find((t=>t.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=VN(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void a1(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void a1(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(VN(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=VN(e),r=[n.source,n.target],a=[];J(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;s<i-1;s++){const i=e[s].key,n=e[s+1].key,r=t.value,o=a.find((t=>t.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=VN(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void a1(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void a1(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void a1(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){iU(this._dataSet,"sankeyLayout",Y0),iU(this._dataSet,"sankeyFormat",G0),a.transform({type:"sankeyFormat"},!1),r.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;iU(o,"sankeyNodes",X0),iU(o,"flatten",T0);const l=new Th(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),l.transform({type:"addVChartProperty",options:{beforeCall:yW.bind(this),call:_W}},!1),this._nodesSeriesData=l,iU(o,"sankeyLinks",$0);const h=new Th(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:yW.bind(this),call:_W}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(o1.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(o1.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=J(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=J(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(d(t)||d(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=tW(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(EW(null===(i=wH.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),BW("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(EW(null===(s=wH.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),BW("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:ZN.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(VN(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new K0(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!d(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new eH;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{g(t[i])&&e.add(t[i]),g(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return W0(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?b(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}o1.type=t.SeriesTypeEnum.sankey,o1.transformerConstructor=r1,o1.mark=n1,o1.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const l1=()=>{s$(),kK(),CE(),wH.registerGraphicComponent("path",(t=>ey(t))),wH.registerMark(s1.type,s1),UK(),wH.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:Z0(t,e)},TV))),wH.registerAnimation("sankeyLinkPath",((t,e)=>({appear:J0(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:CV.disappear.duration}}))),QP.registerBuiltInAnimate("linkPathGrowOut",t1),QP.registerBuiltInAnimate("linkPathGrowIn",Q0),DV(),wH.registerSeries(o1.type,o1)},h1=(t,e)=>{let i={},s=e.fields;if(u(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=T0(n);return i=dW([{latestData:r}],e),i};class c1 extends cW{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const u1=Object.assign(Object.assign({},SW),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),d1=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class p1 extends zW{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const g1=()=>{wH.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)})},f1=()=>{wH.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)})},m1=(t,e)=>{if(e.getViewBox()){const i=new TJ(e).layout(t,e.getViewBox()),s=[];return OZ(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[mW,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class v1 extends VW{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.treemap,this.transformerConstructor=p1,this._categoryField="name",this._valueField="value",this._viewBox=new ss,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:mW),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new as),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:iN},getRawData:()=>this.getRawData()}),C(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),iU(this._dataSet,"treemap",m1),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(iU(this._rawData.dataSet,"addVChartProperty",sW),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:bW.bind(this),call:xW}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=h1([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=N(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){iU(this._dataSet,"hierarchyDimensionStatistics",h1),iU(this._dataSet,"flatten",T0);const i=new Th(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return L0(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(v1.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(v1.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(EW(null===(e=wH.getAnimationInKey("treemap"))||void 0===e?void 0:e(),BW(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new c1(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(XN.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(XN.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}v1.type=t.SeriesTypeEnum.treemap,v1.mark=u1,v1.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},v1.transformerConstructor=p1,Z(v1,P0),Z(v1,F$);const y1=()=>{g1(),f1(),s$(),UK(),wH.registerAnimation("treemap",((t,e)=>({appear:d1(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:CV.disappear.duration}}))),DV(),wH.registerSeries(v1.type,v1)},_1=Object.assign(Object.assign({},oZ),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),b1=Object.assign(Object.assign({},SW),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),x1={type:"fadeIn"};function S1(t,e){return"fadeIn"===e?x1:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class A1 extends zW{constructor(){super(...arguments),this._supportStack=!1}}class k1 extends cW{enableByType(t){return"dimension"!==t}}const C1="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",M1={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:C1,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:C1,fill:"#ddd"}}};class T1 extends lZ{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.gaugePointer,this.transformerConstructor=A1,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(T1.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},T1.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(T1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new k1(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return g(this.radiusAxisHelper)&&g(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=et(e),s=it(e),n=It(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(EW(null===(i=wH.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),BW("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}T1.type=t.SeriesTypeEnum.gaugePointer,T1.mark=b1,T1.builtInTheme={gaugePointer:M1},T1.transformerConstructor=A1;const w1=()=>{wH.registerSeries(T1.type,T1),E$(),s$(),wH.registerAnimation("gaugePointer",((t,e)=>{const i=S1(t,e);return{appear:i,enter:i,disappear:{duration:CV.disappear.duration}}})),zq(),Oq()};class D1 extends zW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class E1 extends lZ{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.gauge,this.transformerConstructor=D1,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=$e(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();iU(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[xN]=t[this._angleField[0]],t[bN]=e>0?i[e-1][xN]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(E1.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(E1.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=Ft(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?rH(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=Ft(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?rH(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return g(t[bN])?this.angleAxisHelper.dataToPosition([t[bN]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[xN]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(EW(null===(i=wH.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),BW("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}E1.type=t.SeriesTypeEnum.gauge,E1.mark=_1,E1.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},E1.transformerConstructor=D1;const B1=()=>{wH.registerSeries(E1.type,E1),mq(),dZ(),Oq()};class P1 extends dV{constructor(){super(...arguments),this.type=P1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Tv(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="rect":a.symbolType=o,a}}P1.type="cell";function R1(t){return!1===t?{}:{type:"fadeIn"}}class L1 extends cW{enableByType(t){return"dimension"!==t}}const I1=Object.assign(Object.assign({},SW),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class O1 extends zW{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class F1 extends VW{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.heatmap,this.transformerConstructor=O1}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=J(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(F1.mark.cell,{isSeriesMark:!0},{morph:LW(this._spec,F1.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(F1.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=Cs(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=UW(this);this._cellMark.setAnimationConfig(EW(null===(i=wH.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),BW("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new L1(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}F1.type=t.SeriesTypeEnum.heatmap,F1.mark=I1,F1.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1}}},F1.transformerConstructor=O1;const z1=()=>{UK(),wH.registerMark(P1.type,P1),wH.registerGraphicComponent("symbol",Tv),FE(),jE(),cF(),wH.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},TV),{appear:R1(e)}))),CY(),xY(),wH.registerSeries(F1.type,F1)},j1=Object.assign(Object.assign({},SW),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),H1=`${ZH}_CORRELATION_X`,N1=`${ZH}_CORRELATION_Y`,U1=`${ZH}_CORRELATION_SIZE`,V1=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!b(t))return t;const y=e.view();if(y.x1-y.x0==0||y.y1-y.y0==0||y.x1-y.x0==-1/0||y.x1-y.x0==1/0||y.y1-y.y0==-1/0||y.y1-y.y0==1/0)return t;const _=$e(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=$e(null!==(s=e.endAngle)&&void 0!==s?s:270),S=Math.max((y.x1-y.x0)/2,(y.y1-y.y0)/2),k=re(null!==(n=e.innerRadius)&&void 0!==n?n:0,S),C=re(e.outerRadius,S),M=[A(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:y.x0+re(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",y.x1-y.x0),A(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:y.y0+re(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",y.y1-y.y0)],T=se(e.field),w=t.map(T),[D,E]=oe(w),B=D===E?t=>(k+C)/2:t=>k+(C-k)*(t-D)/(E-D),P=d(e.radiusField)?T:se(e.radiusField),R=null!==(p=null===(u=null==e?void 0:e.radiusRange)||void 0===u?void 0:u[1])&&void 0!==p?p:5;let L=t=>R;if(P){const[i,s]=P!==T?oe(t.map(P)):[D,E],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(L=t=>n+(r-n)*(P(t)-i)/(s-i))}const I=Math.min(_,x),O=Math.max(_,x),F=W1(I,O,t.length),z=[],j=(O-I)/60;return t.forEach(((t,e)=>{const i=B(w[e]),s=L(t);let n,r,a=F[e];for(let t=0;t<60&&(n=M[0]+i*Math.cos(a),r=M[1]+i*Math.sin(a),G1({x:n,y:r,size:s},z)||n-s<y.x0||n+s>y.x1||r-s<y.y0||r+s>y.y1);t++)t<59&&(a+=j,a>O?a=I:a<I&&(a=O));z.push(Object.assign({[H1]:n,[N1]:r,[U1]:s},t))})),z},W1=(t,e,i)=>{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let u=t;for(;l<i;)h<n&&(c.push(u+(h%2?Math.floor(h/2)+Math.floor(n/2):h/2)*r*o),h++),l++,h===n&&(h=0,a+=1,o*=-1,0===s?s=r/2:s/=2,u=-1===o?e-s:t+s,a>=2&&(r/=2,n*=2));return c},G1=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)<Math.pow(t.size+e.size,2))),Y1=(t,e)=>{if(!t||!b(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[eN]:null==n?void 0:n[eN],[sN]:null==n?void 0:n[sN]}};class X1 extends AK{constructor(){super(...arguments),this.type=X1.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=It(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}X1.type="ripple";const $1=()=>{kK(),jE(),wH.registerMark(X1.type,X1),wH.registerGraphicComponent("symbol",(t=>Tv(t)))},K1=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class q1 extends zW{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class Z1 extends nq{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.correlation,this.transformerConstructor=q1,this._viewBox=new ss}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){g(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){g(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){g(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;iU(this._dataSet,"correlation",V1);const s=new Mh;sU(s,"dataview",ch),iU(s,"correlationCenter",Y1);const n=new Th(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new oV(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const e=this._createMark(Z1.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:eN});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(Z1.mark.ripplePoint,{key:eN,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(Z1.mark.centerPoint,{key:eN,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[H1],y:t=>t[N1],size:t=>t[U1],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(EW(null===(e=wH.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),BW("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}Z1.type=t.SeriesTypeEnum.correlation,Z1.mark=j1,Z1.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},Z1.transformerConstructor=q1;const J1=()=>{fG(),$1(),wH.registerSeries(Z1.type,Z1),wH.registerAnimation("correlation",((t,e)=>Object.assign({appear:K1(0,e)},MV)))},Q1={duration:2e3,loop:!0,channel:{wave:{from:0,to:1}}},t2=t=>({duration:2e3,channel:{wave:{from:0,to:1},height:t.height,dy:t.dy}}),e2=t2;function i2(t,e){switch(e){case"wave":default:return Q1;case"grow":return t2(t);case"waveGrow":return e2(t)}}function s2(t,e){switch(e){case"wave":default:return Q1;case"grow":case"waveGrow":return(t=>({duration:2e3,channel:{dy:t.dy}}))(t)}}const n2=Object.assign(Object.assign({},SW),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class r2 extends AK{constructor(){super(...arguments),this.type=r2.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}r2.type="liquid";const a2=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,u=a-c,d=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${u} ${d}\n A ${r} ${r} 0 1 1 ${u+2*c} ${d}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${u} ${d}\n Z \n `}(0,0,e):t;class o2 extends cW{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class l2 extends jW{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.liquid,this.transformerConstructor=mG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:u,height:d}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=u/2+(r+h-(a+c))/2,g=d/2+(s+o-(n+l))/2;let f=u-(r+a+h+c),m=d-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Lv({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Tv({x:s,y:n,size:r,symbolType:a2(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){g(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=gH(this._spec.outlineMargin),this._paddingSpec=gH(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=we(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(l2.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(l2.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(l2.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(l2.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new o2(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(EW(null===(i=wH.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),BW("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(EW(null===(s=wH.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),BW("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(r<e&&a>i){const e=cB(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}l2.type=t.SeriesTypeEnum.liquid,l2.mark=n2,l2.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},l2.transformerConstructor=mG;const h2=()=>{kK(),pE(),wH.registerMark(r2.type,r2),wH.registerGraphicComponent("area",(t=>ny(t))),fV(),wH.registerAnimation("liquid",((t,e)=>({appear:i2(t,e),enter:i2(t,e),exit:i2(t,e)}))),wH.registerAnimation("liquidGroup",((t,e)=>({appear:s2(t,e),enter:s2(t,e),exit:s2(t,e)}))),wH.registerSeries(l2.type,l2)},c2=t=>J(t).join(",");class u2 extends cW{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>c2(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>c2(null==t?void 0:t[this.series.getDimensionField()[0]])}}const d2=Object.assign(Object.assign({},SW),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}}),p2=t=>{switch(t){case"fadeIn":default:return{type:"fadeIn"};case"growIn":return{type:"growRadiusIn"};case"scaleIn":return{type:"scaleIn"}}},g2=t=>{switch(t){case"fadeIn":default:return{type:"fadeIn"};case"scaleIn":return{type:"scaleIn"}}};class f2 extends cR{onBind(){var t,e;this.fromCircles={},null===(t=HJ(this.target.attribute.arcs))||void 0===t||t.forEach((t=>{this.fromCircles[t.setId]=t})),this.toCircles={},null===(e=HJ(this.target.getFinalAttribute().arcs))||void 0===e||e.forEach((t=>{this.toCircles[t.setId]=t}))}onUpdate(t,e,i){const s=[];Object.keys(this.fromCircles).forEach((t=>{const i=this.fromCircles[t],n=this.toCircles[t];i&&n&&s.push({radius:i.radius+(n.radius-i.radius)*e,x:i.x+(n.x-i.x)*e,y:i.y+(n.y-i.y)*e,setId:t})}));const n=zJ(s);this.target.setAttributes({arcs:n,path:jJ(n)})}}class m2 extends zW{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const v2=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?NJ(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class y2 extends jW{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.venn,this.transformerConstructor=m2,this._viewBox=new ss}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:iN)}initData(){var t;super.initData(),iU(this._dataSet,"venn",v2),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(y2.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(y2.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>c2(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>c2(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new u2(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:c2(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return c2(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[c2(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>J(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(c2(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(EW(null===(e=wH.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),BW(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(EW(null===(e=wH.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),BW(t.name,this._spec,this._markAttributeContext)))}))}}y2.type=t.SeriesTypeEnum.venn,y2.mark=d2,y2.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},y2.transformerConstructor=m2;const _2=()=>{mq(),E$(),wH.registerAnimation("vennCircle",((t,e)=>({appear:p2(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:CV.disappear.duration}}))),wH.registerAnimation("vennOverlap",((t,e)=>({appear:g2(e),update:{custom:f2},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:CV.disappear.duration}}))),DV(),wH.registerGrammarTransform("vennMark",{transform:UJ}),wH.registerSeries(y2.type,y2)};class b2 extends l${constructor(){super(...arguments),this.type=t.SeriesTypeEnum.mosaic,this.transformerConstructor=o$}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(vN),this.setFieldX2(mN)),this.setFieldY(_N),this.setFieldY2(yN)):(t&&(this.setFieldY(vN),this.setFieldY2(mN)),this.setFieldX(_N),this.setFieldX2(yN)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&d(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];d(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}b2.type=t.SeriesTypeEnum.mosaic,b2.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},b2.transformerConstructor=o$;const x2=()=>{s$(),UK(),DV(),xY(),wH.registerSeries(b2.type,b2)};class S2 extends JY{_isValidSeries(e){return e===t.SeriesTypeEnum.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class A2 extends qY{constructor(){super(...arguments),this.transformerConstructor=S2,this.type="map",this.seriesType=t.SeriesTypeEnum.map}}A2.type="map",A2.seriesType=t.SeriesTypeEnum.map,A2.transformerConstructor=S2;const k2=()=>{PX(),V$(),wH.registerChart(A2.type,A2)};class C2 extends JY{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=J(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return g(r)&&n.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),b(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),g(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class M2 extends C2{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),d(l.type)&&(l.type="linear"),d(o.type)&&(o.type="band");const h=wG(l,{min:0,max:1});d(l.min)&&(l.min=h.min),d(l.max)&&(l.max=h.max),s&&Object.assign(l,TH({},s,l)),n&&Object.assign(o,TH({},n,o))}}class T2 extends C2{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class w2 extends C2{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class D2 extends qY{constructor(){super(...arguments),this.transformerConstructor=w2}}D2.transformerConstructor=w2;class E2 extends D2{constructor(){super(...arguments),this.transformerConstructor=w2,this.type="pie",this.seriesType=t.SeriesTypeEnum.pie}}E2.type="pie",E2.seriesType=t.SeriesTypeEnum.pie,E2.transformerConstructor=w2;const B2=()=>{PX(),Sq(),wH.registerChart(E2.type,E2)};class P2 extends T2{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:WG,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:WG,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&d(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=J(t.crosshair||{}).map((t=>TH({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const R2=(t,e)=>{if(!t)return null;const i=sG(t,(t=>"angle"===t.getOrient()),e),s=sG(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&CI(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=Rj({x:1,y:0},u);p=((t,e)=>{const i=2*Math.PI,s=it(e),n=et(e);return t<s?t+=Math.ceil((s-t)/i)*i:t>n&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=Lj(u),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(d(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=eG(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&CI(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=Rj({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=Lj(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=eG(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class L2 extends qY{constructor(){super(...arguments),this.transformerConstructor=P2,this.type="rose",this.seriesType=t.SeriesTypeEnum.rose}_setModelOption(){this._modelOption.getDimensionInfo=R2}}L2.type="rose",L2.seriesType=t.SeriesTypeEnum.rose,L2.transformerConstructor=P2,Z(L2,sX);const I2=()=>{EX(),PX(),oX(),aX(),Hq(),wH.registerChart(L2.type,L2)};class O2 extends T2{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=TH({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=J(t.crosshair||{}).map((t=>TH({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class F2 extends qY{constructor(){super(...arguments),this.transformerConstructor=O2,this.type="radar",this.seriesType=t.SeriesTypeEnum.radar}_setModelOption(){this._modelOption.getDimensionInfo=R2}}F2.type="radar",F2.seriesType=t.SeriesTypeEnum.radar,F2.transformerConstructor=O2,Z(F2,sX);const z2=()=>{EX(),PX(),LX(),oX(),aX(),Kq(),wH.registerChart(F2.type,F2)};class j2 extends JY{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=f(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{L(e,"trimPadding")&&TH(e,BU(this.type,t))})),this._transformAxisSpec(t)}}class H2 extends qY{constructor(){super(...arguments),this.transformerConstructor=j2,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=pX(t,e,i))&&void 0!==s?s:[],...null!==(n=R2(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=fX,this._modelOption.getRectByDimensionData=xX}}H2.type="common",H2.transformerConstructor=j2,Z(H2,sX);const N2=()=>{EX(),PX(),LX(),oX(),wH.registerChart(H2.type,H2),aX()};class U2 extends JY{_getSeriesDataLength(t,e){var i,s;if(e.data){const t=J(e.data)[0];return t instanceof Th?null===(i=t.latestData)||void 0===i?void 0:i.length:null===(s=t.values)||void 0===s?void 0:s.length}const n=J(t.data).find(((t,i)=>e.dataId?t instanceof Th?t.name===e.dataId:t.id===e.dataId:e.dataIndex===i));return n?n instanceof Th?n.latestData.length:n.values.length:0}addAttrToComponentSpec(t,e,i){return Array.isArray(t)?t[0][e]=i:t[e]=i,t}addPaddingRow(t,e,i){t.push({index:e,size:i})}addOrientAxes(t,e,i,s){t.push({id:`regionAxesRow${i}`}),e.push({modelId:`axesRow${i}`,col:1,row:i}),s.axes[0].id=`axesRow${i}`,s.axes[0].regionIndex=Array.from(Array(s.series.length),((t,e)=>"top"===s.axes[0].orient?e+1:e))}transformSpec(e){var i,s,n,r,a,o,l,h,c,u,d,p,g,f,m;super.transformSpec(e);let v=0;const y=[],_=[],b=[],x=[],S=[],A=this._option.getCompiler().getStage(),k=(A.viewWidth,A.viewHeight);let C=0;if(null==e?void 0:e.legends){y.push({modelId:`legendRow${v}`,col:1,row:v}),this.addAttrToComponentSpec(e.legends,"id",`legendRow${v}`);const t=J(e.legends);let l=null!==(i=t[0].height)&&void 0!==i?i:40;if(t[0].padding){const e=gH(t[0].padding);l+=Number(null!==(s=null==e?void 0:e.bottom)&&void 0!==s?s:0),l+=Number(null!==(n=null==e?void 0:e.top)&&void 0!==n?n:0),t[0].offsetY=Number(null!==(a=null===(r=t[0])||void 0===r?void 0:r.offsetY)&&void 0!==a?a:0)+Number(null!==(o=null==e?void 0:e.top)&&void 0!==o?o:0)}S.push({index:v,size:l}),C+=l,v++}(null==e?void 0:e.dataZoom)&&(y.push({modelId:`dataZoomRow${v}`,col:1,row:v}),this.addAttrToComponentSpec(e.dataZoom,"id",`dataZoomRow${v}`),C+=60,v++,this.addPaddingRow(S,v,10),C+=10,v++),C+=60,null!==e.axes&&"top"!==(null===(h=null===(l=null==e?void 0:e.axes)||void 0===l?void 0:l[0])||void 0===h?void 0:h.orient)||(this.addOrientAxes(_,y,v,e),v++);const M=e.series.filter((e=>e.type!==t.SeriesTypeEnum.link)).length,T=(k-C-20*M)/M,w=(null===(c=null==e?void 0:e.appendPadding)||void 0===c?void 0:c.left)||0,D=(null===(u=null==e?void 0:e.appendPadding)||void 0===u?void 0:u.right)||0;null===(d=null==e?void 0:e.series)||void 0===d||d.forEach((i=>{var s,n;if([t.SeriesTypeEnum.bar,t.SeriesTypeEnum.line,t.SeriesTypeEnum.area,t.SeriesTypeEnum.dot].includes(i.type)){if(y.push({modelId:`${i.type}Row${v}`,col:1,row:v}),y.push({modelId:`axesLeftRow${v}`,col:0,row:v}),_.push({id:`${i.type}Row${v}`,clip:!1}),S.push({index:v,size:(null==i?void 0:i.height)||T}),b.push({orient:"left",id:`axesLeftRow${v}`,type:i.type===t.SeriesTypeEnum.dot?"band":"linear",visible:i.type!==t.SeriesTypeEnum.dot,title:{visible:!0,autoRotate:!1,style:{text:null==i?void 0:i.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof(null===(s=null==i?void 0:i.grid)||void 0===s?void 0:s.visible)||(null===(n=null==i?void 0:i.grid)||void 0===n?void 0:n.visible),style:(t,e)=>{var s,n,r,a,o;let l=0;if(0===e){const t=null===(s=null==i?void 0:i.grid)||void 0===s?void 0:s.style;l=null!==(r=null!==(n=null==t?void 0:t.lineWidth)&&void 0!==n?n:null==t?void 0:t.strokeWidth)&&void 0!==r?r:1}return{lineWidth:l,stroke:(null===(o=null===(a=null==i?void 0:i.grid)||void 0===a?void 0:a.style)||void 0===o?void 0:o.stroke)||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:_.length-1}),i.type===t.SeriesTypeEnum.dot){y.push({modelId:`scrollBarRightRow${v}`,col:2,row:v});const s=this._getSeriesDataLength(e,i);let n=0;s&&(n=((null==i?void 0:i.height)||T)/(30*s)),x.push(Object.assign({orient:"right",visible:i.type===t.SeriesTypeEnum.dot&&n<1,id:`scrollBarRightRow${v}`,start:0,end:Math.min(n,1),filterMode:"axis",regionIndex:_.length-1,axisId:`axesLeftRow${v}`},J(null==e?void 0:e.scrollBar)[0]))}i.regionIndex=_.length-1,v++,this.addPaddingRow(S,v,(null==i?void 0:i.padding)||20),v++,i.leftAppendPadding=w,i.type===t.SeriesTypeEnum.dot&&(i.title.style.dx=-w,i.subTitle.style.dx=-w)}})),this.addPaddingRow(S,v,20),v++,null===(p=null==e?void 0:e.series)||void 0===p||p.forEach((i=>{if(i.type===t.SeriesTypeEnum.link){const t=i.dotSeriesIndex+1;y.push({modelId:`${i.type}Row${t}`,col:1,row:t-1}),i.regionIndex=e.series[i.dotSeriesIndex].regionIndex,i.leftAppendPadding=w,i.height=e.series[i.dotSeriesIndex].height,i.clipHeight=e.series[i.dotSeriesIndex].clipHeight}})),(null==e?void 0:e.legends)&&this.addAttrToComponentSpec(e.legends,"regionIndex",[_.length-1]),"bottom"===(null===(f=null===(g=null==e?void 0:e.axes)||void 0===g?void 0:g[0])||void 0===f?void 0:f.orient)&&(this.addOrientAxes(_,y,v,e),v++);const E={type:"grid",col:4,row:v,colWidth:[{index:0,size:w},{index:2,size:12},{index:3,size:D}],rowHeight:S,elements:y};e.layout=E,e.region=_,null===(m=e.axes)||void 0===m||m.push(...b),e.scrollBar=x}}class V2 extends qY{constructor(){super(...arguments),this.transformerConstructor=U2,this.type="sequence"}_createSeries(i,s){if(!i)return;const{spec:n}=s,r=e(s,["spec"]);let a;if(n.type===t.SeriesTypeEnum.link&&(n.dotSeriesSpec=this._spec.series[n.dotSeriesIndex]),n.regionId&&(a=this.getRegionsInUserId(n.regionId)),a||(a=this.getRegionsInIndex(n.regionIndex?[n.regionIndex]:void 0)[0]),!a)return;const o=new i(n,Object.assign(Object.assign(Object.assign({},this._modelOption),r),{region:a,specKey:"series",globalScale:this._globalScale}));o&&(o.created(),this._series.push(o),a.addSeries(o))}}V2.type="sequence",V2.transformerConstructor=U2;const W2=()=>{EX(),PX(),eZ(),aZ(),CY(),xY(),wH.registerChart(V2.type,V2)};class G2 extends QY{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class Y2 extends qY{constructor(){super(...arguments),this.transformerConstructor=G2}}Y2.transformerConstructor=G2,Z(Y2,sX);class X2 extends G2{transformSpec(t){super.transformSpec(t),wU(t)}}class $2 extends Y2{constructor(){super(...arguments),this.transformerConstructor=X2,this.type="histogram",this.seriesType=t.SeriesTypeEnum.bar}_setModelOption(){this._modelOption.getDimensionInfo=pX,this._modelOption.getDimensionInfoByValue=fX,this._modelOption.getRectByDimensionData=xX}}$2.type="histogram",$2.seriesType=t.SeriesTypeEnum.bar,$2.transformerConstructor=X2;const K2=()=>{EX(),PX(),LX(),oX(),aX(),h$(),wH.registerTransform("bin",Pl),wH.registerChart($2.type,$2)};class q2 extends M2{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class Z2 extends qY{constructor(){super(...arguments),this.transformerConstructor=q2,this.type="circularProgress",this.seriesType=t.SeriesTypeEnum.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=R2}}Z2.type="circularProgress",Z2.seriesType=t.SeriesTypeEnum.circularProgress,Z2.transformerConstructor=q2,Z(Z2,sX);const J2=()=>{EX(),PX(),oX(),aX(),fZ(),wH.registerChart(Z2.type,Z2)};class Q2 extends M2{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(e){const i=super._getDefaultSeriesSpec(e);return i.type=t.SeriesTypeEnum.circularProgress,i}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((e=>e.type===t.SeriesTypeEnum.gauge||e.type===t.SeriesTypeEnum.circularProgress));d(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(d(o.radiusField)&&d(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),d(o.valueField)&&d(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===t.SeriesTypeEnum.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),d(s.angle.type)&&(s.angle.type="linear"),d(s.radius.type)&&(s.radius.type="linear"),d(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class t3 extends qY{constructor(){super(...arguments),this.transformerConstructor=Q2,this.type="gauge",this.seriesType=t.SeriesTypeEnum.gaugePointer}}t3.type="gauge",t3.seriesType=t.SeriesTypeEnum.gaugePointer,t3.transformerConstructor=Q2;const e3=()=>{PX(),w1(),B1(),fZ(),wH.registerChart(t3.type,t3)};class i3 extends JY{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class s3 extends qY{constructor(){super(...arguments),this.transformerConstructor=i3,this.type="wordCloud",this.seriesType=t.SeriesTypeEnum.wordCloud}}s3.transformerConstructor=i3;class n3 extends s3{constructor(){super(...arguments),this.transformerConstructor=i3,this.type="wordCloud",this.seriesType=t.SeriesTypeEnum.wordCloud}}n3.type="wordCloud",n3.seriesType=t.SeriesTypeEnum.wordCloud,n3.transformerConstructor=i3;const r3=()=>{PX(),QQ(),wH.registerChart(n3.type,n3)},a3=()=>{wH.registerGrammarTransform("wordcloudShape",{transform:NQ}),QQ(),r3()};class o3 extends JY{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class l3 extends qY{constructor(){super(...arguments),this.transformerConstructor=o3,this.type="funnel",this.seriesType=t.SeriesTypeEnum.funnel}}l3.type="funnel",l3.seriesType=t.SeriesTypeEnum.funnel,l3.transformerConstructor=o3;const h3=()=>{PX(),_0(),wH.registerChart(l3.type,l3)};class c3 extends QY{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="band"),d(i.type)&&(i.type="linear");const n=wG(i,{min:0,max:1});d(i.min)&&(i.min=n.min),d(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="linear"),d(e.type)&&(e.type="band");const n=wG(s,{min:0,max:1});d(s.min)&&(s.min=n.min),d(s.max)&&(s.max=n.max)}}}class u3 extends qY{constructor(){super(...arguments),this.transformerConstructor=c3,this.type="linearProgress",this.seriesType=t.SeriesTypeEnum.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=pX,this._modelOption.getDimensionInfoByValue=fX,this._modelOption.getRectByDimensionData=xX}}u3.type="linearProgress",u3.seriesType=t.SeriesTypeEnum.linearProgress,u3.transformerConstructor=c3,Z(u3,sX);const d3=()=>{EX(),PX(),oX(),aX(),SZ(),wH.registerChart(u3.type,u3)};class p3 extends QY{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),wU(t)}}class g3 extends qY{constructor(){super(...arguments),this.transformerConstructor=p3,this.type="rangeColumn",this.seriesType=t.SeriesTypeEnum.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=pX,this._modelOption.getDimensionInfoByValue=fX,this._modelOption.getRectByDimensionData=xX}}g3.type="rangeColumn",g3.seriesType=t.SeriesTypeEnum.rangeColumn,g3.transformerConstructor=p3;const f3=()=>{EX(),PX(),oX(),aX(),ZK(),wH.registerChart(g3.type,g3)};class m3 extends JY{_getDefaultSeriesSpec(t){const e=g(t.startAngle)?t.startAngle:-90,i=g(t.endAngle)?t.endAngle:e+Ke(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class v3 extends qY{constructor(){super(...arguments),this.transformerConstructor=m3,this.type="sunburst",this.seriesType=t.SeriesTypeEnum.sunburst}}v3.type="sunburst",v3.seriesType=t.SeriesTypeEnum.sunburst,v3.transformerConstructor=m3;const y3=()=>{PX(),F0(),wH.registerChart(v3.type,v3)};class _3 extends JY{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class b3 extends qY{constructor(){super(...arguments),this.transformerConstructor=_3,this.type="circlePacking",this.seriesType=t.SeriesTypeEnum.circlePacking}}b3.type="circlePacking",b3.seriesType=t.SeriesTypeEnum.circlePacking,b3.transformerConstructor=_3;const x3=()=>{PX(),V0(),wH.registerChart(b3.type,b3)};class S3 extends JY{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class A3 extends qY{constructor(){super(...arguments),this.transformerConstructor=S3,this.type="treemap",this.seriesType=t.SeriesTypeEnum.treemap}}A3.type="treemap",A3.seriesType=t.SeriesTypeEnum.treemap,A3.transformerConstructor=S3;const k3=()=>{PX(),y1(),wH.registerChart(A3.type,A3)};class C3 extends c${transformSpec(t){super.transformSpec(t),t.legends&&J(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),wU(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class M3 extends u${constructor(){super(...arguments),this.transformerConstructor=C3,this.type="waterfall",this.seriesType=t.SeriesTypeEnum.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=pX,this._modelOption.getDimensionInfoByValue=fX,this._modelOption.getRectByDimensionData=xX}}M3.type="waterfall",M3.seriesType=t.SeriesTypeEnum.waterfall,M3.transformerConstructor=C3;const T3=()=>{EX(),PX(),LX(),oX(),aX(),yK(),wH.registerChart(M3.type,M3)};class w3 extends QY{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),wU(t)}}class D3 extends qY{constructor(){super(...arguments),this.transformerConstructor=w3,this.type="boxPlot",this.seriesType=t.SeriesTypeEnum.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=pX,this._modelOption.getDimensionInfoByValue=fX,this._modelOption.getRectByDimensionData=xX}}D3.type="boxPlot",D3.seriesType=t.SeriesTypeEnum.boxPlot,D3.transformerConstructor=w3;const E3=()=>{EX(),PX(),oX(),aX(),HK(),wH.registerTransform("boxplot",Rl),wH.registerChart(D3.type,D3)};class B3 extends JY{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class P3 extends qY{constructor(){super(...arguments),this.transformerConstructor=B3,this.type="sankey",this.seriesType=t.SeriesTypeEnum.sankey}_setStateInDatum(t,e,i,s){const n=b(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=VN(t))||void 0===e?void 0:e.datum;return b(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}P3.type="sankey",P3.seriesType=t.SeriesTypeEnum.sankey,P3.transformerConstructor=B3;const R3=()=>{PX(),mc.load(sB),l1(),wH.registerChart(P3.type,P3)};class L3 extends QY{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),wU(t)}}class I3 extends qY{constructor(){super(...arguments),this.transformerConstructor=L3,this.type="rangeArea",this.seriesType=t.SeriesTypeEnum.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=pX,this._modelOption.getDimensionInfoByValue=fX,this._modelOption.getRectByDimensionData=xX}}I3.type="rangeArea",I3.seriesType=t.SeriesTypeEnum.rangeArea,I3.transformerConstructor=L3;const O3=()=>{EX(),PX(),LX(),oX(),aX(),sq(),wH.registerChart(I3.type,I3)};class F3 extends QY{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class z3 extends qY{constructor(){super(...arguments),this.transformerConstructor=F3,this.type="heatmap",this.seriesType=t.SeriesTypeEnum.heatmap}}z3.type="heatmap",z3.seriesType=t.SeriesTypeEnum.heatmap,z3.transformerConstructor=F3;const j3=()=>{PX(),z1(),wH.registerChart(z3.type,z3)};class H3 extends JY{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class N3 extends qY{constructor(){super(...arguments),this.transformerConstructor=H3,this.type="correlation",this.seriesType=t.SeriesTypeEnum.correlation}}N3.type="correlation",N3.seriesType=t.SeriesTypeEnum.correlation,N3.transformerConstructor=H3;const U3=()=>{PX(),J1(),wH.registerChart(N3.type,N3)};function V3(t){var e,i;const s=Object.assign({},t);return R(t.style)||(s.textStyle=NN(t.style)),R(t.textStyle)||TH(s.textStyle,NN(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&NN(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&NN(s.background.style),s}const W3=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},G3=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),u=l();if(0===c.length&&u.length)return[];if(c.length===u.length)return t;const d={};c.forEach((t=>{d[t]=!0}));const p=null!==(i=o())&&void 0!==i?i:sN;return h?h(t,c,p):(b(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):g(p)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,p)]))),t)};class Y3 extends qG{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{Oj(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Oj(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=lH(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;g(s)&&(this._seriesUserId=J(s)),g(e)&&(this._regionUserId=J(e)),g(n)&&(this._seriesIndex=J(n)),g(i)&&(this._regionUserIndex=J(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(Y(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new oV(this._option,e),this._initSelectedData(),Oj(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;d(e)||JSON.stringify(r)===JSON.stringify(e)||(Oj(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;C(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)Y(s,this._cacheAttrs)||this._legendComponent.setAttributes(TH({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(TH({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());Y(t,this._cacheAttrs)||this._legendComponent.setAttributes(TH({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}Y3.specKey="legends";class X3 extends Y3{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return eW(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),Oj(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){iU(this._option.dataSet,"discreteLegendFilter",G3),iU(this._option.dataSet,"discreteLegendDataMake",W3);const t=new Th(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return Oj(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(d(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!DA(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return u(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=MN(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const s=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=t;n=F(n),r=F(r),a=F(a),o=F(o);const l=s;return n.visible?l.title=V3(n):l.title={visible:!1},R(r.focusIconStyle)||NN(r.focusIconStyle),r.shape&&(r.shape=zN(r.shape)),r.label&&(r.label=zN(r.label)),r.value&&(r.value=zN(r.value)),r.background&&(r.background=zN(r.background)),hH(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),hH(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),hH(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(R(a.railStyle)||NN(a.railStyle),R(a.sliderStyle)||NN(a.sliderStyle)):(R(a.textStyle)||NN(a.textStyle),a.handler&&zN(a.handler)),l.pager=a,o.visible&&!R(o.style)&&(TH(l,o.style),g(o.padding)&&(l.padding=o.padding)),l}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return Wz}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(Fz.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(Fz.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(Fz.legendItemUnHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:C(s)?s:1,strokeOpacity:C(n)?n:1,opacity:C(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return u(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=tW(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=tW(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}X3.specKey="legends",X3.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},X3.type=r.discreteLegend;const $3=()=>{wH.registerComponent(X3.type,X3)},K3=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;C(n)&&(t=Math.min(n,t)),C(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},q3=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!f(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!R(o)){const[e,i]=o;return a?a(t,o,l):h(t)?FN(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const Z3={color:Kz,size:Zz},J3={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},Q3=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},J3),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},t5={horizontal:Q3(!0),vertical:Q3(!1)},e5=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},J3),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},i5={horizontal:e5(!0),vertical:e5(!1)},s5=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],n5=[2,10];class r5 extends Y3{static getSpecInfo(t){const e=eW(t,this.specKey,this.type,(t=>function(t){return"color"===t||"size"===t}(t.type)));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),Oj(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){iU(this._option.dataSet,"continuousLegendFilter",q3),iU(this._option.dataSet,"continuousLegendDataMake",K3);const t=new Th(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>Fj(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=MN(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!DA(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=MN(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),R(a)&&(a="color"===this._legendType?s5:n5);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=TH({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:d,id:p,visible:f,orient:m,position:v,data:y,defaultSelected:_,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:C,padding:M}=i,T=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?T.title=V3(s):T.title={visible:!1},T.showHandler=!1!==n.visible,R(n.style)||(T.handlerStyle=NN(n.style)),g(r.width)&&(T.railWidth=r.width),g(r.height)&&(T.railHeight=r.height),R(r.style)||(T.railStyle=NN(r.style)),R(a.style)||(T.trackStyle=NN(a.style)),T.startText=zN(o),T.endText=zN(l),T.handlerText=zN(h),R(c)||(T.sizeBackground=NN(c)),u.visible&&!R(u.style)&&(TH(T,u.style),g(u.padding)&&(T.padding=u.padding)),T}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return Z3[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",jt((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}r5.specKey="legends",r5.builtInTheme={colorLegend:t5,sizeLegend:i5},r5.type=r.continuousLegend;const a5=()=>{wH.registerComponent(r5.type,r5)},o5=(t,e)=>g(e)?t.map((t=>e[t])):void 0,l5=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),h5=t=>!d(t)&&(b(t)?t.length>0&&t.every(g):Object.keys(t).length>0);function c5(t,e,i){var s,n,r,a,o,l;const h=Object.assign({regionIndex:0},e),c=i.getOption(),u=c.getRegionsInUserIdOrIndex(g(h.regionId)?[h.regionId]:void 0,g(h.regionIndex)?[h.regionIndex]:void 0)[0];if(!u)return"none";const p=u5(t,u),f=null!==(s=h.activeType)&&void 0!==s?s:p.length>1?"dimension":"mark",m=u.getLayoutStartPoint(),v=u.getLayoutRect(),y=c.globalInstance.getContainer(),_=Object.assign({x:0,y:0},y?Rn(y):{}),b=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>l5(i,s)(t)&&l5(n,r)(t)&&(d(a)||l5([a],[o])(t))));return l},x=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),v.width),y:Math.min(Math.max(t.y,0),v.height)}))(t),n=null!==(e=h.x)&&void 0!==e?e:m.x+s.x,r=null!==(i=h.y)&&void 0!==i?i:m.y+s.y;return{canvasX:n,canvasY:r,clientX:_.x+n,clientY:_.y+r}};if("dimension"===f){const e=p[0];if(!e)return"none";const s=new Map;p.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const l=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>b(t))))&&void 0!==i?i:[]}}))}];g(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=c.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:qN.chart,event:x({x:p.reduce(((t,e)=>t+e.pos.x),0)/p.length,y:p.reduce(((t,e)=>t+e.pos.y),0)/p.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const u=c.globalInstance;return KV.globalConfig.uniqueTooltip&&KV.hideTooltip(u.id),f}if("mark"===f){const e=p[0];if(!e)return"none";const s=Object.assign(Object.assign({},b(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(l=c.globalInstance.getChart())&&void 0!==l?l:void 0,datum:s,model:e.series,source:qN.chart,event:x(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=c.globalInstance;return KV.globalConfig.uniqueTooltip&&KV.hideTooltip(a.id),f}return"none"}const u5=(e,i)=>{const s=i.getSeries(),n=[];return s.forEach((i=>{var s,r,a,o,l,h,c;const u=i.getDimensionField(),p=i.getMeasureField(),f=i.getSeriesField(),m=g(f)?e[f]:void 0,v=g(f)&&null!==(o=null===(a=null===(r=null===(s=i.getViewDataStatistics)||void 0===s?void 0:s.call(i))||void 0===r?void 0:r.latestData[f])||void 0===a?void 0:a.values)&&void 0!==o?o:[],y=o5(u,e);let _=o5(p,e);const b=h5(_),x=!b&&g(f)&&d(m)&&v.length>0,S=()=>{var e;const s=null===(e=i.getViewData())||void 0===e?void 0:e.latestData.find(l5(u,y));if(!b&&(_=o5(p,s),!h5(_)))return;const r=i.type===t.SeriesTypeEnum.pie?i.dataToCentralPosition(s):i.dataToPosition(s);d(r)||isNaN(r.x)||isNaN(r.y)||n.push({pos:r,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:m},series:i})};if("cartesian"===i.coordinate){const t=i,e=CI(null===(h=null===(l=i.getYAxisHelper())||void 0===l?void 0:l.getScale(0))||void 0===h?void 0:h.type)?"y":"x",s=u.map(((t,e)=>[t,e])).filter((([,t])=>d(null==y?void 0:y[t])));let r=[null!=y?y:[]];s.length>0&&s.forEach((([t,e])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=i.getViewDataStatistics)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((i=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[e]=i,h.push(n)}))})),r=h})),r.forEach((s=>{var r,a;if(x){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(l5(u,s));v.forEach((r=>{const o=a.find((t=>t[f]===r));if(_=o5(p,o),!h5(_))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||n.push({pos:l,data:{dimensionFields:u,dimensionData:s,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:r},series:i,dimType:e})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(l5(u,s));if(!b&&(_=o5(p,r),!h5(_)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;n.push({pos:o,data:{dimensionFields:u,dimensionData:s,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:m},dimType:e,series:i})}}))}else if("polar"===i.coordinate)if(i.type===t.SeriesTypeEnum.pie)S();else{const t=i;if(x){const e=(null===(c=t.getViewData())||void 0===c?void 0:c.latestData.filter(l5(u,y))).find((t=>t[f]===m));v.forEach((s=>{if(_=o5(p,e),!h5(_))return;const r=t.dataToPosition(e);d(r)||isNaN(r.x)||isNaN(r.y)||n.push({pos:r,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:s},series:i})}))}else S()}else"geo"===i.coordinate&&S()})),n},d5=t=>g(t)&&!b(t),p5=t=>g(t)&&b(t);class g5 extends KG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=TH({},this._theme,r.style),r.offset=TH({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return g(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:CA(this._option.mode)||!AA(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,g(t.parentElement)?_(t.parentElement)&&(t.parentElement=Px.getElementById(t.parentElement)):AA(this._option.mode)&&(t.parentElement=null==SA?void 0:SA.body)}}const f5={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class m5 extends qG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=g5,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=AA(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||f(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s<n;s++){const n=a[s],o=!!this.processor[n]&&this._showTooltipByMouseEvent(n,i,t,e);if("unShowByOption"===o)r[n]="unShowByOption";else if(o){r[n]=!0;break}}Object.values(r).every((t=>!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&d5(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):g(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!d(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&KV.globalConfig.uniqueTooltip&&l&&KV.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:qN.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:qN.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?CX.canvas:CX.dom,n=wH.getComponentPluginInType(t);n||_A("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=wH.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=J(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=J(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(kA(s)||CA(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):f(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>f(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=A(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,Ht(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(f(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=(i=this.tooltipHandler).reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=c5(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(d(this._cacheInfo)||d(t))return!1;if(p5(t)){if(d5(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>QW(t,e[i])))}if(p5(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}m5.type=r.tooltip,m5.transformerConstructor=g5,m5.builtInTheme={tooltip:f5},m5.specKey="tooltip";const v5=()=>{wH.registerComponent(m5.type,m5)};var y5,_5;t.TooltipResult=void 0,(y5=t.TooltipResult||(t.TooltipResult={}))[y5.success=0]="success",y5[y5.failed=1]="failed",function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(_5||(_5={}));const b5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class x5 extends qG{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),A(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=Ht((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(f(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{CI(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||Y(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:ZN.chart}:{source:qN.chart};b(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;b(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:kA(e)||CA(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=J(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:qN.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:qN.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:qN.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{b5[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:u}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const d=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+d.left),o=Math.min(o,i-u+d.top),l=Math.max(l,e+t.getLayoutRect().width-c-d.right),h=Math.max(h,i+t.getLayoutRect().height-u-d.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||A(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:u,fillOpacity:d,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?u:d;if(A(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:u}=n,d=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},u)},d):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2<a||r.y1>o||r.y2<o)&&t.delete(n.getSpecIndex()),n.type.startsWith("polarAxis")){const s=n.getCenter(),r=n.getInnerRadius(),a=n.getOuterRadius(),o=Ye.distancePP({x:e,y:i},s);(o>a||o<r)&&t.delete(n.getSpecIndex())}})),t}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new DB(e),null==s||s.add(t),i(t)),function(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:u=0}=t.attribute;let d=0,p=0;a<i&&(d=i-a),o<s&&(p=s-o),l>n&&(d=n-l),h>r&&(p=r-h),d&&t.setAttribute("dx",d+c),p&&t.setAttribute("dy",p+u)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}x5.specKey="crosshair";const S5={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class A5 extends x5{static getSpecInfo(t){return eW(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=WW(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){WW(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(g(t.dimType)?"y"===t.dimType:GW(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=zj(this._regions,"cartesian");e&&(mX(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=_X(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,u,d;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(u=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==u?u:0,textStyle:Object.assign(Object.assign({},null===(d=i.label)||void 0===d?void 0:d.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new $B(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new KB(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}A5.specKey="crosshair",A5.builtInTheme={crosshair:S5},A5.type=r.cartesianCrosshair;const k5=()=>{wH.registerComponent(A5.type,A5)};class C5 extends x5{static getSpecInfo(t){return eW(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=zj(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&g(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=TG(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=tW(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:u,coord:d,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),u={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:u,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ti(u,a.getInnerRadius(),o),end:ti(u,a.getOuterRadius(),o)};const d=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ii(t,e),s=(p-d)/g,n=Math.floor((i-d)/s),r=n*s+d,h=Math.min((n+1)*s+d,p),c=ti(t,o,r),u=ti(t,o,h),m=hi([u.x,u.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=It(Ye.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:u,startAngle:d,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new $B(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new ZB(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new JB(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new qB(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=u.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=si(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(d):function(t){let e="center",i="middle";return e=(t=si(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ti(e,p[1]+m.offset,d):ti(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}C5.specKey="crosshair",C5.builtInTheme={crosshair:S5},C5.type=r.polarCrosshair;const M5=()=>{wH.registerComponent(C5.type,C5)},T5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(d(o)||d(a))return t;const l=r(),h=b(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},w5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(d(a)||d(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return J(r).every((i=>{t[i]>=a[0]&&t[i]<=Q(a)&&(e=!0)})),e}:t=>{let e=!1;return J(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},D5=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],u=[],p=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(d(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);g(null==t?void 0:t.max)&&g(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{d(h[t])&&(p.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{J(i[e]).forEach((i=>{d(t[i])||(d(h[t[i]])&&(p.push(t[i]),h[t[i]]=0,c.push(t[i])),d(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?p:!1===r||m?p.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),u.push(e)})),u},E5=(t,e,i)=>{const s=e.domain();if(AI(e.type))return i?s[0]+(Q(s)-s[0])*(1-t):s[0]+(Q(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(Q(n)-n[0])*t;return e.invert(r)},B5=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&AI(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(Q(n)-n[0])))},P5=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},R5=t=>{const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}},L5=(t,e,i)=>"start"===t?"percent"===e&&g(i.start)||"value"===e&&g(i.startValue):"percent"===e&&g(i.end)||"value"===e&&g(i.endValue),I5=(t,e,i)=>{if(AI(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class O5{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:g(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),u=Math.abs(this.getState().start-this.getState().end),d=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(u>=1&&n<1)return;if(u<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=u*(n-1)*d;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=It(this.getState().start+f,0,1),y=It(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ce(s/n)>=.5:Ce(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===$W(XW(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=N({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=N({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=N({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}Z(O5,F$);class F5 extends qG{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:B5(t,this._stateScale,this._isHorizontal),a="percent"===n?e:B5(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-t<this._minSpan||e-t>this._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=P5(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=I5(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&R5(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else Oj(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Oj(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=XW(t),this._isHorizontal="horizontal"===$W(this._orient),this._dataFilterEvent=new O5(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||Y(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(AI(n.type)){const r=n.domain(),a=r[0],o=Q(r)-a,l=g(t)?a+o*t:+e,h=g(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=g(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=g(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(g(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):g(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),d(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>$W(t._orient)===$W(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!AI(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(g(i)&&(g(i.userId)&&(this._seriesUserId=J(i.userId)),g(i.specIndex)&&(this._seriesIndex=J(i.specIndex))),g(this._spec.seriesId)){const t=J(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(g(this._spec.seriesIndex)){const t=J(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(g(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(J(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(g(this._spec.regionId)){const t=J(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_initData(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};Oj(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,u=c===l?h:l,d=AI(u.getScale(0).type),p=AI(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?J(g.xField):J(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?J(g.yField):J(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:u===l?f:m;d&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else Oj(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:r}=this._option;sU(r,"dataview",ch),iU(r,"dataFilterComputeDomain",D5);const a=new Th(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new oV(this._option,a),a.reRunAllTransform(),r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(iU(this._option.dataSet,"dataFilterWithNewDomain",w5),iU(this._option.dataSet,"lockStatisticsFilter",T5),Oj(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>AI(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>AI(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(AI(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!Y(this._domainCache,e)&&(this._domainCache=e,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;L5("start",i,this._spec)&&L5("end",s,this._spec)&&(t="percent"===i?this._spec.start:B5(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:B5(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?B5(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?B5(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=E5(this._start,this._stateScale,P5(i,this._isHorizontal)),this._endValue=E5(this._end,this._stateScale,P5(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,AI(this._stateScale.type)&&this._stateScale.domain()[0]!==Q(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(Q(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(Q(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=I5(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&Oj(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);C(null==i?void 0:i.min)&&C(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new fO:new $I,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[it(t),et(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),u=R5(h);if(!this._dataUpdating&&CI(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==u?void 0:u.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==u?void 0:u.bandSize,CI(c.type)){u&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!d(t)||!d(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}Z(F5,F$);class z5 extends KG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=TH({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=b(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const j5=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),H5={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:j5(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:j5(!0)};class N5 extends F5{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=z5,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=E5(e,this._stateScale,P5(s,this._isHorizontal)),a=E5(i,this._stateScale,P5(s,this._isHorizontal));if(!g(r)||!g(a))return;this._start=e,this._end=i;(u(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new fO),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(P5(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=P5(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,u=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+u,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+u),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),d(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),d(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const u=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=u?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new fO;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(P5(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[it(e),et(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!AI(t.type)||e[0]!==Q(e))&&(!CI(t.type)||1!==nt(e).length)}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:A(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:A(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:g(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:P5(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=this._isHorizontal?this._stateScale:this._valueScale,i=this._isHorizontal?this._valueScale:this._stateScale,s=this._isScaleValid(e)&&this._isScaleValid(i)&&!1!==this._spec.showBackgroundChart,n=this._getAttrs(s),r=this._relatedAxisComponent;if(this._component)this._component.setAttributes(n),t&&(this._component.setPreviewData(this._data.getDataView().latestData),s&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>E5(t,this._stateScale,P5(r,this._isHorizontal))))));else{const t=this.getContainer();this._component=new zF(n),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?s&&this._component.setPreviewPointsY1(this._dataToPositionY2):s&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>E5(t,this._stateScale,P5(r,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,u;const{middleHandler:d={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:NN(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:NN(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:d.visible?{visible:!0,icon:NN(null===(s=d.icon)||void 0===s?void 0:s.style),background:{size:null===(n=d.background)||void 0===n?void 0:n.size,style:NN(null===(r=d.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:NN(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:NN(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:NN(g.style)},selectedBackgroundStyle:NN(this._spec.selectedBackground.style),dragMaskStyle:NN(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:TH(NN(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},NN(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:TH(NN(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},NN(null===(u=m.area)||void 0===u?void 0:u.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=tW(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(P5(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}N5.type=r.dataZoom,N5.transformerConstructor=z5,N5.builtInTheme={dataZoom:H5},N5.specKey="dataZoom";const U5=()=>{wH.registerComponent(N5.type,N5)},V5={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class W5 extends F5{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=Tj(this._start,e)&&Tj(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=E5(e,this._stateScale,!1),r=E5(i,this._stateScale,!1);(u(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(n,r))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:A(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:A(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:g(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new QE(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return d(i)||(s.padding=i),R(null==t?void 0:t.style)||(s.railStyle=NN(t.style)),R(null==e?void 0:e.style)||(s.sliderStyle=NN(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}W5.type=r.scrollBar,W5.builtInTheme={scrollBar:V5},W5.specKey="scrollBar";const G5=()=>{wH.registerComponent(W5.type,W5)},Y5=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),J(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},X5=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),$5={title:{visible:!0,autoLimit:!1,autoFit:!1,style:X5("l1FontSize","primaryFontColor")},content:{visible:!0,style:X5("l2FontSize","tertiaryFontColor")}};class K5 extends qG{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return eW(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=J(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(J(this._spec.regionId),J(this._spec.regionIndex))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(VN(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(VN(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){iU(this._option.dataSet,"indicatorFilter",Y5);const t=new Th(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new oV(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:u}=a,d=e(a,["content","offsetX","offsetY","limitRatio","title"]),p=[];return J(o).forEach((t=>{const e=TH({},this._theme.content,t);p.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},HN(V(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?mH(l,this._computeLayoutRadius()):0,dy:h?mH(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==u.visible&&(!g(u.field)||null!==this._activeDatum),space:u.space||this._gap,autoLimit:u.autoLimit,autoFit:u.autoFit,fitPercent:u.fitPercent,fitStrategy:u.fitStrategy,style:Object.assign(Object.assign({},HN(V(u.style,["text"]),this._activeDatum)),{text:this._createText(u.field,u.style.text)})},content:p},d)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)Y(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new tj(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":u(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}K5.type=r.indicator,K5.builtInTheme={indicator:$5},K5.specKey="indicator";const q5=()=>{wH.registerComponent(K5.type,K5)},Z5=["sum","average","min","max","variance","standardDeviation","median"];function J5(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=it(s),r=et(s);return e<n||e>r}function Q5(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return A(t.x)&&J5(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=hH(t.x)?s4(t.x,n)+r.x:n4(l.getXAxisHelper(),[t.x])+r.x,h}function t4(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return A(t.y)&&J5(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=hH(t.y)?s4(t.y,n)+r.y:n4(l.getYAxisHelper(),[t.y])+r.y,h}function e4(t,e,i,s){var n,r;const{relativeSeries:a}=s;return A(t.angle)&&J5(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),n4(a.angleAxisHelper,[t.angle])}function i4(t,e,i,s){var n,r;const{relativeSeries:a}=s;return A(t.radius)&&J5(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),n4(a.radiusAxisHelper,[t.radius])}function s4(t,e){return Number(t.substring(0,t.length-1))*e/100}function n4(t,e){const i=t.getScale(0);return AI(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function r4(t){return Z5.includes(t)}function a4(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),u=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},p=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),y=m.getScale(0).domain(),_=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=g(t.x),i=g(t.y);let s,r;if(e&&i)s=Q5(t,y,n,d,c,o),r=t4(t,_,n,d,u,o),o4(s,b,S,p.length),o4(r,x,A,p.length),p.push([{x:s,y:r}]);else if(e){s=Q5(t,y,n,d,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);o4(s,b,S,p.length),p.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=t4(t,_,n,d,u,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);o4(r,x,A,p.length),p.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(p,m,v,S,A),p}function o4(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value<t)&&(i.max={value:t,index:s})),t}function l4(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=g(t.angle),i=g(t.radius);if(e&&i){const e=e4(t,l,n,r),i=i4(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=e4(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=i4(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function h4(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=b(s);return r.forEach(((t,r)=>{var o,l,h,c;const u=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,d=u.getRegion(),p=d.getLayoutStartPoint(),{width:g,height:f}=d.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=hH(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=hH(i)?Number(i.substring(0,i.length-1))*f/100:i)}const y=u.getXAxisHelper().getScale(0).domain(),_=u.getYAxisHelper().getScale(0).domain(),b=J(t.x),x=J(t.y);1===b.length&&A(b[0])&&J5(y,b[0],i)&&(null===(l=null===(o=u.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&A(x[0])&&J5(_,x[0],i)&&(null===(c=null===(h=u.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:n4(u.getXAxisHelper(),b)+p.x+m,y:n4(u.getYAxisHelper(),x)+p.y+v})})),n}function c4(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),u=J(t.angle),d=J(t.radius);1===u.length&&A(u[0])&&J5(h,u[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",u[0])),1===d.length&&A(d[0])&&J5(c,d[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",d[0])),s.push({angle:n4(l.angleAxisHelper,u),radius:n4(l.radiusAxisHelper,d)})})),s}function u4(t,e,i){let{x:s,y:n}=t;return hH(s)&&(s=s4(s,e)),hH(n)&&(n=s4(n,i)),{x:s,y:n}}function d4(t,e,i){let s;if(s=u(t)?J(t(e.getData().getLatestData(),e)):J(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=u4(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>u4(t,n,r)))}function p4(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.x<e&&(e=r.x),r.x+a.width>i&&(i=r.x+a.width),r.y<s&&(s=r.y),r.y+a.height>n&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function g4(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},NN(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},m4(NN(n.style),i,s)),g(n.padding)&&(t.padding=Cs(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=m4(NN(r),i,s)),t}return{visible:!1}}function f4(t,e,i){for(const s in t)u(t[s])&&(t[s]=t[s](e,i));return t}function m4(t,e,i){return u(t)?t(e,i):t}function v4(t,e){return u(t)?t(e):t}function y4(t,e,i){return g(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function _4(t){return{isXProcess:g(t.x),isYProcess:g(t.y),isX1Process:g(t.x1),isY1Process:g(t.y1),isAngleProcess:g(t.angle),isRadiusProcess:g(t.radius),isAngle1Process:g(t.angle1),isRadius1Process:g(t.radius1),isCoordinatesProcess:g(t.coordinates),isValidProcess:g(t.process)}}function b4(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=_4(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function x4(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=_4(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function S4(t){return{doXYProcess:g(t.x)&&g(t.y),doPolarProcess:g(t.angle)&&g(t.radius),doGeoProcess:g(t.areaName)}}function A4(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(u(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=J(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;g(r)&&(c=J(i)[r]),n&&J(i).includes(n)&&(c=n);let u=s;g(l)&&(u=J(s)[l]),a&&J(s).includes(a)&&(u=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&r4(t[c])?h.x={field:c,aggrType:t[c]}:h.x=J(c).map((e=>t[e])),_(t[u])&&r4(t[u])?h.y={field:u,aggrType:t[u]}:h.y=J(u).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;g(r)&&(a=J(s)[r]),n&&J(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&r4(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=J(a).map((e=>t[e])),_(t[l])&&r4(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=J(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(g(e.x)){const s=e.x;b(s)?i.x=s.map((i=>C4(i,t,e))):i.x=C4(s,t,e)}if(g(e.y)){const s=e.y;b(s)?i.y=s.map((i=>C4(i,t,e))):i.y=C4(s,t,e)}if(g(e.angle)){const s=e.angle;b(s)?i.angle=s.map((i=>C4(i,t,e))):i.angle=C4(s,t,e)}if(g(e.radius)){const s=e.radius;b(s)?i.radius=s.map((i=>C4(i,t,e))):i.radius=C4(s,t,e)}if(g(e.areaName)){const s=e.areaName;i.areaName=C4(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const k4={min:(t,e)=>wj(t[0].latestData,e.field),max:(t,e)=>Dj(t[0].latestData,e.field),sum:function(t,e){return Ej(t[0].latestData,e.field)},average:function(t,e){return Bj(t[0].latestData,e.field)},variance:function(t,e){return Pj(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(Pj(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return bt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function C4(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(u(t))return t(a,o,l,s,n,r);if(v(t)){const{aggrType:i,field:s}=t;return k4[i](e,{field:s})}return t}function M4(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class T4 extends qG{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return eW(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&r4(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];J(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Mh;return e.registerParser("array",s),new Th(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(g(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=zj(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){d(this._spec.offsetX)||(this._layoutOffsetX=uH(this._spec.offsetX,e.width,e)),d(this._spec.offsetY)||(this._layoutOffsetY=uH(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return Y(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();iU(this._option.dataSet,"markerAggregation",A4),iU(this._option.dataSet,"markerFilter",M4);const i=new Th(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function w4(t,e){return function(t,e,i){const{predict:s}=ge(t,(t=>t[e]),(t=>t[i])),n=wj(t,e),r=Dj(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class D4 extends T4{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=b4(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,u,d;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=J(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:m4(NN(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>g4(t,this._markerData,this._markAttributeContext))),state:{line:f4(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:f4(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:f4(null!==(u=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==u?u:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return f4(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return f4(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:m4(NN(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:m4(NN(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||J(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=p4([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const u=J((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),d=J(this._spec.label),p=u.map(((t,e)=>{const i=d[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:u}=b4(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||u||e))return;iU(this._option.dataSet,"markerAggregation",A4),iU(this._option.dataSet,"markerRegression",w4),iU(this._option.dataSet,"markerFilter",M4);const{options:d,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Th(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:d}),g&&m.transform({type:"markerRegression",options:d}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}D4.specKey="markLine";const E4=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),B4={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},P4={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:E4(!1),endSymbol:E4(!0),label:B4};class R4 extends D4{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new Az(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=g(e.coordinates),o=g(e.process),l=o&&g(e.process.x),h=o&&g(e.process.y),c=g(e.positions),u=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:d,doYProcess:p,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:y}=b4(e);let _=[];if(d||f||p||m||v||a&&l||a&&h){const t=a4(i,s,n,r,u);_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=h4(i,r,u,e.coordinatesOffset):c&&(_=d4(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let u;if(hH(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));u=Number(c.substring(0,c.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));u=Number(c.substring(0,c.length-1))*n/100}}else u=c;const{points:d,limitRect:p}=r;if(!d||d.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(d[0],d[1],h,u);let m;m=o&&g(l)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(d[0],d[1],h,u));const v=J((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),y=J(r.label),_=J(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:y.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=_[e])&&void 0!==n?n:_[0];return C(null==c?void 0:c.refX)&&(a+=c.refX),C(null==c?void 0:c.refY)&&(o+=c.refY),C(null==c?void 0:c.dx)&&(l+=c.dx),C(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:p,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:u}=b4(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(u){if(t=this._processSpecCoo(n),i=!1,e=new Th(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&g(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&g(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&g(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}R4.type=r.markLine,R4.coordinateType="cartesian",R4.builtInTheme={markLine:P4};const L4=()=>{wH.registerComponent(R4.type,R4),Sz()};class I4 extends D4{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=b4(this._spec);return e||i?new Mz(t):new Az(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:u,doCoordinatesProcess:d}=b4(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||u){const t=l4(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ti(f,t.radius,t.angle)))}}else d&&(p=c4(i,r,a),g={points:p.map((t=>ti(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=b4(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}I4.type=r.polarMarkLine,I4.coordinateType="polar",I4.builtInTheme={polarMarkLine:P4};const O4=()=>{wH.registerComponent(I4.type,I4),Mz._animate=sz,Sz()};class F4 extends qG{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=lH(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return eW(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){C(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),C(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:C(t.width())?t.width():0,height:this._spec.height?this._spec.height:C(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o;if(!1===this._spec.visible)return{visible:!1};const l=this.getLayoutRect(),h=uH(this._spec.width,l.width,null,l.width),c=uH(this._spec.maxWidth,l.width,null,l.width),u=Math.max(Math.min(h,c,l.width),0),d=Object.assign(Object.assign({},V(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtextType:null!==(i=this._spec.subtextType)&&void 0!==i?i:"text",subtext:null!==(s=this._spec.subtext)&&void 0!==s?s:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(r=this._spec.y)&&void 0!==r?r:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:u,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(a=this._spec.align)&&void 0!==a?a:"left",verticalAlign:null!==(o=this._spec.verticalAlign)&&void 0!==o?o:"top",textStyle:Object.assign({width:u,maxLineWidth:u},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:u},this._spec.subtextStyle)});return g(this._spec.width)&&(d.textStyle.width=Math.max(h,l.width),d.subtextStyle.width=d.textStyle.width),d}_createOrUpdateTitleComponent(t){if(this._titleComponent)Y(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new Jz(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}F4.type=r.title,F4.specKey=r.title,F4.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};const z4=()=>{wH.registerComponent(F4.type,F4)};class j4 extends T4{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=x4(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=J(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:m4(NN(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>g4(t,this._markerData,this._markAttributeContext))),state:{area:f4(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>f4(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return f4(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||J(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=p4([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=J(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=J(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=x4(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}j4.specKey="markArea";const H4={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class N4 extends j4{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new Cz(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=x4(i),u=g(i.positions),d=null!==(t=i.autoRange)&&void 0!==t&&t,p=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=a4(s,n,r,a,d,p);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=a4(s,n,r,a,d,p);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=h4(s,a,d,i.coordinatesOffset):u&&(f=d4(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=x4(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}N4.type=r.markArea,N4.coordinateType="cartesian",N4.builtInTheme={markArea:H4};const U4=()=>{wH.registerComponent(N4.type,N4),kz()};class V4 extends j4{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=x4(this._spec);return i||e||s?new Tz(t):new Cz(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=x4(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let u,d={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=l4(i,s,n,r,c);l?d={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?d={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(d={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(u=c4(i,r,c),d={points:u.map((t=>ti(p,t.radius,t.angle)))});return d}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=x4(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}V4.type=r.polarMarkArea,V4.coordinateType="polar",V4.builtInTheme={polarMarkArea:H4};const W4=()=>{wH.registerComponent(V4.type,V4),Tz._animate=rz,kz()},G4=t=>NN(Object.assign({},t)),Y4=t=>Object.assign(Object.assign({},t),{style:Object.assign({},NN(t.style))}),X4=t=>{var e,i,s,n,r,a,o,l,h,c,u,d,p,g,f;const m=G4(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=G4(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),y=(_=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},NN(Object.assign({},_)));var _;const b=Y4(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Y4(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Y4(null!==(d=null===(u=null==t?void 0:t.controller)||void 0===u?void 0:u.backward)&&void 0!==d?d:{}),A=Y4(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:y}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},$4=t=>"left"===t||"right"===t,K4=t=>"top"===t||"bottom"===t,q4={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class Z4 extends qG{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},X4(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},X4(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?Y(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new gj(t):this._playerComponent=new vj(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...J(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...J(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...J(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...J(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=$4(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=$4(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...J(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...J(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...J(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...J(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())})),this._playerComponent.addEventListener(lj.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(lj.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(lj.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(lj.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(lj.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(lj.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),C(t.x)){const e=$4(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(C(t.y)){const e=K4(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return A(this._spec.width)?Math.min(t.width,Number(this._spec.width)):$4(this._orient)?this._maxSize():t.width}_computeHeight(t){return A(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):K4(this._orient)?this._maxSize():t.height}_computeDx(t){return $4(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return K4(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}}Z4.builtInTheme={player:q4},Z4.specKey="player",Z4.type=r.player;const J4=()=>{wH.registerComponent(Z4.type,Z4)};class Q4 extends qG{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,Y(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=qj({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:J(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==JU.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),v(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}Q4.type=r.label;class t8 extends NK{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}t8.type="text",t8.constructorType="label";const e8=()=>{UK(),wH.registerMark(t8.constructorType,t8)};class i8 extends KG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class s8 extends Q4{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=i8,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(XN.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(XN.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Oj(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n<i.length;n++){const r=i[n],a=t.getMarkInName(r);a&&e[r].forEach(((e,i)=>{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&g(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(g(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{J(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),u(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();b(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),u=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let d=TH({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},aK(h,r),Object.assign(Object.assign(Object.assign({},V(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:u}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[fN])):t=>t.filter((t=>t.data[gN]))}:{});return l&&l.parseLabelStyle&&(d=l.parseLabelStyle(d,a,o)),"line"!==h&&"area"!==h||(d.type=h),d},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?oK(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=b(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=J(i())[t])}))}return e}}s8.type=r.label,s8.specKey="label",s8.transformerConstructor=i8;const n8=()=>{wH.registerGraphicComponent(s8.type,(t=>new bF(t))),e8(),tY(),wH.registerComponent(s8.type,s8,!0,1/0)};class r8 extends Q4{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[dN]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return TH({textStyle:{pickable:!0===this._spec.interactive},position:a8(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[fN]:t.data[gN]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>oK({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function a8(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}r8.type=r.totalLabel,r8.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},r8.specKey="totalLabel";const o8=()=>{wH.registerGraphicComponent(r8.type,(t=>new bF(t))),e8(),tY(),wH.registerComponent(r8.type,r8,!0)};class l8 extends T4{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=S4(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,u,d,p,g,f,m,v,y,_,b,x,S,A,k,C,M,T,w,D,E,B,P,R;const{itemContent:L={},itemLine:I={},targetSymbol:O={}}=this._spec,F=L,{type:z="text",text:j,symbol:H,image:U,richText:V,customMark:W,textStyle:G,symbolStyle:Y,imageStyle:X,richTextStyle:$,customMarkStyle:K,style:q={},state:Z={}}=F,J=e(F,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let Q=null,tt=null,et={};"text"===z?(Q=null!==(t=null==j?void 0:j.state)&&void 0!==t?t:Z,et={dx:0,dy:0},tt=g4(Object.assign(Object.assign({},j),{style:N(et,null!==(s=null!==(i=null==j?void 0:j.textStyle)&&void 0!==i?i:G)&&void 0!==s?s:q)}),this._markerData,this._markAttributeContext)):"richText"===z?(Q=null!==(n=null==V?void 0:V.state)&&void 0!==n?n:Z,et={width:100,height:100},tt=m4(N(et,null!==(a=null!==(r=null==V?void 0:V.style)&&void 0!==r?r:$)&&void 0!==a?a:q),this._markerData,this._markAttributeContext)):"symbol"===z?(Q=null!==(o=null==H?void 0:H.state)&&void 0!==o?o:Z,et={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},tt=NN(m4(N(et,null!==(h=null!==(l=null==H?void 0:H.style)&&void 0!==l?l:Y)&&void 0!==h?h:q),this._markerData,this._markAttributeContext))):"image"===z?(Q=null!==(c=null==U?void 0:U.state)&&void 0!==c?c:Z,et={width:80,height:80},tt=m4(N(et,null!==(d=null!==(u=null==U?void 0:U.style)&&void 0!==u?u:X)&&void 0!==d?d:q),this._markerData,this._markAttributeContext)):"custom"===z&&(Q=null!==(p=null==W?void 0:W.state)&&void 0!==p?p:Z,tt=m4(null!==(f=null!==(g=null==W?void 0:W.style)&&void 0!==g?g:K)&&void 0!==f?f:q,this._markerData,this._markAttributeContext));const it={zIndex:this.layoutZIndex,interactive:null===(m=this._spec.interactive)||void 0===m||m,hover:null===(v=this._spec.interactive)||void 0===v||v,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(_=this._spec.clip)&&void 0!==_&&_,itemContent:Object.assign(Object.assign({type:z,offsetX:v4(L.offsetX,this._relativeSeries.getRegion()),offsetY:v4(L.offsetX,this._relativeSeries.getRegion())},J),{style:m4(tt,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(b=O.offset)&&void 0!==b?b:0,visible:null!==(x=O.visible)&&void 0!==x&&x,size:null!==(S=O.size)&&void 0!==S?S:20,style:m4(O.style,this._markerData,this._markAttributeContext)},state:{line:f4(null!==(k=null===(A=this._spec.itemLine.line)||void 0===A?void 0:A.state)&&void 0!==k?k:{},this._markerData,this._markAttributeContext),lineStartSymbol:f4(null!==(M=null===(C=this._spec.itemLine.startSymbol)||void 0===C?void 0:C.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineEndSymbol:f4(null!==(w=null===(T=this._spec.itemLine.endSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),itemContent:f4(Q,this._markerData,this._markAttributeContext),textBackground:f4(null===(E=null===(D=this._spec.itemContent.text)||void 0===D?void 0:D.labelBackground)||void 0===E?void 0:E.state,this._markerData,this._markAttributeContext),targetItem:f4(null!==(P=null===(B=this._spec.targetSymbol)||void 0===B?void 0:B.state)&&void 0!==P?P:{},this._markerData,this._markAttributeContext)},animation:null!==(R=this._spec.animation)&&void 0!==R&&R,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:st,line:nt={}}=I,rt=e(I,["visible","line"]);it.itemLine=!1!==st?Object.assign(Object.assign({},rt),{visible:!0,lineStyle:NN(nt.style)}):{visible:!1};return new Dz(it)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let u;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=p4([o.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:y4(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:y4(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=S4(t);(g(t.coordinate)||e||i||s)&&this._initCommonDataView()}}l8.specKey="markPoint";const h8={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class c8 extends l8{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=g(s.x)&&g(s.y),o=g(s.coordinate),l=g(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=a4(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=h4(n,r,h,s.coordinatesOffset)[0]:l&&(c=d4(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=S4(t),i=g(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}c8.type=r.markPoint,c8.coordinateType="cartesian",c8.builtInTheme={markPoint:h8};const u8=()=>{wH.registerComponent(c8.type,c8),wz()};class d8 extends l8{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=l4(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:ti({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}d8.type=r.polarMarkPoint,d8.coordinateType="polar",d8.builtInTheme={polarMarkPoint:h8};const p8=()=>{wH.registerComponent(d8.type,d8),wz()};class g8 extends l8{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{g(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}g8.type=r.geoMarkPoint,g8.coordinateType="geo",g8.builtInTheme={geoMarkPoint:h8};const f8=()=>{wH.registerComponent(g8.type,g8),wz()},m8="inBrush",v8="outOfBrush";class y8 extends qG{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return eW(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),m8,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),v8,t.AttributeLevel.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&J(t).includes(n.userId.toString())||e&&J(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){g(this._spec.regionId)||g(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(J(this._spec.regionId),J(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(g(this._spec.brushLinkSeriesId)||g(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(J(this._spec.brushLinkSeriesId),J(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){g(this._spec.axisId)?J(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):g(this._spec.axisIndex)?J(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return Y(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new xj(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:NN(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(fj.brushActive,(s=>{this._initMarkBrushState(i,v8),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener(fj.drawStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(fj.moveStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(fj.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(fj.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(fj.brushClear,(s=>{this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener(fj.drawEnd,(s=>{var n;this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener(fj.moveEnd,(i=>{this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},NN(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:u}=t.globalTransMatrix,d=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+u}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,d,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(m8,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(m8),i.addState(v8,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:u,d:d,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+u*t.y+p+f,y:c*t.x+d*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(m8,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(m8),i.addState(v8,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],Yi(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(m8),s.removeState(v8),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,u=r?"x":"y",d=r?"width":"height",p=r?o:h,g=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=(p-e.getLayoutStartPoint()[u])/e.getLayoutRect()[d],n=(g-e.getLayoutStartPoint()[u])/e.getLayoutRect()[d],r=this._stateClamp(s-a),o=this._stateClamp(n+a);i.setStartAndEnd(Math.min(r,o),Math.max(r,o),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:r,end:o,startValue:E5(r,i.stateScale,P5(i.relatedAxisComponent,i.isHorizontal)),endValue:E5(o,i.stateScale,P5(i.relatedAxisComponent,i.isHorizontal))})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=Q(i)<i[0],o=p-e.getLayoutStartPoint()[u],l=g-e.getLayoutStartPoint()[u],h=r?Math.min(o,l):Math.max(o,l),c=r?Math.max(o,l):Math.min(o,l),d=(c-i[0])/(Q(i)-i[0])*(s[1]-s[0])+s[0],f=(h-i[0])/(Q(i)-i[0])*(s[1]-s[0])+s[0],m=this._stateClamp(d-a),v=this._stateClamp(f+a);t.scaleRangeFactor([m,v]),t.effect.scaleUpdate(),this._zoomRecord.push({operateComponent:t,start:m,end:v,startValue:t.getScale().invert(c),endValue:t.getScale().invert(h)})}}))}}_getNeedClearVRenderComponents(){return this._brushComponents}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}y8.type=r.brush,y8.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},y8.specKey="brush";const _8=()=>{wH.registerComponent(y8.type,y8)};class b8 extends qG{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${ZH}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:g(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(g(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=EW({},BW(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(d(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),g(t.dataId)||C(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return Y(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new ss).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new ss;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}b8.type=r.customMark,b8.specKey="customMark";const x8=()=>{wH.registerComponent(b8.type,b8)};class S8{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(C(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:u(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&g(e.modelId)){if(g(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&g(e.modelKey)&&"modelIndex"in e&&g(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r<t[e]+(null!==(i=t[`${e}Span`])&&void 0!==i?i:1);r++)n+=s[r].value;return n}getSizeFromUser(t,e){var i,s;const n="col"===e?this._colSize:this._rowSize;if(!(null===(i=n[t[e]])||void 0===i?void 0:i.isUserSetting))return;let r=0;for(let i=t[e];i<t[e]+(null!==(s=t[`${e}Span`])&&void 0!==s?s:1);i++){if(!n[i].isUserSetting)return;r+=n[i].value}return r}setItemLayoutSizeToGrid(t,e){if(A8(t)){if(e.colSpan&&e.colSpan>1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;t<e.col;t++)i.x+=this._colSize[t].value;for(let t=0;t<e.row;t++)i.y+=this._rowSize[t].value;return i.x+=t.layoutPaddingLeft+t.layoutOffsetX,i.y+=t.layoutPaddingTop+t.layoutOffsetY,i}getItemLayoutRect(t){var e,i;const s=this.getItemGridInfo(t);return{width:(null!==(e=this.getSizeFromGrid(s,"col"))&&void 0!==e?e:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(i=this.getSizeFromGrid(s,"row"))&&void 0!==i?i:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom}}layoutItems(t,e,i,s){this._chartLayoutRect=i,this._chartViewBox=s,this.clearLayoutSize(),e.sort(((t,e)=>e.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>A8(t))),a=n.filter((t=>!A8(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>A8(t))),h=o.filter((t=>!A8(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);C(h.width)||(h.width=l.width),C(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function A8(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}S8.type="grid";const k8=()=>{wH.registerLayout(S8.type,S8)},C8=()=>{mc.load(YB)},M8="vchart-tooltip",T8=`${M8}-container`,w8=`${M8}-title`,D8=`${M8}-content-box`,E8={offsetX:10,offsetY:10},B8="99999999999999";function P8(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\(/g,"&#40;").replace(/ /g," &nbsp;")}const R8=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,L8=t=>_(t)&&""!==(null==t?void 0:t.trim())||A(t)?P8(t):"",I8=(t,e)=>{let i;if(g(t))if(A(t))i=t;else if(u(t)){const s=t(e);A(s)&&(i=s)}return i},O8={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},F8=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=O8[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class z8 extends kG{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const u=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,u,e,t))&&void 0!==n?n:0;const d=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[u])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==d?void 0:d.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,d;const p=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:S,offsetY:k}=this._option,M=m[_],T=rW(null==M?void 0:M.position,b,e),w=null!==(r=rW(null==M?void 0:M.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:D=0,height:E=0}=null!=i?i:{},B="canvas"===m.renderMode,P=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==P?void 0:P.width)&&void 0!==o?o:JH,L=null!==(l=null==P?void 0:P.height)&&void 0!==l?l:QH;let I=!1;const O={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,N=1;const U=AA(this._env);if(U&&!m.confine?(O.width=window.innerWidth,O.height=window.innerHeight):(O.width=R,O.height=L),U&&!B){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(d=this._compiler.getCanvas())&&void 0!==d?d:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=R8(e,F),N=R8(t,j)}const V=N/H,W={},G={x:T,y:T},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?S:k;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(p&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=p(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?D:E;switch(F8(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},$=["x","y"];if(f(T))if(f(K=T)&&(g(K.left)||g(K.right)||g(K.top)||g(K.bottom))){const{left:t,right:e,top:i,bottom:s}=T;W.left=I8(t,y),W.top=I8(i,y),W.right=I8(e,y),W.bottom=I8(s,y)}else(t=>f(t)&&(g(t.x)||g(t.y)))(T)&&$.forEach((t=>{const e=T[t];A(e)||u(e)?W[Y[t][0]]=I8(e,y):X(e,t)}));else g(T)&&(X({orient:T,mode:w},"x"),X({orient:T,mode:w},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?D:E,s="x"===t?R:L,n="x"===t?S:k,r=F8(G[t],t);if(C(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(C(W[Y[t][1]]))q[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;q[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}q[t]*=H,U&&(q[t]+=z[t]),q[t]/=N;const a="x"===t?O.width:O.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/N:-j[t]/N,l=a/N+o-i;2!==r&&q[t]<o?I?q[t]=o:(q[t]+=0===r?n+i/2:2*n+i,q[t]>l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]<o&&(q[t]=o)))})),q}}get env(){return this._env}onAdd(t){super.onAdd(t);const e=t.component;this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i,s;const n=null!==(e=null===(t=this._component)||void 0===t?void 0:t.getSpec())&&void 0!==e?e:{};n.handler?null===(s=(i=n.handler).release)||void 0===s||s.call(i):(this._removeTooltip(),this._isReleased=!0,this._chartOption=null,this._component=null)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return i?{offsetX:null!==(t=i.x)&&void 0!==t?t:E8.offsetX,offsetY:null!==(e=i.y)&&void 0!==e?e:E8.offsetY}:E8}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption()}reInit(){this._initFromSpec()}}z8.specKey="tooltip";const j8=(t,e)=>g(t)?b(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",H8=(t={},e={})=>{var i,s;g(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return g(n)&&(e.color=n),g(t.fontWeight)&&(e.fontWeight=t.fontWeight),g(t.textAlign)&&(e.textAlign=t.textAlign),g(t.fontSize)&&(e.fontSize=j8(t.fontSize)),g(t.maxWidth)&&(e.maxWidth=j8(t.maxWidth)),t.multiLine||g(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},N8=(t={})=>{const{lineHeight:e}=t;return t.fontSize?uH(e,t.fontSize):0},U8=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return g(l)&&(a.borderRadius=C(l)?`${l}px`:`${l}`),r&&(o=Cs(r),a.padding=j8(o)),{panelStyle:a,panelPadding:o}};function V8(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const W8=t=>{wH.registerComponentPlugin(t.type,t)};class G8 extends z8{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(G8.type),this.type=CX.dom,this._tooltipContainer=null==SA?void 0:SA.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(SA&&t&&t.children&&t.children.length){for(let e=0;e<t.children.length;e++)if(t.children[e].classList.contains(T8)){this._container=t.children[e];break}this._container||(this._container=SA.createElement("div"),this._container.style.position="relative",this._container.style.zIndex=B8,this._container.classList.add(T8),t.appendChild(this._container))}}initRootDom(){var t;const e=this._component.getSpec(),i=document.createElement("div"),s=null===(t=this._chartOption)||void 0===t?void 0:t.getTheme("fontFamily");V8(i,Object.assign({left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:B8,fontFamily:null!=s?s:bH.fontFamily,fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh",visibility:"hidden"},this._domStyle.panel)),i.classList.add(e.className),i.setAttribute("vchart-tooltip-id",`${this.id}`),this._container.appendChild(i),this._rootDom=i}_getTooltipBoxSize(t,e){var i;this._rootDom||this.initRootDom(),e||this._updateDomStringByCol(t),this._updateDomStyle("height",e);const s=null===(i=this._rootDom)||void 0===i?void 0:i.getBoundingClientRect();return{width:null==s?void 0:s.width,height:null==s?void 0:s.height}}_removeTooltip(){this._rootDom&&this._rootDom.parentNode&&(this._rootDom.parentNode.removeChild(this._rootDom),this._rootDom=null),this._container=null}_updateTooltip(t,e){var i,s;if(t&&this._rootDom){const{tooltipSpec:n,activeTooltipSpec:r}=e;e.changePositionOnly||(this._tooltipActual=r);const a=this._rootDom;if(a){const{x:o=0,y:l=0}=null!==(i=r.position)&&void 0!==i?i:{};let h={x:o,y:l};const c=this.getVisibility();n.updateElement&&(this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:o,y:l}),n.updateElement(a,r,e),h=this._getActualTooltipPosition(r,e,{width:a.offsetWidth,height:a.offsetHeight}),this._cacheCustomTooltipPosition=h),!c&&t&&(this._rootDom.style.transition="none",this._updatePosition(h,!1),this._rootDom.getBoundingClientRect()),this._updatePosition(h)}this.setVisibility(t)}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){const t=this._component.getSpec();this._domStyle=((t={})=>{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=U8(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),C(g)&&(y.marginBottom=`${g}px`);const _={width:j8(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=H8(h),x=H8(u),S=H8(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[A]=j8(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=j8(null!==(s=u.spacing)&&void 0!==s?s:26),S[A]=j8(null!==(n=p.spacing)&&void 0!==n?n:0);const k=Math.max(N8(p),N8(u));return y.lineHeight=k>0?`${k}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(w8))),l=a.find((t=>t.className.includes(D8)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(w8),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(V8(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${M8}-column`),e.classList.add(`${M8}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(D8),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];V8(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));V8(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${M8}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=L8(e.key),e.keyStyle&&H8(e.keyStyle,l)):"value"===i?(o.innerHTML=L8(e.value),e.valueStyle&&H8(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:u=!1,shapeFill:d}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,g=t.shapeLineWidth?P8(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?P8(c):m,y=p,b=t=>new Mv({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new ss));let C=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==g){const[t,e,i,s]=C.split(" ").map((t=>Number(t))),n=Number(g.slice(0,-2));C=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const M=dd.IsGradientStr(d);if(!d||_(d)&&!M||u)return m=u?"none":d?P8(d):"currentColor",`\n <svg ${l} width="${p}" height="${p}" viewBox="${C}">\n <path\n d="${k}"\n style="fill: ${m}; stroke: ${v()}; stroke-width: ${g}"\n >\n </path>\n </svg>`;const T=M?dd.Parse(d):f(d)?d:null;if(T){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=T.stops)&&void 0!==s?s:[]).map((t=>`<stop offset="${P8(t.offset.toString())}" stop-color="${P8(t.color)}"/>`)).join("");return"radial"===T.gradient?t=`<radialGradient id="${m}" cx="50%" cy="50%" r="50%" fx="0%" fy="0%">\n ${i}\n </radialGradient>`:"linear"===T.gradient&&(t=`<linearGradient id="${m}" x1="${100*(null!==(n=T.x0)&&void 0!==n?n:0)}%" y1="${100*(null!==(r=T.y0)&&void 0!==r?r:0)}%" x2="${100*(null!==(a=T.x1)&&void 0!==a?a:0)}%" y2="${100*(null!==(o=T.y1)&&void 0!==o?o:0)}%">\n ${i}\n </linearGradient>`),`\n <svg ${l} width="${p}" height="${p}" viewBox="-0.5 -0.5 1 1">\n ${t}\n <path\n d="${k}"\n style="fill: url(#${m}); stroke: ${v()}; stroke-width: ${g}"\n >\n </path>\n </svg>`}return""}(e,`${this.id}_${a}`)),V8(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(D8))),h=[...o.children].find((t=>t.className.includes(w8)));if(l){const o=this._component.getSpec(),c={},u=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(u&&u.autoWidth&&!1!==u.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(g(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(w8)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=uH(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,V8(l,c))}const d=l.children,p=[];if(d){for(let i=0;i<d.length;i++){const s=null!==(r=d[i].children)&&void 0!==r?r:[];for(let i=0;i<s.length;i++){e&&(s[i].style[t]="initial");const n=s[i].getBoundingClientRect()[t];(void 0===p[i]||p[i]<n)&&(p[i]=n)}}for(let e=0;e<d.length;e++){const i=null!==(a=d[e].children)&&void 0!==a?a:[];for(let e=0;e<i.length;e++)i[e].style[t]=`${p[e]}px`}}}}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle(),this._rootDom&&V8(this._rootDom,this._domStyle.panel),this.getVisibility()&&(this._updateDomStringByCol(this._tooltipActual),this._updateDomStyle("height",!1))}_updatePosition({x:t,y:e},i=!0){this._rootDom&&(this._rootDom.style.transform=`translate3d(${t}px, ${e}px, 0)`,i&&""!==this._rootDom.style.transition&&(this._rootDom.style.transition="",Object.assign(this._rootDom.style,this._domStyle.panel)))}}G8.type=CX.dom;const Y8=()=>{W8(G8)},X8={fontFamily:bH.fontFamily,spacing:10,wordBreak:"break-word"},$8=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>e<s.length-1?t+"\n":t))):s=[t],n=s.map((t=>Object.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},_y||(_y=vy.CreateGraphic("richtext",{})),_y.setAttributes(a),_y.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function K8(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:X8),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:g(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const q8=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return g(a)&&(r.cornerRadius=[a,a,a,a]),r};class Z8 extends z8{constructor(){super(Z8.type),this.type=CX.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new Mj({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:u={},titleLabel:d,shape:p,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=Cs(u.padding),b=gH(u.padding),x=K8(Object.assign({textAlign:"right"===y?"right":"left"},d),i),S=K8(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=K8(m,i),k={fill:!0,size:null!==(s=null==p?void 0:p.size)&&void 0!==s?s:8,spacing:null!==(n=null==p?void 0:p.spacing)&&void 0!==n?n:6},C={panel:q8(u),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:M={},content:T=[]}=t;let w=b.left+b.right,D=b.top+b.bottom,E=0;const B=!!T.length;let P=0,R=0,L=0,I=0;if(B){const t=[],e=[],i=[],s=[];let n=0;C.content=T.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:u,shapeStroke:d,shapeLineWidth:p,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:C}=r,M={height:0,spaceRow:null!=_?_:v};if(g(h)){const i=TH({},S,K8(b,void 0,{})),{width:s,height:n,text:r}=$8(h,i);M.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),y?e.push(s):t.push(s),o=Math.max(o,n)}if(g(m)){const t=TH({},A,K8(x,void 0,{})),{width:e,height:s,text:n}=$8(m,t);M.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};C?t.stroke=u:t.fill=u,t.stroke=null!=d?d:u,t.lineWidth=p,M.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else M.shape={visible:!1};return M.height=o,n+=o,a<T.length-1&&(n+=M.spaceRow),M})),D+=n,P=t.length?et(t):0,R=e.length?et(e):0,L=i.length?et(i):0,I=s.length?et(s)+k.spacing:0,E=Math.max(I+P+S.spacing+L+A.spacing,I+R,E),C.hasContentShape=!!s.length,C.keyWidth=P,C.valueWidth=L}let O=0,F=0,z=0;const{visible:j=!0,value:H="",valueStyle:N,spaceRow:U}=M;C.title.visible=j,C.title.spaceRow=null!=U?U:v;let V={};const W=()=>V.autoWidth&&!1!==V.multiLine;if(j){V=TH({},x,K8(N,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:B?Math.ceil(E):void 0);const{text:t,width:e,height:i}=$8(H,V);C.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),O=C.title.value.width,F=C.title.value.height,z=F+(B?C.title.spaceRow:0)}return D+=z,C.title.width=O,C.title.height=F,W()?w+=E||O:w+=Math.max(O,E),B&&C.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=w-b.left-b.right-I-P-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),C.valueWidth=Math.max(C.valueWidth,i.width))})),C.panel.width=w,C.panel.height=D,C})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?g(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}Z8.type=CX.canvas;const J8=()=>{W8(Z8)},Q8=t=>{wH.registerChartPlugin(t.type,t)},t6=/\{([^}]+)\}/,e6=/\{([^}]+)\}/g,i6=/:/;class s6 extends kG{constructor(){super(s6.type),this.type="formatterPlugin",this._timeModeFormat={utc:Zn.getInstance().timeUTCFormat,local:Zn.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=rr.getInstance().format,this._numericSpecifier=rr.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[s6.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;u(r)?this._formatter=r:(this._formatter=this._format.bind(this),u(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),wH.registerFormatter(this._formatter)}_format(t,e,i){return b(t)?t.map(((t,s)=>{const n=b(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):b(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=t6.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(e6,((t,i)=>{if(!i6.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(ir.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}s6.pluginType="chart",s6.specKey="formatter",s6.type="formatterPlugin";const n6=()=>{Q8(s6)},r6={state:t.STATE_VALUE_ENUM.STATE_ACTIVE,trigger:"pointerover",triggerOff:"pointerout"};class a6 extends NV{constructor(t){super(t),this.type="element-active",this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{this.reset(t.item)},this.options=Object.assign({},r6,t),this.updateMarkIdByState([this.options.state])}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.triggerOff,handler:this.handleReset}]}getStartState(){return this.options.state}start(t){if(t){const{state:e,interaction:i}=this.options;this.isGraphicInStateMark(t,e)&&(t.addState(e,!0),i.setStatedGraphics(this,[t]))}}reset(t){const{interaction:e,state:i}=this.options,s=e.getStatedGraphics(this),n=null!=t?t:null==s?void 0:s[0];n&&s.includes(n)&&(n.removeState(i),e.setStatedGraphics(this,s.filter((t=>t!==n))))}}a6.type="element-active",a6.defaultOptions=r6;const o6=()=>{wH.registerInteractionTrigger(a6.type,a6)},l6="element-active-by-legend",h6={state:t.STATE_VALUE_ENUM.STATE_ACTIVE,filterType:"groupKey"};class c6 extends NV{constructor(t){super(t),this.type=l6,this.handleStart=t=>{var e,i;const s=t.event;s&&this.start(null===(i=null===(e=s.detail)||void 0===e?void 0:e.data)||void 0===i?void 0:i.id)},this.handleReset=t=>{this.resetAll()},this.options=Object.assign({},h6,t),this.updateMarkIdByState([this.options.state])}getEvents(){return[{type:t.ChartEvent.legendItemHover,handler:this.handleStart},{type:t.ChartEvent.legendItemUnHover,handler:this.handleReset}]}getStartState(){return this.options.state}start(t){if(d(t))return;const{interaction:e,state:i}=this.options,s=jV(this.options),n=e.getStatedGraphics(this),r=[];this.getMarks().forEach((e=>{var i;null===(i=e.getGraphics())||void 0===i||i.forEach((e=>{s(e)===t&&r.push(e)}))})),e.updateStates(this,r,n,i),e.setStatedGraphics(this,r)}resetAll(){const{interaction:t,state:e}=this.options;t.clearAllStatesOfTrigger(this,e),t.setStatedGraphics(this,[])}reset(t){const{state:e,interaction:i}=this.options;if(t){const s=i.getStatedGraphics(this);s&&s.includes(t)&&(t.removeState(e),i.setStatedGraphics(this,s.filter((e=>e!==t))))}else this.resetAll()}}c6.type=l6,c6.defaultOptions=h6;const u6=()=>{wH.registerInteractionTrigger(l6,c6)},d6="element-highlight-by-group";class p6 extends NV{constructor(t){super(t),this.type=d6,this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const e=t.item;e&&this.isGraphicInMark(e)&&this.resetAll()},this.options=Object.assign({},HV,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.triggerOff,handler:this.handleReset}]}resetAll(){const{interaction:t,highlightState:e,blurState:i}=this.options;t.clearAllStatesOfTrigger(this,e,i),t.setStatedGraphics(this,[])}_getHightlightKey(t){var e;return null===(e=t.context)||void 0===e?void 0:e.groupKey}start(t){if(t&&this.isGraphicInMark(t)){const e=this._getHightlightKey(t);if(d(e))return;const{interaction:i,highlightState:s,blurState:n}=this.options,r=i.getStatedGraphics(this),a=[];this.getMarks().forEach((t=>{var i;null===(i=t.getGraphics())||void 0===i||i.forEach((t=>{this._getHightlightKey(t)===e&&a.push(t)}))})),i.updateStates(this,a,r,s,n),i.setStatedGraphics(this,a)}}reset(t){if(t){if(this.isGraphicInMark(t)){const{interaction:e}=this.options,i=e.getStatedGraphics(this);t.removeState([this.options.highlightState,this.options.blurState]),e.setStatedGraphics(this,i.filter((e=>e!==t)))}}else this.resetAll()}}p6.type=d6,p6.defaultOptions=HV;const g6=()=>{wH.registerInteractionTrigger(d6,p6)},f6="element-highlight-by-key";class m6 extends p6{constructor(){super(...arguments),this.type=f6}_getHightlightKey(t){var e;return null===(e=t.context)||void 0===e?void 0:e.key}}m6.type=f6;const v6=()=>{wH.registerInteractionTrigger(f6,m6)},y6="element-highlight-by-legend",_6={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,filterType:"groupKey"};class b6 extends NV{constructor(t){super(t),this.type=y6,this.handleStart=t=>{var e,i;const s=t.event;s&&this.start(null===(i=null===(e=s.detail)||void 0===e?void 0:e.data)||void 0===i?void 0:i.id)},this.handleReset=t=>{this.resetAll()},this.options=Object.assign({},_6,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){return[{type:t.ChartEvent.legendItemHover,handler:this.handleStart},{type:t.ChartEvent.legendItemUnHover,handler:this.handleReset}]}start(t){if(t){const e=jV(this.options),{interaction:i,highlightState:s,blurState:n}=this.options,r=i.getStatedGraphics(this),a=[];this.getMarks().forEach((i=>{var s;null===(s=i.getGraphics())||void 0===s||s.forEach((i=>{e(i)===t&&a.push(i)}))})),i.updateStates(this,a,r,s,n),i.setStatedGraphics(this,a)}}resetAll(){const{interaction:t,highlightState:e,blurState:i}=this.options;t.clearAllStatesOfTrigger(this,e,i),t.setStatedGraphics(this,[])}reset(t){const{highlightState:e,blurState:i,interaction:s}=this.options;if(t){const n=s.getStatedGraphics(this);n&&n.includes(t)&&(t.removeState([e,i]),s.setStatedGraphics(this,n.filter((e=>e!==t))))}else this.resetAll()}}b6.type=y6,b6.defaultOptions=_6;const x6=()=>{wH.registerInteractionTrigger(y6,b6)},S6="element-highlight-by-name",A6={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,filterType:"groupKey"};class k6 extends NV{constructor(t){super(t),this.type=S6,this.handleStart=t=>{if(this.options.shouldStart?this.options.shouldStart(t):this._filterByName(t)){const e=this._parseTargetKey(t);this.start(e)}},this.handleReset=t=>{(this.options.shouldReset?this.options.shouldReset(t):this._filterByName(t))&&this.resetAll()},this.options=Object.assign({},A6,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.triggerOff,handler:this.handleReset}]}_filterByName(t){var e;const i=J(this.options.graphicName);return(null===(e=null==t?void 0:t.node)||void 0===e?void 0:e.name)&&i.includes(t.node.name)}_parseTargetKey(t){return this.options.parseData?this.options.parseData(t):"text"===t.node.type?t.node.attribute.text:null}start(t){if(t){const e=jV(this.options),{interaction:i,highlightState:s,blurState:n}=this.options,r=i.getStatedGraphics(this),a=[];this.getMarks().forEach((i=>{var s;null===(s=i.getGraphics())||void 0===s||s.forEach((i=>{e(i)===t&&a.push(i)}))})),i.updateStates(this,a,r,s,n),i.setStatedGraphics(this,a)}}resetAll(){const{interaction:t,highlightState:e,blurState:i}=this.options;t.clearAllStatesOfTrigger(this,e,i),t.setStatedGraphics(this,[])}reset(t){const{highlightState:e,blurState:i,interaction:s}=this.options;if(t){const n=s.getStatedGraphics(this);n&&n.includes(t)&&(t.removeState([e,i]),s.setStatedGraphics(this,n.filter((e=>e!==t))))}else this.resetAll()}}k6.type=S6,k6.defaultOptions=A6;const C6=()=>{wH.registerInteractionTrigger(S6,k6)};class M6 extends dV{constructor(){super(...arguments),this.type=M6.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}M6.type="image";const T6=()=>{wH.registerMark(M6.type,M6),FE(),xE(),wH.registerGraphicComponent("image",Gv)},w6=()=>{fV(),pG(),fG(),Q$(),UK(),jX(),s$(),E$(),mq(),f0(),T6(),$1(),tY()};KV.useRegisters([OX,$X,d$,C$,B2,I2,z2,K2,k2,e3,r3,a3,h3,T3,E3,J2,d3,f3,O3,y3,x3,k3,R3,j3,W2,U3,N2,xY,CY,TY,DY,BY,zq,Oq,$3,a5,v5,k5,M5,U5,G5,q5,H$,L4,U4,u8,O4,W4,p8,f8,z4,J4,n8,o8,_8,x8,C8,k8,w6,Y8,J8,n6,o6,u6,x6,C6,g6,v6,OV,pA,uA]);class D6 extends JY{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","maskShape","reverse","outlineMargin","outlinePadding","indicatorSmartInvert","liquidBackground","liquidOutline"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class E6 extends qY{constructor(){super(...arguments),this.transformerConstructor=D6,this.type="liquid",this.seriesType=t.SeriesTypeEnum.liquid}}E6.type="liquid",E6.seriesType=t.SeriesTypeEnum.liquid,E6.transformerConstructor=D6;class B6 extends JY{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","circle","overlap","overlapLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class P6 extends qY{constructor(){super(...arguments),this.transformerConstructor=B6,this.type="venn",this.seriesType=t.SeriesTypeEnum.venn}}P6.type="venn",P6.seriesType=t.SeriesTypeEnum.venn,P6.transformerConstructor=B6;class R6 extends QY{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar","bandWidthField"])}transformSpec(t){super.transformSpec(t),wU(t)}_setDefaultXAxisSpec(t){return{orient:"bottom",type:"linear",label:{visible:!1}}}_setDefaultYAxisSpec(t){return{orient:"left",type:"linear"}}}class L6 extends qY{constructor(){super(...arguments),this.transformerConstructor=R6,this.type="mosaic",this.seriesType=t.SeriesTypeEnum.mosaic,this.handleAfterStackRegion=(t,e)=>{t.getSeries().forEach((t=>{const i=t.getStackData(),s=t.getStackValue(),n=t.getStackValueField();i&&n&&(EN(e[s],n),BN(t,e[s]))}))}}_beforeInit(){this._dataSet&&iU(this._dataSet,"stackSplit",eX)}_initStack(){this._stack=new iX(this,{afterStackRegion:this.handleAfterStackRegion}),this._stack.init()}_setModelOption(){this._modelOption.getDimensionInfo=pX,this._modelOption.getDimensionInfoByValue=fX,this._modelOption.getRectByDimensionData=xX}}L6.type="mosaic",L6.seriesType=t.SeriesTypeEnum.mosaic,L6.transformerConstructor=R6;const I6=(e="chart",i,s)=>{var n,a,o,l,h,c,u,d,p,g,f;const m={modelInfo:[]};if("chart"===e)m.isChart=!0,m.modelInfo.push({spec:i,type:"chart"});else if("region"===e)m.modelType="region",m.specKey="region",null===(n=i.region)||void 0===n||n.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===e)m.modelType="series",m.specKey="series",null===(a=i.series)||void 0===a||a.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(t.SeriesTypeEnum).includes(e))m.modelType="series",m.specKey="series",m.type=e,null===(o=i.series)||void 0===o||o.forEach(((t,i)=>{t.type===e&&m.modelInfo.push({spec:t,specPath:["series",i],type:e})}));else if(Object.values(r).includes(e)){m.modelType="component",m.type=e,m.specKey=null===(l=wH.getComponentInKey(e))||void 0===l?void 0:l.specKey;const{specKey:t}=m,n=J(null!==(c=null===(h=s.component)||void 0===h?void 0:h[t])&&void 0!==c?c:[]);null===(d=J(null!==(u=i[t])&&void 0!==u?u:[]))||void 0===d||d.forEach(((t,i)=>{const s=n[i];s&&s.type===e?m.modelInfo.push(Object.assign(Object.assign({},s),{spec:t})):t&&!1===t.visible&&m.modelInfo.push({type:e,spec:t})}))}else{const t=wH.getComponents().filter((({cmp:t})=>t.specKey===e)).map((({cmp:t})=>t.type));if(t.length>0){m.modelType="component";const n=e;m.specKey=n;const r=J(null!==(g=null===(p=s.component)||void 0===p?void 0:p[n])&&void 0!==g?g:[]);J(null!==(f=i[n])&&void 0!==f?f:[]).forEach(((e,i)=>{const s=r[i];s&&t.includes(s.type)&&m.modelInfo.push(Object.assign(Object.assign({},s),{spec:e}))}))}}return m},O6=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:c,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=I6(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!d(e)||J(e).some((e=>u(e)?e(t,i,s):AH(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=TH({},i),m=u(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:TH(f,m),hasChanged:!0};const i=TH({},t,m);kH(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);b(f[c])?f[c].push(t):d(f[c])?f[c]="component"===h?t:[t]:f[c]=[f[c],t]}return{chartSpec:f,hasChanged:!0}};class F6 extends kG{constructor(){super(F6.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[F6.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[F6.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=MH(this._option.globalInstance.getSpec(),["data",F6.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=MH(this._baseChartSpec,["data",F6.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(g(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(g(t.minHeight)&&e.height<t.minHeight)return!1;break;case"maxWidth":if(g(t.maxWidth)&&e.width>t.maxWidth)return!1;break;case"minWidth":if(g(t.minWidth)&&e.width<t.minWidth)return!1;break;case"onResize":if(g(t.onResize)&&!t.onResize(e,i))return!1}return!0})(t.query,this._currentMediaInfo,e);return{isActive:i,hasChanged:i!==this.currentActiveItems.has(t)}}_apply(t,e,i){const{query:s,action:n}=t;let r=!1;return J(n).forEach((t=>{const n=O6(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=MH(i,["data",F6.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}F6.pluginType="chart",F6.specKey="media",F6.type="MediaQueryPlugin";class z6 extends kG{constructor(){super(z6.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[z6.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=I$(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom<this._maxZoom))return;n=this._maxZoom}if(n===s)return;const r=n/s;if(this._zoom=n,i.resize(i.getCurrentSize().width*this._zoom,i.getCurrentSize().height*this._zoom),e&&this._container){const{scrollLeft:t,scrollTop:i}=this._container;this._container.scrollLeft=t+e.x*(r-1),this._container.scrollTop=i+e.y*(r-1)}}release(){this._container&&this._triggerEvent&&this._container.removeEventListener(this._triggerEvent,this._onWheel)}}z6.specKey="resizeZoom",z6.type="ChartResizeZoomPlugin";class j6{constructor(t,e,i,s,n){this.state=t,this.graphics=e,this.config=i||[],this.beforeExecute=s,this.afterExecute=n}execute(t,e){if(!this.graphics.length||!this.config.length)return void(null==e||e());this.beforeExecute&&this.beforeExecute(this.graphics);let i=0;const s=this.graphics.length,n=()=>{i++,i>=s&&(this.afterExecute&&this.afterExecute(this.graphics),null==e||e())};this.graphics.forEach((t=>{if(!t)return void i++;"exit"===this.state&&(t.isExiting=!0);const e=this.config.length>1?this.config.map((e=>({name:this.state,animation:Object.assign(Object.assign({},e),{customParameters:t.context})}))):{name:this.state,animation:Object.assign(Object.assign({},this.config[0]),{customParameters:t.context})};t.applyAnimationState([this.state],[e],n)}))}executeOnGroup(t,e){if(!this.graphics.length||!this.config.length||!t)return void(null==e||e());this.beforeExecute&&this.beforeExecute(this.graphics);const i=this.config[0],s=[{name:this.state,animation:Object.assign({},i)}];s.forEach((t=>{t.animation.customParameters=(t,e)=>e.context})),t.applyAnimationState([this.state],s,(()=>{this.afterExecute&&this.afterExecute(this.graphics),null==e||e()}))}}class H6{constructor(){this.name="verticalBarSplit"}shouldApply(t,e){var i,s;const n="rect"===t.type,r="vertical"===(null===(i=t.model)||void 0===i?void 0:i.direction),a=(null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||{};return n&&r&&("x"in a||"width"in a||"x1"in a)&&("y"in a||"height"in a||"y1"in a)}split(t,e){var i;const s=(null===(i=e.context)||void 0===i?void 0:i.diffAttrs)||{},n={},r={};Object.entries(s).forEach((([t,e])=>{"x"===t||"width"===t||"x1"===t?n[t]=e:"y"===t||"height"===t||"y1"===t?r[t]=e:n[t]=e}));const a=e.context,o=a.fieldX,l=a.originalFieldX,h=Array.isArray(o)&&o.length>1,c=(l?!(Array.isArray(l)&&l.length>1):!h)&&h;return[{attrs:n,order:c?1:2},{attrs:r,order:c?2:1}]}}class N6{constructor(){this.name="horizontalBarSplit"}shouldApply(t,e){var i,s;const n="rect"===t.type,r="horizontal"===(null===(i=t.model)||void 0===i?void 0:i.direction),a=(null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||{};return n&&r&&("y"in a||"height"in a||"y1"in a)&&("x"in a||"width"in a||"x1"in a)}split(t,e){var i;const s=(null===(i=e.context)||void 0===i?void 0:i.diffAttrs)||{},n={},r={};Object.entries(s).forEach((([t,e])=>{"y"===t||"height"===t||"y1"===t?n[t]=e:"x"===t||"width"===t||"x1"===t?r[t]=e:n[t]=e}));const a=e.context,o=a.fieldY,l=a.originalFieldY,h=Array.isArray(o)&&o.length>1,c=!(l?!(Array.isArray(l)&&l.length>1):!h)&&!h;return[{attrs:n,order:c?2:1},{attrs:r,order:c?1:2}]}}class U6{constructor(t){this.splitStrategies=[],this.mark=t,"rect"===t.type&&(this.registerStrategy(new H6),this.registerStrategy(new N6))}registerStrategy(t){this.splitStrategies.push(t)}detect(t,e){const i=[],s=[],n=[],r=[],a=this.mark.model.fieldX,o=this.mark.model.fieldY;return t.forEach((t=>{const e=t.context;e.fieldX&&(e.originalFieldX=e.fieldX),e.fieldY&&(e.originalFieldY=e.fieldY),e.fieldX=a,e.fieldY=o;switch(t.context.animationState){case"update":s.push(t);break;case"enter":n.push(t);break;case"appear":r.push(t);break;default:t.context.diffState===JU.exit?i.push(t):t.context.diffState===JU.enter?n.push(t):s.push(t)}})),e.size>t.length&&e.forEach(((t,e)=>{t.context.diffState!==JU.exit||t.isExiting||i.push(t)})),{hasExit:i.length>0,hasUpdate:s.length>0,hasEnter:n.length>0,hasAppear:r.length>0,exitGraphics:i,updateGraphics:s,enterGraphics:n,appearGraphics:r}}createPlanners(t,e){const i=[];if(t.hasExit&&e.exit&&i.push(new j6("exit",t.exitGraphics,e.exit)),t.hasUpdate&&e.update){const s=new Map,n=[];t.updateGraphics.forEach((t=>{let e=!1;for(const i of this.splitStrategies)if(i.shouldApply(this.mark,t)){const n=i.split(this.mark,t),r={graphic:t,steps:n};n.forEach((t=>{const{order:e}=t;s.has(e)||s.set(e,[]),s.get(e).push(r)})),e=!0;break}e||n.push(t)})),n.length>0&&i.push(new j6("update",n,e.update));const r=Array.from(s.keys()).sort(((t,e)=>t-e));r.forEach((t=>{const n=s.get(t);if(n&&n.length>0){const s=n.map((({graphic:e,steps:i})=>{const s=i.find((e=>e.order===t));return{graphic:e,attrs:(null==s?void 0:s.attrs)||{}}}));i.push(new j6("update",s.map((t=>t.graphic)),e.update,(t=>{t.forEach(((t,e)=>{const i=s[e].attrs,n=t.context;n._originalDiffAttrs||(n._originalDiffAttrs=t.context.diffAttrs),t.context.diffAttrs=i}))}),(e=>{t===r[r.length-1]&&e.forEach((t=>{const e=t.context;e._originalDiffAttrs&&(t.context.diffAttrs=e._originalDiffAttrs,delete e._originalDiffAttrs)}))})))}}))}return t.hasEnter&&e.enter&&i.push(new j6("enter",t.enterGraphics,e.enter)),t.hasAppear&&e.appear&&i.push(new j6("appear",t.appearGraphics,e.appear)),i}}class V6{registerAnimationSplitStrategy(t){this._grammarDetector||(this._grammarDetector=new U6(this)),this._grammarDetector.registerStrategy(t)}getGrammarDetector(){return this.initGrammarDetector(),this._grammarDetector}initGrammarDetector(){this._grammarDetector||(this._grammarDetector=new U6(this))}_runSequentialAnimations(t){this.initGrammarDetector();const e=this.getAnimationConfig(),i=this._grammarDetector.detect(t,this._graphicMap),s=this._grammarDetector.createPlanners(i,e);this._executePlanners(s,0)}_executePlanners(t,e){if(e>=t.length)return;const i=t[e];i.execute(this._product,(()=>{this._executePlanners(t,e+1),"exit"===i.state&&i.graphics.forEach((t=>{t.isExiting&&(this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release&&t.release())}))}))}}t.AABBBounds=ns,t.ACustomAnimate=cR,t.AbstractComponent=BA,t.AnimateExecutor=QP,t.ArcMark=fq,t.AreaChart=XX,t.AreaMark=zX,t.AreaSeries=WX,t.AxisSyncPlugin=CG,t.BandAxisMixin=SY,t.BarChart=u$,t.BarChartSpecTransformer=c$,t.BarSeries=l$,t.BarSeriesSpecTransformer=o$,t.BaseArcMark=gq,t.BaseChart=qY,t.BaseChartSpecTransformer=JY,t.BaseComponent=qG,t.BaseComponentSpecTransformer=KG,t.BaseHistogramChart=Y2,t.BaseMark=dV,t.BasePieChart=D2,t.BasePieChartSpecTransformer=w2,t.BasePieSeries=bq,t.BasePlugin=kG,t.BasePolygonMark=p0,t.BaseSeries=jW,t.BaseSeriesSpecTransformer=zW,t.BaseSeriesTooltipHelper=cW,t.BaseWordCloudChart=s3,t.BaseWordCloudChartSpecTransformer=i3,t.BaseWordCloudSeries=BZ,t.Bounds=ss,t.BoxPlotChart=D3,t.BoxPlotSeries=jK,t.Brush=y8,t.CanvasTooltipHandler=Z8,t.CartesianAxis=aY,t.CartesianBandAxis=kY,t.CartesianChartSpecTransformer=QY,t.CartesianCrossHair=A5,t.CartesianLinearAxis=bY,t.CartesianLogAxis=wY,t.CartesianMarkArea=N4,t.CartesianMarkLine=R4,t.CartesianMarkPoint=c8,t.CartesianSeries=VW,t.CartesianSymlogAxis=EY,t.CartesianTimeAxis=MY,t.ChartResizeZoomPlugin=z6,t.CirclePackingChart=b3,t.CirclePackingLayout=JZ,t.CirclePackingSeries=U0,t.CircularProgressChart=Z2,t.CircularProgressSeries=gZ,t.Color=_s,t.ColorUtil=ks,t.CommonChart=H2,t.CommonChartSpecTransformer=j2,t.CompilableData=oV,t.ComponentMark=QG,t.ContinuousLegend=r5,t.CorrelationChart=N3,t.CorrelationSeries=Z1,t.CustomMark=b8,t.DAY=Ls,t.DEFAULT_ANIMATION_CONFIG=CV,t.DEFAULT_CHART_HEIGHT=QH,t.DEFAULT_CHART_WIDTH=JH,t.DEFAULT_CLOSE_STROKE_JOIN=JV,t.DEFAULT_COLORS=ps,t.DEFAULT_DATA_INDEX=eN,t.DEFAULT_DATA_KEY=iN,t.DEFAULT_DATA_SERIES_FIELD=sN,t.DEFAULT_KEY=SN,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=ZV,t.DEFAULT_MAP_LOOK_UP_KEY=AN,t.DEFAULT_MEASURE_CANVAS_ID=tN,t.DEFAULT_SERIES_STYLE_NAME=nN,t.DEFAULT_SMOOTH_INTERPOLATE=qV,t.DataSet=Mh,t.DataView=Th,t.DataZoom=N5,t.DimensionClickEvent=JW,t.DimensionHoverEvent=nG,t.DiscreteLegend=X3,t.DomTooltipHandler=G8,t.DotSeries=tZ,t.ElementHighlight=VV,t.ElementSelect=YV,t.Event=YN,t.EventEmitter=l,t.Factory=wH,t.FormatSpecifier=er,t.FormatterPlugin=s6,t.FunnelChart=l3,t.FunnelChartSpecTransformer=o3,t.FunnelSeries=y0,t.FunnelSeriesSpecTransformer=v0,t.GaugeChart=t3,t.GaugePointerSeries=T1,t.GaugeSeries=E1,t.GeoCoordinate=j$,t.GeoMarkPoint=g8,t.GeoSeries=M$,t.GlyphMark=AK,t.GraphicUtil=class t{constructor(t){this.canvas=t,t&&(this.ctx=t.getContext("2d"))}setCanvas(t){this.canvas=t,t&&(this.ctx=t.getContext("2d"))}measureText(t){return this.canvas?this.measureTextByCanvas(t):(console.warn("[warn] no canvas, measureText might be not accurate"),this.estimate(t))}measureTextByCanvas(t){return this.ctx?(this.ctx.font=function({fontStyle:t,fontVariant:e,fontWeight:i,fontSize:s,fontFamily:n}){return(t?t+" ":"")+(e?e+" ":"")+(i?i+" ":"")+(s||12)+"px "+(n||"sans-serif")}(t),{width:this.ctx.measureText(t.text).width,height:t.fontSize}):(console.error("[error!!!]measureTextByCanvas can not be called without canvas"),{width:-1,height:t.fontSize})}estimate({text:t,fontSize:e}){let i=0,s=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?i++:s++;return{width:~~(.8*i*e+s*e),height:e}}static getDefaultUtils(e){return t.instance||(t.instance=new t(e)),t.instance}},t.GridLayout=S8,t.GroupMark=gV,t.HOUR=Rs,t.HashTable=class{constructor(){this.items={},this.itemList=[]}get type(){return"xhHashTable"}set(t,e){const i=new _e;i.key=t,i.value=e;let s=this.itemList.length;return this.has(t)&&(s=this.items[t].index),i.index=s,this.itemList[s]=i,this.items[t]=i,i}clear(){this.items={},this.itemList=[]}del(t){if(this.has(t)){const e=this.items[t].index;e>-1&&this.itemList.splice(e,1),delete this.items[t],this.resetIndex()}}delFrom(t){for(let e=t+1;e<this.count();e++){const t=this.itemList[e].key;delete this.items[t]}this.itemList.splice(t+1,this.count()-t),this.resetIndex()}resetIndex(){this.foreachHashv(((t,e)=>{const i=this.itemList.indexOf(e);this.items[t].index=i}))}has(t){return t in this.items}get(t){return this.has(t)?this.items[t].value:null}count(){return this.itemList.length}all(){return this.itemList.map((t=>t.value))}first(){return this.itemList[0].value}last(){return this.itemList[this.itemList.length-1].value}getByIndex(t){return this.itemList[t].value}getKeyByIndex(t){return this.itemList[t].key}foreach(t){for(const e in this.items)if(!1===t(e,this.items[e].value))return!1;return!0}foreachHashv(t){for(const e in this.items)if(!1===t(e,this.items[e]))return!1;return!0}hasValue(t){for(const e in this.items)if(this.items[e].value===t)return!0;return!1}indexOf(t){return this.has(t)?this.items[t].index:-1}insertAt(t,e,i){const s=new _e;s.index=t,s.key=i,s.value=e,this.itemList.splice(t,0,s),this.items[i]=s,this.resetIndex()}sort(t){return this.itemList.sort(((e,i)=>t(e.value,i.value)))}toArray(){return this.itemList.slice(0,this.itemList.length).map((t=>t.value))}push(t){t.foreach(((t,e)=>{this.set(t,e)}))}mapKey(){const t=[];for(const e in this.items)t.push(e);return t}toImmutableMap(){}},t.HashValue=_e,t.HeatmapChart=z3,t.HeatmapSeries=F1,t.HistogramChart=$2,t.HistogramChartSpecTransformer=X2,t.ImageCloudGridLayout=qQ,t.ImageCloudSpiralLayout=GQ,t.ImageCloudStackLayout=ZQ,t.ImageMark=M6,t.Indicator=K5,t.LRU=ls,t.Label=s8,t.Layout=ZU,t.LineChart=IX,t.LineMark=dG,t.LineSeries=GY,t.LinearAxisMixin=fY,t.LinearProgressChart=u3,t.LinearProgressSeries=xZ,t.LinkSeries=rZ,t.LiquidChart=E6,t.LiquidSeries=l2,t.Logger=gt,t.MINUTE=6e4,t.MONTH=26784e5,t.MOSAIC_CAT_END_PERCENT=_N,t.MOSAIC_CAT_START_PERCENT=yN,t.MOSAIC_VALUE_END_PERCENT=vN,t.MOSAIC_VALUE_START_PERCENT=mN,t.ManualTicker=class extends KP{constructor(t){super(t),this.lastFrameTime=0,this.status=wc.RUNNING}setupTickHandler(){const t=new qP;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===wc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wc.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wc.RUNNING,!0}},t.MapChart=A2,t.MapSeries=U$,t.MarkPoint=Dz,t.Matrix=as,t.MediaQuery=F6,t.MosaicChart=L6,t.MosaicSeries=b2,t.NEWTON_ITERATIONS=4,t.NEWTON_MIN_SLOPE=.001,t.NumberUtil=rr,t.OBBBounds=rs,t.PREFIX=ZH,t.PathMark=D$,t.PieChart=E2,t.PieSeries=xq,t.PieSeriesSpecTransformer=yq,t.Player=Z4,t.Point=Ge,t.PointService=Ye,t.PolarAxis=Pq,t.PolarBandAxis=Fq,t.PolarCrossHair=C5,t.PolarLinearAxis=Iq,t.PolarMarkArea=V4,t.PolarMarkLine=I4,t.PolarMarkPoint=d8,t.PolarPoint=Xe,t.PolarSeries=nq,t.PolygonMark=g0,t.ProgressLikeSeries=lZ,t.RGB=bs,t.RadarChart=F2,t.RadarSeries=$q,t.RangeAreaChart=I3,t.RangeAreaSeries=iq,t.RangeColumnChart=g3,t.RangeColumnSeries=qK,t.RangeColumnSeriesSpecTransformer=KK,t.RectMark=i$,t.RippleMark=X1,t.RoseChart=L2,t.RoseLikeSeries=Dq,t.RoseSeries=jq,t.RotateBySphereAnimate=class extends cR{onBind(){super.onBind(),this.propKeys=["x","y","z","alpha","zIndex"]}onFirstRun(){super.onFirstRun();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t)}onStart(){super.onStart();const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.finalAttribute.x,s=this.target.finalAttribute.y,n=this.target.finalAttribute.z,r=Math.acos((s-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));n-t.z<0&&(a=ke-a),this.theta=a,this.phi=r}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const s=this.target,{center:n,r:r,cb:a}="function"==typeof this.params?this.params():this.params,o=2*Math.PI*e,l=this.theta+o,h=this.phi,c=r*Math.sin(h)*Math.cos(l)+n.x,u=r*Math.cos(h)+n.y,d=r*Math.sin(h)*Math.sin(l)+n.z;for(s.attribute.x=c,s.attribute.y=u,s.attribute.z=d,s.attribute.alpha=l+xe/2;s.attribute.alpha>ke;)s.attribute.alpha-=ke;s.attribute.alpha=ke-s.attribute.alpha,s.attribute.zIndex=-1e4*s.attribute.z,a&&a(i)}},t.RuleMark=J$,t.SECOND=1e3,t.SEGMENT_FIELD_END=xN,t.SEGMENT_FIELD_START=bN,t.SMALL=Wn,t.STACK_FIELD_END=oN,t.STACK_FIELD_END_OffsetSilhouette=uN,t.STACK_FIELD_END_PERCENT=hN,t.STACK_FIELD_KEY=rN,t.STACK_FIELD_START=aN,t.STACK_FIELD_START_OffsetSilhouette=cN,t.STACK_FIELD_START_PERCENT=lN,t.STACK_FIELD_TOTAL=dN,t.STACK_FIELD_TOTAL_BOTTOM=fN,t.STACK_FIELD_TOTAL_PERCENT=pN,t.STACK_FIELD_TOTAL_TOP=gN,t.SUBDIVISION_MAX_ITERATIONS=10,t.SUBDIVISION_PRECISION=1e-7,t.SankeyChart=P3,t.SankeyLayout=oJ,t.SankeySeries=o1,t.ScatterChart=k$,t.ScatterSeries=x$,t.ScrollBar=W5,t.Segment=eP,t.SequenceChart=V2,t.Stack=iX,t.StackChartMixin=sX,t.StreamLight=XL,t.SunburstChart=v3,t.SunburstLayout=dJ,t.SunburstSeries=O0,t.SymbolMark=gG,t.TextMark=NK,t.TextMeasure=Ji,t.ThemeManager=WH,t.TimeUtil=Zn,t.Title=F4,t.Tooltip=m5,t.TotalLabel=r8,t.TreeLayout=AJ,t.TreemapChart=A3,t.TreemapLayout=TJ,t.TreemapSeries=v1,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=KV,t.VennChart=P6,t.VennSeries=y2,t.WaterfallChart=M3,t.WaterfallSeries=vK,t.WordCloudChart=n3,t.WordCloudSeries=JQ,t.WordcloudCloudLayout=ZJ,t.WordcloudFastLayout=fQ,t.WordcloudGridLayout=gQ,t.YEAR=31536e6,t.aabbSeparation=ts,t.abs=Ce,t.acos=Re,t.alternatingWave=function(t,e,i,s,n,r,a,o=0,l=1){const h=e/s,c=i/n,u=o+l*(Math.sin(2*r*Math.PI-2*h*Math.PI)*Math.sin(2*r*Math.PI-2*c*Math.PI)+1)/2;return Math.min(1,Math.max(0,u))},t.animationConfig=EW,t.array=J,t.arrayEqual=st,t.ascending=lt,t.asin=Le,t.atan2=Me,t.barGrowIn=qX,t.barGrowOut=ZX,t.barPresetAnimation=t$,t.baseMerge=z,t.baseSeriesMark=SW,t.binaryFuzzySearch=vt,t.binaryFuzzySearchInNumberRange=yt,t.bisect=ft,t.boundsInRect=pH,t.builtinThemes=RH,t.calcLayoutNumber=uH,t.calcPadding=dH,t.calculateAnchorOfArc=(t,e)=>{const{startAngle:i,endAngle:s,innerRadius:n,outerRadius:r}=t;let a=(i+s)/2,o=(n+r)/2;switch(e){case"inner-start":a=i,o=n;break;case"outer-start":a=i,o=r;break;case"inner-end":a=s,o=n;break;case"outer-end":a=s,o=r;break;case"inner-middle":o=n;break;case"outer-middle":o=r}return{angle:a,radius:o}},t.calculateAnchorOfBounds=Qi,t.calculateMaxRadius=ri,t.calculateNodeValue=RZ,t.cartesianToPolar=ei,t.centerToCorner=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=n/2,u=Math.sqrt(Math.pow((e-h)/h,2)+Math.pow((i-c)/c,2)),d=1-Math.min(u,1),p=o+l*(Math.sin(2*r*Math.PI-2*d*Math.PI)+1)/2;return Math.min(1,Math.max(0,p))},t.circleArea=Xn,t.circleCircleIntersection=Kn,t.circleOverlap=$n,t.circlePackingTransform=(t,e)=>{const i=new JZ(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return OZ(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},t.clamp=It,t.clampAngleByDegree=Qe,t.clampAngleByRadian=Ze,t.clampDegree=Je,t.clampRadian=qe,t.clampRange=Ot,t.clamper=Ft,t.clone=function(t,e=!1,i=0,s=void 0){const n=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,a){if(null===i)return null;if(0===a)return i;let o;if("object"!=typeof i)return i;if(b(i)?o=[]:T(i)?(o=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(o.lastIndex=i.lastIndex)):o=S(i)?new Date(i.getTime()):void 0===s?Object.create(Object.getPrototypeOf(i)):Object.create(s),e){const t=n.indexOf(i);if(-1!==t)return r[t];n.push(i),r.push(o)}for(const e in i)o[e]=t(i[e],a-1);return o}(t,i)},t.cloneDeep=F,t.columnCenterToEdge=function(t,e,i,s,n,r,a,o=0,l=1){const h=n/2,c=Math.abs(i-h)/h,u=o+l*(Math.sin(2*r*Math.PI-2*c*Math.PI)+1)/2;return Math.min(1,Math.max(0,u))},t.columnEdgeToCenter=function(t,e,i,s,n,r,a,o=0,l=1){const h=n/2,c=1-Math.abs(i-h)/h,u=o+l*(Math.sin(2*r*Math.PI-2*c*Math.PI)+1)/2;return Math.min(1,Math.max(0,u))},t.columnLeftToRight=function(t,e,i,s,n,r,a,o=0,l=1){const h=i/n,c=o+l*(Math.sin(2*r*Math.PI-2*h*Math.PI)+1)/2;return Math.min(1,Math.max(0,c))},t.columnRightToLeft=function(t,e,i,s,n,r,a,o=0,l=1){const h=(n-1-i)/n,c=o+l*(Math.sin(2*r*Math.PI-2*h*Math.PI)+1)/2;return Math.min(1,Math.max(0,c))},t.computeActualDataScheme=$j,t.computeQuadrant=ai,t.conjugateGradient=mr,t.constant=Dt,t.containedInCircles=Yn,t.convertPoint=fH,t.cornerToCenter=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=n/2,u=Math.sqrt(Math.pow((e-h)/h,2)+Math.pow((i-c)/c,2)),d=Math.min(u,1),p=o+l*(Math.sin(2*r*Math.PI-2*d*Math.PI)+1)/2;return Math.min(1,Math.max(0,p))},t.cos=Te,t.createArc=oy,t.createArc3d=hy,t.createArea=ny,t.createGroup=Bm,t.createImage=Gv,t.createLine=Ev,t.createPath=ey,t.createPyramid3d=gy,t.createRect=Lv,t.createRect3d=Fv,t.createRichText=Jv,t.createScale=sH,t.createScaleWithSpec=nH,t.createSymbol=Tv,t.createText=kv,t.crossProduct=Fe,t.crossProductPoint=ze,t.darkTheme=SH,t.dataScheme=vH,t.dateGetterName=ws,t.dateSetterName=function(t){return t?"setUTCDate":"setDate"},t.dayCount=Qs,t.dayField=tn,t.dayFloor=Zs,t.dayOffset=Js,t.debounce=jt,t.default=KV,t.defaultThemeName=LH,t.defaults=q,t.degreeToRadian=$e,t.destination=function(t,e,i,s={}){const n=$e(t[0]),r=$e(t[1]),a=$e(i),o=function(t,e){void 0===e&&(e="kilometers");var i=Nn[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Ke(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Ke(l)}},t.deviation=function(t,e){const i=_t(t,e);return i?Math.sqrt(i):i},t.diagonalCenterToEdge=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=n/2,u=Math.sqrt(Math.pow((e-h)/s,2)+Math.pow((i-c)/n,2)),d=o+l*(Math.sin(2*r*Math.PI-2*u*Math.PI)+1)/2;return Math.min(1,Math.max(0,d))},t.diagonalTopLeftToBottomRight=function(t,e,i,s,n,r,a,o=0,l=1){const h=(e/s+i/n)/2,c=o+l*(Math.sin(2*r*Math.PI-2*h*Math.PI)+1)/2;return Math.min(1,Math.max(0,c))},t.dotProduct=je,t.drawCardioid=hQ,t.drawRegularPolygon=lQ,t.eachAfter=IZ,t.eachBefore=LZ,t.eastAsianCharacterInfo=Ki,t.ecdf=function(t){const e=t.length,i=t.slice().sort(((t,e)=>t-e));function s(t){if(0===e)return 0;let s=0,n=e;for(;s<n;){const e=s+n>>>1;i[e]<=t?s=e+1:n=e}return s/e}return{evaluate:function(t){if(Array.isArray(t)){const e=[];for(let i=0;i<t.length;i++)e.push(s(t[i]));return e}return s(t)},evaluateGrid:function(t){const n=[];if(t<=0)return n;if(0===e)return n;const r=i[0],a=i[e-1];if(r===a){for(let e=0;e<t;e++)n.push({x:r,y:1});return n}const o=(a-r)/(t-1);for(let e=0;e<t;e++){const i=e===t-1?a:r+o*e;n.push({x:i,y:s(i)})}return n},n:e}},t.epanechnikov=t=>Math.abs(t)<=1?.75*(1-t*t):0,t.epsilon=be,t.exponent=or,t.extent=oe,t.fakeRandom=te,t.field=se,t.findBoundaryAngles=ni,t.findMarkGraphic=WN,t.findZeroOfFunction=mt,t.fixPrecision=Ne,t.flattenArray=at,t.flattenNodes=OZ,t.flattenTreeLinks=pJ,t.formatLinkPath=(t,e=!0)=>{var i;return d(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.vertical)?t.map((t=>{const i=t.thickness/2;let s=t.x0,n=t.x1,r=(s+n)/2,a=t.y0-i,o=t.y0+i,l=t.y1-i,h=t.y1+i;return e&&(s=Math.round(s),n=Math.round(n),r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h)),Object.assign({},t,{path:`\n M${s},${a}\n C${r},${a},${r},${l},${n},${l}\n L${n},${h}\n C${r},${h},${r},${o},${s},${o}\n Z`})})):t.map((t=>{const i=t.thickness/2;let s=t.y0,n=t.y1,r=(s+n)/2,a=t.x0-i,o=t.x0+i,l=t.x1-i,h=t.x1+i;return e&&(s=Math.round(s),n=Math.round(n),r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h)),Object.assign({},t,{path:`\n M${a},${s}\n C${a},${r},${l},${r},${l},${n}\n L${h},${n}\n C${h},${r},${o},${r},${o},${s}\n Z\n `})}))},t.formatLinkPolygon=t=>{var e;return d(null===(e=null==t?void 0:t[0])||void 0===e?void 0:e.vertical)?t.map((t=>{const e=t.thickness/2,i=[{x:t.x0,y:t.y0-e},{x:t.x1,y:t.y1-e},{x:t.x1,y:t.y1+e},{x:t.x0,y:t.y0+e}];return Object.assign({},t,{points:i})})):t.map((t=>{const e=t.thickness/2,i=[{x:t.x0-e,y:t.y0},{x:t.x1-e,y:t.y1},{x:t.x1+e,y:t.y1},{x:t.x0+e,y:t.y0}];return Object.assign({},t,{points:i})}))},t.formatNodeRect=t=>t.map((t=>Object.assign({},t,{x:t.x0,y:t.y0,width:t.x1-t.x0,height:t.y1-t.y0}))),t.formatNumerals=lr,t.formatSpecifier=sr,t.formatTypes=ar,t.fullYearGetterName=Ms,t.fullYearSetterName=function(t){return t?"setUTCFullYear":"setFullYear"},t.functionTransform=KH,t.fuzzyEqualNumber=function(t,e){return Ce(t-e)<1e-12},t.fuzzyEqualVec=He,t.gaussian=me,t.gemv=function(t,e,i){for(let s=0;s<t.length;++s)t[s]=je(e[s],i)},t.generateCardioidPoints=oQ,t.generateCeil=En,t.generateCount=Bn,t.generateIsEmptyPixel=sQ,t.generateMaskCanvas=nQ,t.generatePoints=aQ,t.generateStepInterval=(t,{floor:e,offset:i,field:s,count:n})=>{const r=Math.floor(t);if(!Number.isFinite(r)||r<=0)return null;if(r<=1)return{floor:e,offset:i,ceil:En(e,i)};const a=Bn(e,n),o=s?t=>s(t)%r==0:t=>a(0,t)%r==0,l=t=>{if(!Number.isNaN(+t))for(e(t);!o(t);)t.setTime(+t-1),e(t);return t},h=(t,e)=>{if(!Number.isNaN(+t))if(r<0)for(;++e<=0;)for(i(t,-1);!o(t);)i(t,-1);else for(;--e>=0;)for(i(t,1);!o(t);)i(t,1);return t};return{floor:l,offset:h,ceil:En(l,h)}},t.get=L,t.getAABBFromPoints=function(t){return xi=1/0,Si=1/0,Ai=-1/0,ki=-1/0,t.forEach((t=>{xi>t.x&&(xi=t.x),Ai<t.x&&(Ai=t.x),Si>t.y&&(Si=t.y),ki<t.y&&(ki=t.y)})),{x1:xi,y1:Si,x2:Ai,y2:ki}},t.getActualColor=qj,t.getActualNumValue=mH,t.getAlignEndTexts=(t,e=0)=>lJ(t[0])?t.map((t=>({y:t.y1-e,x:(t.x0+t.x1)/2,datum:t.datum,key:t.key}))):t.map((t=>({x:t.x0-e,y:(t.y0+t.y1)/2,datum:t.datum,key:t.key}))),t.getAlignStartTexts=(t,e=0)=>lJ(t[0])?t.map((t=>({y:t.y1,x:(t.x0+t.x1)/2,datum:t.datum,key:t.key}))):t.map((t=>({x:t.x1,y:(t.y0+t.y1)/2,datum:t.datum,key:t.key}))),t.getAngleByPoint=ii,t.getArcsFromCircles=zJ,t.getArcsFromPath=t=>{const e=[],i=t.split("A"),s=i[0];let n=s.indexOf(",");for(e.push({p1:{x:+s.slice(1,n),y:+s.slice(n+1)}}),n=1;n<i.length;n++){const t=i[n].split(",");e[n-1].radius=+t[0];const s=+t[2].slice(2),r=+t[3].split(" ")[0];e[n-1].p2={x:s,y:r},e[n-1].largeArcFlag="1"===t[1][t[1].length-1],n<i.length-1&&e.push({p1:{x:s,y:r}})}return e},t.getBoundsOfNodes=t=>{let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{e=Math.min(t.x0,e),i=Math.max(t.x1,i),s=Math.min(t.y0,s),n=Math.max(t.y1,n)})),{x0:e,x1:i,y0:s,y1:n,width:i-e,height:n-s}},t.getCartesianCrosshairRect=xX,t.getCartesianDimensionInfo=pX,t.getCenter=qn,t.getCirclesFromArcs=HJ,t.getColorSchemeBySeries=tH,t.getCombinedSizeOfRegions=nY,t.getContainerSize=Pn,t.getContextFont=Zi,t.getDataScheme=Xj,t.getDatumOfGraphic=VN,t.getDecimalPlaces=Ue,t.getDiffAttributesOfGraphic=GN,t.getDimensionInfoByValue=fX,t.getElementAbsolutePosition=Rn,t.getElementRelativePosition=function(t,e){const i=Rn(t),s=Rn(e);return{x:i.x-s.x,y:i.y-s.y}},t.getFieldAlias=MN,t.getFormatFromValue=function(t,e){const i=Xt(t),s=i[Ts(e)]()+1,n=i[ws(e)](),r=i[Ds(e)](),a=i[Es(e)](),o=i[Bs(e)](),l=0===i[Ps(e)](),h=l&&0===o,c=h&&0===a,u=c&&0===r,d=u&&1===n;return d&&1===s?"YYYY":d?"YYYY-MM":u?"YYYY-MM-DD":c?"HH":h?"HH:mm":l?"HH:mm:ss":"HH:mm:ss SSS"},t.getFunnelTheme=BH,t.getGroupAnimationParams=UW,t.getIntersectPoint=hi,t.getIntervalOptions=(t,e)=>"year"===t&&e?{floor:js,offset:Hs,count:Ns,field:Us}:"month"===t&&e?{floor:Xs,offset:$s,count:Ks,field:qs}:"day"===t&&e?{floor:en,offset:sn,count:nn,field:rn}:"hour"===t&&e?{floor:cn,offset:un,count:ln,field:dn}:"minute"===t&&e?{floor:vn,offset:yn,count:fn,field:_n}:"second"===t&&e?{floor:kn,offset:Cn,count:Sn,field:Mn}:"year"===t?{floor:Is,offset:Os,count:Fs,field:zs}:"month"===t?{floor:Vs,offset:Ws,count:Gs,field:Ys}:"day"===t?{floor:Zs,offset:Js,count:Qs,field:tn}:"hour"===t?{floor:an,offset:on,count:ln,field:hn}:"minute"===t?{floor:pn,offset:gn,count:fn,field:mn}:"second"===t?{floor:bn,offset:xn,count:Sn,field:An}:{floor:Tn,offset:wn,count:Dn},t.getMaxRadiusAndCenter=GJ,t.getMergedTheme=UH,t.getOBBFromLine=function(t,e,i){return Ci=e.x-t.x,Mi=e.y-t.y,Ti=Mi,wi=-Ci,Bi=Di=Math.sqrt(Ti*Ti+wi*wi),Pi=i,Ti/=Di,wi/=Di,Ei=i/2,Ci=Ei*Ti,Mi=Ei*wi,{point1:{x:t.x+Ci,y:t.y+Mi},point2:{x:t.x-Ci,y:t.y-Mi},point3:{x:e.x+Ci,y:e.y+Mi},point4:{x:e.x-Ci,y:e.y-Mi},width:Bi,height:Pi,left:Math.min(t.x,e.x)-Math.abs(Ci),top:Math.min(t.y,e.y)-Math.abs(Mi)}},t.getPathFromArcs=jJ,t.getPolarDimensionInfo=R2,t.getRectIntersect=ci,t.getRegionStackGroup=TN,t.getScale=t=>t.offsetWidth>0?Ln(t):In(t),t.getScaleX=Ln,t.getScaleY=In,t.getScrollLeft=t=>{var e,i,s;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(s=null===(i=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===i?void 0:i.documentElement)||void 0===s?void 0:s.scrollLeft)||t.scrollLeft:"html"===t.tagName.toLowerCase()?0:t.scrollLeft},t.getScrollTop=t=>{var e,i,s;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(s=null===(i=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===i?void 0:i.documentElement)||void 0===s?void 0:s.scrollTop)||t.scrollTop:"html"===t.tagName.toLowerCase()?0:t.scrollTop},t.getShapeFunction=YJ,t.getSpecInfo=eW,t.getTheme=jH,t.getTimeFormatter=function(t,e){return i=>{const s=Xt(i),n=s[Ms(e)](),r=s[Ts(e)]()+1,a=Math.floor((r-1)/3)+1,o=s[ws(e)](),l=s["get"+(e?"UTC":"")+"Day"](),h=s[Ds(e)](),c=(h-1)%12+1,u=s[Es(e)](),d=s[Bs(e)](),p=s[Ps(e)]();return(t||"").replace(/YYYY/g,Pt(n+"",4,"0","left")).replace(/yyyy/g,n+"").replace(/yy/g,n%100+"").replace(/Q/g,a+"").replace(/MM/g,Pt(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,Pt(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,Pt(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,Pt(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,Pt(u,2,"0","left")).replace(/m/g,u+"").replace(/ss/g,Pt(d,2,"0","left")).replace(/s/g,d+"").replace(/SSS/g,Pt(p,3,"0","left")).replace(/S/g,p+"")}},t.getter=ee,t.graphicCreator=vy,t.halfPi=Se,t.has=O,t.hasParentElement=function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1},t.hasThemeMerged=FH,t.hexToRgb=xs,t.hourCount=ln,t.hourField=hn,t.hourFloor=an,t.hourOffset=on,t.hoursGetterName=Ds,t.hoursSetterName=function(t){return t?"setUTCHours":"setHours"},t.hslToRgb=hs,t.imagecloudTransform=(t,e,i)=>{var s,n;const r=u(t.size)?t.size():t.size;if(t.size=r,!r||d(r[0])||d(r[1])||r[0]<=0||r[1]<=0)return gt.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];if(t.size=[Math.ceil(r[0]),Math.ceil(r[1])],t.image||gt.getInstance().error("Imagecloud: image source must be specified."),t.onBeforeLayout&&t.onBeforeLayout(),!e||0===e.length)return[];let a;switch(null!==(n=null===(s=t.layoutConfig)||void 0===s?void 0:s.layoutMode)&&void 0!==n?n:"spiral"){case"grid":a=qQ;break;case"stack":a=ZQ;break;default:a=GQ}const o=new a(t);return o.layout(e),o.unfinished()?{progressive:o}:o.output()},t.interpolateDate=Vt,t.interpolateNumber=Nt,t.interpolateNumberRound=Ut,t.interpolateRgb=As,t.interpolateString=function(t,e){let i,s,n,r=Wt.lastIndex=Gt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=Wt.exec(t))&&(s=Gt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:Nt(i,s)})),r=Gt.lastIndex;return r<e.length&&(n=e.slice(r),o[a]?o[a]+=n:o[++a]=n),o.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(let i,s=0;s<e;++s)o[(i=l[s]).i]=i.x(t);return o.join("")})},t.intersectionArea=Gn,t.isArray=b,t.isArrayLike=x,t.isBase64=w,t.isBoolean=c,t.isCollectionMark=UN,t.isColorKey=Zj,t.isDate=S,t.isEmpty=R,t.isEqual=Y,t.isFunction=u,t.isGreater=Tt,t.isHTMLElement=jn,t.isIntersect=li,t.isLess=wt,t.isNil=d,t.isNull=p,t.isNumber=A,t.isNumberClose=Mt,t.isNumeric=k,t.isObject=f,t.isObjectLike=m,t.isPercent=hH,t.isPercentOffset=cH,t.isPlainObject=v,t.isPointInLine=Wi,t.isPointInPolygon=function(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===fi(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e<a.length;++e)for(let i=0;i<a[e].length;++i)if(Vi(a[e][i].map((t=>({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o},t.isPolarAxisSeries=HW,t.isProgressiveDataColorScheme=Jj,t.isRectIntersect=gi,t.isRegExp=T,t.isRotateAABBIntersect=bi,t.isShallowEqual=function(t,e){if(X(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;if(b(t)!==b(e))return!1;if($(t)!==$(e))return!1;let i=!0;return Object.keys(t).forEach((s=>!!X(t[s],e[s])||(i=!1,i))),i},t.isSpecValueWithScale=oH,t.isString=_,t.isTokenKey=_H,t.isType=h,t.isUndefined=y,t.isValid=g,t.isValidNumber=C,t.isValidOrient=lH,t.isValidUrl=M,t.isValueInScaleDomain=aH,t.isXAxis=WW,t.isYAxis=GW,t.isZAxis=YW,t.kde=function(t,e={}){const i=t.length,s=e.kernel||me;let n=e.bandwidth;if(!n||n<=0){const s=function(t){const e=t.length;if(0===e)return 0;let i=0;for(let s=0;s<e;s++)i+=t[s];i/=e;let s=0;for(let n=0;n<e;n++){const e=t[n]-i;s+=e*e}return Math.sqrt(s/e)}(t)||0,r=e.bandwidthMethod||"scott";n="silverman"===r?ye(i,s,1):ve(i,s,1)}if(!n||n<=0)return{bandwidth:0,kernel:s,evaluate:t=>{if(Array.isArray(t)){const e=[];for(let i=0;i<t.length;i++)e.push(0);return e}return 0},evaluateGrid:e=>{const s=[];if(e<=0)return s;let n=1/0,r=-1/0;for(let e=0;e<i;e++){const i=t[e];i<n&&(n=i),i>r&&(r=i)}if(n===1/0||r===-1/0){for(let t=0;t<e;t++)s.push({x:0,y:0});return s}for(let t=0;t<e;t++)s.push({x:n,y:0});return s}};const r=1/(i*n);function a(e){let a=0;for(let r=0;r<i;r++)a+=s((e-t[r])/n);return a*r}return{bandwidth:n,kernel:s,evaluate:function(t){if(Array.isArray(t)){const e=[];for(let i=0;i<t.length;i++)e.push(a(t[i]));return e}return a(t)},evaluateGrid(e){const s=[];if(e<=0)return s;let n=1/0,r=-1/0;for(let e=0;e<i;e++){const i=t[e];i<n&&(n=i),i>r&&(r=i)}if(n===1/0||r===-1/0)return s;if(n===r){for(let t=0;t<e;t++)s.push({x:n,y:a(n)});return s}const o=(r-n)/(e-1);for(let t=0;t<e;t++){const i=t===e-1?r:n+o*t;s.push({x:i,y:a(i)})}return s}}},t.keys=K,t.last=Q,t.lengthFromPointToLine=Oe,t.lightTheme=xH,t.lineIntersectPolygon=Ui,t.loadImage=LQ,t.loadImages=IQ,t.lookup=iW,t.lowerCamelCaseToMiddle=Fn,t.lowerFirst=Kt,t.max=we,t.maxInArray=et,t.measureText=qH,t.median=bt,t.memoize=Et,t.merge=N,t.mergeAABB=function(t){const e=[];return function t(i,s){const n=[];s.forEach((t=>{let e;(e=Ri(i,t)).length>1?n.push(t):i=e[0]})),e.push(i),n.length&&t(n[0],n.slice(1))}(t[0],t.slice(1)),e},t.mergeFields=kN,t.millisecondsCount=Dn,t.millisecondsFloor=Tn,t.millisecondsGetterName=Ps,t.millisecondsOffset=wn,t.millisecondsSetterName=function(t){return t?"setUTCMilliseconds":"setMilliseconds"},t.min=De,t.minInArray=it,t.minuteCount=fn,t.minuteField=mn,t.minuteFloor=pn,t.minuteOffset=gn,t.minutesGetterName=Es,t.minutesSetterName=function(t){return t?"setUTCMinutes":"setMinutes"},t.mixin=Z,t.monthCount=Gs,t.monthField=Ys,t.monthFloor=Vs,t.monthGetterName=Ts,t.monthOffset=Ws,t.monthSetterName=function(t){return t?"setUTCMonth":"setMonth"},t.nelderMead=gr,t.norm2=ur,t.normalTransform=os,t.normalizeAngle=si,t.normalizeLayoutPaddingSpec=gH,t.normalizePadding=Cs,t.numberSpecifierReg=ir,t.obbSeparation=es,t.ordinaryLeastSquares=ue,t.pad=Pt,t.parseUint8ToImageData=(t,e,i)=>{const s=new Uint8ClampedArray(t),n=new Uint8ClampedArray(t.length);for(let t=i-1;t>=0;t--)for(let r=0;r<e;r++){const a=t*e*4+4*r,o=(i-t)*e*4+4*r;n[o]=s[a],n[o+1]=s[a+1],n[o+2]=s[a+2],n[o+3]=s[a+3]}return new ImageData(n,e,i)},t.particleEffect=function(t,e,i,s,n,r,a,o=0,l=1){const h=e*n+i,c=2*UE(h,0)*Math.PI,u=.5*UE(h,1)+.5,d=2*UE(h,2)*Math.PI,p=s/2,g=n/2,f=Math.sqrt(Math.pow((e-p)/p,2)+Math.pow((i-g)/g,2)),m=Math.min(f,1),v=(r-.4)/.6,y=Math.sin(v*u*8*Math.PI+c+d*v),_=Math.cos(m*Math.PI+v*Math.PI),b=o+l*((y+1)/2*Math.max(0,1-1.2*v)*(.3+.7*_));return Math.min(1,Math.max(0,b))},t.pi=xe,t.pi2=ke,t.pick=function(t,e){if(!t||!v(t))return t;const i={};return e.forEach((e=>{U.call(t,e)&&(i[e]=t[e])})),i},t.pickWithout=V,t.pieDisappear=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:lq(t,!0,fU.exit)}),t.pieEnter=uq,t.pieExit=dq,t.piePresetAnimation=pq,t.pointAt=Ie,t.pointBetweenLine=Hi,t.pointInAABB=function(t,e){return fi(t,e,!1)},t.pointInLine=Oi,t.pointInOBB=function(t,e){return Li.x=(e.point1.x+e.point2.x)/2,Li.y=(e.point1.y+e.point2.y)/2,Ii.x=(e.point3.x+e.point4.x)/2,Ii.y=(e.point3.y+e.point4.y)/2,Oi(t,Li,Ii,e.height)},t.pointInRect=fi,t.polarToCartesian=ti,t.polygonContainPoint=Vi,t.polygonIntersectPolygon=Yi,t.pow=Pe,t.precisionAdd=Ve,t.precisionSub=We,t.pulseWave=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=n/2,u=Math.sqrt(Math.pow((e-h)/h,2)+Math.pow((i-c)/c,2)),d=Math.min(u,1),p=2*r*Math.PI*3,g=Math.max(0,1-d),f=o+l*((Math.sin(p-4*d*Math.PI)+1)/2)*(.7*g+.3);return Math.min(1,Math.max(0,f))},t.quantileSorted=ct,t.queryColorFromColorScheme=Kj,t.queryToken=yH,t.rSquared=pe,t.radianToDegree=Ke,t.randomLCG=Qt,t.randomOpacity=function(t,e,i,s,n,r,a,o=0,l=1){const h=2*UE(e*n+i)*Math.PI,c=o+l*(Math.sin(2*r*Math.PI+h)+1)/2;return Math.min(1,Math.max(0,c))},t.range=ot,t.rectInsideAnotherRect=pi,t.registerAllEnv=()=>{UT()},t.registerAllMarks=w6,t.registerAnimate=OV,t.registerArc3d=uE,t.registerArcAnimation=RV,t.registerArcMark=mq,t.registerAreaChart=$X,t.registerAreaMark=jX,t.registerAreaSeries=GX,t.registerBarAnimation=e$,t.registerBarChart=d$,t.registerBarSeries=h$,t.registerBoxplotChart=E3,t.registerBoxplotSeries=HK,t.registerBrowserEnv=yV,t.registerBrush=_8,t.registerCanvasTooltipHandler=J8,t.registerCartesianBandAxis=CY,t.registerCartesianCrossHair=k5,t.registerCartesianLinearAxis=xY,t.registerCartesianLogAxis=DY,t.registerCartesianSymlogAxis=BY,t.registerCartesianTimeAxis=TY,t.registerChartPlugin=Q8,t.registerChartResizeZoomPlugin=()=>{Q8(z6)},t.registerCirclePackingChart=x3,t.registerCirclePackingSeries=V0,t.registerCircularProgressChart=J2,t.registerCircularProgressSeries=fZ,t.registerCommonChart=N2,t.registerComponentMark=tY,t.registerContinuousLegend=a5,t.registerCorrelationChart=U3,t.registerCustomAnimate=()=>{QP.registerBuiltInAnimate("increaseCount",fR),QP.registerBuiltInAnimate("fromTo",YL),QP.registerBuiltInAnimate("scaleIn",SL),QP.registerBuiltInAnimate("scaleOut",AL),QP.registerBuiltInAnimate("growHeightIn",KR),QP.registerBuiltInAnimate("growHeightOut",qR),QP.registerBuiltInAnimate("growWidthIn",dL),QP.registerBuiltInAnimate("growWidthOut",pL),QP.registerBuiltInAnimate("growCenterIn",YR),QP.registerBuiltInAnimate("growCenterOut",XR),QP.registerBuiltInAnimate("clipIn",zR),QP.registerBuiltInAnimate("clipOut",jR),QP.registerBuiltInAnimate("fadeIn",HR),QP.registerBuiltInAnimate("fadeOut",NR),QP.registerBuiltInAnimate("growPointsIn",QR),QP.registerBuiltInAnimate("growPointsOut",tL),QP.registerBuiltInAnimate("growPointsXIn",iL),QP.registerBuiltInAnimate("growPointsXOut",sL),QP.registerBuiltInAnimate("growPointsYIn",rL),QP.registerBuiltInAnimate("growPointsYOut",aL),QP.registerBuiltInAnimate("growAngleIn",WR),QP.registerBuiltInAnimate("growAngleOut",GR),QP.registerBuiltInAnimate("growRadiusIn",hL),QP.registerBuiltInAnimate("growRadiusOut",cL),QP.registerBuiltInAnimate("moveIn",HL),QP.registerBuiltInAnimate("moveOut",NL),QP.registerBuiltInAnimate("rotateIn",VL),QP.registerBuiltInAnimate("rotateOut",WL),QP.registerBuiltInAnimate("update",zL),QP.registerBuiltInAnimate("state",kL),QP.registerBuiltInAnimate("labelItemAppear",gL),QP.registerBuiltInAnimate("labelItemDisappear",fL),QP.registerBuiltInAnimate("poptipAppear",mL),QP.registerBuiltInAnimate("poptipDisappear",vL),QP.registerBuiltInAnimate("inputText",BR),QP.registerBuiltInAnimate("inputRichText",yL),QP.registerBuiltInAnimate("outputRichText",_L),QP.registerBuiltInAnimate("slideRichText",bL),QP.registerBuiltInAnimate("slideOutRichText",xL),QP.registerBuiltInAnimate("slideIn",CL),QP.registerBuiltInAnimate("growIn",ML),QP.registerBuiltInAnimate("spinIn",TL),QP.registerBuiltInAnimate("moveScaleIn",EL),QP.registerBuiltInAnimate("moveRotateIn",BL),QP.registerBuiltInAnimate("strokeIn",wL),QP.registerBuiltInAnimate("slideOut",PL),QP.registerBuiltInAnimate("growOut",RL),QP.registerBuiltInAnimate("spinOut",LL),QP.registerBuiltInAnimate("moveScaleOut",IL),QP.registerBuiltInAnimate("moveRotateOut",OL),QP.registerBuiltInAnimate("strokeOut",DL),QP.registerBuiltInAnimate("pulse",FL),QP.registerBuiltInAnimate("MotionPath",GL),QP.registerBuiltInAnimate("streamLight",XL),QP.registerBuiltInAnimate("dissolve",QL),QP.registerBuiltInAnimate("grayscale",tI),QP.registerBuiltInAnimate("distortion",eI),QP.registerBuiltInAnimate("particle",iI),QP.registerBuiltInAnimate("glitch",sI),QP.registerBuiltInAnimate("gaussianBlur",nI),QP.registerBuiltInAnimate("pixelation",rI)},t.registerCustomMark=x8,t.registerDataSetInstanceParser=sU,t.registerDataSetInstanceTransform=iU,t.registerDataZoom=U5,t.registerDimensionEvents=oX,t.registerDimensionHover=aX,t.registerDimensionTooltipProcessor=EX,t.registerDirectionalLight=tS,t.registerDiscreteLegend=$3,t.registerDomTooltipHandler=Y8,t.registerDotSeries=eZ,t.registerDragPlugin=()=>{wH.registerStageEventPlugin("drag",ok)},t.registerElementActive=o6,t.registerElementActiveByLegend=u6,t.registerElementHighlight=WV,t.registerElementHighlightByGroup=g6,t.registerElementHighlightByKey=v6,t.registerElementHighlightByLegend=x6,t.registerElementHighlightByName=C6,t.registerElementSelect=XV,t.registerFormatPlugin=n6,t.registerFunnelChart=h3,t.registerFunnelSeries=_0,t.registerGaugeChart=e3,t.registerGaugePointerSeries=w1,t.registerGaugeSeries=B1,t.registerGeoCoordinate=H$,t.registerGeoMarkPoint=f8,t.registerGesturePlugin=FV,t.registerGlyphMark=kK,t.registerGridLayout=k8,t.registerGroupMark=fV,t.registerGroupTooltipProcessor=LX,t.registerHarmonyEnv=()=>{Sw(mc)},t.registerHeatmapChart=j3,t.registerHeatmapSeries=z1,t.registerHistogramChart=K2,t.registerHtmlAttributePlugin=uA,t.registerImageMark=T6,t.registerIndicator=q5,t.registerLabel=n8,t.registerLarkEnv=()=>{wM(mc)},t.registerLine=AE,t.registerLineChart=OX,t.registerLineMark=pG,t.registerLineSeries=YY,t.registerLinearProgressChart=d3,t.registerLinearProgressSeries=SZ,t.registerLinkSeries=aZ,t.registerLiquidChart=()=>{PX(),h2(),wH.registerChart(E6.type,E6)},t.registerLiquidSeries=h2,t.registerLynxEnv=()=>{GM(mc)},t.registerMapChart=k2,t.registerMapSeries=V$,t.registerMarkArea=U4,t.registerMarkFilterTransform=g1,t.registerMarkLine=L4,t.registerMarkMapTransform=f1,t.registerMarkPoint=u8,t.registerMarkTooltipProcessor=PX,t.registerMediaQuery=()=>{Q8(F6)},t.registerMosaicChart=()=>{EX(),PX(),LX(),oX(),aX(),x2(),wH.registerChart(L6.type,L6)},t.registerMosaicSeries=x2,t.registerNodeEnv=_V,t.registerOrthoCamera=iS,t.registerPathMark=E$,t.registerPieChart=B2,t.registerPieSeries=Sq,t.registerPlayer=J4,t.registerPolarBandAxis=zq,t.registerPolarCrossHair=M5,t.registerPolarLinearAxis=Oq,t.registerPolarMarkArea=W4,t.registerPolarMarkLine=O4,t.registerPolarMarkPoint=p8,t.registerPolygonAnimation=IV,t.registerPolygonMark=f0,t.registerPoptip=C8,t.registerPyramid3d=DE,t.registerRadarChart=z2,t.registerRadarSeries=Kq,t.registerRangeAreaChart=O3,t.registerRangeAreaSeries=sq,t.registerRangeColumnChart=f3,t.registerRangeColumnSeries=ZK,t.registerReactAttributePlugin=pA,t.registerRect=BE,t.registerRect3d=RE,t.registerRectAnimation=PV,t.registerRectMark=s$,t.registerRippleMark=$1,t.registerRoseChart=I2,t.registerRoseSeries=Hq,t.registerRuleMark=Q$,t.registerSankeyChart=R3,t.registerSankeySeries=l1,t.registerScaleInOutAnimation=wV,t.registerScatterChart=C$,t.registerScatterSeries=S$,t.registerScrollBar=G5,t.registerSequenceChart=W2,t.registerSequentialAnimate=function(){Z(dV,V6)},t.registerShadowRoot=FE,t.registerStateTransition=function(){const t=ZP.getInstance();t.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),t.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),t.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),t.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),t.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),t.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))},t.registerSunBurstSeries=F0,t.registerSunburstChart=y3,t.registerSymbolMark=fG,t.registerTTEnv=()=>{rw(mc)},t.registerTaroEnv=()=>{AT(mc)},t.registerTextMark=UK,t.registerTheme=zH,t.registerTitle=z4,t.registerTooltip=v5,t.registerTotalLabel=o8,t.registerTreemapChart=k3,t.registerTreemapSeries=y1,t.registerVRenderAnimate=hR,t.registerVennChart=()=>{PX(),_2(),wH.registerChart(P6.type,P6)},t.registerVennSeries=_2,t.registerViewTransform3dPlugin=()=>{Wx.registerPlugin("ViewTransform3dPlugin",gA)},t.registerWXEnv=()=>{HT(mc)},t.registerWaterfallChart=T3,t.registerWaterfallSeries=yK,t.registerWordCloudChart=r3,t.registerWordCloudSeries=QQ,t.registerWordCloudShapeChart=a3,t.regressionLinear=ge,t.regressionLogistic=function(t,e=(t=>t.x),i=(t=>t.y),s){var n,r,a;const o=null!==(n=null==s?void 0:s.maxIteration)&&void 0!==n?n:25,l=null!==(r=null==s?void 0:s.tol)&&void 0!==r?r:1e-6,h=null!==(a=null==s?void 0:s.alpha)&&void 0!==a?a:.05,c=[],u=[];de(t,e,i,((t,e)=>{c.push(t),u.push(e?1:0)}));const d=c.length;if(0===d)return{coef:[0,0],predict:t=>0,evaluateGrid:t=>[],confidenceInterval:(t=50)=>[]};let p=0,g=0;for(let t=0;t<o;t++){const t=new Array(d);let e=!0;for(let e=0;e<d;e++){const i=p+g*c[e],s=1/(1+Math.exp(-i));t[e]=s}let i=0,s=0,n=0,r=0,a=0;for(let e=0;e<d;e++){const o=t[e]*(1-t[e]),l=u[e]-t[e];i+=l,s+=l*c[e],n+=o,r+=o*c[e],a+=o*c[e]*c[e]}const o=n*a-r*r;if(Math.abs(o)<1e-12)break;const h=(a*i-r*s)/o,f=(-r*i+n*s)/o;if(p+=h,g+=f,(Math.abs(h)>l||Math.abs(f)>l)&&(e=!1),e)break}const f=t=>{const e=p+g*t;return 1/(1+Math.exp(-e))};return{coef:[p,g],predict:f,evaluateGrid:function(s){const n=[];if(s<=0)return n;let r=1/0,a=-1/0;if(de(t,e,i,(t=>{t<r&&(r=t),t>a&&(a=t)})),r===1/0||a===-1/0)return n;if(r===a){const t=f(r);for(let e=0;e<s;e++)n.push({x:r,y:t});return n}const o=(a-r)/(s-1);for(let t=0;t<s;t++){const e=t===s-1?a:r+o*t;n.push({x:e,y:f(e)})}return n},confidenceInterval:function(s=50){const n=[];if(s<=0)return n;const r=he(t,e,i,f);if(0===r.n)return n;const a=Math.abs(le(1-h/2));if(r.min===r.max){const t=f(r.min),e=ce(r.min,r);for(let i=0;i<s;i++)n.push({x:r.min,mean:t,lower:t-a*e.seMean,upper:t+a*e.seMean,predLower:t-a*e.sePred,predUpper:t+a*e.sePred});return n}const o=(r.max-r.min)/(s-1);for(let t=0;t<s;t++){const e=t===s-1?r.max:r.min+o*t,i=f(e),l=ce(e,r);n.push({x:e,mean:i,lower:i-a*l.seMean,upper:i+a*l.seMean,predLower:i-a*l.sePred,predUpper:i+a*l.sePred})}return n}}},t.regressionLowess=function(t,e=(t=>t.x),i=(t=>t.y),s={}){var n;const r=s.span||.3,a=0===s.degree?0:1,o=null!==(n=s.alpha)&&void 0!==n?n:.05,l=null==s.iterations?2:s.iterations,h=s.maxSamples||1e3,c=[];de(t,e,i,((t,e)=>{c.push({x:t,y:e})})),c.sort(((t,e)=>t.x-e.x));const u=function(t,e){const i=t.length;if(i<=e)return t;const s=[],n=i/e;for(let r=0;r<e;r++){const e=Math.min(Math.floor(r*n),i-1);s.push(t[e])}return s}(c,h),d=u.length,p=new Array(d),g=new Array(d);for(let t=0;t<d;t++)p[t]=u[t].x,g[t]=u[t].y;function f(t,e){if(0===d)return 0;let i=0,s=d;for(;i<s;){const e=i+s>>1;p[e]<t?i=e+1:s=e}const n=Math.max(2,Math.min(d,Math.floor(r*d))),o=Math.max(0,i-Math.floor(n/2)),l=Math.min(d,o+n),h=Math.max(0,l-n);let c=0;const u=l-h,f=new Array(u);for(let e=h;e<l;e++){const i=Math.abs(p[e]-t);f[e-h]=i,i>c&&(c=i)}let m=0;const v=new Array(u);for(let t=0;t<u;t++){let i=fe(0===c?0:f[t]/c);e&&null!=e[h+t]&&(i*=e[h+t]),v[t]=i,m+=i}if(0===m)return g[i<d?i:d-1];if(0===a){let t=0;for(let e=0;e<v.length;e++)t+=v[e]*g[h+e];return t/m}let y=0,_=0,b=0,x=0,S=0;for(let t=h;t<l;t++){const e=t-h,i=p[t],s=g[t],n=v[e];y+=n,_+=n*i,b+=n*s,x+=n*i*i,S+=n*i*s}const A=_/y,k=b/y,C=x-_*A,M=Math.abs(C)<1e-12?0:(S-_*k)/C;return k-M*A+M*t}function m(t){if(Array.isArray(t)){const e=t.length,i=new Array(e);for(let s=0;s<e;s++)i[s]=f(t[s]);return i}return f(t)}return{predict:m,evaluate:m,evaluateGrid:function(t){if(t<=0)return[];if(0===d)return[];const e=new Array(t),i=p[0],n=p[d-1];if(i===n){const s=f(i);for(let n=0;n<t;n++)e[n]={x:i,y:s};return e}const r=(n-i)/(t-1);let a;const o=null!=s.iterations?l:d>500?0:l;if(o>0)for(let t=0;t<o;t++){const t=new Array(d),e=new Array(d);for(let i=0;i<d;i++)t[i]=f(p[i],a),e[i]=Math.abs(g[i]-t[i]);const i=e.slice().sort(((t,e)=>t-e))[Math.floor(d/2)]||0;a=new Array(d);for(let t=0;t<d;t++){const s=0===i?0:e[t]/(6*i),n=Math.abs(s)>=1?0:(1-s*s)*(1-s*s);a[t]=n}}for(let s=0;s<t;s++){const o=s===t-1?n:i+r*s;e[s]={x:o,y:f(o,a)}}return e},confidenceInterval:function(s=50){const n=[];if(s<=0)return n;if(0===d)return n;const r=p[0],a=p[d-1];if(void 0===r||void 0===a||r===1/0||a===-1/0)return n;const l=he(t,e,i,(t=>f(t)));if(0===l.n)return n;const h=Math.abs(le(1-o/2));if(l.min===l.max){const t=f(l.min),e=ce(l.min,l);for(let i=0;i<s;i++)n.push({x:l.min,mean:t,lower:t-h*e.seMean,upper:t+h*e.seMean,predLower:t-h*e.sePred,predUpper:t+h*e.sePred});return n}const c=(a-r)/(s-1);for(let t=0;t<s;t++){const e=t===s-1?a:r+c*t,i=f(e),o=ce(e,l);n.push({x:e,mean:i,lower:i-h*o.seMean,upper:i+h*o.seMean,predLower:i-h*o.sePred,predUpper:i+h*o.sePred})}return n}}},t.regressionPolynomial=function(t,e=(t=>t.x),i=(t=>t.y),s={}){var n,r;let a=null!==(n=s.degree)&&void 0!==n?n:0;a<0&&(a=0);const o=null!==(r=s.alpha)&&void 0!==r?r:.05,l=a+1,h=new Array(2*a+1).fill(0);de(t,e,i,((t,e)=>{let i=1;for(let e=0;e<h.length;e++)h[e]+=i,i*=t}));const c=new Array(l);for(let t=0;t<l;t++){c[t]=new Array(l).fill(0);for(let e=0;e<l;e++)c[t][e]=h[t+e]}const u=new Array(l).fill(0);de(t,e,i,((t,e)=>{let i=1;for(let s=0;s<l;s++)u[s]+=e*i,i*=t}));const p=function(t,e){const i=e.length,s=new Array(i);for(let n=0;n<i;n++)s[n]=t[n].slice(),s[n].push(e[n]);for(let t=0;t<i;t++){let e=t,n=Math.abs(s[t][t]);for(let r=t+1;r<i;r++){const i=Math.abs(s[r][t]);i>n&&(n=i,e=r)}if(e!==t){const i=s[t];s[t]=s[e],s[e]=i}if(Math.abs(s[t][t])<1e-12)return new Array(i).fill(0);for(let e=t+1;e<=i;e++)s[t][e]=s[t][e]/s[t][t];s[t][t]=1;for(let e=0;e<i;e++){if(e===t)continue;const n=s[e][t];if(0!==n){for(let r=t+1;r<=i;r++)s[e][r]-=n*s[t][r];s[e][t]=0}}}const n=new Array(i);for(let t=0;t<i;t++)n[t]=s[t][i];return n}(c,u),g=t=>{let e=1,i=0;for(let s=0;s<p.length;s++)i+=p[s]*e,e*=t;return i};return{degree:a,coef:p,predict:g,rSquared:pe(t,e,i,(()=>{let s=0,n=0;return de(t,e,i,((t,e)=>{s+=e,n++})),0===n?0:s/n})(),g),evaluateGrid(s){const n=[];if(s<=0)return n;let r=1/0,a=-1/0;if(de(t,e,i,(t=>{d(t)||(t<r&&(r=t),t>a&&(a=t))})),r===1/0||a===-1/0)return n;if(r===a){const t=g(r);for(let e=0;e<s;e++)n.push({x:r,y:t});return n}const o=(a-r)/(s-1);for(let t=0;t<s;t++){const e=t===s-1?a:r+o*t;n.push({x:e,y:g(e)})}return n},confidenceInterval(s=50){const n=[];if(s<=0)return n;const r=he(t,e,i,g);if(0===r.n)return n;const a=Math.abs(le(1-o/2));if(r.min===r.max){const t=g(r.min),e=ce(r.min,r);for(let i=0;i<s;i++)n.push({x:r.min,mean:t,lower:t-a*e.seMean,upper:t+a*e.seMean,predLower:t-a*e.sePred,predUpper:t+a*e.sePred});return n}const l=(r.max-r.min)/(s-1);for(let t=0;t<s;t++){const e=t===s-1?r.max:r.min+l*t,i=g(e),o=ce(e,r);n.push({x:e,mean:i,lower:i-a*o.seMean,upper:i+a*o.seMean,predLower:i-a*o.sePred,predUpper:i+a*o.sePred})}return n}}},t.removeBorder=dQ,t.removeTheme=HH,t.rgbToHex=Ss,t.rgbToHsl=cs,t.rippleEffect=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=n/2,u=Math.sqrt(Math.pow(e-h,2)+Math.pow(i-c,2))/Math.sqrt(Math.pow(s/2,2)+Math.pow(n/2,2)),d=o+l*(Math.sin(2*r*Math.PI*3-2*u*Math.PI)+1)/2;return Math.min(1,Math.max(0,d))},t.rotatePoint=vi,t.rotationScan=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=n/2,u=Math.atan2(e-h,i-c),d=(u<0?u+2*Math.PI:u)/(2*Math.PI),p=o+l*(Math.sin(2*r*Math.PI-2*d*Math.PI)+1)/2;return Math.min(1,Math.max(0,p))},t.rowBottomToTop=function(t,e,i,s,n,r,a,o=0,l=1){const h=(s-1-e)/s,c=o+l*(Math.sin(2*r*Math.PI-2*h*Math.PI)+1)/2;return Math.min(1,Math.max(0,c))},t.rowCenterToEdge=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=Math.abs(e-h)/h,u=o+l*(Math.sin(2*r*Math.PI-2*c*Math.PI)+1)/2;return Math.min(1,Math.max(0,u))},t.rowEdgeToCenter=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=1-Math.abs(e-h)/h,u=o+l*(Math.sin(2*r*Math.PI-2*c*Math.PI)+1)/2;return Math.min(1,Math.max(0,u))},t.rowTopToBottom=function(t,e,i,s,n,r,a,o=0,l=1){const h=e/s,c=o+l*(Math.sin(2*r*Math.PI-2*h*Math.PI)+1)/2;return Math.min(1,Math.max(0,c))},t.sankeyTransform=hJ,t.scale=dr,t.scaleAndMiddleShape=pQ,t.scott=ve,t.secondCount=Sn,t.secondField=An,t.secondFloor=bn,t.secondOffset=xn,t.secondsGetterName=Bs,t.secondsSetterName=function(t){return t?"setUTCSeconds":"setSeconds"},t.seedRandom=Zt,t.segmentation=uQ,t.setDefaultCrosshairForCartesianChart=wU,t.shapes=VJ,t.shouldMarkDoMorph=LW,t.shuffleArray=rt,t.silverman=ye,t.simpleField=ne,t.sin=Ee,t.snakeWave=function(t,e,i,s,n,r,a,o=0,l=1){const h=(e+i)%(s+n)/(s+n),c=o+l*(Math.sin(2*r*Math.PI-4*h*Math.PI)+1)/2;return Math.min(1,Math.max(0,c))},t.sortDataInAxisHelper=NW,t.sortStackValueGroup=wN,t.span=t=>t.length<=1?0:Q(t)-t[0],t.specTransform=$H,t.spiralEffect=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=n/2,u=Math.sqrt(Math.pow(e-h,2)+Math.pow(i-c,2)),d=Math.atan2(e-h,i-c),p=(u/Math.sqrt(Math.pow(s/2,2)+Math.pow(n/2,2))+d/(2*Math.PI))/2,g=o+l*(Math.sin(2*r*Math.PI-4*p*Math.PI)+1)/2;return Math.min(1,Math.max(0,g))},t.spirals=qJ,t.sqrt=Be,t.stack=RN,t.stackGroup=LN,t.stackMosaic=BN,t.stackMosaicTotal=EN,t.stackOffsetSilhouette=PN,t.stackTotal=DN,t.stringWidth=function(t,e=!0){if("string"!=typeof t||0===t.length)return 0;if(0===(t=Xi(t)).length)return 0;t=t.replace(qi()," ");const i=e?1:2;let s=0;for(const e of t){const t=e.codePointAt(0);if(!(t<=31||t>=127&&t<=159)&&!(t>=768&&t<=879))switch(Ki(e)){case"F":case"W":s+=2;break;case"A":s+=i;break;default:s+=1}}return s},t.styleStringToObject=On,t.substitute=function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,((t,i)=>"\\"===t.charAt(0)?t.slice(1):void 0===e[i]?"":e[i])):t},t.sunburstTransform=(t,e)=>{const i=new dJ(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return OZ(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},t.svgParser=(t,e={},i)=>{let s=e.customDOMParser;if(s||(null===window||void 0===window?void 0:window.DOMParser)&&(s=t=>(new DOMParser).parseFromString(t,"text/xml")),!s)throw new Error("No Available DOMParser!");const n=s(t);let r=9===n.nodeType?n.firstChild:n;for(;r&&("svg"!==r.nodeName.toLowerCase()||1!==r.nodeType);)r=r.nextSibling;return r?function(t,e={}){const i=[],s=xh(t,null);let n=parseFloat(t.getAttribute("width")||e.width),r=parseFloat(t.getAttribute("height")||e.height);!C(n)&&(n=null),!C(r)&&(r=null);const a=t.getAttribute("viewBox");let o;if(a){const t=a.match(vh)||[];if(t.length>=4&&(o={x:parseFloat(t[0]||0),y:parseFloat(t[1]||0),width:parseFloat(t[2]),height:parseFloat(t[3])},n||r)){const t={x:0,y:0,width:n,height:r},e=t.width/o.width,i=t.height/o.height,a=Math.min(e,i),l=-(o.x+o.width/2)*a+(t.x+t.width/2),h=-(o.y+o.height/2)*a+(t.y+t.height/2),c=(new as).translate(l,h).scale(a,a);s.transform=c}}return Ah(t,s,i),{root:s,width:n,height:r,elements:i,viewBoxRect:o}}(r):null},t.tau=Ae,t.themeExist=NH,t.themes=IH,t.throttle=Ht,t.tickStep=function(t,e,i){const s=Math.abs(e-t)/Math.max(0,i);let n=Math.pow(10,Math.floor(Math.log(s)/Math.LN10));const r=s/n;return r>=xt?n*=10:r>=St?n*=5:r>=At&&(n*=2),e<t?-n:n},t.toCamelCase=zn,t.toDate=Xt,t.toNumber=ht,t.toPercent=re,t.toValidNumber=$t,t.token=bH,t.transformBounds=function(t,e,i,s,n,r,a){if(!(Ce(s)<=be||Ce(n)<=be)){if(1!==s&&t.scaleX(s),1!==n&&t.scaleY(n),isFinite(r)&&Math.abs(r)>be){let e=0,i=0;void 0!==a&&(e=a[0],i=a[1]),t.rotate(r,e,i)}t.translate(e,i)}},t.transformBoundsWithMatrix=is,t.transformColorSchemeToStandardStruct=Qj,t.transformToGraphic=NN,t.treeTransform=(t,e)=>{const i=new AJ(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const{maxDepth:e}=null!=t?t:{},s=[];OZ(i,s,{maxDepth:e});const n=[];return pJ(i,n,{maxDepth:e}),{nodes:s,links:n}}return i},t.treemapTransform=(t,e)=>{const i=new TJ(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return OZ(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},t.truncate=Rt,t.unionAABB=Ri,t.uniqArray=nt,t.upperFirst=qt,t.userAnimationConfig=BW,t.utcDayCount=nn;t.utcDayField=rn,t.utcDayFloor=en,t.utcDayOffset=sn,t.utcHourField=dn,t.utcHourFloor=cn,t.utcHourOffset=un,t.utcMinuteField=_n,t.utcMinuteFloor=vn,t.utcMinuteOffset=yn,t.utcMonthCount=Ks,t.utcMonthField=qs,t.utcMonthFloor=Xs,t.utcMonthOffset=$s,t.utcSecondField=Mn,t.utcSecondFloor=kn,t.utcSecondOffset=Cn,t.utcYearCount=Ns,t.utcYearField=Us,t.utcYearFloor=js,t.utcYearOffset=Hs,t.uuid=Lt,t.valueInScaleRange=rH,t.variance=_t,t.vennMarkTransform=UJ,t.vennTransform=NJ,t.version="2.0.12",t.vglobal=Px,t.visitPoints=de,t.warn=yA,t.weightedSum=pr,t.wordcloudShapeTransform=NQ,t.wordcloudTransform=yQ,t.yearCount=Fs,t.yearField=zs,t.yearFloor=Is,t.yearOffset=Os,t.zero=ae,t.zeros=hr,t.zerosM=cr,Object.defineProperty(t,"__esModule",{value:!0})}));
22
+ */let gQ=class t extends KJ{constructor(e){super(N({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),u=this.options.createCanvas({width:1,height:1}),d=u.getContext("2d",{willReadFrequently:!0});d.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=d.measureText(a).width,g=Math.max(r,d.measureText("m").width,d.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),y=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=y*this.gridSize;const _=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;u.setAttribute("width",""+A),u.setAttribute("height",""+k),d.scale(1,1),d.translate(A/2,k/2),d.rotate(-h),d.font=l+" "+o+" "+r.toString(10)+"px "+c,d.fillStyle="#000",d.textBaseline="middle",d.fillText(a,_,b);const C=d.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const M=[];let T,w=S;const D=[x/2,S/2,x/2,S/2],E=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(C[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),t<D[3]&&(D[3]=t),t>D[1]&&(D[1]=t),e<D[0]&&(D[0]=e),void(e>D[2]&&(D[2]=e))}};for(;w--;)for(T=x;T--;)E(w,T,M);return{datum:t,occupied:M,bounds:D,gw:S,gh:x,fillTextOffsetX:_,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t<this.ngx;t++)for(let i=0;i<this.ngy;i++)this.grid[t][i]&&e++;return e/t}canFitText(t,e,i,s,n){let r=n.length;for(;r--;){const i=t+n[r][0],s=e+n[r][1];if(i>=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),rt(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(f(e)){const i=nQ(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=sQ(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=GJ(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};gQ.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class fQ extends KJ{constructor(t){super(N({},fQ.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e<i;e++)if(mQ(t,this.result[e]))return!1;return!0}getTextInfo(t,e){const i={datum:t,fontSize:this.getTextFontSize(t),fontWeight:this.getTextFontWeight(t),fontStyle:this.getTextFontStyle(t),fontFamily:this.getTextFontFamily(t),angle:this.getTextRotate(t,e),text:this.getText(t)+"",x:this.center[0],y:this.center[1]},s=this.options.getTextBounds(i);return i.width=s.width(),i.height=s.height(),i.top=this.center[1]-i.height+.21*i.height,i.left=this.center[0]-i.width/2,i}layoutWord(t){const e=this.getTextInfo(this.data[t],t);let i=2*Math.PI,s=0,n=e.left,r=e.top;const a=e.width,o=e.height;let l=1,h=this.fit(e);for(;!h&&s<this.maxRadius;)s+=.5,l=this.shape(s/this.maxRadius*2*Math.PI),i+=.5*(this.options.random?this.random()>.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;i<t.length&&(this.layoutWord(i),i++,this.progressiveIndex=i,!this.exceedTime()););return this.result}}function mQ(t,e){return!(t.left+t.width<e.left||t.top+t.height<e.top||t.left>e.left+e.width||t.top>e.top+e.height)}fQ.defaultOptions={enlarge:!1};const vQ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},yQ=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return gt.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?_Q(t.fontFamily):"sans-serif",u=t.fontStyle?_Q(t.fontStyle):"normal",d=t.fontWeight?_Q(t.fontWeight):"normal",p=t.rotate?_Q(t.rotate):0,g=_Q(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?_Q(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",y=null!==(r=t.shrink)&&void 0!==r&&r,_=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,S=t.randomVisible,k=t.as?Object.assign(Object.assign({},vQ),t.as):vQ,C=t.depth_3d,M=t.postProjection;let T=t.fontSize?_Q(t.fontSize):14;const w=t.fontSizeRange;if(w&&!A(T)){const t=T,e=xQ(SQ(t,l),w);T=i=>e(t(i))}let D=ZJ;"fast"===t.layoutType?D=fQ:"grid"===t.layoutType&&(D=gQ);const E=new D(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:u,fontWeight:d,fontSize:T,shrink:y,clip:b,enlarge:_,minFontSize:x,random:S,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r<a;r++)n=e[r],s=n.datum,s[k.x]=n.x,s[k.y]=n.y,s[k.fontFamily]=n.fontFamily,s[k.fontSize]=n.fontSize,s[k.fontStyle]=n.fontStyle,s[k.fontWeight]=n.fontWeight,s[k.angle]=n.angle,"StereographicProjection"===M&&AQ(h,n,s,k,C),t.dataIndexKey&&(s[t.dataIndexKey]=`${r}`),i.push(s);return i}}));return E.layout(l,{width:h[0],height:h[1]}),t.progressiveStep>0||t.progressiveTime>0?{progressive:E}:E.output()},_Q=t=>_(t)||A(t)||u(t)||b(t)?t:e=>e[t.field],bQ=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),xQ=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=bQ(t[0]),n=bQ(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(bQ(t)-r)/(a-r)*(e[1]-e[0])+e[0]},SQ=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;a<n;++a)r=ht(t(e[a])),r<i&&(i=r),r>s&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function AQ(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l<Math.PI/2?1:-1)*Math.pow(Math.min(l-Math.PI/2,1),2)/5,{x:i*Math.sin(l)*Math.cos(o)+s.x,y:i*Math.cos(l)+s.y,z:i*Math.sin(l)*Math.sin(o)+s.z}}(t[0],t[1],r,{x:r,y:r,z:null!=n?n:r},e);i[s.x]=a.x,i[s.y]=a.y,i[s.z]=a.z}var kQ;t.WORDCLOUD_SHAPE_HOOK_EVENT=void 0,(kQ=t.WORDCLOUD_SHAPE_HOOK_EVENT||(t.WORDCLOUD_SHAPE_HOOK_EVENT={})).BEFORE_WORDCLOUD_SHAPE_LAYOUT="beforeWordcloudShapeLayout",kQ.AFTER_WORDCLOUD_SHAPE_LAYOUT="afterWordcloudShapeLayout",kQ.AFTER_WORDCLOUD_SHAPE_DRAW="afterWordcloudShapeDraw";const CQ=t=>/^[\u4e00-\u9fa5]+$/.test(t),MQ=(t,e)=>{if(d(t))return 0;let i=0;for(const e of t)CQ(e)?i+=1:i+=.53;return i};function TQ(t,e,i){const{stepFactor:s,importantWordCount:n,globalShinkLimit:r}=e,{size:a,segmentation:{regions:o},tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:u,shapeRatio:d}=i,p=l.getContext("2d",{willReadFrequently:!0}),g=PQ(i);let f=g.slice(0);const m=e.fontSizeShrinkFactor;let v=null,y=1,_=1;const b=n;let x=0;t.length>b&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;e<o.length;e++){const i=o[e],{words:n,center:c,maxR:u,ratio:d}=i;let b=!1;for(let e=0;e<n.length;e++){BQ(l,p,t,e);const i=n[e];if(i.x=c[0],i.y=c[1],!i.skip&&i.hasText&&i.sprite&&wQ(f,i,u,d,a,h,s))i.hasPlaced=!0;else{if(!i.skip&&i.weight>x&&_>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==v&&(v=e,y=_),_*=m,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*m})),f=g.slice(0),b=!0;break}if(!i.skip&&i.datum[Symbol.for("vGrammar_id")]===v){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/_})),i.skip=!0,_=y,v=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i<e.textLayoutTimes;i++){const i=t.filter((t=>(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=Math.max(~~(t.fontSize*e.fontSizeShrinkFactor),e.minFontSize)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t<i.length;t++){const e=i[t];BQ(l,p,i,t),e.x=c[0],e.y=c[1],e.hasText&&wQ(f,e,u,d,a,h,s)&&(e.hasPlaced=!0)}}e.board=f}function wQ(t,e,i,s,n,r,a){const o=e.x,l=e.y,h=function(t){return function(e){return[t*(e*=.1)*Math.cos(e),e*Math.sin(e)]}}(s),c=1*a;let u,d,p,g=-c;for(;u=h(g+=c);){const{wordSize:s,bounds:{dTop:a,dBottom:h,dLeft:c,dRight:g}}=e;if(d=u[0],p=u[1],Math.min(Math.abs(d),Math.abs(p))>=i)break;if(e.x=~~(o+d),e.y=~~(l+p),!(e.x-c<0||e.x+g>n[0]||e.y-a<0||e.y+h>n[1]||EQ(e,t,r)))return DQ(e,t,r),!0}return!1}function DQ(t,e,i){const{wordSize:s}=t,n=t.sprite,r=s[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=s[1];let u,d=(t.y-(s[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t<c;t++){for(let i=0;i<r;i++)e[d+i]|=n[t*r+i];d+=a}else for(let t=0;t<c;t++){u=0;for(let i=0;i<=r;i++)e[d+i]|=u<<h|(i<r?(u=n[t*r+i])>>>l:0);d+=a}}function EQ(t,e,i){const{sprite:s,wordSize:n}=t,r=i[0]>>5,a=n[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=n[1];let u,d=(t.y-(n[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t<c;t++){for(let i=0;i<a;i++)if(e[d+i]&s[t*a+i])return!0;d+=r}else for(let t=0;t<c;t++){u=0;for(let i=0;i<=a;i++)if((u<<h|(i<a?(u=s[t*a+i])>>>l:0))&e[d+i])return!0;d+=r}return!1}function BQ(t,e,i,s){if(i[s].sprite||0===i[s].fontSize)return;const n=2048,r=Math.PI/180,a=i.length;t.width=n,t.height=2048,e.clearRect(0,0,n,2048),e.textAlign="center";let o,l,h=0,c=0,u=0,d=0;const p=s;for(--s;++s<a;){const t=i[s],a=Math.max(t.fontSize,2);if(e.save(),e.font=t.fontStyle+" "+t.fontWeight+" "+a+"px "+t.fontFamily,o=e.measureText(t.text+"m").width+2*t.padding,l=2*a+2*t.padding,0!==t.rotate){const e=Math.sin(t.rotate*r),i=Math.cos(t.rotate*r),s=o*i,n=o*e,a=l*i,h=l*e;o=Math.max(Math.abs(s+h),Math.abs(s-h)),l=~~Math.max(Math.abs(n+a),Math.abs(n-a))}if(o=o+31>>5<<5,l=Math.ceil(l),l>u&&(u=l),h+o>=n&&(h=0,c+=u,u=l),c+l>=2048){if(0===c){t.hasText=!1;continue}break}c+l>=d&&(d=c+l),e.translate(h+(o>>1),c+(l>>1)),0!==t.rotate&&e.rotate(t.rotate*r),e.fillText(t.text,0,0),t.padding&&(e.lineWidth=2*t.padding,e.strokeText(t.text,0,0)),e.restore(),t.LT=[h,c],t.wordSize=[o,l],t.hasText=!0,h+=o}if(0===d)return;const g=e.getImageData(0,0,n,d).data;let f,m;for(;--s>=p;){const t=i[s];if(!t.hasText){t.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:e=[0,0],wordSize:r}=t;[h,c]=e;const a=r[0]>>5,o=new Array(a*r[1]).fill(0);let[l,u,d,p]=[1/0,-1/0,1/0,-1/0];for(m=0;m<r[1];m++){let t;for(f=0;f<r[0];f++)if(g[4*((c+m)*n+(h+f))+3]>0){const e=1<<31-f%32;o[a*m+(f>>5)]|=e,f<d&&(d=f),f>p&&(p=f),t|=e}t&&(m<l&&(l=m),m>u&&(u=m))}t.bounds={dTop:(r[1]>>1)-l,dBottom:u-(r[1]>>1),dLeft:(r[0]>>1)-d,dRight:p-(r[0]>>1)},t.sprite=o,delete t.LT}}function PQ(t){const{segmentation:{labels:e},boardSize:i,size:s}=t,n=i[0]>>5,r=new Array(n*s[1]).fill(0);for(let t=0;t<s[1];t++)for(let i=0;i<s[0];i++)if(0===e[t*s[0]+i]){const e=1<<31-i%32;r[n*t+(i>>5)]|=e}if(i[0]>s[0]){const t=(1<<i[0]-s[0])-1;for(let e=0;e<s[1];e++)r[n*e+n-1]|=t}return r}function RQ(t,e,i){(function(t,e){const{segmentation:{regions:i}}=e;let s=-1/0,n=0,r=0;i.forEach(((t,e)=>{const i=t.area;i>s&&(s=i,r=e),n+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/n*t.length),o=i/s;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),a<t.length&&(i[r].wordsNum+=t.length-a);let o=r;const l=i.map((t=>t.regionNum));t.forEach((t=>{let e=0,s=0;t.regionIndex=-1;do{if(l[o]>0&&t.weight<=i[o].regionWeight){t.regionIndex=o,i[o].words.push(t),l[o]--,o=(o+1)%i.length;break}o=(o+1)%i.length,e++,s++,s>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),s=0)}while(-1===t.regionIndex&&e<3*i.length);-1===t.regionIndex&&(t.regionIndex=r,i[r].words.push(t),l[r]--)})),i.forEach((t=>{t.words.sort(((t,e)=>e.weight-t.weight))}))})(t,i),"ensureMapping"===e.layoutMode?TQ(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:s,stepFactor:n,importantWordCount:r}=e,{segmentation:{regions:a},tempCanvas:o,boardSize:l,shapeCenter:h,shapeMaxR:c,shapeRatio:u}=i,d=o.getContext("2d",{willReadFrequently:!0}),p=PQ(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,m=Math.min(r,t.length);let v=0;t.length>m&&(v=t.sort(((t,e)=>e.weight-t.weight))[m-1].weight);let y=0,_=1,b=!1;for(let r=0;r<a.length;r++){const h=a[r],{words:c,center:u,maxR:x,ratio:S}=h;let A=!1;for(let r=0;r<c.length;r++){BQ(o,d,t,r);const a=c[r];if(a.x=u[0],a.y=u[1],a.hasText&&a.sprite&&wQ(g,a,x,S,s,l,n)){if(a.hasPlaced=!0,a.weight>=v&&y++,y>=m&&!b){_*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),A=!0,y=0;break}}else{if(a.weight>=v&&_>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),_/=f,b=!0,g=p.slice(0),A=!0;break}if(a.weight>=v)return TQ(t,e,i)}}A&&(r=-1)}for(let i=0;i<e.textLayoutTimes;i++){const i=t.filter((t=>(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=Math.max(~~(t.fontSize*e.fontSizeShrinkFactor),e.minFontSize)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t<i.length;t++){const e=i[t];BQ(o,d,i,t),e.x=h[0],e.y=h[1],e.hasText&&wQ(g,e,c,u,s,l,n)&&(e.hasPlaced=!0)}}e.board=g}(t,e,i):function(t,e,i){const{size:s,stepFactor:n}=e,{segmentation:{regions:r},tempCanvas:a,boardSize:o,shapeCenter:l,shapeMaxR:h,shapeRatio:c}=i,u=PQ(i),d=a.getContext("2d",{willReadFrequently:!0});for(const e of r){const{words:i,center:r,maxR:l,ratio:h}=e;for(let e=0;e<i.length;e++){BQ(a,d,t,e);const c=i[e];c.x=r[0],c.y=r[1],c.hasText&&c.sprite&&wQ(u,c,l,h,s,o,n)&&(c.hasPlaced=!0)}}for(let i=0;i<e.textLayoutTimes;i++){const i=t.filter((t=>(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=Math.max(~~(t.fontSize*e.fontSizeShrinkFactor),e.minFontSize)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t<i.length;t++){const e=i[t];BQ(a,d,i,t),e.x=l[0],e.y=l[1],e.hasText&&wQ(u,e,h,c,s,o,n)&&(e.hasPlaced=!0)}}e.board=u}(t,e,i);const s=function(t,e,i){const{size:s,fillingTimes:n,fillingXStep:r,fillingYStep:a,getFillingFontStyle:o,getFillingFontWeight:l,getFillingFontFamily:h,fillingInitialFontSize:c,fillingDeltaFontSize:u,fillingInitialOpacity:d,fillingDeltaOpacity:p,fillingRotateList:g,getFillingPadding:f,random:m,board:v,minFillFontSize:y}=e,{boardSize:_,shapeBounds:b,tempCanvas:x,randomGenerator:S}=i,A=x.getContext("2d",{willReadFrequently:!0});let k=c,C=d;const M=[];for(let t=0;t<n;t++)T(k,C),k=Math.max(k>u?k-u:u,y),C=C>p?C-p:p;return M;function T(e,i){const n=t.map((t=>{const{text:s,color:n,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:s,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:n,fillingColor:r,hasPlaced:a,datum:c}}));w(n);let c=0;const{x1:u,y1:d,x2:p,y2:y}=b,[k,C]=[u+~~(S()*r*2),d+~~(S()*a*2)];for(let t=C;t<=y;t+=a)for(let e=k;e<=p;e+=r){BQ(x,A,n,c);const i=n[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===n.length&&(c=0,m&&w(n));continue}const{dTop:l,dBottom:h,dLeft:u,dRight:d}=a;i.x-u<0||i.x+d>s[0]||i.y-l<0||i.y+h>s[1]||i.hasText&&i.sprite&&!EQ(i,v,_)&&(DQ(i,v,_),M.push(Object.assign({},i)),++c===n.length&&(c=0,m&&w(n)))}}function w(t){return t.sort((()=>S()-.5))}}(t,e,i),n=[],r=[];for(let e=0;e<t.length;e++)t[e].hasPlaced?r.push(t[e]):n.push(t[e]);return n.forEach((t=>t.visible=!1)),{fillingWords:s,successedWords:r,failedWords:n}}function LQ(t,e){return t&&(M(t)||w(t)||t.startsWith("<svg"))?new Promise(((i,s)=>{var n;const r=e({image:t}),a=null===(n=r.resources)||void 0===n?void 0:n.get(t);a&&"success"===a.state&&a.data?i(a.data):(r.successCallback=()=>{var e;if(r){const n=null===(e=r.resources)||void 0===e?void 0:e.get(t);n&&"success"===n.state&&n.data?i(n.data):s(new Error("image load failed: "+t))}else s(new Error("image load failed: "+t))},r.failCallback=()=>{s(new Error("image load failed: "+t))})})):null}function IQ(t,e){return Promise.allSettled(t.map((t=>LQ(t,e))))}const OQ={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"};const FQ=(t,e,i,s)=>{var n,r,a,o;const{colorMode:l,getColor:h,getFillingColor:c}=e,{sameColorList:u}=i;let d,p,g=e.colorList,f=i.fillingColorList;if("ordinal"===l){const e=t.map((t=>h(t)));if(d=t=>(new GI).domain(e).range(g).scale(t),c&&((null===(n=s.colorField)||void 0===n?void 0:n.field)!==(null===(r=s.fillingColorField)||void 0===r?void 0:r.field)||!u)){const e=t.map((t=>c(t)));p=t=>(new GI).domain(e).range(f).scale(t)}}else{1===g.length&&(g=[g[0],g[0]]);const e=(new fO).domain(HQ(h,t)).range(g);if(d=t=>e.scale(t),c&&((null===(a=s.colorField)||void 0===a?void 0:a.field)!==(null===(o=s.fillingColorField)||void 0===o?void 0:o.field)||!u)){1===f.length&&(f=[f[0],f[0]]);const e=(new fO).domain(HQ(c,t)).range(f);p=t=>e.scale(t)}}Object.assign(e,{colorScale:d,fillingColorScale:p})},zQ=(t,e,i)=>{let{fontSizeRange:s}=e;const{getFontSize:n,getText:r}=e;let a;if(n){if(n&&s){const e=(new bO).domain(HQ(n,t)).range(s);a=t=>e.scale(n(t))}else if(n&&u(n)&&!s){const e=.5,[o,l]=HQ(n,t),h=t.map((t=>({text:r(t),value:n(t),weight:l===o?1:(n(t)-o)/(l-o)}))),c=jQ(h,i,!0);s=[~~(e*c),~~c];const u=(new bO).domain(HQ(n,t)).range(s);a=t=>u.scale(n(t))}}else{const e=t.map((t=>({text:r(t)}))),s=jQ(e,i,!1);a="function"==typeof(o=s)?o:function(){return o}}var o;Object.assign(e,{getFontSize:n,fontSizeRange:s,fontSizeScale:a})},jQ=(t,e,i)=>{const s=e.shapeArea,n=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(s)/12),o=t.reduce(((t,e)=>{const s=MQ(e.text);return s<a?t+s*(i?(.5+.5*e.weight)**2:1):t}),0);if(0===o)return 12;let l=20;if(1===r.length)l=Math.sqrt(n*(s/(1.7*o)));else{const t=[];for(let e=0;e<r.length;e++){const i=r[e].area,a=r[e].ratio,l=i/s;if(l<.1)continue;const h=l*(o*(a<1?2.7-a:1.7)),c=Math.sqrt(n*(i/h));t.push(c)}l=t.length?Math.min(...t):Math.sqrt(n*(s/(1.7*o)))}return l};const HQ=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;a<n;++a)r=ht(t(e[a])),r<i&&(i=r),r>s&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]},NQ=(t,e,i)=>{if(!t.size||d(t.size[0])||d(t.size[1])||t.size[0]<=0||t.size[1]<=0)return gt.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];if(t.size=[Math.ceil(t.size[0]),Math.ceil(t.size[1])],t.shape||gt.getInstance().error("WordcloudShape shape must be specified."),t.text||gt.getInstance().error("WordcloudShape text must be specified."),t.onBeforeLayout&&t.onBeforeLayout(),!e||0===e.length)return[];const s=new class{constructor(t){this.progressiveResult=[],this.options=t}layout(t){this.data=t;const e=this.options,i={shapeUrl:e.shape,size:e.size,ratio:e.ratio||.8,tempCanvas:void 0,boardSize:[0,0],random:!1,randomGenerator:void 0},s=this.options.createCanvas({width:e.size[0],height:e.size[1]}),n=s.getContext("2d",{willReadFrequently:!0});n.textAlign="center",n.textBaseline="middle",i.tempCanvas=s;const r=e.size[0]+31>>5<<5;if(i.boardSize=[r,e.size[1]],i.random?i.randomGenerator=Math.random:i.randomGenerator=te(),this.segmentationInput=i,_(i.shapeUrl)){i.isEmptyPixel=sQ(void 0,void 0,this.options.createCanvas);const t=LQ(i.shapeUrl,this.options.createImage);t?(this.isImageFinished=!1,this.isLayoutFinished=!1,t.then((t=>{this.isImageFinished=!0;const s=this.options.createCanvas({width:e.size[0],height:e.size[1],dpr:1});i.maskCanvas=s;const n=s.getContext("2d");e.removeWhiteBorder&&dQ(t,s,i.isEmptyPixel);const r=pQ(t,e.size);n.clearRect(0,0,e.size[0],e.size[1]),n.drawImage(t,r.x,r.y,r.width,r.height),this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i.maskCanvas)})).catch((t=>{this.isImageFinished=!0}))):(this.isImageFinished=!0,this.isLayoutFinished=!0)}else if(i.shapeUrl&&("text"===i.shapeUrl.type||"geometric"===i.shapeUrl.type)){i.isEmptyPixel=sQ(i.shapeUrl.backgroundColor,void 0,this.options.createCanvas);const t=nQ(i.shapeUrl,e.size[0],e.size[1],void 0,!1,this.options.createCanvas);i.maskCanvas=t,this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(t),this.doLayout(),this.isImageFinished=!0,this.isLayoutFinished=!0}}canAnimate(){return!0}unfinished(){return!this.isLayoutFinished}output(){return this.progressiveResult}progressiveRun(){this.isImageFinished&&!this.isLayoutFinished&&(this.segmentationInput.maskCanvas&&this.doLayout(),this.isLayoutFinished=!0)}progressiveOutput(){return this.progressiveResult}doLayout(){var t,e,i,s,n,r,a,o,l,h,c,u,d,p,g,f,m,v,y,_,b;const x=this.segmentationInput,S=uQ(x);if(!S.segmentation.regions.length)return;const A=this.options,k=this.data,C=A.colorMode||"ordinal",M={getText:ne(A.text),getFontSize:ne(A.fontSize),fontSizeRange:A.fontSizeRange,colorMode:C,getColor:A.colorField?ne(A.colorField):ne(A.text),getFillingColor:ne(A.fillingColorField),colorList:A.colorList||("ordinal"===C?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:ne(A.colorHexField),getFontFamily:ne(A.fontFamily||"sans-serif"),rotateList:A.rotateList||[0],getPadding:ne(A.padding||1),getFontStyle:ne(A.fontStyle||"normal"),getFontWeight:ne(A.fontWeight||"normal"),getFontOpacity:A.fontOpacity?ne(A.fontOpacity):()=>1};zQ(k,M,S);const T={size:A.size,ratio:A.ratio||.8,shapeUrl:A.shape,random:void 0===A.random||A.random,textLayoutTimes:null!==(t=A.textLayoutTimes)&&void 0!==t?t:3,removeWhiteBorder:A.removeWhiteBorder,layoutMode:null!==(e=A.layoutMode)&&void 0!==e?e:"default",fontSizeShrinkFactor:null!==(i=A.fontSizeShrinkFactor)&&void 0!==i?i:.8,stepFactor:null!==(s=A.stepFactor)&&void 0!==s?s:1,importantWordCount:null!==(n=A.importantWordCount)&&void 0!==n?n:10,globalShinkLimit:A.globalShinkLimit||.2,fontSizeEnlargeFactor:null!==(r=A.fontSizeEnlargeFactor)&&void 0!==r?r:1.5,fillingRatio:null!==(a=A.fillingRatio)&&void 0!==a?a:.7,fillingTimes:null!==(o=A.fillingTimes)&&void 0!==o?o:4,fillingXStep:A.fillingXRatioStep?Math.max(Math.floor(A.size[0]*A.fillingXRatioStep),1):null!==(l=A.fillingXStep)&&void 0!==l?l:4,fillingYStep:A.fillingYRatioStep?Math.max(Math.floor(A.size[1]*A.fillingYRatioStep),1):null!==(h=A.fillingYStep)&&void 0!==h?h:4,fillingInitialFontSize:A.fillingInitialFontSize,fillingDeltaFontSize:A.fillingDeltaFontSize,fillingInitialOpacity:null!==(c=A.fillingInitialOpacity)&&void 0!==c?c:.8,fillingDeltaOpacity:null!==(u=A.fillingDeltaOpacity)&&void 0!==u?u:.05,getFillingFontFamily:ne(A.fillingFontFamily||"sans-serif"),getFillingFontStyle:ne(A.fillingFontStyle||"normal"),getFillingFontWeight:ne(A.fillingFontWeight||"normal"),getFillingPadding:ne(null!==(d=A.fillingPadding)&&void 0!==d?d:.4),fillingRotateList:null!==(p=A.fillingRotateList)&&void 0!==p?p:[0,90],fillingDeltaFontSizeFactor:null!==(g=A.fillingDeltaFontSizeFactor)&&void 0!==g?g:.2,fillingColorList:A.fillingColorList||["#537EF5"],sameColorList:!1,minInitFontSize:null!==(f=A.minInitFontSize)&&void 0!==f?f:10,minFontSize:null!==(m=A.minFontSize)&&void 0!==m?m:4,minFillFontSize:null!==(v=A.minFillFontSize)&&void 0!==v?v:2},w=((t,e)=>{if(1===e.length&&"#537EF5"===e[0])return!0;if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0})(M.colorList,T.fillingColorList);T.sameColorList=w,FQ(k,M,T,A),function(t,e,i,s){const{getText:n}=e;let{fillingInitialFontSize:r,fillingDeltaFontSize:a}=i;const{fillingRatio:o}=i,l=Math.ceil(Math.sqrt(s.shapeArea)/4);if(!r||!a){const e=o/100,h=t.reduce(((t,e)=>{const i=MQ(n(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*s.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(k,M,T,S);const{getText:D,getFontFamily:E,getFontStyle:B,getFontWeight:P,getPadding:R,getColor:L,getFillingColor:I,getColorHex:O,fontSizeScale:F,colorScale:z,fillingColorScale:j,getFontOpacity:H,rotateList:N}=M,U=k.map((t=>{var e,i;return{x:0,y:0,weight:0,text:D(t),fontFamily:E(t),fontWeight:P(t),fontStyle:B(t),rotate:N[~~(x.randomGenerator()*N.length)],fontSize:Math.max(T.minInitFontSize,~~F(t)),opacity:H(t),padding:R(t),color:O&&O(t)||z&&z(L(t))||"black",fillingColor:!I||(null===(e=A.colorField)||void 0===e?void 0:e.field)===(null===(i=A.fillingColorField)||void 0===i?void 0:i.field)&&w?void 0:O&&O(t)||j&&j(I(t))||"black",datum:t,visible:!0,hasPlaced:!1}})),V=et(U.map((t=>t.fontSize)));U.forEach((t=>t.weight=t.fontSize/V)),U.sort(((t,e)=>e.weight-t.weight));const{fillingWords:W,successedWords:G,failedWords:Y}=RQ(U,T,S),X=null!==(_=null===(y=A.text)||void 0===y?void 0:y.field)&&void 0!==_?_:"textKey",$=null!==(b=A.dataIndexKey)&&void 0!==b?b:"defaultDataIndexKey",K=A.as?Object.assign(Object.assign({},OQ),A.as):OQ;let q,Z;const J=[];for(let t=0;t<U.length;++t)q=U[t],Z=q.datum,Z[K.x]=q.x,Z[K.y]=q.y,Z[K.fontFamily]=q.fontFamily,Z[K.fontSize]=q.fontSize,Z[K.fontStyle]=q.fontStyle,Z[K.fontWeight]=q.fontWeight,Z[K.angle]=$e(q.rotate),Z[K.opacity]=q.opacity,Z[K.visible]=q.visible,Z[K.isFillingWord]=!1,Z[K.color]=q.color,Z[$]=`${q.text}_${t}_keyword`,J.push(Z);const Q=[];W.forEach(((t,e)=>{var i,s;const n=Object.assign({},t.datum);n[K.x]=t.x,n[K.y]=t.y,n[K.fontFamily]=t.fontFamily,n[K.fontSize]=t.fontSize,n[K.fontStyle]=t.fontStyle,n[K.fontWeight]=t.fontWeight,n[K.angle]=$e(t.rotate),n[K.opacity]=t.opacity,n[K.visible]=t.visible,n[K.isFillingWord]=!0,n[K.color]=I?(null===(i=A.colorField)||void 0===i?void 0:i.field)===(null===(s=A.fillingColorField)||void 0===s?void 0:s.field)&&w?t.color:t.fillingColor:T.fillingColorList[~~(x.randomGenerator()*T.fillingColorList.length)],n[X]=t.text,n[$]=`${t.text}_${e}_fillingWords`,Q.push(n)})),this.options.onLayoutFinished&&this.options.onLayoutFinished({successedWords:G,failedWords:Y}),this.progressiveResult=J.concat(Q)}release(){this.segmentationInput=null,this.data=null,this.progressiveResult=null,this.options=null}}(t);return s.layout(e),s.unfinished()?{progressive:s}:s.output()};var UQ;function VQ(t,e){t.aspectRatio>1?(t.width=e,t.height=~~(e/t.aspectRatio)):(t.height=e,t.width=~~(e*t.aspectRatio))}!function(t){t.BEFORE_IMAGECLOUD_LAYOUT="beforeImagecloudLayout",t.AFTER_IMAGECLOUD_LAYOUT="afterImagecloudLayout",t.AFTER_IMAGECLOUD_DRAW="afterImagecloudDraw"}(UQ||(UQ={}));class WQ{constructor(t){this.progressiveResult=[],this.imageCollageList=[],this.options=t}preProcess(){const{imageConfig:t={},weight:e}=this.options,{padding:i=0}=t;let s=this.imageCollageList;return s.forEach(((t,s)=>{!1===t.valid?(t.x=-10,t.y=-10,t.width=0,t.height=0,t.opacity=0):(t.padding=i,t.weight=ne(e)(this.data[s]),t.datum=this.data[s])})),s=s.filter((t=>!1!==t.valid)).sort(((t,e)=>e.weight-t.weight)),s}onImageCollageInputReady(t){t.forEach(((t,e)=>{if("fulfilled"===t.status){const i=t.value,{width:s,height:n}=i;this.imageCollageList.push(Object.assign({},this.data[e],{aspectRatio:s/n}))}else this.imageCollageList.push(Object.assign({},this.data[e],{valid:!1}))}))}layout(t){this.data=t,this.loadSegmentationInput(),this.loadImageCollageInput()}loadSegmentationInput(){var t,e,i,s,n,r;const a=this.options,o=a.size,l={shapeUrl:null!==(t=a.mask)&&void 0!==t?t:{type:"geometric",shape:"rect"},size:o,ratio:a.ratio||.8,tempCanvas:void 0,boardSize:[0,0],random:!1,randomGenerator:void 0,blur:null===(e=a.maskConfig)||void 0===e?void 0:e.edgeBlur},h=this.options.createCanvas({width:o[0],height:o[1]}),c=h.getContext("2d",{willReadFrequently:!0});c.textAlign="center",c.textBaseline="middle",l.tempCanvas=h;const u=o[0]+31>>5<<5;if(l.boardSize=[u,o[1]],l.random?l.randomGenerator=Math.random:l.randomGenerator=te(),this.segmentationInput=l,_(l.shapeUrl)){l.isEmptyPixel=sQ(void 0,{threshold:null!==(s=null===(i=a.maskConfig)||void 0===i?void 0:i.threshold)&&void 0!==s?s:200,invert:null===(n=a.maskConfig)||void 0===n?void 0:n.invert},this.options.createCanvas);const t=LQ(l.shapeUrl,this.options.createImage);t?(this.isMaskImageFinished=!1,this.isLayoutFinished=!1,t.then((t=>{var e,i;this.isMaskImageFinished=!0;const s=a.size,n=this.options.createCanvas({width:s[0],height:s[1],dpr:1});l.maskCanvas=n;const r=n.getContext("2d");(null===(e=a.maskConfig)||void 0===e?void 0:e.removeWhiteBorder)&&dQ(t,n,l.isEmptyPixel);const o=pQ(t,s);let h;r.clearRect(0,0,s[0],s[1]),r.drawImage(t,o.x,o.y,o.width,o.height),this.segmentationOutput=uQ(this.segmentationInput),"masked"===(null===(i=this.options.layoutConfig)||void 0===i?void 0:i.placement)&&(h=this.generateTransparentMaskCanvas(t,s)),this.segmentationOutput.transparentMaskCanvas=h,this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(n,h)})).catch((t=>{this.isMaskImageFinished=!0}))):(this.isMaskImageFinished=!0,this.isLayoutFinished=!0)}else if(l.shapeUrl&&("text"===l.shapeUrl.type||"geometric"===l.shapeUrl.type)){l.isEmptyPixel=sQ(l.shapeUrl.backgroundColor,void 0,this.options.createCanvas),"text"!==l.shapeUrl.type&&"geometric"!==l.shapeUrl.type||l.shapeUrl.backgroundColor||(l.shapeUrl.backgroundColor="rgba(255,255,255,255)");const t=nQ(l.shapeUrl,o[0],o[1],void 0,null===(r=a.maskConfig)||void 0===r?void 0:r.invert,this.options.createCanvas);l.maskCanvas=t,this.segmentationOutput=uQ(this.segmentationInput),this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(t,t),this.isMaskImageFinished=!0}}loadImageCollageInput(){const t=IQ(this.data.map((t=>ne(this.options.image)(t))),this.options.createImage);t?t.then((t=>{this.onImageCollageInputReady(t),this.isImagesFinished=!0})).catch((t=>{this.isImagesFinished=!0,this.isLayoutFinished=!0,gt.getInstance().error("image load failed",t)})):(this.isImagesFinished=!0,this.isLayoutFinished=!0)}canAnimate(){return!0}unfinished(){return!this.isLayoutFinished}output(){return this.progressiveResult}progressiveRun(){if(this.isImagesFinished&&this.isMaskImageFinished&&!this.isLayoutFinished){const t=this.preProcess(),e=this.doLayout(t);this.options&&this.options.onLayoutEnd&&this.options.onLayoutEnd(e),this.progressiveResult=this.processOutput(e),this.isLayoutFinished=!0}}progressiveOutput(){return this.progressiveResult}release(){this.segmentationInput=null,this.data=null,this.progressiveResult=null,this.options=null}calculateImageSize(t,e={},i=.45){const{imageSizeRange:s,padding:n=0}=e,r=A(e.imageSize)?e.imageSize:se(e.imageSize),a=this.options.size;if(r||s)if(r&&!u(r))t.forEach((t=>VQ(t,r)));else if(s){const e=(new bO).domain(oe(t,(t=>t.weight))).range(s);t.forEach((t=>VQ(t,~~e.scale(t.weight))))}else if(r&&u(r)&&!s){const e=.5,[s,r]=oe(t,(t=>t.weight)),o=t.reduce(((t,i)=>{const n=i.aspectRatio,a=(i.weight-s)/(r-s);return t+(n>1?1/n:n)*(e+(1-e)*a)**2}),0),l=~~Math.sqrt(i*a[0]*a[1]/o),h=[~~(e*l)-2*n<0?1:~~(e*l)-2*n,~~l-2*n<0?1:~~l-2*n],c=(new bO).domain(oe(t,(t=>t.weight))).range(h);t.forEach((t=>VQ(t,~~c.scale(t.weight))))}else console.warn("image cloud imageSize error");else{const e=t.reduce(((t,e)=>{const i=e.aspectRatio;return t+(i>1?1/i:i)}),0);let s=~~Math.sqrt(i*a[0]*a[1]/e);s=s-2*n<0?1:s-2*n,t.forEach((t=>VQ(t,s)))}return t}generateTransparentMaskCanvas(t,e){var i;const s=this.options.createCanvas({width:e[0],height:e[1],dpr:1}),n=s.getContext("2d");this.segmentationOutput.transparentMaskCanvas=s,(null===(i=this.options.maskConfig)||void 0===i?void 0:i.removeWhiteBorder)&&dQ(t,s,this.segmentationInput.isEmptyPixel);const r=n.createImageData(e[0],e[1]),a=this.segmentationOutput.segmentation.labels;for(let t=0;t<a.length;t++){const e=0===a[t]?255:0,i=255*a[t],s=4*t;r.data[s]=e,r.data[s+1]=e,r.data[s+2]=e,r.data[s+3]=i}return n.clearRect(0,0,e[0],e[1]),n.fillStyle="rgba(255,255,255,0)",n.fillRect(0,0,e[0],e[1]),n.putImageData(r,0,0),s}processOutput(t){var e;const i=null===(e=this.options)||void 0===e?void 0:e.as;return i&&Object.keys(i).forEach((e=>{t.forEach((t=>{t[i[e]]=t[e],delete t[e]}))})),t}}class GQ extends WQ{preProcess(){const t=super.preProcess(),{imageConfig:e={},ratio:i=.45}=this.options;return this.calculateImageSize(t,e,i)}tryPlaceImage(t,e,i,s,n,r=1){const[a,o]=e,l=a/2,h=o/2,c=Math.sqrt(l**2+h**2),u=qJ[i](e);let d,p,g=-r;const{segmentation:f}=s,{labels:m}=f;for(;([d,p]=u(g+=r))&&!(Math.min(Math.abs(d),Math.abs(p))>=c);)if(d-=t.width/2,p-=t.height/2,t.visible=!0,t.x=~~(l+d),t.y=~~(h+p),t._left=t.x+t.padding,t._top=t.y+t.padding,t._leftWithoutPadding=t.x,t._topWithoutPadding=t.y,YQ(t,n)){const{x:e,y:i,width:s,height:n}=t;let r=!1;for(let t=0;t<s;t++){for(let s=0;s<n&&i+t<=o;s++)if(!(e+s>a||m[(i+t)*a+(e+s)])){r=!0;break}if(r)break}if(!r){const e=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x,y:t.y+t.height},{x:t.x+t.width,y:t.y+t.height}];let i=!0;for(const t of e)if(!m[t.y*a+t.x]){i=!1;break}if(!i)continue;return!0}}return!1}doLayout(t){var e;const{segmentationOutput:i}=this,{layoutConfig:s={}}=this.options,n=this.options.size,{spiralType:r="archimedean",fillingTimes:a=4,minFillingImageSize:o=10}=s,l=[],h=Object.keys(t[0]).find((t=>t.includes("VGRAMMAR")));for(const e of t)e._widthWithPadding=e.width+2*e.padding,e._heightWithPadding=e.height+2*e.padding,e.frequency=1,this.tryPlaceImage(e,n,r,i,l)&&l.push(e);const c=it(l,((t,e)=>t.width-e.width)).width,u=it(l,((t,e)=>t.height-e.height)).height,d=[];for(let s=0;s<a;s++){const a=.5*c-1*s,p=.5*u-1*s;for(const s of t){const t=Object.assign({},s,{visible:!0});VQ(t,Math.max(o,t.aspectRatio>1?a:p)),t._widthWithPadding=t.width+2*t.padding,t._heightWithPadding=t.height+2*t.padding,this.tryPlaceImage(t,n,r,i,[...d,...l],.5)&&(s._tempFrequency=(null!==(e=s._tempFrequency)&&void 0!==e?e:s.frequency)+1,t.frequency=s._tempFrequency,t.distance=Math.sqrt(Math.pow(t.x-n[0]/2,2)+Math.pow(t.y-n[1]/2,2)),t[h]=`${t[h]}_${t.frequency}`,d.push(t))}}return[...l,...d].filter((t=>t.visible))}}function YQ(t,e){for(let i=0;i<e.length;i++)if(XQ(t,e[i]))return!1;return!0}function XQ(t,e){return!(t._leftWithoutPadding+t._widthWithPadding<e._leftWithoutPadding||t._topWithoutPadding+t._heightWithPadding<e._topWithoutPadding||t._leftWithoutPadding>e._leftWithoutPadding+e._widthWithPadding||t._topWithoutPadding>e._topWithoutPadding+e._heightWithPadding)}function $Q(t){const{imageConfig:e={},size:i,ratio:s=.1,layoutConfig:n={}}=t,{padding:r=0,imageSize:a}=e,[o,l]=i;let h;h=a||Math.min(o,l)*s-2*r,h<0&&(h=1);const{rectAspectRatio:c=1}=n;let u,d;c>1?(u=h,d=h/c):(d=h,u=h*c);const p=Math.ceil(l/(d+r)),g=Math.ceil(o/(u+r)),f=o/2,m=l/2,v=new Array(g*p);for(let t=0;t<p;t++)for(let e=0;e<g;e++){const i=e*(u+r)+u/2,s=t*(d+r)+d/2;v[t*g+e]={centerX:i,centerY:s,x:i-u/2,y:s-d/2,row:t,col:e,distance:Math.sqrt(Math.pow(i-f,2)+Math.pow(s-m,2))}}return{context:Object.assign({},n,{cellWidth:u,cellHeight:d,cellInfo:v,cellCount:v.length,cellType:"rect",cellPixelCount:u*d,eachPixel:(t,e)=>{const{x:i,y:s}=t;for(let t=0;t<u;t++)for(let n=0;n<d&&s+t<=l;n++)i+n>o||e((~~s+t)*o+(~~i+n))},clipPath:`M${-u/2} ${-d/2} L${u/2} ${-d/2} L${u/2} ${d/2} L${-u/2} ${d/2} Z`}),imageLength:h}}const KQ={rect:$Q,circle:function(t){const{imageConfig:e={},size:i,ratio:s=.1,layoutConfig:n={}}=t,{padding:r=0,imageSize:a=0}=e,[o,l]=i,h=o/2,c=l/2;let u=0;u=a?a/2:Math.min(o,l)*s/2,u-r<=0&&(u=r+1);const d=2*u,p=Math.sqrt(3)/2*d+r,g=[];let f=0;for(let t=0;t*p-u<l;t++){const e=t*p,i=t%2==0?0:u;for(let s=-1;s*(d+r)+i-u<o;s++){const n=s*(d+r)+i+u;g[f++]={centerX:n,centerY:e,x:n-u,y:e-u,row:t,col:s,distance:Math.sqrt(Math.pow(n-h,2)+Math.pow(e-c,2))}}}let m=0;const v=u*u;for(let t=0;t<d;t++)for(let e=0;e<d;e++){const i=t-u,s=e-u;i*i+s*s<=v&&m++}return{context:Object.assign({},n,{cellWidth:d,cellHeight:d,cellInfo:g,cellCount:g.length,cellType:"circle",cellPixelCount:m,eachPixel:(t,e)=>{const{x:i,y:s}=t;for(let t=0;t<d;t++)for(let n=0;n<d;n++){if(t+i<0||t+i>o||n+s>l||n+s<0)continue;const r=t-u,a=n-u;r*r+a*a<=v&&e((~~s+t)*o+(~~i+n))}},clipPath:"M 1 0 A 1 1 0 1 0 -1 0 A 1 1 0 1 0 1 0 Z"}),imageLength:d}},hexagonal:function(t){const{imageConfig:e={},size:i,ratio:s=.1,layoutConfig:n={}}=t,{padding:r=0,imageSize:a}=e,[o,l]=i,h=o/2,c=l/2;let u;u=a?a/2:Math.min(o,l)*s/2,u-r<=0&&(u=r+1);const d=[],p=2*Math.PI/6;for(let t=0;t<6;t++){const e=p*t;d.push({x:(u-r/2)*Math.cos(e),y:(u-r/2)*Math.sin(e)})}const g=2*u,f=Math.sin(Math.PI/6)*g,m=Math.sqrt(3)*f,v=g-f/2,y=Math.cos(Math.PI/6)*g,_=y/2,b=Math.floor(l/m),x=Math.floor(o/f),S=[];for(let t=-1;t<=b+1;t++)for(let e=-1;e<=x;e++){const i=e*v,s=t*y+(e%2?_:0);S.push({centerX:i,centerY:s,x:i-f,y:s-f,row:t,col:e,distance:Math.sqrt(Math.pow(i-h,2)+Math.pow(s-c,2))})}let A=0;const k=[];for(let t=0;t<=m;t++)for(let e=0;e<=2*f;e++){const i=e-f,s=t-m/2,n=Math.abs(i),r=Math.abs(s);n<=f&&r<=m/2&&2*r+n*Math.sqrt(3)<=m?(A++,k.push(!0)):k.push(!1)}return{context:Object.assign({},n,{cellHexSideLength:f,cellHexPoints:d,cellHeight:m,cellWidth:2*f,cellInfo:S,cellCount:S.length,cellType:"hexagonal",cellPixelCount:A,eachPixel:(t,e)=>{const{x:i,y:s}=t;let n=0;for(let t=0;t<=m;t++)for(let r=0;r<=2*f;r++)k[n++]&&e((~~s+t)*o+(~~i+r))},clipPath:"M 1 0 L 0.5 0.866 L -0.5 0.866 L -1 0 L -0.5 -0.866 L 0.5 -0.866 Z"}),imageLength:g-r}}};let qQ=class extends WQ{preProcess(){var t;const e=super.preProcess(),{layoutConfig:i={}}=this.options,{cellType:s="rect"}=i,n=(null!==(t=KQ[s])&&void 0!==t?t:KQ.rect)(this.options),{context:r,imageLength:a}=n;return e.forEach((t=>function(t,e){t.aspectRatio>1?(t.height=e,t.width=~~(e*t.aspectRatio)):(t.width=e,t.height=~~(e/t.aspectRatio))}(t,a))),r.cellInfo.sort(((t,e)=>t.distance-e.distance)),this.layoutContext=r,e}doLayout(t){const{cellWidth:e,cellHeight:i,cellInfo:s,cellCount:n,clipPath:r,eachPixel:a,cellPixelCount:o}=this.layoutContext;if(0===t.length||0===n||0===e||0===i||0===s.length)return void(this.isLayoutFinished=!0);const{segmentationOutput:l}=this,{layoutConfig:h={}}=this.options,{placement:c="default"}=h;if("edge"===c||"default"===c){const{segmentation:t}=l,{labels:e}=t;s.forEach((t=>{let i=0;a(t,(t=>{e[t]&&i++})),t.intersectPixels=i}))}const u=t.length,d=t=>{const{intersectPixels:e}=t;return"default"===c?e>=.45*o:"edge"!==c||e>.1*o&&e<o};for(let e=0;e<u;e++){const i=t[e],n=s[e];n&&(i.x=n.centerX-i.width/2,i.y=n.centerY-i.height/2,i.clipConfig={shape:r},i.frequency=1,i.visible=d(n),i.cell=V(n,["image"]),i.distance=n.distance,n.image=i)}const p=Object.keys(t[0]).find((t=>t.includes("VGRAMMAR")));if(u<n)for(let e=u;e<n;e++){const i=t[e-u],n=s[e];if(n){const e=Object.assign({},i);e.x=n.centerX-e.width/2,e.y=n.centerY-e.height/2,e.frequency+=1,e[p]=`${e[p]}_${e.frequency}`,e.visible=d(n),e.distance=n.distance,e.cell=V(n,["image"]),n.image=e,t.push(e)}}return t.filter((t=>t.visible))}};class ZQ extends WQ{preProcess(){const t=super.preProcess(),{imageConfig:e={},ratio:i=.1}=this.options,s=$Q;return this.layoutContext=s(Object.assign({},this.options,{imageConfig:{imageSize:null}})).context,this.layoutContext.cellInfo.sort(((t,e)=>t.distance-e.distance)),this.calculateImageSize(t,e,i)}doLayout(t){const{segmentationOutput:e}=this,{cellWidth:i,cellHeight:s,cellInfo:n,cellCount:r,eachPixel:a,cellPixelCount:o}=this.layoutContext;if(0===t.length||0===r||0===i||0===s||0===n.length)return void(this.isLayoutFinished=!0);const{layoutConfig:l={}}=this.options,h=this.options.size,{placement:c="default",maxAngle:u=Math.PI/180*45}=l;if("edge"===c||"default"===c){const{segmentation:t}=e,{labels:i}=t;n.forEach((t=>{let e=0;a(t,(t=>{i[t]&&e++})),t.intersectPixels=e}))}const d=t.length,p=Math.sqrt(Math.pow(h[0],2)+Math.pow(h[1],2)),g=t=>{const{intersectPixels:e}=t;return"default"===c?e>.5*o:"edge"!==c||e>.1*o&&e<o};for(let e=0;e<d;e++){const i=t[e],s=n[e];s&&(i.x=s.centerX-i.width/2,i.y=s.centerY-i.height/2,i.visible=g(s),i.cell=`${s.row}_${s.col}`,i.angle=Math.random()*(2*u)-u,i.anchor=[i.x+i.width/2,i.y+i.height/2],i.zIndex=p-s.distance,i.distance=s.distance,i.frequency=1,s.image=i)}const f=Object.keys(t[0]).find((t=>t.includes("VGRAMMAR")));if(d<r)for(let e=d;e<r;e++){const i=t[e-d],s=n[e];if(s){const e=Object.assign({},i);e.x=s.centerX-e.width/2,e.y=s.centerY-e.height/2,e.anchor=[e.x+e.width/2,e.y+e.height/2],e.angle=Math.random()*(2*u)-u,e.frequency+=1,e[f]=`${e[f]}_${e.frequency}`,e.visible=g(s),e.cell=`${s.row}_${s.col}`,e.distance=s.distance,e.zIndex=p-s.distance,s.image=e,t.push(e)}}return t.filter((t=>t.visible))}}class JQ extends BZ{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.wordCloud}}JQ.type=t.SeriesTypeEnum.wordCloud;const QQ=()=>{wH.registerGrammarTransform("wordcloud",{transform:yQ}),UK(),wH.registerAnimation("wordCloud",((t,e)=>({appear:PZ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:CV.disappear.duration}}))),wH.registerSeries(JQ.type,JQ)},t0=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:u,asLastValue:d,asCurrentValue:p,asNextValue:g,heightVisual:f=!1,isCone:m=!0,range:v}=e,y=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),_=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:_,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:y];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),y=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),_=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=C(_*v)&&0!==v?_/v:0,S=C(v*y)&&0!==y?v/y:0;d&&(t[d]=y),g&&(t[g]=_),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:_/b[1]),u&&(t[u]=0===e?1:y/b[1]),p&&(t[p]=v)})),n},e0=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},i0=`${ZH}_FUNNEL_TRANSFORM_RATIO`,s0=`${ZH}_FUNNEL_REACH_RATIO`,n0=`${ZH}_FUNNEL_HEIGHT_RATIO`,r0=`${ZH}_FUNNEL_VALUE_RATIO`,a0=`${ZH}_FUNNEL_LAST_VALUE_RATIO`,o0=`${ZH}_FUNNEL_NEXT_VALUE_RATIO`,l0=`${ZH}_FUNNEL_LAST_VALUE`,h0=`${ZH}_FUNNEL_CURRENT_VALUE`,c0=`${ZH}_FUNNEL_NEXT_VALUE`,u0=`${ZH}_FUNNEL_TRANSFORM_LEVEL`;class d0 extends cW{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[s0])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return g(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class p0 extends dV{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class g0 extends p0{constructor(){super(...arguments),this.type=g0.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}g0.type="polygon";const f0=()=>{wH.registerMark(g0.type,g0),FE(),TE(),IV(),wH.registerGraphicComponent("polygon",dy)},m0=Object.assign(Object.assign({},SW),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class v0 extends zW{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class y0 extends jW{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=v0,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;iU(this._dataSet,"funnel",t0),iU(this._dataSet,"funnelTransform",e0);const t=new Th(this._dataSet,{name:`${ZH}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new oV(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:h0,asTransformRatio:i0,asReachRatio:s0,asHeightRatio:n0,asValueRatio:r0,asNextValueRatio:o0,asLastValueRatio:a0,asLastValue:l0,asNextValue:c0,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:u0}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},y0.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:LW(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},y0.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(y0.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(y0.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new d0(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>g(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),u(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;g(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&mA(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&mA(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*jj(s0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(EW(null===(s=wH.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),BW("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(EW(wH.getAnimationInKey("fadeInOut")(),BW(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(EW(wH.getAnimationInKey("funnel")({},o),BW(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(EW(null===(a=wH.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),BW("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[a0])/2:this._getSecondaryAxisLength(t[r0])/2,n=this._getSecondaryAxisLength(t[r0])/2):(s=this._getSecondaryAxisLength(t[r0])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[o0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[u0])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return g(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[iN]===t[iN]));if(!g(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(A(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,u=c?c.x2-c.x1:0,d=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,u);return"center"===this._funnelAlign&&(p/=2),p-d-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const u=this.getCategoryField(),d=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[u])===t[u]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[u])===t[u]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==d?void 0:d.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_<this._minLabelLineWidth&&(_=y-this._minLabelLineWidth),v=m):(y=this._getPolygonCenter(i).y+s/2+e,_=!1!==f.alignLabel?(null==d?void 0:d.y1)-e:y+e,m=this._getPolygonCenter(i).x,_-y<this._minLabelLineWidth&&(_=y+this._minLabelLineWidth),v=m),{x1:m,x2:v,y1:y,y2:_}}const b=this.getPoints(t),x=(Math.abs(b[0].x-b[1].x)+Math.abs(b[2].x-b[3].x))/2,S=(null==g?void 0:g.x2)-(null==g?void 0:g.x1)||0,A=null!==(c=f.spaceWidth)&&void 0!==c?c:5;return"right"===this._spec.outerLabel.position||"left"===this._funnelAlign?(m=this._getPolygonCenter(b).x+Math.max(S/2,x/2)+A,v=!1!==f.alignLabel?(null==d?void 0:d.x1)-A:m+A,y=this._getPolygonCenter(b).y,v-m<this._minLabelLineWidth&&(v=m+this._minLabelLineWidth),_=y):(m=this._getPolygonCenter(b).x-Math.max(S/2,x/2)-A,v=!1!==f.alignLabel?(null==d?void 0:d.x2)+A:m-A,y=this._getPolygonCenter(b).y,m-v<this._minLabelLineWidth&&(v=m-this._minLabelLineWidth),_=y),{x1:m,x2:v,y1:y,y2:_}}_computeMaxSize(){var t;const e=this._isHorizontal()?this.getLayoutRect().height:this.getLayoutRect().width;return uH(null!==(t=this._spec.maxSize)&&void 0!==t?t:"80%",e)}_computeMinSize(){var t;const e=this._isHorizontal()?this.getLayoutRect().height:this.getLayoutRect().width;return uH(null!==(t=this._spec.minSize)&&void 0!==t?t:0,e)}_isHorizontal(){return"left"===this._funnelOrient||"right"===this._funnelOrient}_isReverse(){return"bottom"===this._funnelOrient||"right"===this._funnelOrient}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._funnelMark]}}y0.type=t.SeriesTypeEnum.funnel,y0.mark=m0,y0.builtInTheme={funnel:PH},y0.transformerConstructor=v0;const _0=()=>{f0(),UK(),Q$(),wH.registerSeries(y0.type,y0),wH.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},TV))),wH.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:LR,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),DV()},b0=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},x0=t=>{const e=t.filter((t=>t.context.diffState===JU.update)),i=it(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},S0=(t,e,i)=>{if(R(t))return[e,i];const s=it(t.map((t=>1*t.getFinalAttribute().startAngle))),n=et(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},A0=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=x0(i.parent.children),a=S0(r,s,n);return b0(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=x0(i.parent.children),a=S0(r,s,n);return b0(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),k0=t=>{const e=it(t.map((t=>1*t.getFinalAttribute().startAngle))),i=et(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},C0=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=x0(i.parent.children),a=k0(r);return b0(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=x0(i.parent.children),a=k0(r);return b0(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),M0=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},T0=(t,e={})=>{if(!t)return[];const i=[];return OZ(t,i,e),i},w0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new dJ(i).layout(t,{width:s,height:n})};class D0 extends cW{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var E0;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(E0||(E0={}));const B0=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(d(n))return t;if(i.type===E0.DrillDown){return J(IN(t,n,s,"children"))}if(i.type===E0.DrillUp){const e=ON(t,n,s,"children");if(e)return J(e)}return t};class P0{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=I$(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;iU(t,"drillFilter",B0),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(d(t.datum)||d(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!b(e)||R(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:E0.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:E0.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!b(r)||R(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:E0.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:E0.DrillUp},model:this}),r}}const R0=Object.assign(Object.assign({},SW),{sunburst:{name:"sunburst",type:"arc"}}),L0=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:fW,operations:["max","min","values"]}),t.push({key:mW,operations:["values"]}),t),I0={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class O0 extends nq{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:mW),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:iN},getRawData:()=>this.getRawData()}),this._startAngle=$e(this._spec.startAngle),this._endAngle=$e(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),iU(this._dataSet,"sunburstLayout",w0),iU(this._dataSet,"flatten",T0),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[g(this._centerX)?this._centerX:this.getLayoutRect().width/2,g(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return L0(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(iU(t.dataSet,"addVChartProperty",sW),t.transform({type:"addVChartProperty",options:{beforeCall:bW.bind(this),call:xW}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(O0.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){d(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(g(this._offsetX)?this._offsetX:0),y:t=>t.y+(g(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(O0.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return f(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(g(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(g(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new D0(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(J(this.__innerRadius))[0],outerRadius:this._computeRadius(J(this.__outerRadius))[0],startAngle:J(this._startAngle)[0],endAngle:J(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(EW(null===(e=wH.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),BW(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(EW(null===(e=wH.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),BW(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return b(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}O0.type=t.SeriesTypeEnum.sunburst,O0.mark=R0,O0.builtInTheme={sunburst:I0},Z(O0,P0);const F0=()=>{wH.registerSeries(O0.type,O0),mq(),UK(),DV(),wH.registerAnimation("sunburst",((t,e)=>({appear:M0(0,e),enter:A0(t),exit:C0(t),disappear:{duration:CV.disappear.duration}})))},z0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new JZ(i).layout(t,{width:s,height:n})};class j0 extends cW{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const H0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},N0=Object.assign(Object.assign({},SW),{circlePacking:{name:"circlePacking",type:"arc"}});class U0 extends VW{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:mW),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:iN},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();d(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),iU(this._dataSet,"circlePackingLayout",z0),iU(this._dataSet,"flatten",T0),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(iU(t.dataSet,"addVChartProperty",sW),t.transform({type:"addVChartProperty",options:{beforeCall:bW.bind(this),call:xW}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(U0.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){d(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(U0.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return L0(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new j0(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(EW(null===(i=wH.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),BW(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(EW(null===(e=wH.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),BW(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}U0.type=t.SeriesTypeEnum.circlePacking,U0.mark=N0,U0.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},Z(U0,P0);const V0=()=>{wH.registerSeries(U0.type,U0),mq(),UK(),wV(),wH.registerAnimation("circlePacking",((t,e)=>({appear:H0(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:CV.disappear.duration}})))},W0=(t,e,i)=>{e.forEach((e=>{d(e[i])||t.add(e[i]),e.children&&e.children.length>0&&W0(t,e.children,i)}))},G0=t=>{var e;if(!t||!b(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},Y0=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new oJ(e),r=[];return r.push(n.layout(s,i)),r},X0=t=>{var e,i;return t&&b(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},$0=t=>{var e,i;return t&&b(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class K0 extends cW{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(A(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const q0=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),Z0=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:q0(t),J0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class Q0 extends cR{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class t1 extends cR{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const e1=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),u=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),u=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=u(t.y0-n/2),l=u(t.y1-n/2)):"end"===t.align?(o=u(t.y0+t.thickness/2-n),l=u(t.y1+t.thickness/2-n)):(o=u(t.y0-t.thickness/2),l=u(t.y1-t.thickness/2));const d=u(o+n),p=u(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${u(l-n/2)}L${u(a+n)},${u((l+p)/2)}L${a},${u(p+n/2)}`:"",m=t.startArrow&&g?`L${r},${u(d+n/2)}L${u(r-n)},${u((o+d)/2)}L${r},${u(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${d}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${d}L${r},${d}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${d},${r},${d}${m}Z`},i1=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),u=t=>t;!1!==t.round&&(u=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=u(t.x0-n/2),l=u(t.x1-n/2)):"end"===t.align?(o=u(t.x0+t.thickness/2-n),l=u(t.x1+t.thickness/2-n)):(o=u(t.x0-t.thickness/2),l=u(t.x1-t.thickness/2));const d=u(o+n),p=u(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${u(l-n/2)},${a}L${u((l+p)/2)},${u(a+n)}L${u(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${u(d+n/2)},${r}L${u((d+o)/2)},${u(r-n)}L${u(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${d},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${d},${h}L${d},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${d},${h},${d},${r}${m}Z`};class s1 extends AK{constructor(){super(...arguments),this.type=s1.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?i1:e1,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}s1.type="linkPath";const n1=Object.assign(Object.assign({},SW),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class r1 extends zW{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const a1=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class o1 extends VW{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.sankey,this.transformerConstructor=r1,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new ss,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(g(a))return a;if(g(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(g(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=A(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=VN(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=VN(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=VN(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),a1(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=VN(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=VN(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=VN(t),u=(null==c?void 0:c.parents)?"parents":"source";if(J(c[u]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=VN(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(J(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;r<n;r++){const n=i[r].key,a=i[r+1]?i[r+1].key:s.key,o=e.value,l=t.find((t=>t.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=VN(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void a1(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void a1(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(VN(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=VN(e),r=[n.source,n.target],a=[];J(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;s<i-1;s++){const i=e[s].key,n=e[s+1].key,r=t.value,o=a.find((t=>t.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=VN(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void a1(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void a1(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void a1(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){iU(this._dataSet,"sankeyLayout",Y0),iU(this._dataSet,"sankeyFormat",G0),a.transform({type:"sankeyFormat"},!1),r.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;iU(o,"sankeyNodes",X0),iU(o,"flatten",T0);const l=new Th(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),l.transform({type:"addVChartProperty",options:{beforeCall:yW.bind(this),call:_W}},!1),this._nodesSeriesData=l,iU(o,"sankeyLinks",$0);const h=new Th(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:yW.bind(this),call:_W}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(o1.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(o1.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=J(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=J(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(d(t)||d(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=tW(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(EW(null===(i=wH.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),BW("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(EW(null===(s=wH.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),BW("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:ZN.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(VN(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new K0(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!d(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new eH;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{g(t[i])&&e.add(t[i]),g(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return W0(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?b(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}o1.type=t.SeriesTypeEnum.sankey,o1.transformerConstructor=r1,o1.mark=n1,o1.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const l1=()=>{s$(),kK(),CE(),wH.registerGraphicComponent("path",(t=>ey(t))),wH.registerMark(s1.type,s1),UK(),wH.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:Z0(t,e)},TV))),wH.registerAnimation("sankeyLinkPath",((t,e)=>({appear:J0(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:CV.disappear.duration}}))),QP.registerBuiltInAnimate("linkPathGrowOut",t1),QP.registerBuiltInAnimate("linkPathGrowIn",Q0),DV(),wH.registerSeries(o1.type,o1)},h1=(t,e)=>{let i={},s=e.fields;if(u(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=T0(n);return i=dW([{latestData:r}],e),i};class c1 extends cW{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const u1=Object.assign(Object.assign({},SW),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),d1=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class p1 extends zW{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const g1=()=>{wH.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)})},f1=()=>{wH.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)})},m1=(t,e)=>{if(e.getViewBox()){const i=new TJ(e).layout(t,e.getViewBox()),s=[];return OZ(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[mW,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class v1 extends VW{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.treemap,this.transformerConstructor=p1,this._categoryField="name",this._valueField="value",this._viewBox=new ss,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:mW),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new as),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:iN},getRawData:()=>this.getRawData()}),C(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),iU(this._dataSet,"treemap",m1),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(iU(this._rawData.dataSet,"addVChartProperty",sW),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:bW.bind(this),call:xW}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=h1([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=N(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){iU(this._dataSet,"hierarchyDimensionStatistics",h1),iU(this._dataSet,"flatten",T0);const i=new Th(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return L0(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(v1.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(v1.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(EW(null===(e=wH.getAnimationInKey("treemap"))||void 0===e?void 0:e(),BW(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new c1(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(XN.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(XN.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}v1.type=t.SeriesTypeEnum.treemap,v1.mark=u1,v1.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},v1.transformerConstructor=p1,Z(v1,P0),Z(v1,F$);const y1=()=>{g1(),f1(),s$(),UK(),wH.registerAnimation("treemap",((t,e)=>({appear:d1(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:CV.disappear.duration}}))),DV(),wH.registerSeries(v1.type,v1)},_1=Object.assign(Object.assign({},oZ),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),b1=Object.assign(Object.assign({},SW),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),x1={type:"fadeIn"};function S1(t,e){return"fadeIn"===e?x1:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class A1 extends zW{constructor(){super(...arguments),this._supportStack=!1}}class k1 extends cW{enableByType(t){return"dimension"!==t}}const C1="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",M1={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:C1,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:C1,fill:"#ddd"}}};class T1 extends lZ{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.gaugePointer,this.transformerConstructor=A1,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(T1.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},T1.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(T1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new k1(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return g(this.radiusAxisHelper)&&g(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=et(e),s=it(e),n=It(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(EW(null===(i=wH.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),BW("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}T1.type=t.SeriesTypeEnum.gaugePointer,T1.mark=b1,T1.builtInTheme={gaugePointer:M1},T1.transformerConstructor=A1;const w1=()=>{wH.registerSeries(T1.type,T1),E$(),s$(),wH.registerAnimation("gaugePointer",((t,e)=>{const i=S1(t,e);return{appear:i,enter:i,disappear:{duration:CV.disappear.duration}}})),zq(),Oq()};class D1 extends zW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class E1 extends lZ{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.gauge,this.transformerConstructor=D1,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=$e(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();iU(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[xN]=t[this._angleField[0]],t[bN]=e>0?i[e-1][xN]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(E1.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(E1.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=Ft(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?rH(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=Ft(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?rH(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return g(t[bN])?this.angleAxisHelper.dataToPosition([t[bN]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[xN]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(EW(null===(i=wH.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),BW("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}E1.type=t.SeriesTypeEnum.gauge,E1.mark=_1,E1.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},E1.transformerConstructor=D1;const B1=()=>{wH.registerSeries(E1.type,E1),mq(),dZ(),Oq()};class P1 extends dV{constructor(){super(...arguments),this.type=P1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Tv(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="rect":a.symbolType=o,a}}P1.type="cell";function R1(t){return!1===t?{}:{type:"fadeIn"}}class L1 extends cW{enableByType(t){return"dimension"!==t}}const I1=Object.assign(Object.assign({},SW),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class O1 extends zW{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class F1 extends VW{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.heatmap,this.transformerConstructor=O1}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=J(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(F1.mark.cell,{isSeriesMark:!0},{morph:LW(this._spec,F1.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(F1.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=Cs(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=UW(this);this._cellMark.setAnimationConfig(EW(null===(i=wH.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),BW("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new L1(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}F1.type=t.SeriesTypeEnum.heatmap,F1.mark=I1,F1.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1}}},F1.transformerConstructor=O1;const z1=()=>{UK(),wH.registerMark(P1.type,P1),wH.registerGraphicComponent("symbol",Tv),FE(),jE(),cF(),wH.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},TV),{appear:R1(e)}))),CY(),xY(),wH.registerSeries(F1.type,F1)},j1=Object.assign(Object.assign({},SW),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),H1=`${ZH}_CORRELATION_X`,N1=`${ZH}_CORRELATION_Y`,U1=`${ZH}_CORRELATION_SIZE`,V1=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!b(t))return t;const y=e.view();if(y.x1-y.x0==0||y.y1-y.y0==0||y.x1-y.x0==-1/0||y.x1-y.x0==1/0||y.y1-y.y0==-1/0||y.y1-y.y0==1/0)return t;const _=$e(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=$e(null!==(s=e.endAngle)&&void 0!==s?s:270),S=Math.max((y.x1-y.x0)/2,(y.y1-y.y0)/2),k=re(null!==(n=e.innerRadius)&&void 0!==n?n:0,S),C=re(e.outerRadius,S),M=[A(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:y.x0+re(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",y.x1-y.x0),A(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:y.y0+re(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",y.y1-y.y0)],T=se(e.field),w=t.map(T),[D,E]=oe(w),B=D===E?t=>(k+C)/2:t=>k+(C-k)*(t-D)/(E-D),P=d(e.radiusField)?T:se(e.radiusField),R=null!==(p=null===(u=null==e?void 0:e.radiusRange)||void 0===u?void 0:u[1])&&void 0!==p?p:5;let L=t=>R;if(P){const[i,s]=P!==T?oe(t.map(P)):[D,E],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(L=t=>n+(r-n)*(P(t)-i)/(s-i))}const I=Math.min(_,x),O=Math.max(_,x),F=W1(I,O,t.length),z=[],j=(O-I)/60;return t.forEach(((t,e)=>{const i=B(w[e]),s=L(t);let n,r,a=F[e];for(let t=0;t<60&&(n=M[0]+i*Math.cos(a),r=M[1]+i*Math.sin(a),G1({x:n,y:r,size:s},z)||n-s<y.x0||n+s>y.x1||r-s<y.y0||r+s>y.y1);t++)t<59&&(a+=j,a>O?a=I:a<I&&(a=O));z.push(Object.assign({[H1]:n,[N1]:r,[U1]:s},t))})),z},W1=(t,e,i)=>{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let u=t;for(;l<i;)h<n&&(c.push(u+(h%2?Math.floor(h/2)+Math.floor(n/2):h/2)*r*o),h++),l++,h===n&&(h=0,a+=1,o*=-1,0===s?s=r/2:s/=2,u=-1===o?e-s:t+s,a>=2&&(r/=2,n*=2));return c},G1=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)<Math.pow(t.size+e.size,2))),Y1=(t,e)=>{if(!t||!b(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[eN]:null==n?void 0:n[eN],[sN]:null==n?void 0:n[sN]}};class X1 extends AK{constructor(){super(...arguments),this.type=X1.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=It(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}X1.type="ripple";const $1=()=>{kK(),jE(),wH.registerMark(X1.type,X1),wH.registerGraphicComponent("symbol",(t=>Tv(t)))},K1=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class q1 extends zW{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class Z1 extends nq{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.correlation,this.transformerConstructor=q1,this._viewBox=new ss}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){g(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){g(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){g(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;iU(this._dataSet,"correlation",V1);const s=new Mh;sU(s,"dataview",ch),iU(s,"correlationCenter",Y1);const n=new Th(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new oV(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const e=this._createMark(Z1.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:eN});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(Z1.mark.ripplePoint,{key:eN,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(Z1.mark.centerPoint,{key:eN,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[H1],y:t=>t[N1],size:t=>t[U1],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(EW(null===(e=wH.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),BW("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}Z1.type=t.SeriesTypeEnum.correlation,Z1.mark=j1,Z1.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},Z1.transformerConstructor=q1;const J1=()=>{fG(),$1(),wH.registerSeries(Z1.type,Z1),wH.registerAnimation("correlation",((t,e)=>Object.assign({appear:K1(0,e)},MV)))},Q1={duration:2e3,loop:!0,channel:{wave:{from:0,to:1}}},t2=t=>({duration:2e3,channel:{wave:{from:0,to:1},height:t.height,dy:t.dy}}),e2=t2;function i2(t,e){switch(e){case"wave":default:return Q1;case"grow":return t2(t);case"waveGrow":return e2(t)}}function s2(t,e){switch(e){case"wave":default:return Q1;case"grow":case"waveGrow":return(t=>({duration:2e3,channel:{dy:t.dy}}))(t)}}const n2=Object.assign(Object.assign({},SW),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class r2 extends AK{constructor(){super(...arguments),this.type=r2.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}r2.type="liquid";const a2=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,u=a-c,d=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${u} ${d}\n A ${r} ${r} 0 1 1 ${u+2*c} ${d}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${u} ${d}\n Z \n `}(0,0,e):t;class o2 extends cW{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class l2 extends jW{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.liquid,this.transformerConstructor=mG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:u,height:d}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=u/2+(r+h-(a+c))/2,g=d/2+(s+o-(n+l))/2;let f=u-(r+a+h+c),m=d-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Lv({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Tv({x:s,y:n,size:r,symbolType:a2(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){g(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=gH(this._spec.outlineMargin),this._paddingSpec=gH(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=we(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(l2.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(l2.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(l2.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(l2.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new o2(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(EW(null===(i=wH.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),BW("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(EW(null===(s=wH.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),BW("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(r<e&&a>i){const e=cB(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}l2.type=t.SeriesTypeEnum.liquid,l2.mark=n2,l2.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},l2.transformerConstructor=mG;const h2=()=>{kK(),pE(),wH.registerMark(r2.type,r2),wH.registerGraphicComponent("area",(t=>ny(t))),fV(),wH.registerAnimation("liquid",((t,e)=>({appear:i2(t,e),enter:i2(t,e),exit:i2(t,e)}))),wH.registerAnimation("liquidGroup",((t,e)=>({appear:s2(t,e),enter:s2(t,e),exit:s2(t,e)}))),wH.registerSeries(l2.type,l2)},c2=t=>J(t).join(",");class u2 extends cW{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>c2(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>c2(null==t?void 0:t[this.series.getDimensionField()[0]])}}const d2=Object.assign(Object.assign({},SW),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}}),p2=t=>{switch(t){case"fadeIn":default:return{type:"fadeIn"};case"growIn":return{type:"growRadiusIn"};case"scaleIn":return{type:"scaleIn"}}},g2=t=>{switch(t){case"fadeIn":default:return{type:"fadeIn"};case"scaleIn":return{type:"scaleIn"}}};class f2 extends cR{onBind(){var t,e;this.fromCircles={},null===(t=HJ(this.target.attribute.arcs))||void 0===t||t.forEach((t=>{this.fromCircles[t.setId]=t})),this.toCircles={},null===(e=HJ(this.target.getFinalAttribute().arcs))||void 0===e||e.forEach((t=>{this.toCircles[t.setId]=t}))}onUpdate(t,e,i){const s=[];Object.keys(this.fromCircles).forEach((t=>{const i=this.fromCircles[t],n=this.toCircles[t];i&&n&&s.push({radius:i.radius+(n.radius-i.radius)*e,x:i.x+(n.x-i.x)*e,y:i.y+(n.y-i.y)*e,setId:t})}));const n=zJ(s);this.target.setAttributes({arcs:n,path:jJ(n)})}}class m2 extends zW{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const v2=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?NJ(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class y2 extends jW{constructor(){super(...arguments),this.type=t.SeriesTypeEnum.venn,this.transformerConstructor=m2,this._viewBox=new ss}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:iN)}initData(){var t;super.initData(),iU(this._dataSet,"venn",v2),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(y2.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(y2.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>c2(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>c2(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new u2(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:c2(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return c2(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[c2(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>J(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(c2(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(EW(null===(e=wH.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),BW(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(EW(null===(e=wH.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),BW(t.name,this._spec,this._markAttributeContext)))}))}}y2.type=t.SeriesTypeEnum.venn,y2.mark=d2,y2.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},y2.transformerConstructor=m2;const _2=()=>{mq(),E$(),wH.registerAnimation("vennCircle",((t,e)=>({appear:p2(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:CV.disappear.duration}}))),wH.registerAnimation("vennOverlap",((t,e)=>({appear:g2(e),update:{custom:f2},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:CV.disappear.duration}}))),DV(),wH.registerGrammarTransform("vennMark",{transform:UJ}),wH.registerSeries(y2.type,y2)};class b2 extends l${constructor(){super(...arguments),this.type=t.SeriesTypeEnum.mosaic,this.transformerConstructor=o$}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(vN),this.setFieldX2(mN)),this.setFieldY(_N),this.setFieldY2(yN)):(t&&(this.setFieldY(vN),this.setFieldY2(mN)),this.setFieldX(_N),this.setFieldX2(yN)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&d(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];d(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}b2.type=t.SeriesTypeEnum.mosaic,b2.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},b2.transformerConstructor=o$;const x2=()=>{s$(),UK(),DV(),xY(),wH.registerSeries(b2.type,b2)};class S2 extends JY{_isValidSeries(e){return e===t.SeriesTypeEnum.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class A2 extends qY{constructor(){super(...arguments),this.transformerConstructor=S2,this.type="map",this.seriesType=t.SeriesTypeEnum.map}}A2.type="map",A2.seriesType=t.SeriesTypeEnum.map,A2.transformerConstructor=S2;const k2=()=>{PX(),V$(),wH.registerChart(A2.type,A2)};class C2 extends JY{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=J(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return g(r)&&n.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),b(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),g(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class M2 extends C2{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),d(l.type)&&(l.type="linear"),d(o.type)&&(o.type="band");const h=wG(l,{min:0,max:1});d(l.min)&&(l.min=h.min),d(l.max)&&(l.max=h.max),s&&Object.assign(l,TH({},s,l)),n&&Object.assign(o,TH({},n,o))}}class T2 extends C2{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class w2 extends C2{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class D2 extends qY{constructor(){super(...arguments),this.transformerConstructor=w2}}D2.transformerConstructor=w2;class E2 extends D2{constructor(){super(...arguments),this.transformerConstructor=w2,this.type="pie",this.seriesType=t.SeriesTypeEnum.pie}}E2.type="pie",E2.seriesType=t.SeriesTypeEnum.pie,E2.transformerConstructor=w2;const B2=()=>{PX(),Sq(),wH.registerChart(E2.type,E2)};class P2 extends T2{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:WG,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:WG,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&d(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=J(t.crosshair||{}).map((t=>TH({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const R2=(t,e)=>{if(!t)return null;const i=sG(t,(t=>"angle"===t.getOrient()),e),s=sG(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&CI(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=Rj({x:1,y:0},u);p=((t,e)=>{const i=2*Math.PI,s=it(e),n=et(e);return t<s?t+=Math.ceil((s-t)/i)*i:t>n&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=Lj(u),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(d(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=eG(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&CI(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=Rj({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=Lj(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=eG(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class L2 extends qY{constructor(){super(...arguments),this.transformerConstructor=P2,this.type="rose",this.seriesType=t.SeriesTypeEnum.rose}_setModelOption(){this._modelOption.getDimensionInfo=R2}}L2.type="rose",L2.seriesType=t.SeriesTypeEnum.rose,L2.transformerConstructor=P2,Z(L2,sX);const I2=()=>{EX(),PX(),oX(),aX(),Hq(),wH.registerChart(L2.type,L2)};class O2 extends T2{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=TH({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=J(t.crosshair||{}).map((t=>TH({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class F2 extends qY{constructor(){super(...arguments),this.transformerConstructor=O2,this.type="radar",this.seriesType=t.SeriesTypeEnum.radar}_setModelOption(){this._modelOption.getDimensionInfo=R2}}F2.type="radar",F2.seriesType=t.SeriesTypeEnum.radar,F2.transformerConstructor=O2,Z(F2,sX);const z2=()=>{EX(),PX(),LX(),oX(),aX(),Kq(),wH.registerChart(F2.type,F2)};class j2 extends JY{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=f(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{L(e,"trimPadding")&&TH(e,BU(this.type,t))})),this._transformAxisSpec(t)}}class H2 extends qY{constructor(){super(...arguments),this.transformerConstructor=j2,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=pX(t,e,i))&&void 0!==s?s:[],...null!==(n=R2(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=fX,this._modelOption.getRectByDimensionData=xX}}H2.type="common",H2.transformerConstructor=j2,Z(H2,sX);const N2=()=>{EX(),PX(),LX(),oX(),wH.registerChart(H2.type,H2),aX()};class U2 extends JY{_getSeriesDataLength(t,e){var i,s;if(e.data){const t=J(e.data)[0];return t instanceof Th?null===(i=t.latestData)||void 0===i?void 0:i.length:null===(s=t.values)||void 0===s?void 0:s.length}const n=J(t.data).find(((t,i)=>e.dataId?t instanceof Th?t.name===e.dataId:t.id===e.dataId:e.dataIndex===i));return n?n instanceof Th?n.latestData.length:n.values.length:0}addAttrToComponentSpec(t,e,i){return Array.isArray(t)?t[0][e]=i:t[e]=i,t}addPaddingRow(t,e,i){t.push({index:e,size:i})}addOrientAxes(t,e,i,s){t.push({id:`regionAxesRow${i}`}),e.push({modelId:`axesRow${i}`,col:1,row:i}),s.axes[0].id=`axesRow${i}`,s.axes[0].regionIndex=Array.from(Array(s.series.length),((t,e)=>"top"===s.axes[0].orient?e+1:e))}transformSpec(e){var i,s,n,r,a,o,l,h,c,u,d,p,g,f,m;super.transformSpec(e);let v=0;const y=[],_=[],b=[],x=[],S=[],A=this._option.getCompiler().getStage(),k=(A.viewWidth,A.viewHeight);let C=0;if(null==e?void 0:e.legends){y.push({modelId:`legendRow${v}`,col:1,row:v}),this.addAttrToComponentSpec(e.legends,"id",`legendRow${v}`);const t=J(e.legends);let l=null!==(i=t[0].height)&&void 0!==i?i:40;if(t[0].padding){const e=gH(t[0].padding);l+=Number(null!==(s=null==e?void 0:e.bottom)&&void 0!==s?s:0),l+=Number(null!==(n=null==e?void 0:e.top)&&void 0!==n?n:0),t[0].offsetY=Number(null!==(a=null===(r=t[0])||void 0===r?void 0:r.offsetY)&&void 0!==a?a:0)+Number(null!==(o=null==e?void 0:e.top)&&void 0!==o?o:0)}S.push({index:v,size:l}),C+=l,v++}(null==e?void 0:e.dataZoom)&&(y.push({modelId:`dataZoomRow${v}`,col:1,row:v}),this.addAttrToComponentSpec(e.dataZoom,"id",`dataZoomRow${v}`),C+=60,v++,this.addPaddingRow(S,v,10),C+=10,v++),C+=60,null!==e.axes&&"top"!==(null===(h=null===(l=null==e?void 0:e.axes)||void 0===l?void 0:l[0])||void 0===h?void 0:h.orient)||(this.addOrientAxes(_,y,v,e),v++);const M=e.series.filter((e=>e.type!==t.SeriesTypeEnum.link)).length,T=(k-C-20*M)/M,w=(null===(c=null==e?void 0:e.appendPadding)||void 0===c?void 0:c.left)||0,D=(null===(u=null==e?void 0:e.appendPadding)||void 0===u?void 0:u.right)||0;null===(d=null==e?void 0:e.series)||void 0===d||d.forEach((i=>{var s,n;if([t.SeriesTypeEnum.bar,t.SeriesTypeEnum.line,t.SeriesTypeEnum.area,t.SeriesTypeEnum.dot].includes(i.type)){if(y.push({modelId:`${i.type}Row${v}`,col:1,row:v}),y.push({modelId:`axesLeftRow${v}`,col:0,row:v}),_.push({id:`${i.type}Row${v}`,clip:!1}),S.push({index:v,size:(null==i?void 0:i.height)||T}),b.push({orient:"left",id:`axesLeftRow${v}`,type:i.type===t.SeriesTypeEnum.dot?"band":"linear",visible:i.type!==t.SeriesTypeEnum.dot,title:{visible:!0,autoRotate:!1,style:{text:null==i?void 0:i.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof(null===(s=null==i?void 0:i.grid)||void 0===s?void 0:s.visible)||(null===(n=null==i?void 0:i.grid)||void 0===n?void 0:n.visible),style:(t,e)=>{var s,n,r,a,o;let l=0;if(0===e){const t=null===(s=null==i?void 0:i.grid)||void 0===s?void 0:s.style;l=null!==(r=null!==(n=null==t?void 0:t.lineWidth)&&void 0!==n?n:null==t?void 0:t.strokeWidth)&&void 0!==r?r:1}return{lineWidth:l,stroke:(null===(o=null===(a=null==i?void 0:i.grid)||void 0===a?void 0:a.style)||void 0===o?void 0:o.stroke)||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:_.length-1}),i.type===t.SeriesTypeEnum.dot){y.push({modelId:`scrollBarRightRow${v}`,col:2,row:v});const s=this._getSeriesDataLength(e,i);let n=0;s&&(n=((null==i?void 0:i.height)||T)/(30*s)),x.push(Object.assign({orient:"right",visible:i.type===t.SeriesTypeEnum.dot&&n<1,id:`scrollBarRightRow${v}`,start:0,end:Math.min(n,1),filterMode:"axis",regionIndex:_.length-1,axisId:`axesLeftRow${v}`},J(null==e?void 0:e.scrollBar)[0]))}i.regionIndex=_.length-1,v++,this.addPaddingRow(S,v,(null==i?void 0:i.padding)||20),v++,i.leftAppendPadding=w,i.type===t.SeriesTypeEnum.dot&&(i.title.style.dx=-w,i.subTitle.style.dx=-w)}})),this.addPaddingRow(S,v,20),v++,null===(p=null==e?void 0:e.series)||void 0===p||p.forEach((i=>{if(i.type===t.SeriesTypeEnum.link){const t=i.dotSeriesIndex+1;y.push({modelId:`${i.type}Row${t}`,col:1,row:t-1}),i.regionIndex=e.series[i.dotSeriesIndex].regionIndex,i.leftAppendPadding=w,i.height=e.series[i.dotSeriesIndex].height,i.clipHeight=e.series[i.dotSeriesIndex].clipHeight}})),(null==e?void 0:e.legends)&&this.addAttrToComponentSpec(e.legends,"regionIndex",[_.length-1]),"bottom"===(null===(f=null===(g=null==e?void 0:e.axes)||void 0===g?void 0:g[0])||void 0===f?void 0:f.orient)&&(this.addOrientAxes(_,y,v,e),v++);const E={type:"grid",col:4,row:v,colWidth:[{index:0,size:w},{index:2,size:12},{index:3,size:D}],rowHeight:S,elements:y};e.layout=E,e.region=_,null===(m=e.axes)||void 0===m||m.push(...b),e.scrollBar=x}}class V2 extends qY{constructor(){super(...arguments),this.transformerConstructor=U2,this.type="sequence"}_createSeries(i,s){if(!i)return;const{spec:n}=s,r=e(s,["spec"]);let a;if(n.type===t.SeriesTypeEnum.link&&(n.dotSeriesSpec=this._spec.series[n.dotSeriesIndex]),n.regionId&&(a=this.getRegionsInUserId(n.regionId)),a||(a=this.getRegionsInIndex(n.regionIndex?[n.regionIndex]:void 0)[0]),!a)return;const o=new i(n,Object.assign(Object.assign(Object.assign({},this._modelOption),r),{region:a,specKey:"series",globalScale:this._globalScale}));o&&(o.created(),this._series.push(o),a.addSeries(o))}}V2.type="sequence",V2.transformerConstructor=U2;const W2=()=>{EX(),PX(),eZ(),aZ(),CY(),xY(),wH.registerChart(V2.type,V2)};class G2 extends QY{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class Y2 extends qY{constructor(){super(...arguments),this.transformerConstructor=G2}}Y2.transformerConstructor=G2,Z(Y2,sX);class X2 extends G2{transformSpec(t){super.transformSpec(t),wU(t)}}class $2 extends Y2{constructor(){super(...arguments),this.transformerConstructor=X2,this.type="histogram",this.seriesType=t.SeriesTypeEnum.bar}_setModelOption(){this._modelOption.getDimensionInfo=pX,this._modelOption.getDimensionInfoByValue=fX,this._modelOption.getRectByDimensionData=xX}}$2.type="histogram",$2.seriesType=t.SeriesTypeEnum.bar,$2.transformerConstructor=X2;const K2=()=>{EX(),PX(),LX(),oX(),aX(),h$(),wH.registerTransform("bin",Pl),wH.registerChart($2.type,$2)};class q2 extends M2{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class Z2 extends qY{constructor(){super(...arguments),this.transformerConstructor=q2,this.type="circularProgress",this.seriesType=t.SeriesTypeEnum.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=R2}}Z2.type="circularProgress",Z2.seriesType=t.SeriesTypeEnum.circularProgress,Z2.transformerConstructor=q2,Z(Z2,sX);const J2=()=>{EX(),PX(),oX(),aX(),fZ(),wH.registerChart(Z2.type,Z2)};class Q2 extends M2{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(e){const i=super._getDefaultSeriesSpec(e);return i.type=t.SeriesTypeEnum.circularProgress,i}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((e=>e.type===t.SeriesTypeEnum.gauge||e.type===t.SeriesTypeEnum.circularProgress));d(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(d(o.radiusField)&&d(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),d(o.valueField)&&d(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===t.SeriesTypeEnum.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),d(s.angle.type)&&(s.angle.type="linear"),d(s.radius.type)&&(s.radius.type="linear"),d(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class t3 extends qY{constructor(){super(...arguments),this.transformerConstructor=Q2,this.type="gauge",this.seriesType=t.SeriesTypeEnum.gaugePointer}}t3.type="gauge",t3.seriesType=t.SeriesTypeEnum.gaugePointer,t3.transformerConstructor=Q2;const e3=()=>{PX(),w1(),B1(),fZ(),wH.registerChart(t3.type,t3)};class i3 extends JY{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class s3 extends qY{constructor(){super(...arguments),this.transformerConstructor=i3,this.type="wordCloud",this.seriesType=t.SeriesTypeEnum.wordCloud}}s3.transformerConstructor=i3;class n3 extends s3{constructor(){super(...arguments),this.transformerConstructor=i3,this.type="wordCloud",this.seriesType=t.SeriesTypeEnum.wordCloud}}n3.type="wordCloud",n3.seriesType=t.SeriesTypeEnum.wordCloud,n3.transformerConstructor=i3;const r3=()=>{PX(),QQ(),wH.registerChart(n3.type,n3)},a3=()=>{wH.registerGrammarTransform("wordcloudShape",{transform:NQ}),QQ(),r3()};class o3 extends JY{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class l3 extends qY{constructor(){super(...arguments),this.transformerConstructor=o3,this.type="funnel",this.seriesType=t.SeriesTypeEnum.funnel}}l3.type="funnel",l3.seriesType=t.SeriesTypeEnum.funnel,l3.transformerConstructor=o3;const h3=()=>{PX(),_0(),wH.registerChart(l3.type,l3)};class c3 extends QY{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="band"),d(i.type)&&(i.type="linear");const n=wG(i,{min:0,max:1});d(i.min)&&(i.min=n.min),d(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="linear"),d(e.type)&&(e.type="band");const n=wG(s,{min:0,max:1});d(s.min)&&(s.min=n.min),d(s.max)&&(s.max=n.max)}}}class u3 extends qY{constructor(){super(...arguments),this.transformerConstructor=c3,this.type="linearProgress",this.seriesType=t.SeriesTypeEnum.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=pX,this._modelOption.getDimensionInfoByValue=fX,this._modelOption.getRectByDimensionData=xX}}u3.type="linearProgress",u3.seriesType=t.SeriesTypeEnum.linearProgress,u3.transformerConstructor=c3,Z(u3,sX);const d3=()=>{EX(),PX(),oX(),aX(),SZ(),wH.registerChart(u3.type,u3)};class p3 extends QY{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),wU(t)}}class g3 extends qY{constructor(){super(...arguments),this.transformerConstructor=p3,this.type="rangeColumn",this.seriesType=t.SeriesTypeEnum.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=pX,this._modelOption.getDimensionInfoByValue=fX,this._modelOption.getRectByDimensionData=xX}}g3.type="rangeColumn",g3.seriesType=t.SeriesTypeEnum.rangeColumn,g3.transformerConstructor=p3;const f3=()=>{EX(),PX(),oX(),aX(),ZK(),wH.registerChart(g3.type,g3)};class m3 extends JY{_getDefaultSeriesSpec(t){const e=g(t.startAngle)?t.startAngle:-90,i=g(t.endAngle)?t.endAngle:e+Ke(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class v3 extends qY{constructor(){super(...arguments),this.transformerConstructor=m3,this.type="sunburst",this.seriesType=t.SeriesTypeEnum.sunburst}}v3.type="sunburst",v3.seriesType=t.SeriesTypeEnum.sunburst,v3.transformerConstructor=m3;const y3=()=>{PX(),F0(),wH.registerChart(v3.type,v3)};class _3 extends JY{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class b3 extends qY{constructor(){super(...arguments),this.transformerConstructor=_3,this.type="circlePacking",this.seriesType=t.SeriesTypeEnum.circlePacking}}b3.type="circlePacking",b3.seriesType=t.SeriesTypeEnum.circlePacking,b3.transformerConstructor=_3;const x3=()=>{PX(),V0(),wH.registerChart(b3.type,b3)};class S3 extends JY{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class A3 extends qY{constructor(){super(...arguments),this.transformerConstructor=S3,this.type="treemap",this.seriesType=t.SeriesTypeEnum.treemap}}A3.type="treemap",A3.seriesType=t.SeriesTypeEnum.treemap,A3.transformerConstructor=S3;const k3=()=>{PX(),y1(),wH.registerChart(A3.type,A3)};class C3 extends c${transformSpec(t){super.transformSpec(t),t.legends&&J(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),wU(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class M3 extends u${constructor(){super(...arguments),this.transformerConstructor=C3,this.type="waterfall",this.seriesType=t.SeriesTypeEnum.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=pX,this._modelOption.getDimensionInfoByValue=fX,this._modelOption.getRectByDimensionData=xX}}M3.type="waterfall",M3.seriesType=t.SeriesTypeEnum.waterfall,M3.transformerConstructor=C3;const T3=()=>{EX(),PX(),LX(),oX(),aX(),yK(),wH.registerChart(M3.type,M3)};class w3 extends QY{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),wU(t)}}class D3 extends qY{constructor(){super(...arguments),this.transformerConstructor=w3,this.type="boxPlot",this.seriesType=t.SeriesTypeEnum.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=pX,this._modelOption.getDimensionInfoByValue=fX,this._modelOption.getRectByDimensionData=xX}}D3.type="boxPlot",D3.seriesType=t.SeriesTypeEnum.boxPlot,D3.transformerConstructor=w3;const E3=()=>{EX(),PX(),oX(),aX(),HK(),wH.registerTransform("boxplot",Rl),wH.registerChart(D3.type,D3)};class B3 extends JY{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class P3 extends qY{constructor(){super(...arguments),this.transformerConstructor=B3,this.type="sankey",this.seriesType=t.SeriesTypeEnum.sankey}_setStateInDatum(t,e,i,s){const n=b(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=VN(t))||void 0===e?void 0:e.datum;return b(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}P3.type="sankey",P3.seriesType=t.SeriesTypeEnum.sankey,P3.transformerConstructor=B3;const R3=()=>{PX(),mc.load(sB),l1(),wH.registerChart(P3.type,P3)};class L3 extends QY{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),wU(t)}}class I3 extends qY{constructor(){super(...arguments),this.transformerConstructor=L3,this.type="rangeArea",this.seriesType=t.SeriesTypeEnum.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=pX,this._modelOption.getDimensionInfoByValue=fX,this._modelOption.getRectByDimensionData=xX}}I3.type="rangeArea",I3.seriesType=t.SeriesTypeEnum.rangeArea,I3.transformerConstructor=L3;const O3=()=>{EX(),PX(),LX(),oX(),aX(),sq(),wH.registerChart(I3.type,I3)};class F3 extends QY{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class z3 extends qY{constructor(){super(...arguments),this.transformerConstructor=F3,this.type="heatmap",this.seriesType=t.SeriesTypeEnum.heatmap}}z3.type="heatmap",z3.seriesType=t.SeriesTypeEnum.heatmap,z3.transformerConstructor=F3;const j3=()=>{PX(),z1(),wH.registerChart(z3.type,z3)};class H3 extends JY{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class N3 extends qY{constructor(){super(...arguments),this.transformerConstructor=H3,this.type="correlation",this.seriesType=t.SeriesTypeEnum.correlation}}N3.type="correlation",N3.seriesType=t.SeriesTypeEnum.correlation,N3.transformerConstructor=H3;const U3=()=>{PX(),J1(),wH.registerChart(N3.type,N3)};function V3(t){var e,i;const s=Object.assign({},t);return R(t.style)||(s.textStyle=NN(t.style)),R(t.textStyle)||TH(s.textStyle,NN(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&NN(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&NN(s.background.style),s}const W3=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},G3=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),u=l();if(0===c.length&&u.length)return[];if(c.length===u.length)return t;const d={};c.forEach((t=>{d[t]=!0}));const p=null!==(i=o())&&void 0!==i?i:sN;return h?h(t,c,p):(b(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):g(p)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,p)]))),t)};class Y3 extends qG{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{Oj(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Oj(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=lH(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;g(s)&&(this._seriesUserId=J(s)),g(e)&&(this._regionUserId=J(e)),g(n)&&(this._seriesIndex=J(n)),g(i)&&(this._regionUserIndex=J(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(Y(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new oV(this._option,e),this._initSelectedData(),Oj(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;d(e)||JSON.stringify(r)===JSON.stringify(e)||(Oj(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;C(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)Y(s,this._cacheAttrs)||this._legendComponent.setAttributes(TH({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(TH({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());Y(t,this._cacheAttrs)||this._legendComponent.setAttributes(TH({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}Y3.specKey="legends";class X3 extends Y3{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return eW(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),Oj(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){iU(this._option.dataSet,"discreteLegendFilter",G3),iU(this._option.dataSet,"discreteLegendDataMake",W3);const t=new Th(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return Oj(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(d(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!DA(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return u(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=MN(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const s=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=t;n=F(n),r=F(r),a=F(a),o=F(o);const l=s;return n.visible?l.title=V3(n):l.title={visible:!1},R(r.focusIconStyle)||NN(r.focusIconStyle),r.shape&&(r.shape=zN(r.shape)),r.label&&(r.label=zN(r.label)),r.value&&(r.value=zN(r.value)),r.background&&(r.background=zN(r.background)),hH(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),hH(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),hH(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(R(a.railStyle)||NN(a.railStyle),R(a.sliderStyle)||NN(a.sliderStyle)):(R(a.textStyle)||NN(a.textStyle),a.handler&&zN(a.handler)),l.pager=a,o.visible&&!R(o.style)&&(TH(l,o.style),g(o.padding)&&(l.padding=o.padding)),l}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return Wz}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(Fz.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(Fz.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(Fz.legendItemUnHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:C(s)?s:1,strokeOpacity:C(n)?n:1,opacity:C(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return u(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=tW(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=tW(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}X3.specKey="legends",X3.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},X3.type=r.discreteLegend;const $3=()=>{wH.registerComponent(X3.type,X3)},K3=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;C(n)&&(t=Math.min(n,t)),C(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},q3=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!f(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!R(o)){const[e,i]=o;return a?a(t,o,l):h(t)?FN(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const Z3={color:Kz,size:Zz},J3={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},Q3=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},J3),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},t5={horizontal:Q3(!0),vertical:Q3(!1)},e5=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},J3),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},i5={horizontal:e5(!0),vertical:e5(!1)},s5=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],n5=[2,10];class r5 extends Y3{static getSpecInfo(t){const e=eW(t,this.specKey,this.type,(t=>function(t){return"color"===t||"size"===t}(t.type)));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),Oj(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){iU(this._option.dataSet,"continuousLegendFilter",q3),iU(this._option.dataSet,"continuousLegendDataMake",K3);const t=new Th(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>Fj(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=MN(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!DA(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=MN(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),R(a)&&(a="color"===this._legendType?s5:n5);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=TH({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:d,id:p,visible:f,orient:m,position:v,data:y,defaultSelected:_,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:C,padding:M}=i,T=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?T.title=V3(s):T.title={visible:!1},T.showHandler=!1!==n.visible,R(n.style)||(T.handlerStyle=NN(n.style)),g(r.width)&&(T.railWidth=r.width),g(r.height)&&(T.railHeight=r.height),R(r.style)||(T.railStyle=NN(r.style)),R(a.style)||(T.trackStyle=NN(a.style)),T.startText=zN(o),T.endText=zN(l),T.handlerText=zN(h),R(c)||(T.sizeBackground=NN(c)),u.visible&&!R(u.style)&&(TH(T,u.style),g(u.padding)&&(T.padding=u.padding)),T}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return Z3[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",jt((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}r5.specKey="legends",r5.builtInTheme={colorLegend:t5,sizeLegend:i5},r5.type=r.continuousLegend;const a5=()=>{wH.registerComponent(r5.type,r5)},o5=(t,e)=>g(e)?t.map((t=>e[t])):void 0,l5=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),h5=t=>!d(t)&&(b(t)?t.length>0&&t.every(g):Object.keys(t).length>0);function c5(t,e,i){var s,n,r,a,o,l;const h=Object.assign({regionIndex:0},e),c=i.getOption(),u=c.getRegionsInUserIdOrIndex(g(h.regionId)?[h.regionId]:void 0,g(h.regionIndex)?[h.regionIndex]:void 0)[0];if(!u)return"none";const p=u5(t,u),f=null!==(s=h.activeType)&&void 0!==s?s:p.length>1?"dimension":"mark",m=u.getLayoutStartPoint(),v=u.getLayoutRect(),y=c.globalInstance.getContainer(),_=Object.assign({x:0,y:0},y?Rn(y):{}),b=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>l5(i,s)(t)&&l5(n,r)(t)&&(d(a)||l5([a],[o])(t))));return l},x=u.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),S=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),v.width),y:Math.min(Math.max(t.y,0),v.height)}))(t),n=null!==(e=h.x)&&void 0!==e?e:m.x+s.x,r=null!==(i=h.y)&&void 0!==i?i:m.y+s.y,a={x:0,y:0};x.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:_.x+o,clientY:_.y+l}};if("dimension"===f){const e=p[0];if(!e)return"none";const s=new Map;p.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const l=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>b(t))))&&void 0!==i?i:[]}}))}];g(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=c.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:qN.chart,event:S({x:p.reduce(((t,e)=>t+e.pos.x),0)/p.length,y:p.reduce(((t,e)=>t+e.pos.y),0)/p.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const u=c.globalInstance;return KV.globalConfig.uniqueTooltip&&KV.hideTooltip(u.id),f}if("mark"===f){const e=p[0];if(!e)return"none";const s=Object.assign(Object.assign({},b(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(l=c.globalInstance.getChart())&&void 0!==l?l:void 0,datum:s,model:e.series,source:qN.chart,event:S(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=c.globalInstance;return KV.globalConfig.uniqueTooltip&&KV.hideTooltip(a.id),f}return"none"}const u5=(e,i)=>{const s=i.getSeries(),n=[];return s.forEach((i=>{var s,r,a,o,l,h,c;const u=i.getDimensionField(),p=i.getMeasureField(),f=i.getSeriesField(),m=g(f)?e[f]:void 0,v=g(f)&&null!==(o=null===(a=null===(r=null===(s=i.getViewDataStatistics)||void 0===s?void 0:s.call(i))||void 0===r?void 0:r.latestData[f])||void 0===a?void 0:a.values)&&void 0!==o?o:[],y=o5(u,e);let _=o5(p,e);const b=h5(_),x=!b&&g(f)&&d(m)&&v.length>0,S=()=>{var e;const s=null===(e=i.getViewData())||void 0===e?void 0:e.latestData.find(l5(u,y));if(!b&&(_=o5(p,s),!h5(_)))return;const r=i.type===t.SeriesTypeEnum.pie?i.dataToCentralPosition(s):i.dataToPosition(s);d(r)||isNaN(r.x)||isNaN(r.y)||n.push({pos:r,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:m},series:i})};if("cartesian"===i.coordinate){const t=i,e=CI(null===(h=null===(l=i.getYAxisHelper())||void 0===l?void 0:l.getScale(0))||void 0===h?void 0:h.type)?"y":"x",s=u.map(((t,e)=>[t,e])).filter((([,t])=>d(null==y?void 0:y[t])));let r=[null!=y?y:[]];s.length>0&&s.forEach((([t,e])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=i.getViewDataStatistics)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((i=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[e]=i,h.push(n)}))})),r=h})),r.forEach((s=>{var r,a;if(x){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(l5(u,s));v.forEach((r=>{const o=a.find((t=>t[f]===r));if(_=o5(p,o),!h5(_))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||n.push({pos:l,data:{dimensionFields:u,dimensionData:s,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:r},series:i,dimType:e})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(l5(u,s));if(!b&&(_=o5(p,r),!h5(_)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;n.push({pos:o,data:{dimensionFields:u,dimensionData:s,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:m},dimType:e,series:i})}}))}else if("polar"===i.coordinate)if(i.type===t.SeriesTypeEnum.pie)S();else{const t=i;if(x){const e=(null===(c=t.getViewData())||void 0===c?void 0:c.latestData.filter(l5(u,y))).find((t=>t[f]===m));v.forEach((s=>{if(_=o5(p,e),!h5(_))return;const r=t.dataToPosition(e);d(r)||isNaN(r.x)||isNaN(r.y)||n.push({pos:r,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:s},series:i})}))}else S()}else"geo"===i.coordinate&&S()})),n},d5=t=>g(t)&&!b(t),p5=t=>g(t)&&b(t);class g5 extends KG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=TH({},this._theme,r.style),r.offset=TH({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return g(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:CA(this._option.mode)||!AA(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,g(t.parentElement)?_(t.parentElement)&&(t.parentElement=Px.getElementById(t.parentElement)):AA(this._option.mode)&&(t.parentElement=null==SA?void 0:SA.body)}}const f5={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class m5 extends qG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=g5,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=AA(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||f(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s<n;s++){const n=a[s],o=!!this.processor[n]&&this._showTooltipByMouseEvent(n,i,t,e);if("unShowByOption"===o)r[n]="unShowByOption";else if(o){r[n]=!0;break}}Object.values(r).every((t=>!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&d5(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):g(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!d(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&KV.globalConfig.uniqueTooltip&&l&&KV.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:qN.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:qN.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?CX.canvas:CX.dom,n=wH.getComponentPluginInType(t);n||_A("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=wH.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=J(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=J(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(kA(s)||CA(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):f(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>f(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=A(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,Ht(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(f(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=(i=this.tooltipHandler).reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=c5(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(d(this._cacheInfo)||d(t))return!1;if(p5(t)){if(d5(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>QW(t,e[i])))}if(p5(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}m5.type=r.tooltip,m5.transformerConstructor=g5,m5.builtInTheme={tooltip:f5},m5.specKey="tooltip";const v5=()=>{wH.registerComponent(m5.type,m5)};var y5,_5;t.TooltipResult=void 0,(y5=t.TooltipResult||(t.TooltipResult={}))[y5.success=0]="success",y5[y5.failed=1]="failed",function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(_5||(_5={}));const b5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class x5 extends qG{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),A(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=Ht((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(f(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{CI(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||Y(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:ZN.chart}:{source:qN.chart};b(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;b(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:kA(e)||CA(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=J(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:qN.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:qN.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:qN.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{b5[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:u}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const d=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+d.left),o=Math.min(o,i-u+d.top),l=Math.max(l,e+t.getLayoutRect().width-c-d.right),h=Math.max(h,i+t.getLayoutRect().height-u-d.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||A(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:u,fillOpacity:d,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?u:d;if(A(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:u}=n,d=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},u)},d):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2<a||r.y1>o||r.y2<o)&&t.delete(n.getSpecIndex()),n.type.startsWith("polarAxis")){const s=n.getCenter(),r=n.getInnerRadius(),a=n.getOuterRadius(),o=Ye.distancePP({x:e,y:i},s);(o>a||o<r)&&t.delete(n.getSpecIndex())}})),t}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new DB(e),null==s||s.add(t),i(t)),function(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:u=0}=t.attribute;let d=0,p=0;a<i&&(d=i-a),o<s&&(p=s-o),l>n&&(d=n-l),h>r&&(p=r-h),d&&t.setAttribute("dx",d+c),p&&t.setAttribute("dy",p+u)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}x5.specKey="crosshair";const S5={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class A5 extends x5{static getSpecInfo(t){return eW(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=WW(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){WW(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(g(t.dimType)?"y"===t.dimType:GW(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=zj(this._regions,"cartesian");e&&(mX(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=_X(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,u,d;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(u=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==u?u:0,textStyle:Object.assign(Object.assign({},null===(d=i.label)||void 0===d?void 0:d.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new $B(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new KB(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}A5.specKey="crosshair",A5.builtInTheme={crosshair:S5},A5.type=r.cartesianCrosshair;const k5=()=>{wH.registerComponent(A5.type,A5)};class C5 extends x5{static getSpecInfo(t){return eW(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=zj(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&g(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=TG(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=tW(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:u,coord:d,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),u={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:u,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ti(u,a.getInnerRadius(),o),end:ti(u,a.getOuterRadius(),o)};const d=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ii(t,e),s=(p-d)/g,n=Math.floor((i-d)/s),r=n*s+d,h=Math.min((n+1)*s+d,p),c=ti(t,o,r),u=ti(t,o,h),m=hi([u.x,u.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=It(Ye.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:u,startAngle:d,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new $B(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new ZB(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new JB(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new qB(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=u.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=si(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(d):function(t){let e="center",i="middle";return e=(t=si(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ti(e,p[1]+m.offset,d):ti(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}C5.specKey="crosshair",C5.builtInTheme={crosshair:S5},C5.type=r.polarCrosshair;const M5=()=>{wH.registerComponent(C5.type,C5)},T5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(d(o)||d(a))return t;const l=r(),h=b(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},w5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(d(a)||d(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return J(r).every((i=>{t[i]>=a[0]&&t[i]<=Q(a)&&(e=!0)})),e}:t=>{let e=!1;return J(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},D5=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],u=[],p=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(d(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);g(null==t?void 0:t.max)&&g(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{d(h[t])&&(p.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{J(i[e]).forEach((i=>{d(t[i])||(d(h[t[i]])&&(p.push(t[i]),h[t[i]]=0,c.push(t[i])),d(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?p:!1===r||m?p.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),u.push(e)})),u},E5=(t,e,i)=>{const s=e.domain();if(AI(e.type))return i?s[0]+(Q(s)-s[0])*(1-t):s[0]+(Q(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(Q(n)-n[0])*t;return e.invert(r)},B5=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&AI(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(Q(n)-n[0])))},P5=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},R5=t=>{const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}},L5=(t,e,i)=>"start"===t?"percent"===e&&g(i.start)||"value"===e&&g(i.startValue):"percent"===e&&g(i.end)||"value"===e&&g(i.endValue),I5=(t,e,i)=>{if(AI(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class O5{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:g(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),u=Math.abs(this.getState().start-this.getState().end),d=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(u>=1&&n<1)return;if(u<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=u*(n-1)*d;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=It(this.getState().start+f,0,1),y=It(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ce(s/n)>=.5:Ce(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===$W(XW(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=N({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=N({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=N({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}Z(O5,F$);class F5 extends qG{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:B5(t,this._stateScale,this._isHorizontal),a="percent"===n?e:B5(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-t<this._minSpan||e-t>this._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=P5(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=I5(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&R5(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else Oj(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Oj(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=XW(t),this._isHorizontal="horizontal"===$W(this._orient),this._dataFilterEvent=new O5(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||Y(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(AI(n.type)){const r=n.domain(),a=r[0],o=Q(r)-a,l=g(t)?a+o*t:+e,h=g(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=g(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=g(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(g(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):g(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),d(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>$W(t._orient)===$W(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!AI(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(g(i)&&(g(i.userId)&&(this._seriesUserId=J(i.userId)),g(i.specIndex)&&(this._seriesIndex=J(i.specIndex))),g(this._spec.seriesId)){const t=J(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(g(this._spec.seriesIndex)){const t=J(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(g(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(J(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(g(this._spec.regionId)){const t=J(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_initData(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};Oj(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,u=c===l?h:l,d=AI(u.getScale(0).type),p=AI(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?J(g.xField):J(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?J(g.yField):J(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:u===l?f:m;d&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else Oj(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:r}=this._option;sU(r,"dataview",ch),iU(r,"dataFilterComputeDomain",D5);const a=new Th(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new oV(this._option,a),a.reRunAllTransform(),r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(iU(this._option.dataSet,"dataFilterWithNewDomain",w5),iU(this._option.dataSet,"lockStatisticsFilter",T5),Oj(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>AI(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>AI(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(AI(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!Y(this._domainCache,e)&&(this._domainCache=e,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;L5("start",i,this._spec)&&L5("end",s,this._spec)&&(t="percent"===i?this._spec.start:B5(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:B5(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?B5(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?B5(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=E5(this._start,this._stateScale,P5(i,this._isHorizontal)),this._endValue=E5(this._end,this._stateScale,P5(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,AI(this._stateScale.type)&&this._stateScale.domain()[0]!==Q(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(Q(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(Q(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=I5(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&Oj(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);C(null==i?void 0:i.min)&&C(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new fO:new $I,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[it(t),et(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),u=R5(h);if(!this._dataUpdating&&CI(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==u?void 0:u.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==u?void 0:u.bandSize,CI(c.type)){u&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!d(t)||!d(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}Z(F5,F$);class z5 extends KG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=TH({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=b(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const j5=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),H5={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:j5(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:j5(!0)};class N5 extends F5{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=z5,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=E5(e,this._stateScale,P5(s,this._isHorizontal)),a=E5(i,this._stateScale,P5(s,this._isHorizontal));if(!g(r)||!g(a))return;this._start=e,this._end=i;(u(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new fO),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(P5(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=P5(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,u=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+u,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+u),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),d(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),d(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const u=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=u?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new fO;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(P5(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[it(e),et(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!AI(t.type)||e[0]!==Q(e))&&(!CI(t.type)||1!==nt(e).length)}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:A(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:A(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:g(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:P5(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=this._isHorizontal?this._stateScale:this._valueScale,i=this._isHorizontal?this._valueScale:this._stateScale,s=this._isScaleValid(e)&&this._isScaleValid(i)&&!1!==this._spec.showBackgroundChart,n=this._getAttrs(s),r=this._relatedAxisComponent;if(this._component)this._component.setAttributes(n),t&&(this._component.setPreviewData(this._data.getDataView().latestData),s&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>E5(t,this._stateScale,P5(r,this._isHorizontal))))));else{const t=this.getContainer();this._component=new zF(n),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?s&&this._component.setPreviewPointsY1(this._dataToPositionY2):s&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>E5(t,this._stateScale,P5(r,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,u;const{middleHandler:d={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:NN(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:NN(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:d.visible?{visible:!0,icon:NN(null===(s=d.icon)||void 0===s?void 0:s.style),background:{size:null===(n=d.background)||void 0===n?void 0:n.size,style:NN(null===(r=d.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:NN(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:NN(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:NN(g.style)},selectedBackgroundStyle:NN(this._spec.selectedBackground.style),dragMaskStyle:NN(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:TH(NN(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},NN(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:TH(NN(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},NN(null===(u=m.area)||void 0===u?void 0:u.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=tW(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(P5(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}N5.type=r.dataZoom,N5.transformerConstructor=z5,N5.builtInTheme={dataZoom:H5},N5.specKey="dataZoom";const U5=()=>{wH.registerComponent(N5.type,N5)},V5={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class W5 extends F5{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=Tj(this._start,e)&&Tj(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=E5(e,this._stateScale,!1),r=E5(i,this._stateScale,!1);(u(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(n,r))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:A(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:A(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:g(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new QE(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return d(i)||(s.padding=i),R(null==t?void 0:t.style)||(s.railStyle=NN(t.style)),R(null==e?void 0:e.style)||(s.sliderStyle=NN(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}W5.type=r.scrollBar,W5.builtInTheme={scrollBar:V5},W5.specKey="scrollBar";const G5=()=>{wH.registerComponent(W5.type,W5)},Y5=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),J(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},X5=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),$5={title:{visible:!0,autoLimit:!1,autoFit:!1,style:X5("l1FontSize","primaryFontColor")},content:{visible:!0,style:X5("l2FontSize","tertiaryFontColor")}};class K5 extends qG{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return eW(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=J(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(J(this._spec.regionId),J(this._spec.regionIndex))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(VN(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(VN(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){iU(this._option.dataSet,"indicatorFilter",Y5);const t=new Th(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new oV(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:u}=a,d=e(a,["content","offsetX","offsetY","limitRatio","title"]),p=[];return J(o).forEach((t=>{const e=TH({},this._theme.content,t);p.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},HN(V(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?mH(l,this._computeLayoutRadius()):0,dy:h?mH(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==u.visible&&(!g(u.field)||null!==this._activeDatum),space:u.space||this._gap,autoLimit:u.autoLimit,autoFit:u.autoFit,fitPercent:u.fitPercent,fitStrategy:u.fitStrategy,style:Object.assign(Object.assign({},HN(V(u.style,["text"]),this._activeDatum)),{text:this._createText(u.field,u.style.text)})},content:p},d)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)Y(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new tj(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":u(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}K5.type=r.indicator,K5.builtInTheme={indicator:$5},K5.specKey="indicator";const q5=()=>{wH.registerComponent(K5.type,K5)},Z5=["sum","average","min","max","variance","standardDeviation","median"];function J5(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=it(s),r=et(s);return e<n||e>r}function Q5(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return A(t.x)&&J5(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=hH(t.x)?s4(t.x,n)+r.x:n4(l.getXAxisHelper(),[t.x])+r.x,h}function t4(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return A(t.y)&&J5(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=hH(t.y)?s4(t.y,n)+r.y:n4(l.getYAxisHelper(),[t.y])+r.y,h}function e4(t,e,i,s){var n,r;const{relativeSeries:a}=s;return A(t.angle)&&J5(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),n4(a.angleAxisHelper,[t.angle])}function i4(t,e,i,s){var n,r;const{relativeSeries:a}=s;return A(t.radius)&&J5(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),n4(a.radiusAxisHelper,[t.radius])}function s4(t,e){return Number(t.substring(0,t.length-1))*e/100}function n4(t,e){const i=t.getScale(0);return AI(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function r4(t){return Z5.includes(t)}function a4(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),u=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},p=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),y=m.getScale(0).domain(),_=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=g(t.x),i=g(t.y);let s,r;if(e&&i)s=Q5(t,y,n,d,c,o),r=t4(t,_,n,d,u,o),o4(s,b,S,p.length),o4(r,x,A,p.length),p.push([{x:s,y:r}]);else if(e){s=Q5(t,y,n,d,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);o4(s,b,S,p.length),p.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=t4(t,_,n,d,u,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);o4(r,x,A,p.length),p.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(p,m,v,S,A),p}function o4(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value<t)&&(i.max={value:t,index:s})),t}function l4(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=g(t.angle),i=g(t.radius);if(e&&i){const e=e4(t,l,n,r),i=i4(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=e4(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=i4(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function h4(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=b(s);return r.forEach(((t,r)=>{var o,l,h,c;const u=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,d=u.getRegion(),p=d.getLayoutStartPoint(),{width:g,height:f}=d.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=hH(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=hH(i)?Number(i.substring(0,i.length-1))*f/100:i)}const y=u.getXAxisHelper().getScale(0).domain(),_=u.getYAxisHelper().getScale(0).domain(),b=J(t.x),x=J(t.y);1===b.length&&A(b[0])&&J5(y,b[0],i)&&(null===(l=null===(o=u.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&A(x[0])&&J5(_,x[0],i)&&(null===(c=null===(h=u.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:n4(u.getXAxisHelper(),b)+p.x+m,y:n4(u.getYAxisHelper(),x)+p.y+v})})),n}function c4(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),u=J(t.angle),d=J(t.radius);1===u.length&&A(u[0])&&J5(h,u[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",u[0])),1===d.length&&A(d[0])&&J5(c,d[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",d[0])),s.push({angle:n4(l.angleAxisHelper,u),radius:n4(l.radiusAxisHelper,d)})})),s}function u4(t,e,i){let{x:s,y:n}=t;return hH(s)&&(s=s4(s,e)),hH(n)&&(n=s4(n,i)),{x:s,y:n}}function d4(t,e,i){let s;if(s=u(t)?J(t(e.getData().getLatestData(),e)):J(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=u4(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>u4(t,n,r)))}function p4(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.x<e&&(e=r.x),r.x+a.width>i&&(i=r.x+a.width),r.y<s&&(s=r.y),r.y+a.height>n&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function g4(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},NN(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},m4(NN(n.style),i,s)),g(n.padding)&&(t.padding=Cs(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=m4(NN(r),i,s)),t}return{visible:!1}}function f4(t,e,i){for(const s in t)u(t[s])&&(t[s]=t[s](e,i));return t}function m4(t,e,i){return u(t)?t(e,i):t}function v4(t,e){return u(t)?t(e):t}function y4(t,e,i){return g(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function _4(t){return{isXProcess:g(t.x),isYProcess:g(t.y),isX1Process:g(t.x1),isY1Process:g(t.y1),isAngleProcess:g(t.angle),isRadiusProcess:g(t.radius),isAngle1Process:g(t.angle1),isRadius1Process:g(t.radius1),isCoordinatesProcess:g(t.coordinates),isValidProcess:g(t.process)}}function b4(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=_4(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function x4(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=_4(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function S4(t){return{doXYProcess:g(t.x)&&g(t.y),doPolarProcess:g(t.angle)&&g(t.radius),doGeoProcess:g(t.areaName)}}function A4(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(u(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=J(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;g(r)&&(c=J(i)[r]),n&&J(i).includes(n)&&(c=n);let u=s;g(l)&&(u=J(s)[l]),a&&J(s).includes(a)&&(u=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&r4(t[c])?h.x={field:c,aggrType:t[c]}:h.x=J(c).map((e=>t[e])),_(t[u])&&r4(t[u])?h.y={field:u,aggrType:t[u]}:h.y=J(u).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;g(r)&&(a=J(s)[r]),n&&J(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&r4(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=J(a).map((e=>t[e])),_(t[l])&&r4(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=J(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(g(e.x)){const s=e.x;b(s)?i.x=s.map((i=>C4(i,t,e))):i.x=C4(s,t,e)}if(g(e.y)){const s=e.y;b(s)?i.y=s.map((i=>C4(i,t,e))):i.y=C4(s,t,e)}if(g(e.angle)){const s=e.angle;b(s)?i.angle=s.map((i=>C4(i,t,e))):i.angle=C4(s,t,e)}if(g(e.radius)){const s=e.radius;b(s)?i.radius=s.map((i=>C4(i,t,e))):i.radius=C4(s,t,e)}if(g(e.areaName)){const s=e.areaName;i.areaName=C4(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const k4={min:(t,e)=>wj(t[0].latestData,e.field),max:(t,e)=>Dj(t[0].latestData,e.field),sum:function(t,e){return Ej(t[0].latestData,e.field)},average:function(t,e){return Bj(t[0].latestData,e.field)},variance:function(t,e){return Pj(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(Pj(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return bt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function C4(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(u(t))return t(a,o,l,s,n,r);if(v(t)){const{aggrType:i,field:s}=t;return k4[i](e,{field:s})}return t}function M4(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class T4 extends qG{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return eW(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&r4(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];J(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Mh;return e.registerParser("array",s),new Th(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(g(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=zj(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){d(this._spec.offsetX)||(this._layoutOffsetX=uH(this._spec.offsetX,e.width,e)),d(this._spec.offsetY)||(this._layoutOffsetY=uH(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return Y(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();iU(this._option.dataSet,"markerAggregation",A4),iU(this._option.dataSet,"markerFilter",M4);const i=new Th(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function w4(t,e){return function(t,e,i){const{predict:s}=ge(t,(t=>t[e]),(t=>t[i])),n=wj(t,e),r=Dj(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class D4 extends T4{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=b4(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,u,d;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=J(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:m4(NN(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>g4(t,this._markerData,this._markAttributeContext))),state:{line:f4(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:f4(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:f4(null!==(u=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==u?u:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return f4(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return f4(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:m4(NN(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:m4(NN(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||J(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=p4([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const u=J((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),d=J(this._spec.label),p=u.map(((t,e)=>{const i=d[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:u}=b4(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||u||e))return;iU(this._option.dataSet,"markerAggregation",A4),iU(this._option.dataSet,"markerRegression",w4),iU(this._option.dataSet,"markerFilter",M4);const{options:d,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Th(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:d}),g&&m.transform({type:"markerRegression",options:d}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}D4.specKey="markLine";const E4=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),B4={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},P4={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:E4(!1),endSymbol:E4(!0),label:B4};class R4 extends D4{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new Az(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=g(e.coordinates),o=g(e.process),l=o&&g(e.process.x),h=o&&g(e.process.y),c=g(e.positions),u=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:d,doYProcess:p,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:y}=b4(e);let _=[];if(d||f||p||m||v||a&&l||a&&h){const t=a4(i,s,n,r,u);_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=h4(i,r,u,e.coordinatesOffset):c&&(_=d4(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let u;if(hH(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));u=Number(c.substring(0,c.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));u=Number(c.substring(0,c.length-1))*n/100}}else u=c;const{points:d,limitRect:p}=r;if(!d||d.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(d[0],d[1],h,u);let m;m=o&&g(l)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(d[0],d[1],h,u));const v=J((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),y=J(r.label),_=J(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:y.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=_[e])&&void 0!==n?n:_[0];return C(null==c?void 0:c.refX)&&(a+=c.refX),C(null==c?void 0:c.refY)&&(o+=c.refY),C(null==c?void 0:c.dx)&&(l+=c.dx),C(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:p,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:u}=b4(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(u){if(t=this._processSpecCoo(n),i=!1,e=new Th(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&g(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&g(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&g(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}R4.type=r.markLine,R4.coordinateType="cartesian",R4.builtInTheme={markLine:P4};const L4=()=>{wH.registerComponent(R4.type,R4),Sz()};class I4 extends D4{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=b4(this._spec);return e||i?new Mz(t):new Az(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:u,doCoordinatesProcess:d}=b4(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||u){const t=l4(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ti(f,t.radius,t.angle)))}}else d&&(p=c4(i,r,a),g={points:p.map((t=>ti(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=b4(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}I4.type=r.polarMarkLine,I4.coordinateType="polar",I4.builtInTheme={polarMarkLine:P4};const O4=()=>{wH.registerComponent(I4.type,I4),Mz._animate=sz,Sz()};class F4 extends qG{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=lH(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return eW(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){C(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),C(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:C(t.width())?t.width():0,height:this._spec.height?this._spec.height:C(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o;if(!1===this._spec.visible)return{visible:!1};const l=this.getLayoutRect(),h=uH(this._spec.width,l.width,null,l.width),c=uH(this._spec.maxWidth,l.width,null,l.width),u=Math.max(Math.min(h,c,l.width),0),d=Object.assign(Object.assign({},V(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtextType:null!==(i=this._spec.subtextType)&&void 0!==i?i:"text",subtext:null!==(s=this._spec.subtext)&&void 0!==s?s:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(r=this._spec.y)&&void 0!==r?r:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:u,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(a=this._spec.align)&&void 0!==a?a:"left",verticalAlign:null!==(o=this._spec.verticalAlign)&&void 0!==o?o:"top",textStyle:Object.assign({width:u,maxLineWidth:u},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:u},this._spec.subtextStyle)});return g(this._spec.width)&&(d.textStyle.width=Math.max(h,l.width),d.subtextStyle.width=d.textStyle.width),d}_createOrUpdateTitleComponent(t){if(this._titleComponent)Y(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new Jz(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}F4.type=r.title,F4.specKey=r.title,F4.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};const z4=()=>{wH.registerComponent(F4.type,F4)};class j4 extends T4{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=x4(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=J(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:m4(NN(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>g4(t,this._markerData,this._markAttributeContext))),state:{area:f4(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>f4(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return f4(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||J(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=p4([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=J(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=J(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=x4(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}j4.specKey="markArea";const H4={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class N4 extends j4{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new Cz(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=x4(i),u=g(i.positions),d=null!==(t=i.autoRange)&&void 0!==t&&t,p=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=a4(s,n,r,a,d,p);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=a4(s,n,r,a,d,p);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=h4(s,a,d,i.coordinatesOffset):u&&(f=d4(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=x4(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}N4.type=r.markArea,N4.coordinateType="cartesian",N4.builtInTheme={markArea:H4};const U4=()=>{wH.registerComponent(N4.type,N4),kz()};class V4 extends j4{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=x4(this._spec);return i||e||s?new Tz(t):new Cz(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=x4(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let u,d={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=l4(i,s,n,r,c);l?d={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?d={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(d={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(u=c4(i,r,c),d={points:u.map((t=>ti(p,t.radius,t.angle)))});return d}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=x4(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}V4.type=r.polarMarkArea,V4.coordinateType="polar",V4.builtInTheme={polarMarkArea:H4};const W4=()=>{wH.registerComponent(V4.type,V4),Tz._animate=rz,kz()},G4=t=>NN(Object.assign({},t)),Y4=t=>Object.assign(Object.assign({},t),{style:Object.assign({},NN(t.style))}),X4=t=>{var e,i,s,n,r,a,o,l,h,c,u,d,p,g,f;const m=G4(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=G4(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),y=(_=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},NN(Object.assign({},_)));var _;const b=Y4(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Y4(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Y4(null!==(d=null===(u=null==t?void 0:t.controller)||void 0===u?void 0:u.backward)&&void 0!==d?d:{}),A=Y4(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:y}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},$4=t=>"left"===t||"right"===t,K4=t=>"top"===t||"bottom"===t,q4={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class Z4 extends qG{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},X4(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},X4(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?Y(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new gj(t):this._playerComponent=new vj(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...J(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...J(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...J(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...J(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=$4(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=$4(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...J(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...J(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...J(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...J(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())})),this._playerComponent.addEventListener(lj.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(lj.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(lj.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(lj.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(lj.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(lj.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),C(t.x)){const e=$4(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(C(t.y)){const e=K4(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return A(this._spec.width)?Math.min(t.width,Number(this._spec.width)):$4(this._orient)?this._maxSize():t.width}_computeHeight(t){return A(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):K4(this._orient)?this._maxSize():t.height}_computeDx(t){return $4(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return K4(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}}Z4.builtInTheme={player:q4},Z4.specKey="player",Z4.type=r.player;const J4=()=>{wH.registerComponent(Z4.type,Z4)};class Q4 extends qG{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,Y(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=qj({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:J(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==JU.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),v(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}Q4.type=r.label;class t8 extends NK{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}t8.type="text",t8.constructorType="label";const e8=()=>{UK(),wH.registerMark(t8.constructorType,t8)};class i8 extends KG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class s8 extends Q4{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=i8,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(XN.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(XN.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Oj(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n<i.length;n++){const r=i[n],a=t.getMarkInName(r);a&&e[r].forEach(((e,i)=>{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&g(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(g(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{J(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),u(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();b(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),u=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let d=TH({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},aK(h,r),Object.assign(Object.assign(Object.assign({},V(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:u}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[fN])):t=>t.filter((t=>t.data[gN]))}:{});return l&&l.parseLabelStyle&&(d=l.parseLabelStyle(d,a,o)),"line"!==h&&"area"!==h||(d.type=h),d},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?oK(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=b(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=J(i())[t])}))}return e}}s8.type=r.label,s8.specKey="label",s8.transformerConstructor=i8;const n8=()=>{wH.registerGraphicComponent(s8.type,(t=>new bF(t))),e8(),tY(),wH.registerComponent(s8.type,s8,!0,1/0)};class r8 extends Q4{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[dN]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return TH({textStyle:{pickable:!0===this._spec.interactive},position:a8(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[fN]:t.data[gN]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>oK({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function a8(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}r8.type=r.totalLabel,r8.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},r8.specKey="totalLabel";const o8=()=>{wH.registerGraphicComponent(r8.type,(t=>new bF(t))),e8(),tY(),wH.registerComponent(r8.type,r8,!0)};class l8 extends T4{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=S4(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,u,d,p,g,f,m,v,y,_,b,x,S,A,k,C,M,T,w,D,E,B,P,R;const{itemContent:L={},itemLine:I={},targetSymbol:O={}}=this._spec,F=L,{type:z="text",text:j,symbol:H,image:U,richText:V,customMark:W,textStyle:G,symbolStyle:Y,imageStyle:X,richTextStyle:$,customMarkStyle:K,style:q={},state:Z={}}=F,J=e(F,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let Q=null,tt=null,et={};"text"===z?(Q=null!==(t=null==j?void 0:j.state)&&void 0!==t?t:Z,et={dx:0,dy:0},tt=g4(Object.assign(Object.assign({},j),{style:N(et,null!==(s=null!==(i=null==j?void 0:j.textStyle)&&void 0!==i?i:G)&&void 0!==s?s:q)}),this._markerData,this._markAttributeContext)):"richText"===z?(Q=null!==(n=null==V?void 0:V.state)&&void 0!==n?n:Z,et={width:100,height:100},tt=m4(N(et,null!==(a=null!==(r=null==V?void 0:V.style)&&void 0!==r?r:$)&&void 0!==a?a:q),this._markerData,this._markAttributeContext)):"symbol"===z?(Q=null!==(o=null==H?void 0:H.state)&&void 0!==o?o:Z,et={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},tt=NN(m4(N(et,null!==(h=null!==(l=null==H?void 0:H.style)&&void 0!==l?l:Y)&&void 0!==h?h:q),this._markerData,this._markAttributeContext))):"image"===z?(Q=null!==(c=null==U?void 0:U.state)&&void 0!==c?c:Z,et={width:80,height:80},tt=m4(N(et,null!==(d=null!==(u=null==U?void 0:U.style)&&void 0!==u?u:X)&&void 0!==d?d:q),this._markerData,this._markAttributeContext)):"custom"===z&&(Q=null!==(p=null==W?void 0:W.state)&&void 0!==p?p:Z,tt=m4(null!==(f=null!==(g=null==W?void 0:W.style)&&void 0!==g?g:K)&&void 0!==f?f:q,this._markerData,this._markAttributeContext));const it={zIndex:this.layoutZIndex,interactive:null===(m=this._spec.interactive)||void 0===m||m,hover:null===(v=this._spec.interactive)||void 0===v||v,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(_=this._spec.clip)&&void 0!==_&&_,itemContent:Object.assign(Object.assign({type:z,offsetX:v4(L.offsetX,this._relativeSeries.getRegion()),offsetY:v4(L.offsetX,this._relativeSeries.getRegion())},J),{style:m4(tt,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(b=O.offset)&&void 0!==b?b:0,visible:null!==(x=O.visible)&&void 0!==x&&x,size:null!==(S=O.size)&&void 0!==S?S:20,style:m4(O.style,this._markerData,this._markAttributeContext)},state:{line:f4(null!==(k=null===(A=this._spec.itemLine.line)||void 0===A?void 0:A.state)&&void 0!==k?k:{},this._markerData,this._markAttributeContext),lineStartSymbol:f4(null!==(M=null===(C=this._spec.itemLine.startSymbol)||void 0===C?void 0:C.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineEndSymbol:f4(null!==(w=null===(T=this._spec.itemLine.endSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),itemContent:f4(Q,this._markerData,this._markAttributeContext),textBackground:f4(null===(E=null===(D=this._spec.itemContent.text)||void 0===D?void 0:D.labelBackground)||void 0===E?void 0:E.state,this._markerData,this._markAttributeContext),targetItem:f4(null!==(P=null===(B=this._spec.targetSymbol)||void 0===B?void 0:B.state)&&void 0!==P?P:{},this._markerData,this._markAttributeContext)},animation:null!==(R=this._spec.animation)&&void 0!==R&&R,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:st,line:nt={}}=I,rt=e(I,["visible","line"]);it.itemLine=!1!==st?Object.assign(Object.assign({},rt),{visible:!0,lineStyle:NN(nt.style)}):{visible:!1};return new Dz(it)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let u;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=p4([o.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:y4(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:y4(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=S4(t);(g(t.coordinate)||e||i||s)&&this._initCommonDataView()}}l8.specKey="markPoint";const h8={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class c8 extends l8{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=g(s.x)&&g(s.y),o=g(s.coordinate),l=g(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=a4(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=h4(n,r,h,s.coordinatesOffset)[0]:l&&(c=d4(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=S4(t),i=g(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}c8.type=r.markPoint,c8.coordinateType="cartesian",c8.builtInTheme={markPoint:h8};const u8=()=>{wH.registerComponent(c8.type,c8),wz()};class d8 extends l8{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=l4(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:ti({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}d8.type=r.polarMarkPoint,d8.coordinateType="polar",d8.builtInTheme={polarMarkPoint:h8};const p8=()=>{wH.registerComponent(d8.type,d8),wz()};class g8 extends l8{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{g(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}g8.type=r.geoMarkPoint,g8.coordinateType="geo",g8.builtInTheme={geoMarkPoint:h8};const f8=()=>{wH.registerComponent(g8.type,g8),wz()},m8="inBrush",v8="outOfBrush";class y8 extends qG{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return eW(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),m8,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),v8,t.AttributeLevel.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&J(t).includes(n.userId.toString())||e&&J(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){g(this._spec.regionId)||g(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(J(this._spec.regionId),J(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(g(this._spec.brushLinkSeriesId)||g(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(J(this._spec.brushLinkSeriesId),J(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){g(this._spec.axisId)?J(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):g(this._spec.axisIndex)?J(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return Y(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new xj(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:NN(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(fj.brushActive,(s=>{this._initMarkBrushState(i,v8),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener(fj.drawStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(fj.moveStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(fj.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(fj.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(fj.brushClear,(s=>{this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener(fj.drawEnd,(s=>{var n;this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener(fj.moveEnd,(i=>{this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},NN(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:u}=t.globalTransMatrix,d=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+u}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,d,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(m8,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(m8),i.addState(v8,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:u,d:d,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+u*t.y+p+f,y:c*t.x+d*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(m8,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(m8),i.addState(v8,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],Yi(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(m8),s.removeState(v8),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,u=r?"x":"y",d=r?"width":"height",p=r?o:h,g=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=(p-e.getLayoutStartPoint()[u])/e.getLayoutRect()[d],n=(g-e.getLayoutStartPoint()[u])/e.getLayoutRect()[d],r=this._stateClamp(s-a),o=this._stateClamp(n+a);i.setStartAndEnd(Math.min(r,o),Math.max(r,o),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:r,end:o,startValue:E5(r,i.stateScale,P5(i.relatedAxisComponent,i.isHorizontal)),endValue:E5(o,i.stateScale,P5(i.relatedAxisComponent,i.isHorizontal))})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=Q(i)<i[0],o=p-e.getLayoutStartPoint()[u],l=g-e.getLayoutStartPoint()[u],h=r?Math.min(o,l):Math.max(o,l),c=r?Math.max(o,l):Math.min(o,l),d=(c-i[0])/(Q(i)-i[0])*(s[1]-s[0])+s[0],f=(h-i[0])/(Q(i)-i[0])*(s[1]-s[0])+s[0],m=this._stateClamp(d-a),v=this._stateClamp(f+a);t.scaleRangeFactor([m,v]),t.effect.scaleUpdate(),this._zoomRecord.push({operateComponent:t,start:m,end:v,startValue:t.getScale().invert(c),endValue:t.getScale().invert(h)})}}))}}_getNeedClearVRenderComponents(){return this._brushComponents}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}y8.type=r.brush,y8.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},y8.specKey="brush";const _8=()=>{wH.registerComponent(y8.type,y8)};class b8 extends qG{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${ZH}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:g(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(g(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=EW({},BW(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(d(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),g(t.dataId)||C(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return Y(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new ss).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new ss;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}b8.type=r.customMark,b8.specKey="customMark";const x8=()=>{wH.registerComponent(b8.type,b8)};class S8{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(C(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:u(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&g(e.modelId)){if(g(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&g(e.modelKey)&&"modelIndex"in e&&g(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r<t[e]+(null!==(i=t[`${e}Span`])&&void 0!==i?i:1);r++)n+=s[r].value;return n}getSizeFromUser(t,e){var i,s;const n="col"===e?this._colSize:this._rowSize;if(!(null===(i=n[t[e]])||void 0===i?void 0:i.isUserSetting))return;let r=0;for(let i=t[e];i<t[e]+(null!==(s=t[`${e}Span`])&&void 0!==s?s:1);i++){if(!n[i].isUserSetting)return;r+=n[i].value}return r}setItemLayoutSizeToGrid(t,e){if(A8(t)){if(e.colSpan&&e.colSpan>1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;t<e.col;t++)i.x+=this._colSize[t].value;for(let t=0;t<e.row;t++)i.y+=this._rowSize[t].value;return i.x+=t.layoutPaddingLeft+t.layoutOffsetX,i.y+=t.layoutPaddingTop+t.layoutOffsetY,i}getItemLayoutRect(t){var e,i;const s=this.getItemGridInfo(t);return{width:(null!==(e=this.getSizeFromGrid(s,"col"))&&void 0!==e?e:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(i=this.getSizeFromGrid(s,"row"))&&void 0!==i?i:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom}}layoutItems(t,e,i,s){this._chartLayoutRect=i,this._chartViewBox=s,this.clearLayoutSize(),e.sort(((t,e)=>e.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>A8(t))),a=n.filter((t=>!A8(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>A8(t))),h=o.filter((t=>!A8(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);C(h.width)||(h.width=l.width),C(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function A8(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}S8.type="grid";const k8=()=>{wH.registerLayout(S8.type,S8)},C8=()=>{mc.load(YB)},M8="vchart-tooltip",T8=`${M8}-container`,w8=`${M8}-title`,D8=`${M8}-content-box`,E8={offsetX:10,offsetY:10},B8="99999999999999";function P8(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\(/g,"&#40;").replace(/ /g," &nbsp;")}const R8=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,L8=t=>_(t)&&""!==(null==t?void 0:t.trim())||A(t)?P8(t):"",I8=(t,e)=>{let i;if(g(t))if(A(t))i=t;else if(u(t)){const s=t(e);A(s)&&(i=s)}return i},O8={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},F8=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=O8[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class z8 extends kG{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const u=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,u,e,t))&&void 0!==n?n:0;const d=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[u])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==d?void 0:d.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,d;const p=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:S,offsetY:k}=this._option,M=m[_],T=rW(null==M?void 0:M.position,b,e),w=null!==(r=rW(null==M?void 0:M.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:D=0,height:E=0}=null!=i?i:{},B="canvas"===m.renderMode,P=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==P?void 0:P.width)&&void 0!==o?o:JH,L=null!==(l=null==P?void 0:P.height)&&void 0!==l?l:QH;let I=!1;const O={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,N=1;const U=AA(this._env);if(U&&!m.confine?(O.width=window.innerWidth,O.height=window.innerHeight):(O.width=R,O.height=L),U&&!B){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(d=this._compiler.getCanvas())&&void 0!==d?d:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=R8(e,F),N=R8(t,j)}const V=N/H,W={},G={x:T,y:T},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?S:k;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(p&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=p(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?D:E;switch(F8(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},$=["x","y"];if(f(T))if(f(K=T)&&(g(K.left)||g(K.right)||g(K.top)||g(K.bottom))){const{left:t,right:e,top:i,bottom:s}=T;W.left=I8(t,y),W.top=I8(i,y),W.right=I8(e,y),W.bottom=I8(s,y)}else(t=>f(t)&&(g(t.x)||g(t.y)))(T)&&$.forEach((t=>{const e=T[t];A(e)||u(e)?W[Y[t][0]]=I8(e,y):X(e,t)}));else g(T)&&(X({orient:T,mode:w},"x"),X({orient:T,mode:w},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?D:E,s="x"===t?R:L,n="x"===t?S:k,r=F8(G[t],t);if(C(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(C(W[Y[t][1]]))q[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;q[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}q[t]*=H,U&&(q[t]+=z[t]),q[t]/=N;const a="x"===t?O.width:O.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/N:-j[t]/N,l=a/N+o-i;2!==r&&q[t]<o?I?q[t]=o:(q[t]+=0===r?n+i/2:2*n+i,q[t]>l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]<o&&(q[t]=o)))})),q}}get env(){return this._env}onAdd(t){super.onAdd(t);const e=t.component;this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i,s;const n=null!==(e=null===(t=this._component)||void 0===t?void 0:t.getSpec())&&void 0!==e?e:{};n.handler?null===(s=(i=n.handler).release)||void 0===s||s.call(i):(this._removeTooltip(),this._isReleased=!0,this._chartOption=null,this._component=null)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return i?{offsetX:null!==(t=i.x)&&void 0!==t?t:E8.offsetX,offsetY:null!==(e=i.y)&&void 0!==e?e:E8.offsetY}:E8}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption()}reInit(){this._initFromSpec()}}z8.specKey="tooltip";const j8=(t,e)=>g(t)?b(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",H8=(t={},e={})=>{var i,s;g(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return g(n)&&(e.color=n),g(t.fontWeight)&&(e.fontWeight=t.fontWeight),g(t.textAlign)&&(e.textAlign=t.textAlign),g(t.fontSize)&&(e.fontSize=j8(t.fontSize)),g(t.maxWidth)&&(e.maxWidth=j8(t.maxWidth)),t.multiLine||g(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},N8=(t={})=>{const{lineHeight:e}=t;return t.fontSize?uH(e,t.fontSize):0},U8=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return g(l)&&(a.borderRadius=C(l)?`${l}px`:`${l}`),r&&(o=Cs(r),a.padding=j8(o)),{panelStyle:a,panelPadding:o}};function V8(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const W8=t=>{wH.registerComponentPlugin(t.type,t)};class G8 extends z8{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(G8.type),this.type=CX.dom,this._tooltipContainer=null==SA?void 0:SA.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(SA&&t&&t.children&&t.children.length){for(let e=0;e<t.children.length;e++)if(t.children[e].classList.contains(T8)){this._container=t.children[e];break}this._container||(this._container=SA.createElement("div"),this._container.style.position="relative",this._container.style.zIndex=B8,this._container.classList.add(T8),t.appendChild(this._container))}}initRootDom(){var t;const e=this._component.getSpec(),i=document.createElement("div"),s=null===(t=this._chartOption)||void 0===t?void 0:t.getTheme("fontFamily");V8(i,Object.assign({left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:B8,fontFamily:null!=s?s:bH.fontFamily,fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh",visibility:"hidden"},this._domStyle.panel)),i.classList.add(e.className),i.setAttribute("vchart-tooltip-id",`${this.id}`),this._container.appendChild(i),this._rootDom=i}_getTooltipBoxSize(t,e){var i;this._rootDom||this.initRootDom(),e||this._updateDomStringByCol(t),this._updateDomStyle("height",e);const s=null===(i=this._rootDom)||void 0===i?void 0:i.getBoundingClientRect();return{width:null==s?void 0:s.width,height:null==s?void 0:s.height}}_removeTooltip(){this._rootDom&&this._rootDom.parentNode&&(this._rootDom.parentNode.removeChild(this._rootDom),this._rootDom=null),this._container=null}_updateTooltip(t,e){var i,s;if(t&&this._rootDom){const{tooltipSpec:n,activeTooltipSpec:r}=e;e.changePositionOnly||(this._tooltipActual=r);const a=this._rootDom;if(a){const{x:o=0,y:l=0}=null!==(i=r.position)&&void 0!==i?i:{};let h={x:o,y:l};const c=this.getVisibility();n.updateElement&&(this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:o,y:l}),n.updateElement(a,r,e),h=this._getActualTooltipPosition(r,e,{width:a.offsetWidth,height:a.offsetHeight}),this._cacheCustomTooltipPosition=h),!c&&t&&(this._rootDom.style.transition="none",this._updatePosition(h,!1),this._rootDom.getBoundingClientRect()),this._updatePosition(h)}this.setVisibility(t)}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){const t=this._component.getSpec();this._domStyle=((t={})=>{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=U8(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),C(g)&&(y.marginBottom=`${g}px`);const _={width:j8(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=H8(h),x=H8(u),S=H8(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[A]=j8(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=j8(null!==(s=u.spacing)&&void 0!==s?s:26),S[A]=j8(null!==(n=p.spacing)&&void 0!==n?n:0);const k=Math.max(N8(p),N8(u));return y.lineHeight=k>0?`${k}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(w8))),l=a.find((t=>t.className.includes(D8)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(w8),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(V8(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${M8}-column`),e.classList.add(`${M8}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(D8),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];V8(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));V8(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${M8}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=L8(e.key),e.keyStyle&&H8(e.keyStyle,l)):"value"===i?(o.innerHTML=L8(e.value),e.valueStyle&&H8(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:u=!1,shapeFill:d}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,g=t.shapeLineWidth?P8(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?P8(c):m,y=p,b=t=>new Mv({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new ss));let C=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==g){const[t,e,i,s]=C.split(" ").map((t=>Number(t))),n=Number(g.slice(0,-2));C=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const M=dd.IsGradientStr(d);if(!d||_(d)&&!M||u)return m=u?"none":d?P8(d):"currentColor",`\n <svg ${l} width="${p}" height="${p}" viewBox="${C}">\n <path\n d="${k}"\n style="fill: ${m}; stroke: ${v()}; stroke-width: ${g}"\n >\n </path>\n </svg>`;const T=M?dd.Parse(d):f(d)?d:null;if(T){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=T.stops)&&void 0!==s?s:[]).map((t=>`<stop offset="${P8(t.offset.toString())}" stop-color="${P8(t.color)}"/>`)).join("");return"radial"===T.gradient?t=`<radialGradient id="${m}" cx="50%" cy="50%" r="50%" fx="0%" fy="0%">\n ${i}\n </radialGradient>`:"linear"===T.gradient&&(t=`<linearGradient id="${m}" x1="${100*(null!==(n=T.x0)&&void 0!==n?n:0)}%" y1="${100*(null!==(r=T.y0)&&void 0!==r?r:0)}%" x2="${100*(null!==(a=T.x1)&&void 0!==a?a:0)}%" y2="${100*(null!==(o=T.y1)&&void 0!==o?o:0)}%">\n ${i}\n </linearGradient>`),`\n <svg ${l} width="${p}" height="${p}" viewBox="-0.5 -0.5 1 1">\n ${t}\n <path\n d="${k}"\n style="fill: url(#${m}); stroke: ${v()}; stroke-width: ${g}"\n >\n </path>\n </svg>`}return""}(e,`${this.id}_${a}`)),V8(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(D8))),h=[...o.children].find((t=>t.className.includes(w8)));if(l){const o=this._component.getSpec(),c={},u=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(u&&u.autoWidth&&!1!==u.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(g(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(w8)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=uH(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,V8(l,c))}const d=l.children,p=[];if(d){for(let i=0;i<d.length;i++){const s=null!==(r=d[i].children)&&void 0!==r?r:[];for(let i=0;i<s.length;i++){e&&(s[i].style[t]="initial");const n=s[i].getBoundingClientRect()[t];(void 0===p[i]||p[i]<n)&&(p[i]=n)}}for(let e=0;e<d.length;e++){const i=null!==(a=d[e].children)&&void 0!==a?a:[];for(let e=0;e<i.length;e++)i[e].style[t]=`${p[e]}px`}}}}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle(),this._rootDom&&V8(this._rootDom,this._domStyle.panel),this.getVisibility()&&(this._updateDomStringByCol(this._tooltipActual),this._updateDomStyle("height",!1))}_updatePosition({x:t,y:e},i=!0){this._rootDom&&(this._rootDom.style.transform=`translate3d(${t}px, ${e}px, 0)`,i&&""!==this._rootDom.style.transition&&(this._rootDom.style.transition="",Object.assign(this._rootDom.style,this._domStyle.panel)))}}G8.type=CX.dom;const Y8=()=>{W8(G8)},X8={fontFamily:bH.fontFamily,spacing:10,wordBreak:"break-word"},$8=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>e<s.length-1?t+"\n":t))):s=[t],n=s.map((t=>Object.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},_y||(_y=vy.CreateGraphic("richtext",{})),_y.setAttributes(a),_y.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function K8(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:X8),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:g(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const q8=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return g(a)&&(r.cornerRadius=[a,a,a,a]),r};class Z8 extends z8{constructor(){super(Z8.type),this.type=CX.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new Mj({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:u={},titleLabel:d,shape:p,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=Cs(u.padding),b=gH(u.padding),x=K8(Object.assign({textAlign:"right"===y?"right":"left"},d),i),S=K8(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=K8(m,i),k={fill:!0,size:null!==(s=null==p?void 0:p.size)&&void 0!==s?s:8,spacing:null!==(n=null==p?void 0:p.spacing)&&void 0!==n?n:6},C={panel:q8(u),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:M={},content:T=[]}=t;let w=b.left+b.right,D=b.top+b.bottom,E=0;const B=!!T.length;let P=0,R=0,L=0,I=0;if(B){const t=[],e=[],i=[],s=[];let n=0;C.content=T.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:u,shapeStroke:d,shapeLineWidth:p,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:C}=r,M={height:0,spaceRow:null!=_?_:v};if(g(h)){const i=TH({},S,K8(b,void 0,{})),{width:s,height:n,text:r}=$8(h,i);M.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),y?e.push(s):t.push(s),o=Math.max(o,n)}if(g(m)){const t=TH({},A,K8(x,void 0,{})),{width:e,height:s,text:n}=$8(m,t);M.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};C?t.stroke=u:t.fill=u,t.stroke=null!=d?d:u,t.lineWidth=p,M.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else M.shape={visible:!1};return M.height=o,n+=o,a<T.length-1&&(n+=M.spaceRow),M})),D+=n,P=t.length?et(t):0,R=e.length?et(e):0,L=i.length?et(i):0,I=s.length?et(s)+k.spacing:0,E=Math.max(I+P+S.spacing+L+A.spacing,I+R,E),C.hasContentShape=!!s.length,C.keyWidth=P,C.valueWidth=L}let O=0,F=0,z=0;const{visible:j=!0,value:H="",valueStyle:N,spaceRow:U}=M;C.title.visible=j,C.title.spaceRow=null!=U?U:v;let V={};const W=()=>V.autoWidth&&!1!==V.multiLine;if(j){V=TH({},x,K8(N,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:B?Math.ceil(E):void 0);const{text:t,width:e,height:i}=$8(H,V);C.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),O=C.title.value.width,F=C.title.value.height,z=F+(B?C.title.spaceRow:0)}return D+=z,C.title.width=O,C.title.height=F,W()?w+=E||O:w+=Math.max(O,E),B&&C.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=w-b.left-b.right-I-P-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),C.valueWidth=Math.max(C.valueWidth,i.width))})),C.panel.width=w,C.panel.height=D,C})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?g(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}Z8.type=CX.canvas;const J8=()=>{W8(Z8)},Q8=t=>{wH.registerChartPlugin(t.type,t)},t6=/\{([^}]+)\}/,e6=/\{([^}]+)\}/g,i6=/:/;class s6 extends kG{constructor(){super(s6.type),this.type="formatterPlugin",this._timeModeFormat={utc:Zn.getInstance().timeUTCFormat,local:Zn.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=rr.getInstance().format,this._numericSpecifier=rr.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[s6.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;u(r)?this._formatter=r:(this._formatter=this._format.bind(this),u(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),wH.registerFormatter(this._formatter)}_format(t,e,i){return b(t)?t.map(((t,s)=>{const n=b(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):b(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=t6.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(e6,((t,i)=>{if(!i6.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(ir.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}s6.pluginType="chart",s6.specKey="formatter",s6.type="formatterPlugin";const n6=()=>{Q8(s6)},r6={state:t.STATE_VALUE_ENUM.STATE_ACTIVE,trigger:"pointerover",triggerOff:"pointerout"};class a6 extends NV{constructor(t){super(t),this.type="element-active",this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{this.reset(t.item)},this.options=Object.assign({},r6,t),this.updateMarkIdByState([this.options.state])}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.triggerOff,handler:this.handleReset}]}getStartState(){return this.options.state}start(t){if(t){const{state:e,interaction:i}=this.options;this.isGraphicInStateMark(t,e)&&(t.addState(e,!0),i.setStatedGraphics(this,[t]))}}reset(t){const{interaction:e,state:i}=this.options,s=e.getStatedGraphics(this),n=null!=t?t:null==s?void 0:s[0];n&&s.includes(n)&&(n.removeState(i),e.setStatedGraphics(this,s.filter((t=>t!==n))))}}a6.type="element-active",a6.defaultOptions=r6;const o6=()=>{wH.registerInteractionTrigger(a6.type,a6)},l6="element-active-by-legend",h6={state:t.STATE_VALUE_ENUM.STATE_ACTIVE,filterType:"groupKey"};class c6 extends NV{constructor(t){super(t),this.type=l6,this.handleStart=t=>{var e,i;const s=t.event;s&&this.start(null===(i=null===(e=s.detail)||void 0===e?void 0:e.data)||void 0===i?void 0:i.id)},this.handleReset=t=>{this.resetAll()},this.options=Object.assign({},h6,t),this.updateMarkIdByState([this.options.state])}getEvents(){return[{type:t.ChartEvent.legendItemHover,handler:this.handleStart},{type:t.ChartEvent.legendItemUnHover,handler:this.handleReset}]}getStartState(){return this.options.state}start(t){if(d(t))return;const{interaction:e,state:i}=this.options,s=jV(this.options),n=e.getStatedGraphics(this),r=[];this.getMarks().forEach((e=>{var i;null===(i=e.getGraphics())||void 0===i||i.forEach((e=>{s(e)===t&&r.push(e)}))})),e.updateStates(this,r,n,i),e.setStatedGraphics(this,r)}resetAll(){const{interaction:t,state:e}=this.options;t.clearAllStatesOfTrigger(this,e),t.setStatedGraphics(this,[])}reset(t){const{state:e,interaction:i}=this.options;if(t){const s=i.getStatedGraphics(this);s&&s.includes(t)&&(t.removeState(e),i.setStatedGraphics(this,s.filter((e=>e!==t))))}else this.resetAll()}}c6.type=l6,c6.defaultOptions=h6;const u6=()=>{wH.registerInteractionTrigger(l6,c6)},d6="element-highlight-by-group";class p6 extends NV{constructor(t){super(t),this.type=d6,this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const e=t.item;e&&this.isGraphicInMark(e)&&this.resetAll()},this.options=Object.assign({},HV,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.triggerOff,handler:this.handleReset}]}resetAll(){const{interaction:t,highlightState:e,blurState:i}=this.options;t.clearAllStatesOfTrigger(this,e,i),t.setStatedGraphics(this,[])}_getHightlightKey(t){var e;return null===(e=t.context)||void 0===e?void 0:e.groupKey}start(t){if(t&&this.isGraphicInMark(t)){const e=this._getHightlightKey(t);if(d(e))return;const{interaction:i,highlightState:s,blurState:n}=this.options,r=i.getStatedGraphics(this),a=[];this.getMarks().forEach((t=>{var i;null===(i=t.getGraphics())||void 0===i||i.forEach((t=>{this._getHightlightKey(t)===e&&a.push(t)}))})),i.updateStates(this,a,r,s,n),i.setStatedGraphics(this,a)}}reset(t){if(t){if(this.isGraphicInMark(t)){const{interaction:e}=this.options,i=e.getStatedGraphics(this);t.removeState([this.options.highlightState,this.options.blurState]),e.setStatedGraphics(this,i.filter((e=>e!==t)))}}else this.resetAll()}}p6.type=d6,p6.defaultOptions=HV;const g6=()=>{wH.registerInteractionTrigger(d6,p6)},f6="element-highlight-by-key";class m6 extends p6{constructor(){super(...arguments),this.type=f6}_getHightlightKey(t){var e;return null===(e=t.context)||void 0===e?void 0:e.key}}m6.type=f6;const v6=()=>{wH.registerInteractionTrigger(f6,m6)},y6="element-highlight-by-legend",_6={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,filterType:"groupKey"};class b6 extends NV{constructor(t){super(t),this.type=y6,this.handleStart=t=>{var e,i;const s=t.event;s&&this.start(null===(i=null===(e=s.detail)||void 0===e?void 0:e.data)||void 0===i?void 0:i.id)},this.handleReset=t=>{this.resetAll()},this.options=Object.assign({},_6,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){return[{type:t.ChartEvent.legendItemHover,handler:this.handleStart},{type:t.ChartEvent.legendItemUnHover,handler:this.handleReset}]}start(t){if(t){const e=jV(this.options),{interaction:i,highlightState:s,blurState:n}=this.options,r=i.getStatedGraphics(this),a=[];this.getMarks().forEach((i=>{var s;null===(s=i.getGraphics())||void 0===s||s.forEach((i=>{e(i)===t&&a.push(i)}))})),i.updateStates(this,a,r,s,n),i.setStatedGraphics(this,a)}}resetAll(){const{interaction:t,highlightState:e,blurState:i}=this.options;t.clearAllStatesOfTrigger(this,e,i),t.setStatedGraphics(this,[])}reset(t){const{highlightState:e,blurState:i,interaction:s}=this.options;if(t){const n=s.getStatedGraphics(this);n&&n.includes(t)&&(t.removeState([e,i]),s.setStatedGraphics(this,n.filter((e=>e!==t))))}else this.resetAll()}}b6.type=y6,b6.defaultOptions=_6;const x6=()=>{wH.registerInteractionTrigger(y6,b6)},S6="element-highlight-by-name",A6={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,filterType:"groupKey"};class k6 extends NV{constructor(t){super(t),this.type=S6,this.handleStart=t=>{if(this.options.shouldStart?this.options.shouldStart(t):this._filterByName(t)){const e=this._parseTargetKey(t);this.start(e)}},this.handleReset=t=>{(this.options.shouldReset?this.options.shouldReset(t):this._filterByName(t))&&this.resetAll()},this.options=Object.assign({},A6,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.triggerOff,handler:this.handleReset}]}_filterByName(t){var e;const i=J(this.options.graphicName);return(null===(e=null==t?void 0:t.node)||void 0===e?void 0:e.name)&&i.includes(t.node.name)}_parseTargetKey(t){return this.options.parseData?this.options.parseData(t):"text"===t.node.type?t.node.attribute.text:null}start(t){if(t){const e=jV(this.options),{interaction:i,highlightState:s,blurState:n}=this.options,r=i.getStatedGraphics(this),a=[];this.getMarks().forEach((i=>{var s;null===(s=i.getGraphics())||void 0===s||s.forEach((i=>{e(i)===t&&a.push(i)}))})),i.updateStates(this,a,r,s,n),i.setStatedGraphics(this,a)}}resetAll(){const{interaction:t,highlightState:e,blurState:i}=this.options;t.clearAllStatesOfTrigger(this,e,i),t.setStatedGraphics(this,[])}reset(t){const{highlightState:e,blurState:i,interaction:s}=this.options;if(t){const n=s.getStatedGraphics(this);n&&n.includes(t)&&(t.removeState([e,i]),s.setStatedGraphics(this,n.filter((e=>e!==t))))}else this.resetAll()}}k6.type=S6,k6.defaultOptions=A6;const C6=()=>{wH.registerInteractionTrigger(S6,k6)};class M6 extends dV{constructor(){super(...arguments),this.type=M6.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}M6.type="image";const T6=()=>{wH.registerMark(M6.type,M6),FE(),xE(),wH.registerGraphicComponent("image",Gv)},w6=()=>{fV(),pG(),fG(),Q$(),UK(),jX(),s$(),E$(),mq(),f0(),T6(),$1(),tY()};KV.useRegisters([OX,$X,d$,C$,B2,I2,z2,K2,k2,e3,r3,a3,h3,T3,E3,J2,d3,f3,O3,y3,x3,k3,R3,j3,W2,U3,N2,xY,CY,TY,DY,BY,zq,Oq,$3,a5,v5,k5,M5,U5,G5,q5,H$,L4,U4,u8,O4,W4,p8,f8,z4,J4,n8,o8,_8,x8,C8,k8,w6,Y8,J8,n6,o6,u6,x6,C6,g6,v6,OV,pA,uA]);class D6 extends JY{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","maskShape","reverse","outlineMargin","outlinePadding","indicatorSmartInvert","liquidBackground","liquidOutline"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class E6 extends qY{constructor(){super(...arguments),this.transformerConstructor=D6,this.type="liquid",this.seriesType=t.SeriesTypeEnum.liquid}}E6.type="liquid",E6.seriesType=t.SeriesTypeEnum.liquid,E6.transformerConstructor=D6;class B6 extends JY{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","circle","overlap","overlapLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class P6 extends qY{constructor(){super(...arguments),this.transformerConstructor=B6,this.type="venn",this.seriesType=t.SeriesTypeEnum.venn}}P6.type="venn",P6.seriesType=t.SeriesTypeEnum.venn,P6.transformerConstructor=B6;class R6 extends QY{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar","bandWidthField"])}transformSpec(t){super.transformSpec(t),wU(t)}_setDefaultXAxisSpec(t){return{orient:"bottom",type:"linear",label:{visible:!1}}}_setDefaultYAxisSpec(t){return{orient:"left",type:"linear"}}}class L6 extends qY{constructor(){super(...arguments),this.transformerConstructor=R6,this.type="mosaic",this.seriesType=t.SeriesTypeEnum.mosaic,this.handleAfterStackRegion=(t,e)=>{t.getSeries().forEach((t=>{const i=t.getStackData(),s=t.getStackValue(),n=t.getStackValueField();i&&n&&(EN(e[s],n),BN(t,e[s]))}))}}_beforeInit(){this._dataSet&&iU(this._dataSet,"stackSplit",eX)}_initStack(){this._stack=new iX(this,{afterStackRegion:this.handleAfterStackRegion}),this._stack.init()}_setModelOption(){this._modelOption.getDimensionInfo=pX,this._modelOption.getDimensionInfoByValue=fX,this._modelOption.getRectByDimensionData=xX}}L6.type="mosaic",L6.seriesType=t.SeriesTypeEnum.mosaic,L6.transformerConstructor=R6;const I6=(e="chart",i,s)=>{var n,a,o,l,h,c,u,d,p,g,f;const m={modelInfo:[]};if("chart"===e)m.isChart=!0,m.modelInfo.push({spec:i,type:"chart"});else if("region"===e)m.modelType="region",m.specKey="region",null===(n=i.region)||void 0===n||n.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===e)m.modelType="series",m.specKey="series",null===(a=i.series)||void 0===a||a.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(t.SeriesTypeEnum).includes(e))m.modelType="series",m.specKey="series",m.type=e,null===(o=i.series)||void 0===o||o.forEach(((t,i)=>{t.type===e&&m.modelInfo.push({spec:t,specPath:["series",i],type:e})}));else if(Object.values(r).includes(e)){m.modelType="component",m.type=e,m.specKey=null===(l=wH.getComponentInKey(e))||void 0===l?void 0:l.specKey;const{specKey:t}=m,n=J(null!==(c=null===(h=s.component)||void 0===h?void 0:h[t])&&void 0!==c?c:[]);null===(d=J(null!==(u=i[t])&&void 0!==u?u:[]))||void 0===d||d.forEach(((t,i)=>{const s=n[i];s&&s.type===e?m.modelInfo.push(Object.assign(Object.assign({},s),{spec:t})):t&&!1===t.visible&&m.modelInfo.push({type:e,spec:t})}))}else{const t=wH.getComponents().filter((({cmp:t})=>t.specKey===e)).map((({cmp:t})=>t.type));if(t.length>0){m.modelType="component";const n=e;m.specKey=n;const r=J(null!==(g=null===(p=s.component)||void 0===p?void 0:p[n])&&void 0!==g?g:[]);J(null!==(f=i[n])&&void 0!==f?f:[]).forEach(((e,i)=>{const s=r[i];s&&t.includes(s.type)&&m.modelInfo.push(Object.assign(Object.assign({},s),{spec:e}))}))}}return m},O6=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:c,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=I6(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!d(e)||J(e).some((e=>u(e)?e(t,i,s):AH(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=TH({},i),m=u(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:TH(f,m),hasChanged:!0};const i=TH({},t,m);kH(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);b(f[c])?f[c].push(t):d(f[c])?f[c]="component"===h?t:[t]:f[c]=[f[c],t]}return{chartSpec:f,hasChanged:!0}};class F6 extends kG{constructor(){super(F6.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[F6.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[F6.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=MH(this._option.globalInstance.getSpec(),["data",F6.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=MH(this._baseChartSpec,["data",F6.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(g(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(g(t.minHeight)&&e.height<t.minHeight)return!1;break;case"maxWidth":if(g(t.maxWidth)&&e.width>t.maxWidth)return!1;break;case"minWidth":if(g(t.minWidth)&&e.width<t.minWidth)return!1;break;case"onResize":if(g(t.onResize)&&!t.onResize(e,i))return!1}return!0})(t.query,this._currentMediaInfo,e);return{isActive:i,hasChanged:i!==this.currentActiveItems.has(t)}}_apply(t,e,i){const{query:s,action:n}=t;let r=!1;return J(n).forEach((t=>{const n=O6(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=MH(i,["data",F6.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}F6.pluginType="chart",F6.specKey="media",F6.type="MediaQueryPlugin";class z6 extends kG{constructor(){super(z6.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[z6.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=I$(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom<this._maxZoom))return;n=this._maxZoom}if(n===s)return;const r=n/s;if(this._zoom=n,i.resize(i.getCurrentSize().width*this._zoom,i.getCurrentSize().height*this._zoom),e&&this._container){const{scrollLeft:t,scrollTop:i}=this._container;this._container.scrollLeft=t+e.x*(r-1),this._container.scrollTop=i+e.y*(r-1)}}release(){this._container&&this._triggerEvent&&this._container.removeEventListener(this._triggerEvent,this._onWheel)}}z6.specKey="resizeZoom",z6.type="ChartResizeZoomPlugin";class j6{constructor(t,e,i,s,n){this.state=t,this.graphics=e,this.config=i||[],this.beforeExecute=s,this.afterExecute=n}execute(t,e){if(!this.graphics.length||!this.config.length)return void(null==e||e());this.beforeExecute&&this.beforeExecute(this.graphics);let i=0;const s=this.graphics.length,n=()=>{i++,i>=s&&(this.afterExecute&&this.afterExecute(this.graphics),null==e||e())};this.graphics.forEach((t=>{if(!t)return void i++;"exit"===this.state&&(t.isExiting=!0);const e=this.config.length>1?this.config.map((e=>({name:this.state,animation:Object.assign(Object.assign({},e),{customParameters:t.context})}))):{name:this.state,animation:Object.assign(Object.assign({},this.config[0]),{customParameters:t.context})};t.applyAnimationState([this.state],[e],n)}))}executeOnGroup(t,e){if(!this.graphics.length||!this.config.length||!t)return void(null==e||e());this.beforeExecute&&this.beforeExecute(this.graphics);const i=this.config[0],s=[{name:this.state,animation:Object.assign({},i)}];s.forEach((t=>{t.animation.customParameters=(t,e)=>e.context})),t.applyAnimationState([this.state],s,(()=>{this.afterExecute&&this.afterExecute(this.graphics),null==e||e()}))}}class H6{constructor(){this.name="verticalBarSplit"}shouldApply(t,e){var i,s;const n="rect"===t.type,r="vertical"===(null===(i=t.model)||void 0===i?void 0:i.direction),a=(null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||{};return n&&r&&("x"in a||"width"in a||"x1"in a)&&("y"in a||"height"in a||"y1"in a)}split(t,e){var i;const s=(null===(i=e.context)||void 0===i?void 0:i.diffAttrs)||{},n={},r={};Object.entries(s).forEach((([t,e])=>{"x"===t||"width"===t||"x1"===t?n[t]=e:"y"===t||"height"===t||"y1"===t?r[t]=e:n[t]=e}));const a=e.context,o=a.fieldX,l=a.originalFieldX,h=Array.isArray(o)&&o.length>1,c=(l?!(Array.isArray(l)&&l.length>1):!h)&&h;return[{attrs:n,order:c?1:2},{attrs:r,order:c?2:1}]}}class N6{constructor(){this.name="horizontalBarSplit"}shouldApply(t,e){var i,s;const n="rect"===t.type,r="horizontal"===(null===(i=t.model)||void 0===i?void 0:i.direction),a=(null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||{};return n&&r&&("y"in a||"height"in a||"y1"in a)&&("x"in a||"width"in a||"x1"in a)}split(t,e){var i;const s=(null===(i=e.context)||void 0===i?void 0:i.diffAttrs)||{},n={},r={};Object.entries(s).forEach((([t,e])=>{"y"===t||"height"===t||"y1"===t?n[t]=e:"x"===t||"width"===t||"x1"===t?r[t]=e:n[t]=e}));const a=e.context,o=a.fieldY,l=a.originalFieldY,h=Array.isArray(o)&&o.length>1,c=!(l?!(Array.isArray(l)&&l.length>1):!h)&&!h;return[{attrs:n,order:c?2:1},{attrs:r,order:c?1:2}]}}class U6{constructor(t){this.splitStrategies=[],this.mark=t,"rect"===t.type&&(this.registerStrategy(new H6),this.registerStrategy(new N6))}registerStrategy(t){this.splitStrategies.push(t)}detect(t,e){const i=[],s=[],n=[],r=[],a=this.mark.model.fieldX,o=this.mark.model.fieldY;return t.forEach((t=>{const e=t.context;e.fieldX&&(e.originalFieldX=e.fieldX),e.fieldY&&(e.originalFieldY=e.fieldY),e.fieldX=a,e.fieldY=o;switch(t.context.animationState){case"update":s.push(t);break;case"enter":n.push(t);break;case"appear":r.push(t);break;default:t.context.diffState===JU.exit?i.push(t):t.context.diffState===JU.enter?n.push(t):s.push(t)}})),e.size>t.length&&e.forEach(((t,e)=>{t.context.diffState!==JU.exit||t.isExiting||i.push(t)})),{hasExit:i.length>0,hasUpdate:s.length>0,hasEnter:n.length>0,hasAppear:r.length>0,exitGraphics:i,updateGraphics:s,enterGraphics:n,appearGraphics:r}}createPlanners(t,e){const i=[];if(t.hasExit&&e.exit&&i.push(new j6("exit",t.exitGraphics,e.exit)),t.hasUpdate&&e.update){const s=new Map,n=[];t.updateGraphics.forEach((t=>{let e=!1;for(const i of this.splitStrategies)if(i.shouldApply(this.mark,t)){const n=i.split(this.mark,t),r={graphic:t,steps:n};n.forEach((t=>{const{order:e}=t;s.has(e)||s.set(e,[]),s.get(e).push(r)})),e=!0;break}e||n.push(t)})),n.length>0&&i.push(new j6("update",n,e.update));const r=Array.from(s.keys()).sort(((t,e)=>t-e));r.forEach((t=>{const n=s.get(t);if(n&&n.length>0){const s=n.map((({graphic:e,steps:i})=>{const s=i.find((e=>e.order===t));return{graphic:e,attrs:(null==s?void 0:s.attrs)||{}}}));i.push(new j6("update",s.map((t=>t.graphic)),e.update,(t=>{t.forEach(((t,e)=>{const i=s[e].attrs,n=t.context;n._originalDiffAttrs||(n._originalDiffAttrs=t.context.diffAttrs),t.context.diffAttrs=i}))}),(e=>{t===r[r.length-1]&&e.forEach((t=>{const e=t.context;e._originalDiffAttrs&&(t.context.diffAttrs=e._originalDiffAttrs,delete e._originalDiffAttrs)}))})))}}))}return t.hasEnter&&e.enter&&i.push(new j6("enter",t.enterGraphics,e.enter)),t.hasAppear&&e.appear&&i.push(new j6("appear",t.appearGraphics,e.appear)),i}}class V6{registerAnimationSplitStrategy(t){this._grammarDetector||(this._grammarDetector=new U6(this)),this._grammarDetector.registerStrategy(t)}getGrammarDetector(){return this.initGrammarDetector(),this._grammarDetector}initGrammarDetector(){this._grammarDetector||(this._grammarDetector=new U6(this))}_runSequentialAnimations(t){this.initGrammarDetector();const e=this.getAnimationConfig(),i=this._grammarDetector.detect(t,this._graphicMap),s=this._grammarDetector.createPlanners(i,e);this._executePlanners(s,0)}_executePlanners(t,e){if(e>=t.length)return;const i=t[e];i.execute(this._product,(()=>{this._executePlanners(t,e+1),"exit"===i.state&&i.graphics.forEach((t=>{t.isExiting&&(this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release&&t.release())}))}))}}t.AABBBounds=ns,t.ACustomAnimate=cR,t.AbstractComponent=BA,t.AnimateExecutor=QP,t.ArcMark=fq,t.AreaChart=XX,t.AreaMark=zX,t.AreaSeries=WX,t.AxisSyncPlugin=CG,t.BandAxisMixin=SY,t.BarChart=u$,t.BarChartSpecTransformer=c$,t.BarSeries=l$,t.BarSeriesSpecTransformer=o$,t.BaseArcMark=gq,t.BaseChart=qY,t.BaseChartSpecTransformer=JY,t.BaseComponent=qG,t.BaseComponentSpecTransformer=KG,t.BaseHistogramChart=Y2,t.BaseMark=dV,t.BasePieChart=D2,t.BasePieChartSpecTransformer=w2,t.BasePieSeries=bq,t.BasePlugin=kG,t.BasePolygonMark=p0,t.BaseSeries=jW,t.BaseSeriesSpecTransformer=zW,t.BaseSeriesTooltipHelper=cW,t.BaseWordCloudChart=s3,t.BaseWordCloudChartSpecTransformer=i3,t.BaseWordCloudSeries=BZ,t.Bounds=ss,t.BoxPlotChart=D3,t.BoxPlotSeries=jK,t.Brush=y8,t.CanvasTooltipHandler=Z8,t.CartesianAxis=aY,t.CartesianBandAxis=kY,t.CartesianChartSpecTransformer=QY,t.CartesianCrossHair=A5,t.CartesianLinearAxis=bY,t.CartesianLogAxis=wY,t.CartesianMarkArea=N4,t.CartesianMarkLine=R4,t.CartesianMarkPoint=c8,t.CartesianSeries=VW,t.CartesianSymlogAxis=EY,t.CartesianTimeAxis=MY,t.ChartResizeZoomPlugin=z6,t.CirclePackingChart=b3,t.CirclePackingLayout=JZ,t.CirclePackingSeries=U0,t.CircularProgressChart=Z2,t.CircularProgressSeries=gZ,t.Color=_s,t.ColorUtil=ks,t.CommonChart=H2,t.CommonChartSpecTransformer=j2,t.CompilableData=oV,t.ComponentMark=QG,t.ContinuousLegend=r5,t.CorrelationChart=N3,t.CorrelationSeries=Z1,t.CustomMark=b8,t.DAY=Ls,t.DEFAULT_ANIMATION_CONFIG=CV,t.DEFAULT_CHART_HEIGHT=QH,t.DEFAULT_CHART_WIDTH=JH,t.DEFAULT_CLOSE_STROKE_JOIN=JV,t.DEFAULT_COLORS=ps,t.DEFAULT_DATA_INDEX=eN,t.DEFAULT_DATA_KEY=iN,t.DEFAULT_DATA_SERIES_FIELD=sN,t.DEFAULT_KEY=SN,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=ZV,t.DEFAULT_MAP_LOOK_UP_KEY=AN,t.DEFAULT_MEASURE_CANVAS_ID=tN,t.DEFAULT_SERIES_STYLE_NAME=nN,t.DEFAULT_SMOOTH_INTERPOLATE=qV,t.DataSet=Mh,t.DataView=Th,t.DataZoom=N5,t.DimensionClickEvent=JW,t.DimensionHoverEvent=nG,t.DiscreteLegend=X3,t.DomTooltipHandler=G8,t.DotSeries=tZ,t.ElementHighlight=VV,t.ElementSelect=YV,t.Event=YN,t.EventEmitter=l,t.Factory=wH,t.FormatSpecifier=er,t.FormatterPlugin=s6,t.FunnelChart=l3,t.FunnelChartSpecTransformer=o3,t.FunnelSeries=y0,t.FunnelSeriesSpecTransformer=v0,t.GaugeChart=t3,t.GaugePointerSeries=T1,t.GaugeSeries=E1,t.GeoCoordinate=j$,t.GeoMarkPoint=g8,t.GeoSeries=M$,t.GlyphMark=AK,t.GraphicUtil=class t{constructor(t){this.canvas=t,t&&(this.ctx=t.getContext("2d"))}setCanvas(t){this.canvas=t,t&&(this.ctx=t.getContext("2d"))}measureText(t){return this.canvas?this.measureTextByCanvas(t):(console.warn("[warn] no canvas, measureText might be not accurate"),this.estimate(t))}measureTextByCanvas(t){return this.ctx?(this.ctx.font=function({fontStyle:t,fontVariant:e,fontWeight:i,fontSize:s,fontFamily:n}){return(t?t+" ":"")+(e?e+" ":"")+(i?i+" ":"")+(s||12)+"px "+(n||"sans-serif")}(t),{width:this.ctx.measureText(t.text).width,height:t.fontSize}):(console.error("[error!!!]measureTextByCanvas can not be called without canvas"),{width:-1,height:t.fontSize})}estimate({text:t,fontSize:e}){let i=0,s=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?i++:s++;return{width:~~(.8*i*e+s*e),height:e}}static getDefaultUtils(e){return t.instance||(t.instance=new t(e)),t.instance}},t.GridLayout=S8,t.GroupMark=gV,t.HOUR=Rs,t.HashTable=class{constructor(){this.items={},this.itemList=[]}get type(){return"xhHashTable"}set(t,e){const i=new _e;i.key=t,i.value=e;let s=this.itemList.length;return this.has(t)&&(s=this.items[t].index),i.index=s,this.itemList[s]=i,this.items[t]=i,i}clear(){this.items={},this.itemList=[]}del(t){if(this.has(t)){const e=this.items[t].index;e>-1&&this.itemList.splice(e,1),delete this.items[t],this.resetIndex()}}delFrom(t){for(let e=t+1;e<this.count();e++){const t=this.itemList[e].key;delete this.items[t]}this.itemList.splice(t+1,this.count()-t),this.resetIndex()}resetIndex(){this.foreachHashv(((t,e)=>{const i=this.itemList.indexOf(e);this.items[t].index=i}))}has(t){return t in this.items}get(t){return this.has(t)?this.items[t].value:null}count(){return this.itemList.length}all(){return this.itemList.map((t=>t.value))}first(){return this.itemList[0].value}last(){return this.itemList[this.itemList.length-1].value}getByIndex(t){return this.itemList[t].value}getKeyByIndex(t){return this.itemList[t].key}foreach(t){for(const e in this.items)if(!1===t(e,this.items[e].value))return!1;return!0}foreachHashv(t){for(const e in this.items)if(!1===t(e,this.items[e]))return!1;return!0}hasValue(t){for(const e in this.items)if(this.items[e].value===t)return!0;return!1}indexOf(t){return this.has(t)?this.items[t].index:-1}insertAt(t,e,i){const s=new _e;s.index=t,s.key=i,s.value=e,this.itemList.splice(t,0,s),this.items[i]=s,this.resetIndex()}sort(t){return this.itemList.sort(((e,i)=>t(e.value,i.value)))}toArray(){return this.itemList.slice(0,this.itemList.length).map((t=>t.value))}push(t){t.foreach(((t,e)=>{this.set(t,e)}))}mapKey(){const t=[];for(const e in this.items)t.push(e);return t}toImmutableMap(){}},t.HashValue=_e,t.HeatmapChart=z3,t.HeatmapSeries=F1,t.HistogramChart=$2,t.HistogramChartSpecTransformer=X2,t.ImageCloudGridLayout=qQ,t.ImageCloudSpiralLayout=GQ,t.ImageCloudStackLayout=ZQ,t.ImageMark=M6,t.Indicator=K5,t.LRU=ls,t.Label=s8,t.Layout=ZU,t.LineChart=IX,t.LineMark=dG,t.LineSeries=GY,t.LinearAxisMixin=fY,t.LinearProgressChart=u3,t.LinearProgressSeries=xZ,t.LinkSeries=rZ,t.LiquidChart=E6,t.LiquidSeries=l2,t.Logger=gt,t.MINUTE=6e4,t.MONTH=26784e5,t.MOSAIC_CAT_END_PERCENT=_N,t.MOSAIC_CAT_START_PERCENT=yN,t.MOSAIC_VALUE_END_PERCENT=vN,t.MOSAIC_VALUE_START_PERCENT=mN,t.ManualTicker=class extends KP{constructor(t){super(t),this.lastFrameTime=0,this.status=wc.RUNNING}setupTickHandler(){const t=new qP;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===wc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wc.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wc.RUNNING,!0}},t.MapChart=A2,t.MapSeries=U$,t.MarkPoint=Dz,t.Matrix=as,t.MediaQuery=F6,t.MosaicChart=L6,t.MosaicSeries=b2,t.NEWTON_ITERATIONS=4,t.NEWTON_MIN_SLOPE=.001,t.NumberUtil=rr,t.OBBBounds=rs,t.PREFIX=ZH,t.PathMark=D$,t.PieChart=E2,t.PieSeries=xq,t.PieSeriesSpecTransformer=yq,t.Player=Z4,t.Point=Ge,t.PointService=Ye,t.PolarAxis=Pq,t.PolarBandAxis=Fq,t.PolarCrossHair=C5,t.PolarLinearAxis=Iq,t.PolarMarkArea=V4,t.PolarMarkLine=I4,t.PolarMarkPoint=d8,t.PolarPoint=Xe,t.PolarSeries=nq,t.PolygonMark=g0,t.ProgressLikeSeries=lZ,t.RGB=bs,t.RadarChart=F2,t.RadarSeries=$q,t.RangeAreaChart=I3,t.RangeAreaSeries=iq,t.RangeColumnChart=g3,t.RangeColumnSeries=qK,t.RangeColumnSeriesSpecTransformer=KK,t.RectMark=i$,t.RippleMark=X1,t.RoseChart=L2,t.RoseLikeSeries=Dq,t.RoseSeries=jq,t.RotateBySphereAnimate=class extends cR{onBind(){super.onBind(),this.propKeys=["x","y","z","alpha","zIndex"]}onFirstRun(){super.onFirstRun();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t)}onStart(){super.onStart();const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.finalAttribute.x,s=this.target.finalAttribute.y,n=this.target.finalAttribute.z,r=Math.acos((s-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));n-t.z<0&&(a=ke-a),this.theta=a,this.phi=r}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const s=this.target,{center:n,r:r,cb:a}="function"==typeof this.params?this.params():this.params,o=2*Math.PI*e,l=this.theta+o,h=this.phi,c=r*Math.sin(h)*Math.cos(l)+n.x,u=r*Math.cos(h)+n.y,d=r*Math.sin(h)*Math.sin(l)+n.z;for(s.attribute.x=c,s.attribute.y=u,s.attribute.z=d,s.attribute.alpha=l+xe/2;s.attribute.alpha>ke;)s.attribute.alpha-=ke;s.attribute.alpha=ke-s.attribute.alpha,s.attribute.zIndex=-1e4*s.attribute.z,a&&a(i)}},t.RuleMark=J$,t.SECOND=1e3,t.SEGMENT_FIELD_END=xN,t.SEGMENT_FIELD_START=bN,t.SMALL=Wn,t.STACK_FIELD_END=oN,t.STACK_FIELD_END_OffsetSilhouette=uN,t.STACK_FIELD_END_PERCENT=hN,t.STACK_FIELD_KEY=rN,t.STACK_FIELD_START=aN,t.STACK_FIELD_START_OffsetSilhouette=cN,t.STACK_FIELD_START_PERCENT=lN,t.STACK_FIELD_TOTAL=dN,t.STACK_FIELD_TOTAL_BOTTOM=fN,t.STACK_FIELD_TOTAL_PERCENT=pN,t.STACK_FIELD_TOTAL_TOP=gN,t.SUBDIVISION_MAX_ITERATIONS=10,t.SUBDIVISION_PRECISION=1e-7,t.SankeyChart=P3,t.SankeyLayout=oJ,t.SankeySeries=o1,t.ScatterChart=k$,t.ScatterSeries=x$,t.ScrollBar=W5,t.Segment=eP,t.SequenceChart=V2,t.Stack=iX,t.StackChartMixin=sX,t.StreamLight=XL,t.SunburstChart=v3,t.SunburstLayout=dJ,t.SunburstSeries=O0,t.SymbolMark=gG,t.TextMark=NK,t.TextMeasure=Ji,t.ThemeManager=WH,t.TimeUtil=Zn,t.Title=F4,t.Tooltip=m5,t.TotalLabel=r8,t.TreeLayout=AJ,t.TreemapChart=A3,t.TreemapLayout=TJ,t.TreemapSeries=v1,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=KV,t.VennChart=P6,t.VennSeries=y2,t.WaterfallChart=M3,t.WaterfallSeries=vK,t.WordCloudChart=n3,t.WordCloudSeries=JQ,t.WordcloudCloudLayout=ZJ,t.WordcloudFastLayout=fQ,t.WordcloudGridLayout=gQ,t.YEAR=31536e6,t.aabbSeparation=ts,t.abs=Ce,t.acos=Re,t.alternatingWave=function(t,e,i,s,n,r,a,o=0,l=1){const h=e/s,c=i/n,u=o+l*(Math.sin(2*r*Math.PI-2*h*Math.PI)*Math.sin(2*r*Math.PI-2*c*Math.PI)+1)/2;return Math.min(1,Math.max(0,u))},t.animationConfig=EW,t.array=J,t.arrayEqual=st,t.ascending=lt,t.asin=Le,t.atan2=Me,t.barGrowIn=qX,t.barGrowOut=ZX,t.barPresetAnimation=t$,t.baseMerge=z,t.baseSeriesMark=SW,t.binaryFuzzySearch=vt,t.binaryFuzzySearchInNumberRange=yt,t.bisect=ft,t.boundsInRect=pH,t.builtinThemes=RH,t.calcLayoutNumber=uH,t.calcPadding=dH,t.calculateAnchorOfArc=(t,e)=>{const{startAngle:i,endAngle:s,innerRadius:n,outerRadius:r}=t;let a=(i+s)/2,o=(n+r)/2;switch(e){case"inner-start":a=i,o=n;break;case"outer-start":a=i,o=r;break;case"inner-end":a=s,o=n;break;case"outer-end":a=s,o=r;break;case"inner-middle":o=n;break;case"outer-middle":o=r}return{angle:a,radius:o}},t.calculateAnchorOfBounds=Qi,t.calculateMaxRadius=ri,t.calculateNodeValue=RZ,t.cartesianToPolar=ei,t.centerToCorner=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=n/2,u=Math.sqrt(Math.pow((e-h)/h,2)+Math.pow((i-c)/c,2)),d=1-Math.min(u,1),p=o+l*(Math.sin(2*r*Math.PI-2*d*Math.PI)+1)/2;return Math.min(1,Math.max(0,p))},t.circleArea=Xn,t.circleCircleIntersection=Kn,t.circleOverlap=$n,t.circlePackingTransform=(t,e)=>{const i=new JZ(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return OZ(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},t.clamp=It,t.clampAngleByDegree=Qe,t.clampAngleByRadian=Ze,t.clampDegree=Je,t.clampRadian=qe,t.clampRange=Ot,t.clamper=Ft,t.clone=function(t,e=!1,i=0,s=void 0){const n=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,a){if(null===i)return null;if(0===a)return i;let o;if("object"!=typeof i)return i;if(b(i)?o=[]:T(i)?(o=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(o.lastIndex=i.lastIndex)):o=S(i)?new Date(i.getTime()):void 0===s?Object.create(Object.getPrototypeOf(i)):Object.create(s),e){const t=n.indexOf(i);if(-1!==t)return r[t];n.push(i),r.push(o)}for(const e in i)o[e]=t(i[e],a-1);return o}(t,i)},t.cloneDeep=F,t.columnCenterToEdge=function(t,e,i,s,n,r,a,o=0,l=1){const h=n/2,c=Math.abs(i-h)/h,u=o+l*(Math.sin(2*r*Math.PI-2*c*Math.PI)+1)/2;return Math.min(1,Math.max(0,u))},t.columnEdgeToCenter=function(t,e,i,s,n,r,a,o=0,l=1){const h=n/2,c=1-Math.abs(i-h)/h,u=o+l*(Math.sin(2*r*Math.PI-2*c*Math.PI)+1)/2;return Math.min(1,Math.max(0,u))},t.columnLeftToRight=function(t,e,i,s,n,r,a,o=0,l=1){const h=i/n,c=o+l*(Math.sin(2*r*Math.PI-2*h*Math.PI)+1)/2;return Math.min(1,Math.max(0,c))},t.columnRightToLeft=function(t,e,i,s,n,r,a,o=0,l=1){const h=(n-1-i)/n,c=o+l*(Math.sin(2*r*Math.PI-2*h*Math.PI)+1)/2;return Math.min(1,Math.max(0,c))},t.computeActualDataScheme=$j,t.computeQuadrant=ai,t.conjugateGradient=mr,t.constant=Dt,t.containedInCircles=Yn,t.convertPoint=fH,t.cornerToCenter=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=n/2,u=Math.sqrt(Math.pow((e-h)/h,2)+Math.pow((i-c)/c,2)),d=Math.min(u,1),p=o+l*(Math.sin(2*r*Math.PI-2*d*Math.PI)+1)/2;return Math.min(1,Math.max(0,p))},t.cos=Te,t.createArc=oy,t.createArc3d=hy,t.createArea=ny,t.createGroup=Bm,t.createImage=Gv,t.createLine=Ev,t.createPath=ey,t.createPyramid3d=gy,t.createRect=Lv,t.createRect3d=Fv,t.createRichText=Jv,t.createScale=sH,t.createScaleWithSpec=nH,t.createSymbol=Tv,t.createText=kv,t.crossProduct=Fe,t.crossProductPoint=ze,t.darkTheme=SH,t.dataScheme=vH,t.dateGetterName=ws,t.dateSetterName=function(t){return t?"setUTCDate":"setDate"},t.dayCount=Qs,t.dayField=tn,t.dayFloor=Zs,t.dayOffset=Js,t.debounce=jt,t.default=KV,t.defaultThemeName=LH,t.defaults=q,t.degreeToRadian=$e,t.destination=function(t,e,i,s={}){const n=$e(t[0]),r=$e(t[1]),a=$e(i),o=function(t,e){void 0===e&&(e="kilometers");var i=Nn[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Ke(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Ke(l)}},t.deviation=function(t,e){const i=_t(t,e);return i?Math.sqrt(i):i},t.diagonalCenterToEdge=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=n/2,u=Math.sqrt(Math.pow((e-h)/s,2)+Math.pow((i-c)/n,2)),d=o+l*(Math.sin(2*r*Math.PI-2*u*Math.PI)+1)/2;return Math.min(1,Math.max(0,d))},t.diagonalTopLeftToBottomRight=function(t,e,i,s,n,r,a,o=0,l=1){const h=(e/s+i/n)/2,c=o+l*(Math.sin(2*r*Math.PI-2*h*Math.PI)+1)/2;return Math.min(1,Math.max(0,c))},t.dotProduct=je,t.drawCardioid=hQ,t.drawRegularPolygon=lQ,t.eachAfter=IZ,t.eachBefore=LZ,t.eastAsianCharacterInfo=Ki,t.ecdf=function(t){const e=t.length,i=t.slice().sort(((t,e)=>t-e));function s(t){if(0===e)return 0;let s=0,n=e;for(;s<n;){const e=s+n>>>1;i[e]<=t?s=e+1:n=e}return s/e}return{evaluate:function(t){if(Array.isArray(t)){const e=[];for(let i=0;i<t.length;i++)e.push(s(t[i]));return e}return s(t)},evaluateGrid:function(t){const n=[];if(t<=0)return n;if(0===e)return n;const r=i[0],a=i[e-1];if(r===a){for(let e=0;e<t;e++)n.push({x:r,y:1});return n}const o=(a-r)/(t-1);for(let e=0;e<t;e++){const i=e===t-1?a:r+o*e;n.push({x:i,y:s(i)})}return n},n:e}},t.epanechnikov=t=>Math.abs(t)<=1?.75*(1-t*t):0,t.epsilon=be,t.exponent=or,t.extent=oe,t.fakeRandom=te,t.field=se,t.findBoundaryAngles=ni,t.findMarkGraphic=WN,t.findZeroOfFunction=mt,t.fixPrecision=Ne,t.flattenArray=at,t.flattenNodes=OZ,t.flattenTreeLinks=pJ,t.formatLinkPath=(t,e=!0)=>{var i;return d(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.vertical)?t.map((t=>{const i=t.thickness/2;let s=t.x0,n=t.x1,r=(s+n)/2,a=t.y0-i,o=t.y0+i,l=t.y1-i,h=t.y1+i;return e&&(s=Math.round(s),n=Math.round(n),r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h)),Object.assign({},t,{path:`\n M${s},${a}\n C${r},${a},${r},${l},${n},${l}\n L${n},${h}\n C${r},${h},${r},${o},${s},${o}\n Z`})})):t.map((t=>{const i=t.thickness/2;let s=t.y0,n=t.y1,r=(s+n)/2,a=t.x0-i,o=t.x0+i,l=t.x1-i,h=t.x1+i;return e&&(s=Math.round(s),n=Math.round(n),r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h)),Object.assign({},t,{path:`\n M${a},${s}\n C${a},${r},${l},${r},${l},${n}\n L${h},${n}\n C${h},${r},${o},${r},${o},${s}\n Z\n `})}))},t.formatLinkPolygon=t=>{var e;return d(null===(e=null==t?void 0:t[0])||void 0===e?void 0:e.vertical)?t.map((t=>{const e=t.thickness/2,i=[{x:t.x0,y:t.y0-e},{x:t.x1,y:t.y1-e},{x:t.x1,y:t.y1+e},{x:t.x0,y:t.y0+e}];return Object.assign({},t,{points:i})})):t.map((t=>{const e=t.thickness/2,i=[{x:t.x0-e,y:t.y0},{x:t.x1-e,y:t.y1},{x:t.x1+e,y:t.y1},{x:t.x0+e,y:t.y0}];return Object.assign({},t,{points:i})}))},t.formatNodeRect=t=>t.map((t=>Object.assign({},t,{x:t.x0,y:t.y0,width:t.x1-t.x0,height:t.y1-t.y0}))),t.formatNumerals=lr,t.formatSpecifier=sr,t.formatTypes=ar,t.fullYearGetterName=Ms,t.fullYearSetterName=function(t){return t?"setUTCFullYear":"setFullYear"},t.functionTransform=KH,t.fuzzyEqualNumber=function(t,e){return Ce(t-e)<1e-12},t.fuzzyEqualVec=He,t.gaussian=me,t.gemv=function(t,e,i){for(let s=0;s<t.length;++s)t[s]=je(e[s],i)},t.generateCardioidPoints=oQ,t.generateCeil=En,t.generateCount=Bn,t.generateIsEmptyPixel=sQ,t.generateMaskCanvas=nQ,t.generatePoints=aQ,t.generateStepInterval=(t,{floor:e,offset:i,field:s,count:n})=>{const r=Math.floor(t);if(!Number.isFinite(r)||r<=0)return null;if(r<=1)return{floor:e,offset:i,ceil:En(e,i)};const a=Bn(e,n),o=s?t=>s(t)%r==0:t=>a(0,t)%r==0,l=t=>{if(!Number.isNaN(+t))for(e(t);!o(t);)t.setTime(+t-1),e(t);return t},h=(t,e)=>{if(!Number.isNaN(+t))if(r<0)for(;++e<=0;)for(i(t,-1);!o(t);)i(t,-1);else for(;--e>=0;)for(i(t,1);!o(t);)i(t,1);return t};return{floor:l,offset:h,ceil:En(l,h)}},t.get=L,t.getAABBFromPoints=function(t){return xi=1/0,Si=1/0,Ai=-1/0,ki=-1/0,t.forEach((t=>{xi>t.x&&(xi=t.x),Ai<t.x&&(Ai=t.x),Si>t.y&&(Si=t.y),ki<t.y&&(ki=t.y)})),{x1:xi,y1:Si,x2:Ai,y2:ki}},t.getActualColor=qj,t.getActualNumValue=mH,t.getAlignEndTexts=(t,e=0)=>lJ(t[0])?t.map((t=>({y:t.y1-e,x:(t.x0+t.x1)/2,datum:t.datum,key:t.key}))):t.map((t=>({x:t.x0-e,y:(t.y0+t.y1)/2,datum:t.datum,key:t.key}))),t.getAlignStartTexts=(t,e=0)=>lJ(t[0])?t.map((t=>({y:t.y1,x:(t.x0+t.x1)/2,datum:t.datum,key:t.key}))):t.map((t=>({x:t.x1,y:(t.y0+t.y1)/2,datum:t.datum,key:t.key}))),t.getAngleByPoint=ii,t.getArcsFromCircles=zJ,t.getArcsFromPath=t=>{const e=[],i=t.split("A"),s=i[0];let n=s.indexOf(",");for(e.push({p1:{x:+s.slice(1,n),y:+s.slice(n+1)}}),n=1;n<i.length;n++){const t=i[n].split(",");e[n-1].radius=+t[0];const s=+t[2].slice(2),r=+t[3].split(" ")[0];e[n-1].p2={x:s,y:r},e[n-1].largeArcFlag="1"===t[1][t[1].length-1],n<i.length-1&&e.push({p1:{x:s,y:r}})}return e},t.getBoundsOfNodes=t=>{let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{e=Math.min(t.x0,e),i=Math.max(t.x1,i),s=Math.min(t.y0,s),n=Math.max(t.y1,n)})),{x0:e,x1:i,y0:s,y1:n,width:i-e,height:n-s}},t.getCartesianCrosshairRect=xX,t.getCartesianDimensionInfo=pX,t.getCenter=qn,t.getCirclesFromArcs=HJ,t.getColorSchemeBySeries=tH,t.getCombinedSizeOfRegions=nY,t.getContainerSize=Pn,t.getContextFont=Zi,t.getDataScheme=Xj,t.getDatumOfGraphic=VN,t.getDecimalPlaces=Ue,t.getDiffAttributesOfGraphic=GN,t.getDimensionInfoByValue=fX,t.getElementAbsolutePosition=Rn,t.getElementRelativePosition=function(t,e){const i=Rn(t),s=Rn(e);return{x:i.x-s.x,y:i.y-s.y}},t.getFieldAlias=MN,t.getFormatFromValue=function(t,e){const i=Xt(t),s=i[Ts(e)]()+1,n=i[ws(e)](),r=i[Ds(e)](),a=i[Es(e)](),o=i[Bs(e)](),l=0===i[Ps(e)](),h=l&&0===o,c=h&&0===a,u=c&&0===r,d=u&&1===n;return d&&1===s?"YYYY":d?"YYYY-MM":u?"YYYY-MM-DD":c?"HH":h?"HH:mm":l?"HH:mm:ss":"HH:mm:ss SSS"},t.getFunnelTheme=BH,t.getGroupAnimationParams=UW,t.getIntersectPoint=hi,t.getIntervalOptions=(t,e)=>"year"===t&&e?{floor:js,offset:Hs,count:Ns,field:Us}:"month"===t&&e?{floor:Xs,offset:$s,count:Ks,field:qs}:"day"===t&&e?{floor:en,offset:sn,count:nn,field:rn}:"hour"===t&&e?{floor:cn,offset:un,count:ln,field:dn}:"minute"===t&&e?{floor:vn,offset:yn,count:fn,field:_n}:"second"===t&&e?{floor:kn,offset:Cn,count:Sn,field:Mn}:"year"===t?{floor:Is,offset:Os,count:Fs,field:zs}:"month"===t?{floor:Vs,offset:Ws,count:Gs,field:Ys}:"day"===t?{floor:Zs,offset:Js,count:Qs,field:tn}:"hour"===t?{floor:an,offset:on,count:ln,field:hn}:"minute"===t?{floor:pn,offset:gn,count:fn,field:mn}:"second"===t?{floor:bn,offset:xn,count:Sn,field:An}:{floor:Tn,offset:wn,count:Dn},t.getMaxRadiusAndCenter=GJ,t.getMergedTheme=UH,t.getOBBFromLine=function(t,e,i){return Ci=e.x-t.x,Mi=e.y-t.y,Ti=Mi,wi=-Ci,Bi=Di=Math.sqrt(Ti*Ti+wi*wi),Pi=i,Ti/=Di,wi/=Di,Ei=i/2,Ci=Ei*Ti,Mi=Ei*wi,{point1:{x:t.x+Ci,y:t.y+Mi},point2:{x:t.x-Ci,y:t.y-Mi},point3:{x:e.x+Ci,y:e.y+Mi},point4:{x:e.x-Ci,y:e.y-Mi},width:Bi,height:Pi,left:Math.min(t.x,e.x)-Math.abs(Ci),top:Math.min(t.y,e.y)-Math.abs(Mi)}},t.getPathFromArcs=jJ,t.getPolarDimensionInfo=R2,t.getRectIntersect=ci,t.getRegionStackGroup=TN,t.getScale=t=>t.offsetWidth>0?Ln(t):In(t),t.getScaleX=Ln,t.getScaleY=In,t.getScrollLeft=t=>{var e,i,s;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(s=null===(i=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===i?void 0:i.documentElement)||void 0===s?void 0:s.scrollLeft)||t.scrollLeft:"html"===t.tagName.toLowerCase()?0:t.scrollLeft},t.getScrollTop=t=>{var e,i,s;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(s=null===(i=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===i?void 0:i.documentElement)||void 0===s?void 0:s.scrollTop)||t.scrollTop:"html"===t.tagName.toLowerCase()?0:t.scrollTop},t.getShapeFunction=YJ,t.getSpecInfo=eW,t.getTheme=jH,t.getTimeFormatter=function(t,e){return i=>{const s=Xt(i),n=s[Ms(e)](),r=s[Ts(e)]()+1,a=Math.floor((r-1)/3)+1,o=s[ws(e)](),l=s["get"+(e?"UTC":"")+"Day"](),h=s[Ds(e)](),c=(h-1)%12+1,u=s[Es(e)](),d=s[Bs(e)](),p=s[Ps(e)]();return(t||"").replace(/YYYY/g,Pt(n+"",4,"0","left")).replace(/yyyy/g,n+"").replace(/yy/g,n%100+"").replace(/Q/g,a+"").replace(/MM/g,Pt(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,Pt(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,Pt(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,Pt(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,Pt(u,2,"0","left")).replace(/m/g,u+"").replace(/ss/g,Pt(d,2,"0","left")).replace(/s/g,d+"").replace(/SSS/g,Pt(p,3,"0","left")).replace(/S/g,p+"")}},t.getter=ee,t.graphicCreator=vy,t.halfPi=Se,t.has=O,t.hasParentElement=function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1},t.hasThemeMerged=FH,t.hexToRgb=xs,t.hourCount=ln,t.hourField=hn,t.hourFloor=an,t.hourOffset=on,t.hoursGetterName=Ds,t.hoursSetterName=function(t){return t?"setUTCHours":"setHours"},t.hslToRgb=hs,t.imagecloudTransform=(t,e,i)=>{var s,n;const r=u(t.size)?t.size():t.size;if(t.size=r,!r||d(r[0])||d(r[1])||r[0]<=0||r[1]<=0)return gt.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];if(t.size=[Math.ceil(r[0]),Math.ceil(r[1])],t.image||gt.getInstance().error("Imagecloud: image source must be specified."),t.onBeforeLayout&&t.onBeforeLayout(),!e||0===e.length)return[];let a;switch(null!==(n=null===(s=t.layoutConfig)||void 0===s?void 0:s.layoutMode)&&void 0!==n?n:"spiral"){case"grid":a=qQ;break;case"stack":a=ZQ;break;default:a=GQ}const o=new a(t);return o.layout(e),o.unfinished()?{progressive:o}:o.output()},t.interpolateDate=Vt,t.interpolateNumber=Nt,t.interpolateNumberRound=Ut,t.interpolateRgb=As,t.interpolateString=function(t,e){let i,s,n,r=Wt.lastIndex=Gt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=Wt.exec(t))&&(s=Gt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:Nt(i,s)})),r=Gt.lastIndex;return r<e.length&&(n=e.slice(r),o[a]?o[a]+=n:o[++a]=n),o.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(let i,s=0;s<e;++s)o[(i=l[s]).i]=i.x(t);return o.join("")})},t.intersectionArea=Gn,t.isArray=b,t.isArrayLike=x,t.isBase64=w,t.isBoolean=c,t.isCollectionMark=UN,t.isColorKey=Zj,t.isDate=S,t.isEmpty=R,t.isEqual=Y,t.isFunction=u,t.isGreater=Tt,t.isHTMLElement=jn,t.isIntersect=li,t.isLess=wt,t.isNil=d,t.isNull=p,t.isNumber=A,t.isNumberClose=Mt,t.isNumeric=k,t.isObject=f,t.isObjectLike=m,t.isPercent=hH,t.isPercentOffset=cH,t.isPlainObject=v,t.isPointInLine=Wi,t.isPointInPolygon=function(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===fi(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e<a.length;++e)for(let i=0;i<a[e].length;++i)if(Vi(a[e][i].map((t=>({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o},t.isPolarAxisSeries=HW,t.isProgressiveDataColorScheme=Jj,t.isRectIntersect=gi,t.isRegExp=T,t.isRotateAABBIntersect=bi,t.isShallowEqual=function(t,e){if(X(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;if(b(t)!==b(e))return!1;if($(t)!==$(e))return!1;let i=!0;return Object.keys(t).forEach((s=>!!X(t[s],e[s])||(i=!1,i))),i},t.isSpecValueWithScale=oH,t.isString=_,t.isTokenKey=_H,t.isType=h,t.isUndefined=y,t.isValid=g,t.isValidNumber=C,t.isValidOrient=lH,t.isValidUrl=M,t.isValueInScaleDomain=aH,t.isXAxis=WW,t.isYAxis=GW,t.isZAxis=YW,t.kde=function(t,e={}){const i=t.length,s=e.kernel||me;let n=e.bandwidth;if(!n||n<=0){const s=function(t){const e=t.length;if(0===e)return 0;let i=0;for(let s=0;s<e;s++)i+=t[s];i/=e;let s=0;for(let n=0;n<e;n++){const e=t[n]-i;s+=e*e}return Math.sqrt(s/e)}(t)||0,r=e.bandwidthMethod||"scott";n="silverman"===r?ye(i,s,1):ve(i,s,1)}if(!n||n<=0)return{bandwidth:0,kernel:s,evaluate:t=>{if(Array.isArray(t)){const e=[];for(let i=0;i<t.length;i++)e.push(0);return e}return 0},evaluateGrid:e=>{const s=[];if(e<=0)return s;let n=1/0,r=-1/0;for(let e=0;e<i;e++){const i=t[e];i<n&&(n=i),i>r&&(r=i)}if(n===1/0||r===-1/0){for(let t=0;t<e;t++)s.push({x:0,y:0});return s}for(let t=0;t<e;t++)s.push({x:n,y:0});return s}};const r=1/(i*n);function a(e){let a=0;for(let r=0;r<i;r++)a+=s((e-t[r])/n);return a*r}return{bandwidth:n,kernel:s,evaluate:function(t){if(Array.isArray(t)){const e=[];for(let i=0;i<t.length;i++)e.push(a(t[i]));return e}return a(t)},evaluateGrid(e){const s=[];if(e<=0)return s;let n=1/0,r=-1/0;for(let e=0;e<i;e++){const i=t[e];i<n&&(n=i),i>r&&(r=i)}if(n===1/0||r===-1/0)return s;if(n===r){for(let t=0;t<e;t++)s.push({x:n,y:a(n)});return s}const o=(r-n)/(e-1);for(let t=0;t<e;t++){const i=t===e-1?r:n+o*t;s.push({x:i,y:a(i)})}return s}}},t.keys=K,t.last=Q,t.lengthFromPointToLine=Oe,t.lightTheme=xH,t.lineIntersectPolygon=Ui,t.loadImage=LQ,t.loadImages=IQ,t.lookup=iW,t.lowerCamelCaseToMiddle=Fn,t.lowerFirst=Kt,t.max=we,t.maxInArray=et,t.measureText=qH,t.median=bt,t.memoize=Et,t.merge=N,t.mergeAABB=function(t){const e=[];return function t(i,s){const n=[];s.forEach((t=>{let e;(e=Ri(i,t)).length>1?n.push(t):i=e[0]})),e.push(i),n.length&&t(n[0],n.slice(1))}(t[0],t.slice(1)),e},t.mergeFields=kN,t.millisecondsCount=Dn,t.millisecondsFloor=Tn,t.millisecondsGetterName=Ps,t.millisecondsOffset=wn,t.millisecondsSetterName=function(t){return t?"setUTCMilliseconds":"setMilliseconds"},t.min=De,t.minInArray=it,t.minuteCount=fn,t.minuteField=mn,t.minuteFloor=pn,t.minuteOffset=gn,t.minutesGetterName=Es,t.minutesSetterName=function(t){return t?"setUTCMinutes":"setMinutes"},t.mixin=Z,t.monthCount=Gs,t.monthField=Ys,t.monthFloor=Vs,t.monthGetterName=Ts,t.monthOffset=Ws,t.monthSetterName=function(t){return t?"setUTCMonth":"setMonth"},t.nelderMead=gr,t.norm2=ur,t.normalTransform=os,t.normalizeAngle=si,t.normalizeLayoutPaddingSpec=gH,t.normalizePadding=Cs,t.numberSpecifierReg=ir,t.obbSeparation=es,t.ordinaryLeastSquares=ue,t.pad=Pt,t.parseUint8ToImageData=(t,e,i)=>{const s=new Uint8ClampedArray(t),n=new Uint8ClampedArray(t.length);for(let t=i-1;t>=0;t--)for(let r=0;r<e;r++){const a=t*e*4+4*r,o=(i-t)*e*4+4*r;n[o]=s[a],n[o+1]=s[a+1],n[o+2]=s[a+2],n[o+3]=s[a+3]}return new ImageData(n,e,i)},t.particleEffect=function(t,e,i,s,n,r,a,o=0,l=1){const h=e*n+i,c=2*UE(h,0)*Math.PI,u=.5*UE(h,1)+.5,d=2*UE(h,2)*Math.PI,p=s/2,g=n/2,f=Math.sqrt(Math.pow((e-p)/p,2)+Math.pow((i-g)/g,2)),m=Math.min(f,1),v=(r-.4)/.6,y=Math.sin(v*u*8*Math.PI+c+d*v),_=Math.cos(m*Math.PI+v*Math.PI),b=o+l*((y+1)/2*Math.max(0,1-1.2*v)*(.3+.7*_));return Math.min(1,Math.max(0,b))},t.pi=xe,t.pi2=ke,t.pick=function(t,e){if(!t||!v(t))return t;const i={};return e.forEach((e=>{U.call(t,e)&&(i[e]=t[e])})),i},t.pickWithout=V,t.pieDisappear=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:lq(t,!0,fU.exit)}),t.pieEnter=uq,t.pieExit=dq,t.piePresetAnimation=pq,t.pointAt=Ie,t.pointBetweenLine=Hi,t.pointInAABB=function(t,e){return fi(t,e,!1)},t.pointInLine=Oi,t.pointInOBB=function(t,e){return Li.x=(e.point1.x+e.point2.x)/2,Li.y=(e.point1.y+e.point2.y)/2,Ii.x=(e.point3.x+e.point4.x)/2,Ii.y=(e.point3.y+e.point4.y)/2,Oi(t,Li,Ii,e.height)},t.pointInRect=fi,t.polarToCartesian=ti,t.polygonContainPoint=Vi,t.polygonIntersectPolygon=Yi,t.pow=Pe,t.precisionAdd=Ve,t.precisionSub=We,t.pulseWave=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=n/2,u=Math.sqrt(Math.pow((e-h)/h,2)+Math.pow((i-c)/c,2)),d=Math.min(u,1),p=2*r*Math.PI*3,g=Math.max(0,1-d),f=o+l*((Math.sin(p-4*d*Math.PI)+1)/2)*(.7*g+.3);return Math.min(1,Math.max(0,f))},t.quantileSorted=ct,t.queryColorFromColorScheme=Kj,t.queryToken=yH,t.rSquared=pe,t.radianToDegree=Ke,t.randomLCG=Qt,t.randomOpacity=function(t,e,i,s,n,r,a,o=0,l=1){const h=2*UE(e*n+i)*Math.PI,c=o+l*(Math.sin(2*r*Math.PI+h)+1)/2;return Math.min(1,Math.max(0,c))},t.range=ot,t.rectInsideAnotherRect=pi,t.registerAllEnv=()=>{UT()},t.registerAllMarks=w6,t.registerAnimate=OV,t.registerArc3d=uE,t.registerArcAnimation=RV,t.registerArcMark=mq,t.registerAreaChart=$X,t.registerAreaMark=jX,t.registerAreaSeries=GX,t.registerBarAnimation=e$,t.registerBarChart=d$,t.registerBarSeries=h$,t.registerBoxplotChart=E3,t.registerBoxplotSeries=HK,t.registerBrowserEnv=yV,t.registerBrush=_8,t.registerCanvasTooltipHandler=J8,t.registerCartesianBandAxis=CY,t.registerCartesianCrossHair=k5,t.registerCartesianLinearAxis=xY,t.registerCartesianLogAxis=DY,t.registerCartesianSymlogAxis=BY,t.registerCartesianTimeAxis=TY,t.registerChartPlugin=Q8,t.registerChartResizeZoomPlugin=()=>{Q8(z6)},t.registerCirclePackingChart=x3,t.registerCirclePackingSeries=V0,t.registerCircularProgressChart=J2,t.registerCircularProgressSeries=fZ,t.registerCommonChart=N2,t.registerComponentMark=tY,t.registerContinuousLegend=a5,t.registerCorrelationChart=U3,t.registerCustomAnimate=()=>{QP.registerBuiltInAnimate("increaseCount",fR),QP.registerBuiltInAnimate("fromTo",YL),QP.registerBuiltInAnimate("scaleIn",SL),QP.registerBuiltInAnimate("scaleOut",AL),QP.registerBuiltInAnimate("growHeightIn",KR),QP.registerBuiltInAnimate("growHeightOut",qR),QP.registerBuiltInAnimate("growWidthIn",dL),QP.registerBuiltInAnimate("growWidthOut",pL),QP.registerBuiltInAnimate("growCenterIn",YR),QP.registerBuiltInAnimate("growCenterOut",XR),QP.registerBuiltInAnimate("clipIn",zR),QP.registerBuiltInAnimate("clipOut",jR),QP.registerBuiltInAnimate("fadeIn",HR),QP.registerBuiltInAnimate("fadeOut",NR),QP.registerBuiltInAnimate("growPointsIn",QR),QP.registerBuiltInAnimate("growPointsOut",tL),QP.registerBuiltInAnimate("growPointsXIn",iL),QP.registerBuiltInAnimate("growPointsXOut",sL),QP.registerBuiltInAnimate("growPointsYIn",rL),QP.registerBuiltInAnimate("growPointsYOut",aL),QP.registerBuiltInAnimate("growAngleIn",WR),QP.registerBuiltInAnimate("growAngleOut",GR),QP.registerBuiltInAnimate("growRadiusIn",hL),QP.registerBuiltInAnimate("growRadiusOut",cL),QP.registerBuiltInAnimate("moveIn",HL),QP.registerBuiltInAnimate("moveOut",NL),QP.registerBuiltInAnimate("rotateIn",VL),QP.registerBuiltInAnimate("rotateOut",WL),QP.registerBuiltInAnimate("update",zL),QP.registerBuiltInAnimate("state",kL),QP.registerBuiltInAnimate("labelItemAppear",gL),QP.registerBuiltInAnimate("labelItemDisappear",fL),QP.registerBuiltInAnimate("poptipAppear",mL),QP.registerBuiltInAnimate("poptipDisappear",vL),QP.registerBuiltInAnimate("inputText",BR),QP.registerBuiltInAnimate("inputRichText",yL),QP.registerBuiltInAnimate("outputRichText",_L),QP.registerBuiltInAnimate("slideRichText",bL),QP.registerBuiltInAnimate("slideOutRichText",xL),QP.registerBuiltInAnimate("slideIn",CL),QP.registerBuiltInAnimate("growIn",ML),QP.registerBuiltInAnimate("spinIn",TL),QP.registerBuiltInAnimate("moveScaleIn",EL),QP.registerBuiltInAnimate("moveRotateIn",BL),QP.registerBuiltInAnimate("strokeIn",wL),QP.registerBuiltInAnimate("slideOut",PL),QP.registerBuiltInAnimate("growOut",RL),QP.registerBuiltInAnimate("spinOut",LL),QP.registerBuiltInAnimate("moveScaleOut",IL),QP.registerBuiltInAnimate("moveRotateOut",OL),QP.registerBuiltInAnimate("strokeOut",DL),QP.registerBuiltInAnimate("pulse",FL),QP.registerBuiltInAnimate("MotionPath",GL),QP.registerBuiltInAnimate("streamLight",XL),QP.registerBuiltInAnimate("dissolve",QL),QP.registerBuiltInAnimate("grayscale",tI),QP.registerBuiltInAnimate("distortion",eI),QP.registerBuiltInAnimate("particle",iI),QP.registerBuiltInAnimate("glitch",sI),QP.registerBuiltInAnimate("gaussianBlur",nI),QP.registerBuiltInAnimate("pixelation",rI)},t.registerCustomMark=x8,t.registerDataSetInstanceParser=sU,t.registerDataSetInstanceTransform=iU,t.registerDataZoom=U5,t.registerDimensionEvents=oX,t.registerDimensionHover=aX,t.registerDimensionTooltipProcessor=EX,t.registerDirectionalLight=tS,t.registerDiscreteLegend=$3,t.registerDomTooltipHandler=Y8,t.registerDotSeries=eZ,t.registerDragPlugin=()=>{wH.registerStageEventPlugin("drag",ok)},t.registerElementActive=o6,t.registerElementActiveByLegend=u6,t.registerElementHighlight=WV,t.registerElementHighlightByGroup=g6,t.registerElementHighlightByKey=v6,t.registerElementHighlightByLegend=x6,t.registerElementHighlightByName=C6,t.registerElementSelect=XV,t.registerFormatPlugin=n6,t.registerFunnelChart=h3,t.registerFunnelSeries=_0,t.registerGaugeChart=e3,t.registerGaugePointerSeries=w1,t.registerGaugeSeries=B1,t.registerGeoCoordinate=H$,t.registerGeoMarkPoint=f8,t.registerGesturePlugin=FV,t.registerGlyphMark=kK,t.registerGridLayout=k8,t.registerGroupMark=fV,t.registerGroupTooltipProcessor=LX,t.registerHarmonyEnv=()=>{Sw(mc)},t.registerHeatmapChart=j3,t.registerHeatmapSeries=z1,t.registerHistogramChart=K2,t.registerHtmlAttributePlugin=uA,t.registerImageMark=T6,t.registerIndicator=q5,t.registerLabel=n8,t.registerLarkEnv=()=>{wM(mc)},t.registerLine=AE,t.registerLineChart=OX,t.registerLineMark=pG,t.registerLineSeries=YY,t.registerLinearProgressChart=d3,t.registerLinearProgressSeries=SZ,t.registerLinkSeries=aZ,t.registerLiquidChart=()=>{PX(),h2(),wH.registerChart(E6.type,E6)},t.registerLiquidSeries=h2,t.registerLynxEnv=()=>{GM(mc)},t.registerMapChart=k2,t.registerMapSeries=V$,t.registerMarkArea=U4,t.registerMarkFilterTransform=g1,t.registerMarkLine=L4,t.registerMarkMapTransform=f1,t.registerMarkPoint=u8,t.registerMarkTooltipProcessor=PX,t.registerMediaQuery=()=>{Q8(F6)},t.registerMosaicChart=()=>{EX(),PX(),LX(),oX(),aX(),x2(),wH.registerChart(L6.type,L6)},t.registerMosaicSeries=x2,t.registerNodeEnv=_V,t.registerOrthoCamera=iS,t.registerPathMark=E$,t.registerPieChart=B2,t.registerPieSeries=Sq,t.registerPlayer=J4,t.registerPolarBandAxis=zq,t.registerPolarCrossHair=M5,t.registerPolarLinearAxis=Oq,t.registerPolarMarkArea=W4,t.registerPolarMarkLine=O4,t.registerPolarMarkPoint=p8,t.registerPolygonAnimation=IV,t.registerPolygonMark=f0,t.registerPoptip=C8,t.registerPyramid3d=DE,t.registerRadarChart=z2,t.registerRadarSeries=Kq,t.registerRangeAreaChart=O3,t.registerRangeAreaSeries=sq,t.registerRangeColumnChart=f3,t.registerRangeColumnSeries=ZK,t.registerReactAttributePlugin=pA,t.registerRect=BE,t.registerRect3d=RE,t.registerRectAnimation=PV,t.registerRectMark=s$,t.registerRippleMark=$1,t.registerRoseChart=I2,t.registerRoseSeries=Hq,t.registerRuleMark=Q$,t.registerSankeyChart=R3,t.registerSankeySeries=l1,t.registerScaleInOutAnimation=wV,t.registerScatterChart=C$,t.registerScatterSeries=S$,t.registerScrollBar=G5,t.registerSequenceChart=W2,t.registerSequentialAnimate=function(){Z(dV,V6)},t.registerShadowRoot=FE,t.registerStateTransition=function(){const t=ZP.getInstance();t.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),t.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),t.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),t.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),t.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),t.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))},t.registerSunBurstSeries=F0,t.registerSunburstChart=y3,t.registerSymbolMark=fG,t.registerTTEnv=()=>{rw(mc)},t.registerTaroEnv=()=>{AT(mc)},t.registerTextMark=UK,t.registerTheme=zH,t.registerTitle=z4,t.registerTooltip=v5,t.registerTotalLabel=o8,t.registerTreemapChart=k3,t.registerTreemapSeries=y1,t.registerVRenderAnimate=hR,t.registerVennChart=()=>{PX(),_2(),wH.registerChart(P6.type,P6)},t.registerVennSeries=_2,t.registerViewTransform3dPlugin=()=>{Wx.registerPlugin("ViewTransform3dPlugin",gA)},t.registerWXEnv=()=>{HT(mc)},t.registerWaterfallChart=T3,t.registerWaterfallSeries=yK,t.registerWordCloudChart=r3,t.registerWordCloudSeries=QQ,t.registerWordCloudShapeChart=a3,t.regressionLinear=ge,t.regressionLogistic=function(t,e=(t=>t.x),i=(t=>t.y),s){var n,r,a;const o=null!==(n=null==s?void 0:s.maxIteration)&&void 0!==n?n:25,l=null!==(r=null==s?void 0:s.tol)&&void 0!==r?r:1e-6,h=null!==(a=null==s?void 0:s.alpha)&&void 0!==a?a:.05,c=[],u=[];de(t,e,i,((t,e)=>{c.push(t),u.push(e?1:0)}));const d=c.length;if(0===d)return{coef:[0,0],predict:t=>0,evaluateGrid:t=>[],confidenceInterval:(t=50)=>[]};let p=0,g=0;for(let t=0;t<o;t++){const t=new Array(d);let e=!0;for(let e=0;e<d;e++){const i=p+g*c[e],s=1/(1+Math.exp(-i));t[e]=s}let i=0,s=0,n=0,r=0,a=0;for(let e=0;e<d;e++){const o=t[e]*(1-t[e]),l=u[e]-t[e];i+=l,s+=l*c[e],n+=o,r+=o*c[e],a+=o*c[e]*c[e]}const o=n*a-r*r;if(Math.abs(o)<1e-12)break;const h=(a*i-r*s)/o,f=(-r*i+n*s)/o;if(p+=h,g+=f,(Math.abs(h)>l||Math.abs(f)>l)&&(e=!1),e)break}const f=t=>{const e=p+g*t;return 1/(1+Math.exp(-e))};return{coef:[p,g],predict:f,evaluateGrid:function(s){const n=[];if(s<=0)return n;let r=1/0,a=-1/0;if(de(t,e,i,(t=>{t<r&&(r=t),t>a&&(a=t)})),r===1/0||a===-1/0)return n;if(r===a){const t=f(r);for(let e=0;e<s;e++)n.push({x:r,y:t});return n}const o=(a-r)/(s-1);for(let t=0;t<s;t++){const e=t===s-1?a:r+o*t;n.push({x:e,y:f(e)})}return n},confidenceInterval:function(s=50){const n=[];if(s<=0)return n;const r=he(t,e,i,f);if(0===r.n)return n;const a=Math.abs(le(1-h/2));if(r.min===r.max){const t=f(r.min),e=ce(r.min,r);for(let i=0;i<s;i++)n.push({x:r.min,mean:t,lower:t-a*e.seMean,upper:t+a*e.seMean,predLower:t-a*e.sePred,predUpper:t+a*e.sePred});return n}const o=(r.max-r.min)/(s-1);for(let t=0;t<s;t++){const e=t===s-1?r.max:r.min+o*t,i=f(e),l=ce(e,r);n.push({x:e,mean:i,lower:i-a*l.seMean,upper:i+a*l.seMean,predLower:i-a*l.sePred,predUpper:i+a*l.sePred})}return n}}},t.regressionLowess=function(t,e=(t=>t.x),i=(t=>t.y),s={}){var n;const r=s.span||.3,a=0===s.degree?0:1,o=null!==(n=s.alpha)&&void 0!==n?n:.05,l=null==s.iterations?2:s.iterations,h=s.maxSamples||1e3,c=[];de(t,e,i,((t,e)=>{c.push({x:t,y:e})})),c.sort(((t,e)=>t.x-e.x));const u=function(t,e){const i=t.length;if(i<=e)return t;const s=[],n=i/e;for(let r=0;r<e;r++){const e=Math.min(Math.floor(r*n),i-1);s.push(t[e])}return s}(c,h),d=u.length,p=new Array(d),g=new Array(d);for(let t=0;t<d;t++)p[t]=u[t].x,g[t]=u[t].y;function f(t,e){if(0===d)return 0;let i=0,s=d;for(;i<s;){const e=i+s>>1;p[e]<t?i=e+1:s=e}const n=Math.max(2,Math.min(d,Math.floor(r*d))),o=Math.max(0,i-Math.floor(n/2)),l=Math.min(d,o+n),h=Math.max(0,l-n);let c=0;const u=l-h,f=new Array(u);for(let e=h;e<l;e++){const i=Math.abs(p[e]-t);f[e-h]=i,i>c&&(c=i)}let m=0;const v=new Array(u);for(let t=0;t<u;t++){let i=fe(0===c?0:f[t]/c);e&&null!=e[h+t]&&(i*=e[h+t]),v[t]=i,m+=i}if(0===m)return g[i<d?i:d-1];if(0===a){let t=0;for(let e=0;e<v.length;e++)t+=v[e]*g[h+e];return t/m}let y=0,_=0,b=0,x=0,S=0;for(let t=h;t<l;t++){const e=t-h,i=p[t],s=g[t],n=v[e];y+=n,_+=n*i,b+=n*s,x+=n*i*i,S+=n*i*s}const A=_/y,k=b/y,C=x-_*A,M=Math.abs(C)<1e-12?0:(S-_*k)/C;return k-M*A+M*t}function m(t){if(Array.isArray(t)){const e=t.length,i=new Array(e);for(let s=0;s<e;s++)i[s]=f(t[s]);return i}return f(t)}return{predict:m,evaluate:m,evaluateGrid:function(t){if(t<=0)return[];if(0===d)return[];const e=new Array(t),i=p[0],n=p[d-1];if(i===n){const s=f(i);for(let n=0;n<t;n++)e[n]={x:i,y:s};return e}const r=(n-i)/(t-1);let a;const o=null!=s.iterations?l:d>500?0:l;if(o>0)for(let t=0;t<o;t++){const t=new Array(d),e=new Array(d);for(let i=0;i<d;i++)t[i]=f(p[i],a),e[i]=Math.abs(g[i]-t[i]);const i=e.slice().sort(((t,e)=>t-e))[Math.floor(d/2)]||0;a=new Array(d);for(let t=0;t<d;t++){const s=0===i?0:e[t]/(6*i),n=Math.abs(s)>=1?0:(1-s*s)*(1-s*s);a[t]=n}}for(let s=0;s<t;s++){const o=s===t-1?n:i+r*s;e[s]={x:o,y:f(o,a)}}return e},confidenceInterval:function(s=50){const n=[];if(s<=0)return n;if(0===d)return n;const r=p[0],a=p[d-1];if(void 0===r||void 0===a||r===1/0||a===-1/0)return n;const l=he(t,e,i,(t=>f(t)));if(0===l.n)return n;const h=Math.abs(le(1-o/2));if(l.min===l.max){const t=f(l.min),e=ce(l.min,l);for(let i=0;i<s;i++)n.push({x:l.min,mean:t,lower:t-h*e.seMean,upper:t+h*e.seMean,predLower:t-h*e.sePred,predUpper:t+h*e.sePred});return n}const c=(a-r)/(s-1);for(let t=0;t<s;t++){const e=t===s-1?a:r+c*t,i=f(e),o=ce(e,l);n.push({x:e,mean:i,lower:i-h*o.seMean,upper:i+h*o.seMean,predLower:i-h*o.sePred,predUpper:i+h*o.sePred})}return n}}},t.regressionPolynomial=function(t,e=(t=>t.x),i=(t=>t.y),s={}){var n,r;let a=null!==(n=s.degree)&&void 0!==n?n:0;a<0&&(a=0);const o=null!==(r=s.alpha)&&void 0!==r?r:.05,l=a+1,h=new Array(2*a+1).fill(0);de(t,e,i,((t,e)=>{let i=1;for(let e=0;e<h.length;e++)h[e]+=i,i*=t}));const c=new Array(l);for(let t=0;t<l;t++){c[t]=new Array(l).fill(0);for(let e=0;e<l;e++)c[t][e]=h[t+e]}const u=new Array(l).fill(0);de(t,e,i,((t,e)=>{let i=1;for(let s=0;s<l;s++)u[s]+=e*i,i*=t}));const p=function(t,e){const i=e.length,s=new Array(i);for(let n=0;n<i;n++)s[n]=t[n].slice(),s[n].push(e[n]);for(let t=0;t<i;t++){let e=t,n=Math.abs(s[t][t]);for(let r=t+1;r<i;r++){const i=Math.abs(s[r][t]);i>n&&(n=i,e=r)}if(e!==t){const i=s[t];s[t]=s[e],s[e]=i}if(Math.abs(s[t][t])<1e-12)return new Array(i).fill(0);for(let e=t+1;e<=i;e++)s[t][e]=s[t][e]/s[t][t];s[t][t]=1;for(let e=0;e<i;e++){if(e===t)continue;const n=s[e][t];if(0!==n){for(let r=t+1;r<=i;r++)s[e][r]-=n*s[t][r];s[e][t]=0}}}const n=new Array(i);for(let t=0;t<i;t++)n[t]=s[t][i];return n}(c,u),g=t=>{let e=1,i=0;for(let s=0;s<p.length;s++)i+=p[s]*e,e*=t;return i};return{degree:a,coef:p,predict:g,rSquared:pe(t,e,i,(()=>{let s=0,n=0;return de(t,e,i,((t,e)=>{s+=e,n++})),0===n?0:s/n})(),g),evaluateGrid(s){const n=[];if(s<=0)return n;let r=1/0,a=-1/0;if(de(t,e,i,(t=>{d(t)||(t<r&&(r=t),t>a&&(a=t))})),r===1/0||a===-1/0)return n;if(r===a){const t=g(r);for(let e=0;e<s;e++)n.push({x:r,y:t});return n}const o=(a-r)/(s-1);for(let t=0;t<s;t++){const e=t===s-1?a:r+o*t;n.push({x:e,y:g(e)})}return n},confidenceInterval(s=50){const n=[];if(s<=0)return n;const r=he(t,e,i,g);if(0===r.n)return n;const a=Math.abs(le(1-o/2));if(r.min===r.max){const t=g(r.min),e=ce(r.min,r);for(let i=0;i<s;i++)n.push({x:r.min,mean:t,lower:t-a*e.seMean,upper:t+a*e.seMean,predLower:t-a*e.sePred,predUpper:t+a*e.sePred});return n}const l=(r.max-r.min)/(s-1);for(let t=0;t<s;t++){const e=t===s-1?r.max:r.min+l*t,i=g(e),o=ce(e,r);n.push({x:e,mean:i,lower:i-a*o.seMean,upper:i+a*o.seMean,predLower:i-a*o.sePred,predUpper:i+a*o.sePred})}return n}}},t.removeBorder=dQ,t.removeTheme=HH,t.rgbToHex=Ss,t.rgbToHsl=cs,t.rippleEffect=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=n/2,u=Math.sqrt(Math.pow(e-h,2)+Math.pow(i-c,2))/Math.sqrt(Math.pow(s/2,2)+Math.pow(n/2,2)),d=o+l*(Math.sin(2*r*Math.PI*3-2*u*Math.PI)+1)/2;return Math.min(1,Math.max(0,d))},t.rotatePoint=vi,t.rotationScan=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=n/2,u=Math.atan2(e-h,i-c),d=(u<0?u+2*Math.PI:u)/(2*Math.PI),p=o+l*(Math.sin(2*r*Math.PI-2*d*Math.PI)+1)/2;return Math.min(1,Math.max(0,p))},t.rowBottomToTop=function(t,e,i,s,n,r,a,o=0,l=1){const h=(s-1-e)/s,c=o+l*(Math.sin(2*r*Math.PI-2*h*Math.PI)+1)/2;return Math.min(1,Math.max(0,c))},t.rowCenterToEdge=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=Math.abs(e-h)/h,u=o+l*(Math.sin(2*r*Math.PI-2*c*Math.PI)+1)/2;return Math.min(1,Math.max(0,u))},t.rowEdgeToCenter=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=1-Math.abs(e-h)/h,u=o+l*(Math.sin(2*r*Math.PI-2*c*Math.PI)+1)/2;return Math.min(1,Math.max(0,u))},t.rowTopToBottom=function(t,e,i,s,n,r,a,o=0,l=1){const h=e/s,c=o+l*(Math.sin(2*r*Math.PI-2*h*Math.PI)+1)/2;return Math.min(1,Math.max(0,c))},t.sankeyTransform=hJ,t.scale=dr,t.scaleAndMiddleShape=pQ,t.scott=ve,t.secondCount=Sn,t.secondField=An,t.secondFloor=bn,t.secondOffset=xn,t.secondsGetterName=Bs,t.secondsSetterName=function(t){return t?"setUTCSeconds":"setSeconds"},t.seedRandom=Zt,t.segmentation=uQ,t.setDefaultCrosshairForCartesianChart=wU,t.shapes=VJ,t.shouldMarkDoMorph=LW,t.shuffleArray=rt,t.silverman=ye,t.simpleField=ne,t.sin=Ee,t.snakeWave=function(t,e,i,s,n,r,a,o=0,l=1){const h=(e+i)%(s+n)/(s+n),c=o+l*(Math.sin(2*r*Math.PI-4*h*Math.PI)+1)/2;return Math.min(1,Math.max(0,c))},t.sortDataInAxisHelper=NW,t.sortStackValueGroup=wN,t.span=t=>t.length<=1?0:Q(t)-t[0],t.specTransform=$H,t.spiralEffect=function(t,e,i,s,n,r,a,o=0,l=1){const h=s/2,c=n/2,u=Math.sqrt(Math.pow(e-h,2)+Math.pow(i-c,2)),d=Math.atan2(e-h,i-c),p=(u/Math.sqrt(Math.pow(s/2,2)+Math.pow(n/2,2))+d/(2*Math.PI))/2,g=o+l*(Math.sin(2*r*Math.PI-4*p*Math.PI)+1)/2;return Math.min(1,Math.max(0,g))},t.spirals=qJ,t.sqrt=Be,t.stack=RN,t.stackGroup=LN,t.stackMosaic=BN,t.stackMosaicTotal=EN,t.stackOffsetSilhouette=PN,t.stackTotal=DN,t.stringWidth=function(t,e=!0){if("string"!=typeof t||0===t.length)return 0;if(0===(t=Xi(t)).length)return 0;t=t.replace(qi()," ");const i=e?1:2;let s=0;for(const e of t){const t=e.codePointAt(0);if(!(t<=31||t>=127&&t<=159)&&!(t>=768&&t<=879))switch(Ki(e)){case"F":case"W":s+=2;break;case"A":s+=i;break;default:s+=1}}return s},t.styleStringToObject=On,t.substitute=function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,((t,i)=>"\\"===t.charAt(0)?t.slice(1):void 0===e[i]?"":e[i])):t},t.sunburstTransform=(t,e)=>{const i=new dJ(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return OZ(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},t.svgParser=(t,e={},i)=>{let s=e.customDOMParser;if(s||(null===window||void 0===window?void 0:window.DOMParser)&&(s=t=>(new DOMParser).parseFromString(t,"text/xml")),!s)throw new Error("No Available DOMParser!");const n=s(t);let r=9===n.nodeType?n.firstChild:n;for(;r&&("svg"!==r.nodeName.toLowerCase()||1!==r.nodeType);)r=r.nextSibling;return r?function(t,e={}){const i=[],s=xh(t,null);let n=parseFloat(t.getAttribute("width")||e.width),r=parseFloat(t.getAttribute("height")||e.height);!C(n)&&(n=null),!C(r)&&(r=null);const a=t.getAttribute("viewBox");let o;if(a){const t=a.match(vh)||[];if(t.length>=4&&(o={x:parseFloat(t[0]||0),y:parseFloat(t[1]||0),width:parseFloat(t[2]),height:parseFloat(t[3])},n||r)){const t={x:0,y:0,width:n,height:r},e=t.width/o.width,i=t.height/o.height,a=Math.min(e,i),l=-(o.x+o.width/2)*a+(t.x+t.width/2),h=-(o.y+o.height/2)*a+(t.y+t.height/2),c=(new as).translate(l,h).scale(a,a);s.transform=c}}return Ah(t,s,i),{root:s,width:n,height:r,elements:i,viewBoxRect:o}}(r):null},t.tau=Ae,t.themeExist=NH,t.themes=IH,t.throttle=Ht,t.tickStep=function(t,e,i){const s=Math.abs(e-t)/Math.max(0,i);let n=Math.pow(10,Math.floor(Math.log(s)/Math.LN10));const r=s/n;return r>=xt?n*=10:r>=St?n*=5:r>=At&&(n*=2),e<t?-n:n},t.toCamelCase=zn,t.toDate=Xt,t.toNumber=ht,t.toPercent=re,t.toValidNumber=$t,t.token=bH,t.transformBounds=function(t,e,i,s,n,r,a){if(!(Ce(s)<=be||Ce(n)<=be)){if(1!==s&&t.scaleX(s),1!==n&&t.scaleY(n),isFinite(r)&&Math.abs(r)>be){let e=0,i=0;void 0!==a&&(e=a[0],i=a[1]),t.rotate(r,e,i)}t.translate(e,i)}},t.transformBoundsWithMatrix=is,t.transformColorSchemeToStandardStruct=Qj,t.transformToGraphic=NN,t.treeTransform=(t,e)=>{const i=new AJ(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const{maxDepth:e}=null!=t?t:{},s=[];OZ(i,s,{maxDepth:e});const n=[];return pJ(i,n,{maxDepth:e}),{nodes:s,links:n}}return i},t.treemapTransform=(t,e)=>{const i=new TJ(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return OZ(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},t.truncate=Rt,t.unionAABB=Ri,t.uniqArray=nt,t.upperFirst=qt,t.userAnimationConfig=BW,t.utcDayCount=nn;t.utcDayField=rn,t.utcDayFloor=en,t.utcDayOffset=sn,t.utcHourField=dn,t.utcHourFloor=cn,t.utcHourOffset=un,t.utcMinuteField=_n,t.utcMinuteFloor=vn,t.utcMinuteOffset=yn,t.utcMonthCount=Ks,t.utcMonthField=qs,t.utcMonthFloor=Xs,t.utcMonthOffset=$s,t.utcSecondField=Mn,t.utcSecondFloor=kn,t.utcSecondOffset=Cn,t.utcYearCount=Ns,t.utcYearField=Us,t.utcYearFloor=js,t.utcYearOffset=Hs,t.uuid=Lt,t.valueInScaleRange=rH,t.variance=_t,t.vennMarkTransform=UJ,t.vennTransform=NJ,t.version="2.0.12",t.vglobal=Px,t.visitPoints=de,t.warn=yA,t.weightedSum=pr,t.wordcloudShapeTransform=NQ,t.wordcloudTransform=yQ,t.yearCount=Fs,t.yearField=zs,t.yearFloor=Is,t.yearOffset=Os,t.zero=ae,t.zeros=hr,t.zerosM=cr,Object.defineProperty(t,"__esModule",{value:!0})}));