@visactor/vchart-extension 2.1.3-alpha.4 → 2.1.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.
- package/build/index.js +42 -21
- package/build/index.min.js +1 -1
- package/cjs/charts/3d/enum.js +1 -2
- package/cjs/charts/axis-3d/band-axis.js +2 -1
- package/cjs/components/histogram-regression-line/type.js +2 -1
- package/cjs/components/map-label/type.js +1 -2
- package/cjs/components/series-break/index.js +1 -2
- package/cjs/components/series-break/util.js +2 -1
- package/esm/charts/3d/enum.js +1 -2
- package/esm/charts/axis-3d/band-axis.js +2 -1
- package/esm/components/histogram-regression-line/type.js +2 -1
- package/esm/components/map-label/type.js +1 -2
- package/esm/components/series-break/index.js +1 -2
- package/esm/components/series-break/util.js +2 -1
- package/package.json +8 -8
package/build/index.min.js
CHANGED
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */
|
|
16
|
-
function v(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]])}return i}const y={cornerRadius:4,stroke:"black",strokeOpacity:1,lineWidth:1,closePath:!1,pickable:!1},_={symbolType:"triangle",size:8,scaleX:.7,fill:"black"},b={fill:"#606773",fontSize:12},S={fill:"#eff1f9"};class x extends e.FunnelChartSpecTransformer{transformSpec(t){const{conversionArrow:e,extensionMark:i=[],funnelBackground:s}=t;if(e&&e.arrows&&e.arrows.length){const t=function(t){const{arrows:e}=t,i=v(t,["arrows"]),s=e.filter((t=>"left"===t.position)),r=e.filter((t=>"right"===t.position)),n=A(r,i),a=A(s,i),o=[];n&&(n.name="arrowRight",o.push(n));a&&(a.name="arrowLeft",o.push(a));return o}(e);t&&t.length&&i.push(...t)}if(s&&s.visible){const t=function(t){const{style:e={}}=t,i=v(t,["style"]);return Object.assign(Object.assign({type:"rect"},i),{dataIndex:0,zIndex:0,style:Object.assign(Object.assign(Object.assign({},S),e),{x:0,y:(t,e)=>e.getPoints(t)[0].y,width:(t,e)=>{const i=e.getRegion(),{width:s}=i.getLayoutRect();return s},height:(t,e)=>{const i=e.getPoints(t),s=i[0];return i[3].y-s.y}})})}(s);t&&i.push(t)}t.extensionMark=i,super.transformSpec(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.conversionArrow=t.conversionArrow,e.funnelBackground=t.funnelBackground,e}}function A(t,i){if(0===(null==t?void 0:t.length))return null;const{line:s,symbol:r,text:n,margin:a}=i,o=[],l={type:"group",zIndex:e.LayoutZIndex.Mark+1,children:[]},h=function(t={},e){const{style:i={}}=t,s=v(t,["style"]),r=(t,e)=>{var i,s;const{from:r,to:n}=t,{vchart:a}=e,o=null===(s=null===(i=null==a?void 0:a.getChart())||void 0===i?void 0:i.getSeriesData())||void 0===s?void 0:s.latestData;return!(n>o.length-1||r>o.length-1)};return Object.assign(Object.assign({type:"polygon",interactive:!1},s),{dataKey:t=>`${t.id}`,style:Object.assign(Object.assign(Object.assign({},y),i),{renderable:r,points:(t,i)=>{if(!r(t,i))return[];let s=t.layout.points;return s=T(t,i,e),s}})})}(s,a);h&&o.push(h);const c=function(t={},e){const{style:i={}}=t,s=v(t,["style"]);return Object.assign(Object.assign({type:"symbol",interactive:!1,dataKey:t=>`${t.id}`},s),{style:Object.assign(Object.assign(Object.assign({},_),i),{x:(t,i)=>{var s,r;let n=t.layout.points;return n=T(t,i,e),null!==(r=null===(s=n[(null==n?void 0:n.length)-1])||void 0===s?void 0:s.x)&&void 0!==r?r:NaN},y:(t,i)=>{var s,r;let n=t.layout.points;return n=T(t,i,e),null!==(r=null===(s=n[(null==n?void 0:n.length)-1])||void 0===s?void 0:s.y)&&void 0!==r?r:NaN},angle:t=>"left"===t.position?90:-90})})}(r,a);c&&o.push(c);const d=function(t={},i){const{style:s={},formatMethod:r,textMargin:n=4}=t,a=v(t,["style","formatMethod","textMargin"]);return Object.assign(Object.assign({type:"text",dataKey:t=>`${t.id}`,interactive:!1,animation:!1},a),{style:Object.assign(Object.assign(Object.assign({},b),{text:(t,i)=>{var s,n,a,o,l,h,c;const{text:d}=t;let u=d;if(e.isFunction(r)){const{vchart:e}=i,{from:p,to:g}=t,{field:m}=t.context,f=null!==(a=null===(n=null===(s=null==e?void 0:e.getChart())||void 0===s?void 0:s.getSeriesData())||void 0===n?void 0:n.latestData)&&void 0!==a?a:[],v=null!==(c=null===(h=null===(l=null===(o=null==e?void 0:e.getChart())||void 0===o?void 0:o.getAllSeries()[0])||void 0===l?void 0:l.getViewData())||void 0===h?void 0:h.latestData)&&void 0!==c?c:[],y=v.find((t=>t[m]===f[p][m])),_=v.find((t=>t[m]===f[g][m]));u=r(d,{arrow:t,from:y,to:_})}return u},x:(t,e)=>{var s,r;let a=t.layout.points;return a=T(t,e,i),null!==(r=(null===(s=a[1])||void 0===s?void 0:s.x)+("left"===t.position?-n:n))&&void 0!==r?r:NaN},y:(t,e)=>{var s,r,n;let a=t.layout.points;return a=T(t,e,i),null!==(n=((null===(s=a[1])||void 0===s?void 0:s.y)+(null===(r=a[2])||void 0===r?void 0:r.y))/2)&&void 0!==n?n:NaN},textAlign:t=>"left"===t.position?"right":"left",textBaseline:"middle"}),s)})}(n,a);return d&&o.push(d),l.children=o,l}function T(t,e,i){var s,r,n,a,o;const{vchart:l}=e,{from:h,to:c}=t,{field:d}=t.context,u=null===(r=null===(s=null==l?void 0:l.getChart())||void 0===s?void 0:s.getSeriesData())||void 0===r?void 0:r.latestData,p=null===(o=null===(a=null===(n=null==l?void 0:l.getChart())||void 0===n?void 0:n.getAllSeries()[0])||void 0===a?void 0:a.getViewData())||void 0===o?void 0:o.latestData;let g=[];if(u&&u.length){const s=p.find((t=>t[d]===u[h][d])),r=p.find((t=>t[d]===u[c][d])),n=p[0];if(s&&r&&n){g=function(t,e,i,s,r=12){const{layout:n,distance:a,position:o}=t,{level:l,fromIndex:h,toIndex:c,fromTotal:d,toTotal:u}=n,p="right"===o,g=p?e[1]:e[0],m=p?e[2]:e[3],f=Math.abs(g.y-m.y),v=p?i[1]:i[0],y=p?i[2]:i[3],_=Math.abs(v.y-y.y),b=p?s[1]:s[0],S=f/(d+1),x=_/(u+1),A=g.y+S*(h+1),T=v.y+x*(c+1),C=p?-1:1,k=[{x:g.x-r*C,y:A},{x:b.x-(r+(l+1)*a)*C,y:A},{x:b.x-(r+(l+1)*a)*C,y:T},{x:v.x-r*C,y:T}];return k}(t,e.getPoints(s),e.getPoints(r),e.getPoints(n),i),t.layout.points=g}}return g}function C(t,e){const{from:i,to:s}=t,{from:r,to:n}=e;return s>r&&n>i}function k(t,e){const{from:i,to:s}=t,{from:r,to:n}=e;return i===r&&s===n}const w=(t,i)=>{var s,r,n;if(!t||!(null===(s=t.arrows)||void 0===s?void 0:s.length))return[];const{arrows:a}=t,o=function(t,i){return t.filter((t=>e.isValidNumber(t.from*t.to))).map(((t,e)=>{const{from:s,to:r,position:n="right"}=t;return Object.assign(Object.assign({},t),{position:n,distance:t.distance||40,from:Math.min(s,r),to:Math.max(s,r),span:Math.abs(s-r),isLayout:!1,context:{field:i},layout:{level:0},id:`${s}-${r}-${n}-${e}`})}))}(a,i.categoryField),l=o.filter((t=>"left"===t.position)),h=o.filter((t=>"right"===t.position));return[...null!==(r=M(l))&&void 0!==r?r:[],...null!==(n=M(h))&&void 0!==n?n:[]]};function M(t){if(0===(null==t?void 0:t.length))return null;const i=new Map;return t.forEach((t=>{const s=i.get(t.from);if(e.isValid(s)){const e=s.fromArrows.find((e=>k(e,t)));e?t.layout.duplicateNode=e:s.degree+=1,s.fromArrows.push(t)}else i.set(t.from,{fromArrows:[t],toArrows:[],totalArrows:[],degree:1});const r=i.get(t.to);if(e.isValid(r)){const e=r.toArrows.find((e=>k(e,t)));e?t.layout.duplicateNode=e:r.degree+=1,r.toArrows.push(t)}else i.set(t.to,{toArrows:[t],fromArrows:[],totalArrows:[],degree:1})})),i.forEach((t=>{t.fromArrows.sort(((t,e)=>e.span-t.span)),t.toArrows.sort(((t,e)=>t.span-e.span)),t.totalArrows=[...t.toArrows,...t.fromArrows]})),t.sort(((t,e)=>t.span-e.span)).forEach((s=>{var r;const n=t.filter((t=>t.layout.isLayout)),a=e.maxInArray(n,((t,e)=>t.layout.level-e.layout.level));let o=null!==(r=null==a?void 0:a.layout.level)&&void 0!==r?r:0;for(;o>=0;){if(n.some((t=>t.layout.level===o&&C(t,s)))){o+=1;break}--o}s.layout.level=Math.max(0,o),s.layout.fromTotal=i.get(s.from).degree,s.layout.toTotal=i.get(s.to).degree;const l=s.layout.duplicateNode;l?(s.layout.fromIndex=l.layout.fromIndex,s.layout.toIndex=l.layout.toIndex):(s.layout.fromIndex=E(s,i.get(s.from).totalArrows),s.layout.toIndex=E(s,i.get(s.to).totalArrows)),s.layout.isLayout=!0})),t}function E(t,e){let i=0,s=0;for(let r=0;r<e.length;r++){const n=e[r];if(n===t){i=r-s;break}n.layout.duplicateNode&&s++}return i}class B extends e.FunnelChart{constructor(){super(...arguments),this.type="conversionFunnel",this.transformerConstructor=x}}B.type="conversionFunnel",B.transformerConstructor=x;class O extends e.FunnelSeries{initData(){var t;super.initData();const{conversionArrow:i}=this._spec;i&&(null===(t=i.arrows)||void 0===t?void 0:t.length)&&(this._arrowData=new e.DataView(this._dataSet,{name:`${e.PREFIX}_series_${this.id}_arrowData`}),this._dataSet.getTransform("conversionArrow")||this._dataSet.registerTransform("conversionArrow",w),this._arrowData.parse(i).transform({type:"conversionArrow",options:{categoryField:this._spec.categoryField}}))}afterCompile(){var t;null===(t=super.afterCompile)||void 0===t||t.call(this);const e=this.getMarkInName("arrowRight");e&&e.getMarks().forEach((t=>{t.setDataView(this._arrowData),t.compileData(),t.setTransform([{type:"filter",callback:t=>"right"===t.position}])}));const i=this.getMarkInName("arrowLeft");i&&i.getMarks().forEach((t=>{t.setDataView(this._arrowData),t.compileData(),t.setTransform([{type:"filter",callback:t=>"left"===t.position}])}))}}const P="dataKey";class I extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,s,r,n;super.transformSpec(t);const a=function(t){const e=[];return Object.keys(t.data).forEach((i=>{const s=t.data[i].nodes;e.push({data:[{id:"nodes",values:s.map(((t,e)=>Object.assign(Object.assign({},t),{[P]:e})))},{id:"endpoints",values:[]},{id:"iter",values:[{iter:i}]},{id:"background",values:[{iter:i,x:t.scope[0],y:t.scope[1]},{iter:i,x:t.scope[0],y:t.scope[3]},{iter:i,x:t.scope[2],y:t.scope[3]},{iter:i,x:t.scope[2],y:t.scope[1]},{iter:i,x:t.scope[0],y:t.scope[1]}]}]})})),e}(t),o="neighborhood"!==t.taskType;t.type="common",t.dataKey=P,t.data=a[0].data,t.series=[{id:"background-series",type:"area",dataId:"background",interactive:!1,persent:!0,xField:"x",yField:"y",point:{visible:!1},line:{visible:!1},area:{visible:!0,interactive:!1,style:{background:e=>"neighborhood"===t.taskType?"":`https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/sequence-scatter-bgimg-2/${e.iter}.png`,fill:"transparent",fillOpacity:.5}},hover:{enable:!1},select:{enable:!1}},{id:"line-series",type:"line",dataId:"endpoints",xField:"x",yField:"y",seriesField:"edgeId",animation:!0,point:{visible:!1},line:{visible:!0,style:{stroke:t=>t.color,lineDash:t=>"same_type"===t.type?[0,0]:[3,2],lineWidth:.8,strokeOpacity:.6}}},{id:"scatter-series",type:"scatter",dataId:"nodes",xField:t.xField,yField:t.yField,seriesField:"label",point:{state:{hover:{scaleX:1.5,scaleY:1.5,fillOpacity:1},hover_reverse:{scaleX:1,scaleY:1,fillOpacity:.3}},style:{size:()=>"neighborhood"===t.taskType?6:4,fill:e=>{var i;return null!==(i=t.labelColor[e.label])&&void 0!==i?i:"gray"},fillOpacity:t=>t.confidence}},label:{visible:!0,style:{visible:()=>"neighborhood"===t.taskType,type:"text",fontFamily:"Console",fontStyle:"italic",fontSize:12,fill:"black",fillOpacity:.6,text:t=>t.id}}}],t.player&&(t.player=Object.assign(Object.assign({},t.player),{specs:a}),t.animationAppear={duration:null!==(i=null===(e=t.player)||void 0===e?void 0:e.duration)&&void 0!==i?i:2e3,easing:"linear"},t.animationUpdate={duration:null!==(r=null===(s=t.player)||void 0===s?void 0:s.duration)&&void 0!==r?r:2e3,easing:"linear"}),t.axes=[{orient:"left",type:"linear",inverse:!0,min:t.scope[1],max:t.scope[3]},{orient:"bottom",type:"linear",min:t.scope[0],max:t.scope[2]}],t.customMark=[{type:"text",dataId:"iter",style:Object.assign({x:50,y:()=>10,textBaseline:"top",textAlign:"left",fontSize:100,fontWeight:"bolder",fill:"black",fillOpacity:.2},null===(n=t.infoLabel)||void 0===n?void 0:n.style)}],t.legends=[{seriesId:"scatter-series",visible:!0,orient:"right",position:"middle",data:t=>t.map((t=>(t.shape.outerBorder={stroke:t.shape.fill,distance:2,lineWidth:1},t))),title:{visible:!0,align:"left",textStyle:{text:"Classes",fontFamily:"Console",fontSize:18,fontWeight:"bold"}},item:{visible:!0,width:"8%",value:{alignRight:!0,style:{fill:"#000",fillOpacity:1,fontSize:12},state:{unselected:{fill:"#d8d8d8"}}}}}],t.tooltip={visible:o,seriesId:"scatter-series",lockAfterClick:!1,activeType:"mark",trigger:"hover",mark:{title:{visible:!0,value:"Info"},content:[{key:"Label",value:t=>t.label,shapeType:"circle",shapeSize:8},{key:"Prediction",value:t=>t.prediction,shapeType:"circle",shapeSize:8,shapeFill:e=>{var i;return null!==(i=t.labelColor[e.prediction])&&void 0!==i?i:"gray"}},{key:"Confidence",value:t=>t.confidence.toFixed(2),shapeType:"square",shapeSize:8,shapeFill:t=>t.label===t.prediction?"green":"red"}]},style:{panel:{padding:{top:10,bottom:15,left:10,right:10},backgroundColor:"#fff",border:{color:"#eee",width:1,radius:10}},titleLabel:{fontSize:20,fontFamily:"Times New Roman",fill:"brown",fontWeight:"bold",textAlign:"center",lineHeight:24},keyLabel:{fontSize:16,fontFamily:"Times New Roman",fill:"black",textAlign:"center",lineHeight:15,spacing:10},valueLabel:{fontSize:14,fill:"black",textAlign:"center",lineHeight:15,spacing:10}}},t.dataZoom=[{visible:!1,orient:"left",filterMode:"axis",showDetail:!1,roamZoom:{enable:!0,focus:!0,rate:3},roamDrag:{enable:!0,reverse:!0,rate:1}},{visible:!1,orient:"bottom",filterMode:"axis",showDetail:!1,roamZoom:{enable:!0,focus:!0,rate:3},roamDrag:{enable:!0,reverse:!0,rate:1}}],super.transformSpec(t)}}class R extends e.BaseChart{constructor(){super(...arguments),this.type="sequenceScatterLink",this.transformerConstructor=I}init(){this.isValid()&&super.init()}isValid(){var t,e,i,s;const{xField:r,yField:n,data:a}=this._spec;return r&&n?!!a||(null===(s=(i=this._option).onError)||void 0===s||s.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}R.type="sequenceScatterLink",R.view="singleDefault",R.transformerConstructor=I;const D=.2;function L(t){const e=Math.sqrt((2*Math.PI)**2);return Math.exp(-(t**2)/2)/e}const F="dataKey";class N extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,s,r,n,a;super.transformSpec(t);const o=function(t){const e=[];return Object.keys(t.data).forEach((i=>{const s=t.data[i].map(((t,e)=>Object.assign(Object.assign({},t),{[F]:e}))),r=function(t,e=100,i){const s=t.reduce(((t,e)=>{const i=e.label;return t[i]=t[i]||[],t[i].push(e),t}),{}),r=[];return Object.entries(s).forEach((([t,s])=>{const n=i||function(t){return t.length**(-1/6)}(s),a=s.map((t=>t.x)),o=s.map((t=>t.y)),l=Math.min(...a),h=Math.max(...a),c=Math.min(...o),d=Math.max(...o),u=l-(h-l)*D,p=c-(d-c)*D;for(let i=0;i<e;i++)for(let a=0;a<e;a++){const e=u+.1*i,o=p+.1*a;let l=0;for(const t of s)l+=L(Math.sqrt((e-t.x)**2+(o-t.y)**2)/n);l/=s.length*n*n,r.push({x:e,y:o,kde:l,label:t})}})),r}(s,150);e.push({data:[{id:"nodes",values:s},{id:"iter",values:[{iter:i}]},{id:"kde",values:r}]})})),e}(t);t.type="common",t.dataKey=F,t.data=o[0].data,t.scales=[{id:"colorScale",type:"ordinal",specified:{0:"rgb(150, 10, 100)",1:"rgb(31, 119, 180)",2:"rgb(255, 127, 14)",3:"rgb(44, 160, 44)",4:"rgb(214, 39, 40)",5:"rgb(148, 103, 189)",6:"rgb(140, 86, 75)",7:"rgb(227, 119, 194)",8:"rgb(127, 127, 127)",9:"rgb(188, 189, 34)",10:"rgb(23, 190, 207)"}},{id:"brighterColorScale",type:"ordinal",specified:{0:"rgb(150, 10, 150)",1:"rgb(31, 119, 230)",2:"rgb(255, 127, 64)",3:"rgb(44, 160, 94)",4:"rgb(214, 39, 90)",5:"rgb(148, 103, 239)",6:"rgb(140, 86, 125)",7:"rgb(227, 119, 244)",8:"rgb(127, 127, 177)",9:"rgb(188, 189, 84)",10:"rgb(23, 190, 255)"}},...null!==(e=t.scales)&&void 0!==e?e:[]],t.series=[{type:"scatter",dataIndex:0,xField:t.xField,yField:t.yField,seriesField:t.seriesField,size:5,point:{zIndex:1e3,style:{fill:{scale:"colorScale",field:t.seriesField}}}}];t.customMark=[{type:"text",dataIndex:1,style:Object.assign({text:t=>t.iter,x:10,y:()=>10,textBaseline:"top",textAlign:"left",fontSize:25,fontWeight:"bolder",fill:"black",fillOpacity:.2},null===(i=t.infoLabel)||void 0===i?void 0:i.style)},{type:"symbol",dataIndex:2,style:{symbolType:"rect",x:(t,e)=>54+(0,e.chart.getAllSeries()[0]._markAttributeContext.valueToX)([t.x]),y:(t,e)=>(0,e.chart.getAllSeries()[0]._markAttributeContext.valueToY)([t.y])+26,size:5,fill:{scale:"brighterColorScale",field:"label"},fillOpacity:t=>10*t.kde}}],t.tooltip={visible:!0,fields:["x","y","label"]},t.player&&(t.player=Object.assign(Object.assign({},t.player),{specs:o}),t.animationAppear={duration:null!==(r=null===(s=t.player)||void 0===s?void 0:s.duration)&&void 0!==r?r:2e3,easing:"linear"},t.animationUpdate={duration:null!==(a=null===(n=t.player)||void 0===n?void 0:n.duration)&&void 0!==a?a:2e3,easing:"linear"}),t.axes=[{orient:"left",type:"linear",nice:!0},{orient:"bottom",type:"linear",nice:!0,label:{visible:!0}}],super.transformSpec(t)}}class U extends e.BaseChart{constructor(){super(...arguments),this.type="sequenceScatterKDE",this.transformerConstructor=N}init(){this.isValid()&&super.init()}isValid(){var t,e,i,s;const{xField:r,yField:n,data:a}=this._spec;return r&&n?!!a||(null===(s=(i=this._option).onError)||void 0===s||s.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}U.type="sequenceScatterKDE",U.view="singleDefault",U.transformerConstructor=N;const j="dataKey";function V(t){const e=[];return Object.keys(t.data).forEach((i=>{let s=null;if(t.backgroundColors&&t.backgroundColors[i]){const e=function(t,e){var i;if("undefined"==typeof document)throw new Error("Canvas rendering requires browser environment with document object");const s=document.createElement("canvas");s.width=e.width,s.height=e.height;const r=s.getContext("2d");if(!r)throw new Error("Failed to get 2D rendering context from canvas");const n=r.createImageData(e.width,e.height);for(let e=0;e<300;e++)for(let s=0;s<300;s++){const r=(null===(i=t[e])||void 0===i?void 0:i[s])||[0,0,0],a=4*(300*e+s);n.data[a]=Math.round(255*r[0]),n.data[a+1]=Math.round(255*r[1]),n.data[a+2]=Math.round(255*r[2]),n.data[a+3]=255}return r.putImageData(n,0,0),s.toDataURL("image/png")}(t.backgroundColors[i],t);s={imageData:e}}e.push({data:[{id:"nodes",values:t.data[i].map(((t,e)=>Object.assign(Object.assign({},t),{[j]:e})))},{id:"inter",values:[{inter:i}]},{id:"background",values:s?[s]:[]}]})})),e}class G extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,s,r,n;super.transformSpec(t);const a=V(t);t.type="common",t.dataKey=j,t.data=a[0].data,t.width=300,t.height=300,t.autoFit=!1,t.series=[{type:"scatter",xField:t.xField,yField:t.yField}],t.player&&(t.player=Object.assign(Object.assign({},t.player),{specs:a}),t.animationAppear={duration:null!==(i=null===(e=t.player)||void 0===e?void 0:e.duration)&&void 0!==i?i:2e3,easing:"linear"},t.animationUpdate={duration:null!==(r=null===(s=t.player)||void 0===s?void 0:s.duration)&&void 0!==r?r:2e3,easing:"linear"}),t.axes=[{orient:"left",type:"linear"},{orient:"bottom",label:{visible:!0},type:"linear"}],t.customMark=[{type:"image",dataIndex:2,style:{x:0,y:0,width:300,height:300,image:t=>t.imageData,zIndex:-1}},{type:"text",dataIndex:1,style:Object.assign({text:t=>t.inter,x:50,y:()=>10,textBaseline:"top",textAlign:"left",fontSize:100,fontWeight:"bolder",fill:"black",fillOpacity:.2},null===(n=t.infoLabel)||void 0===n?void 0:n.style)}],t.tooltip={visible:!1},super.transformSpec(t)}}class z extends e.BaseChart{constructor(){super(...arguments),this.type="sequenceScatterPixel",this.transformerConstructor=G}init(){this.isValid()&&super.init()}isValid(){var t,e,i,s;const{xField:r,yField:n,data:a}=this._spec;return r&&n?!!a||(null===(s=(i=this._option).onError)||void 0===s||s.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}z.type="sequenceScatterPixel",z.view="singleDefault",z.transformerConstructor=G;class K extends e.BarChartSpecTransformer{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.barWidth=t.barWidth,e.barMaxWidth=t.barMaxWidth,e.barMinWidth=t.barMinWidth,e.barGapInGroup=t.barGapInGroup,e}}var H,W,$,Y,X,q;!function(t){t.bar3d="bar3d",t.histogram3d="histogram3d",t.rangeColumn3d="rangeColumn3d",t.pie3d="pie3d",t.wordCloud3d="wordCloud3d",t.funnel3d="funnel3d"}(H||(H={})),function(t){t.rect3d="rect3d",t.arc3d="arc3d",t.pyramid3d="pyramid3d"}(W||(W={})),function(t){t.bar3d="bar3d",t.rangeColumn3d="rangeColumn3d",t.pie3d="pie3d",t.wordCloud3d="wordCloud3d",t.funnel3d="funnel3d"}($||($={})),function(t){t.bar3d="bar3d",t.funnel3d="funnel3d",t.transform3d="transform3d",t.pie3d="pie3d"}(Y||(Y={})),function(t){t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical"}(X||(X={})),function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(q||(q={}));class Z{static Get(t,e=q.Color1,i=[0,0,0,1]){if(e===q.Color1){const e=Z.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const r=s.Color.parseColorString(t);if(r){const e=[r.r/255,r.g/255,r.b/255,r.opacity];Z.store1[t]=e,Z.store255[t]=[r.r,r.g,r.b,r.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const r=Z.store255[t];if(r)return i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i;const n=s.Color.parseColorString(t);return n&&(Z.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Z.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===q.Color1){if(Z.store1[t])return;Z.store1[t]=i,Z.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Z.store255[t])return;Z.store255[t]=i,Z.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function J(t,e=!1){return Array.isArray(t)&&s.isNumber(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Q(t,e,i,r,n){return Array.isArray(t)&&!s.isNumber(t[0])||Array.isArray(e)&&!s.isNumber(e[0])?new Array(4).fill(0).map(((n,a)=>{var o,l;return tt(s.isArray(t)?null!==(o=t[a])&&void 0!==o?o:t[0]:t,s.isArray(e)?null!==(l=e[a])&&void 0!==l?l:e[0]:e,i,r)})):tt(t,e,i,r,n)}function tt(t,e,i,s,r){if(!t||!e)return t&&J(t)||e&&J(e)||!1;let n,a,o=!1,l=!1;if(Array.isArray(t)?n=t:"string"==typeof t?n=Z.Get(t,q.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Z.Get(e,q.Color255):l=!0,o!==l){const n=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},n),{stops:n.stops.map((t=>Object.assign(Object.assign({},t),{color:J(a)})))});return o?Q(n,l,i,s,r):Q(l,n,i,s,r)}if(o){if(t.gradient===e.gradient){const s=t,r=e,n=s.stops,a=r.stops;if(n.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,r=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:rt(s[e].color,r[e].color,i),offset:s[e].offset+(r[e].offset-s[e].offset)*i})))}}(s,r,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,r=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:rt(s[e].color,r[e].color,i),offset:s[e].offset+(r[e].offset-s[e].offset)*i})))}}(s,r,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,r=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:rt(s[e].color,r[e].color,i),offset:s[e].offset+(r[e].offset-s[e].offset)*i})))}}(s,r,i)}return!1}return r&&r(n,a),J(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(n,a,i),s)}function et(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Z.store255={},Z.store1={};const it=[0,0,0,0],st=[0,0,0,0];function rt(t,e,i){return Z.Get(t,q.Color255,it),Z.Get(e,q.Color255,st),`rgba(${Math.round(it[0]+(st[0]-it[0])*i)},${Math.round(it[1]+(st[1]-it[1])*i)},${Math.round(it[2]+(st[2]-it[2])*i)},${it[3]+(st[3]-it[3])*i})`}const nt=Symbol.for("@visactor/vrender-core/factory-state");class at{static GenAutoIncrementId(){return at.auto_increment_id++}}at.auto_increment_id=0;class ot{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const r=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(r>i)){s++;break}}this.taps[s]=t}}class lt extends ot{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}class ht{}const ct=Symbol.for("@visactor/vrender-core/application-state");const dt=function(){const t=globalThis;return t[ct]||(t[ct]={application:new ht}),t[ct]}().application;class ut{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),r=this._resolveOnce(i),n=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(n,e);if(a.has(s))return;const o=i=>{const n=this._eventListenerTransformer(i);"function"==typeof e?e(n):e.handleEvent&&e.handleEvent(n),r&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,r;if(!e)return;const n=this._resolveCapture(i),a=null===(r=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===r?void 0:r.get(n);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,n),this._deleteListenerRecord(t,e,n))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const r=s.get(e);r&&(r.delete(i),0===r.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}const pt=Symbol.for("VWindow");function gt(t){const e=dt.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class mt extends ut{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t=dt.global,e=gt){super(),this.handlerFactory=e,this.hooks={onChange:new lt(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=at.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,r,n){this._handler.setViewBoxTransform(t,e,i,s,r,n)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&s.isNumberClose(this.width,t.width())&&s.isNumberClose(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class ft{get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get x(){return this.canvas.x}get y(){return this.canvas.y}get canvasX(){return this.canvas.x}get canvasY(){return this.canvas.y}get viewX(){return this.viewport.x}get viewY(){return this.viewport.y}constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=ft.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer={x:0,y:0},this.page={x:0,y:0},this.canvas={x:0,y:0},this.viewport={x:0,y:0},this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}composedPath(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.composedDetailPath(),this.path}composedDetailPath(){return this.pickParams&&this.pickParams.graphic?(this.detailPath=this.path.slice(),this._composedDetailPath(this.pickParams)):this.detailPath=this.path.slice(),this.detailPath}_composedDetailPath(t){if(t&&t.graphic){const e=t.graphic;if(e.stage){const i=e.stage.eventSystem.manager.propagationPath(e);this.detailPath.push(i),this._composedDetailPath(t.params)}}}preventDefault(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault()}catch(t){this.nativeEvent.preventDefault&&s.isFunction(this.nativeEvent.preventDefault)&&this.nativeEvent.preventDefault()}this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.stopPropagation()}catch(t){this.nativeEvent.stopPropagation&&s.isFunction(this.nativeEvent.stopPropagation)&&this.nativeEvent.stopPropagation()}this.propagationStopped=!0}initEvent(){}initUIEvent(){}clone(){throw new Error("Method not implemented.")}}class vt extends ft{constructor(t,e){super(),this.type=t,this.detail=e}}const yt={dispatchEvent(t){var e;if(!(t instanceof ft))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.detailPath&&(t.detailPath=[]),t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new vt(t,e))}};var _t=function(t,e,i,s){return new(i||(i=Promise))((function(r,n){function a(t){try{l(s.next(t))}catch(t){n(t)}}function o(t){try{l(s.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class bt extends s.EventEmitter{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=at.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return _t(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&s.Logger.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t<e;t++){if(!i)return null;t>0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i<t;i++){if(!e._next)return null;e=e._next}return e}at(t){return this.getChildAt(t)}containNode(t){if(!this._idMap)return!1;if(this._idMap.has(t._uid))return!0;let e=this._firstChild;for(;e;){if(e.containNode(t))return!0;e=e._next}return!1}getRootNode(){let t=this.parent;for(;null==t?void 0:t.parent;)t=t.parent;return t||this}hasChildNodes(){return null!==this._firstChild}addChild(t){return this.appendChild(t)}add(t){return this.appendChild(t)}getChildren(){const t=[];let e=this._firstChild;for(;e;)t.push(e),e=e._next;return t}isChildOf(t){return!!this.parent&&this.parent._uid===t._uid}isParentOf(t){return t.isChildOf(this)}isDescendantsOf(t){let e=this.parent;if(!e)return!1;do{if(e._uid===t._uid)return!0;e=e.parent}while(null!==e);return!1}isAncestorsOf(t){return t.isDescendantsOf(this)}getAncestor(t){throw new Error("暂不支持")}setAllDescendantsProps(t,e){let i=this._firstChild;for(;i;)i[t]=e,i.setAllDescendantsProps(t,e),i=i._next}setCount(t){this._count+=t;let e=this.parent;if(e)do{e._count+=t,e=e.parent}while(null!==e)}clone(){throw new Error("暂不支持")}cloneTo(t){throw new Error("暂不支持")}getParent(){return this.parent}del(t){return this.removeChild(t)}addEventListener(t,e,i){const r=s.isBoolean(i,!0)&&i||s.isObject(i)&&i.capture,n=s.isObject(i)&&i.once,a=s.isFunction(e)?void 0:e;return t=r?`${t}capture`:t,e=s.isFunction(e)?e:e.handleEvent,n?super.once(t,e,a):super.on(t,e,a),this}on(t,e,i){return this.addEventListener(t,e,i)}removeEventListener(t,e,i){const r=s.isBoolean(i,!0)&&i||s.isObject(i)&&i.capture,n=s.isFunction(e)?void 0:e;t=r?`${t}capture`:t,e=s.isFunction(e)?e:e.handleEvent;const a=s.isObject(i)&&i.once;return super.off(t,e,n,a),this}off(t,e,i){return this.removeEventListener(t,e,i)}once(t,e,i){return s.isObject(i)?(i.once=!0,this.addEventListener(t,e,i)):this.addEventListener(t,e,{once:!0})}removeAllEventListeners(){return super.removeAllListeners(),this}removeAllListeners(){return this.removeAllEventListeners()}dispatchEvent(t,...e){return super.emit(t.type,t,...e),!t.defaultPrevented}emit(t,e){return this.dispatchEvent(t,e)}release(){this.removeAllListeners()}}const St=s.tau-1e-8;class xt{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,r,n,a){if(Math.abs(n-r)>St)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let o,l,h,c,d=1/0,u=-1/0,p=1/0,g=-1/0;function m(t){h=i*Math.cos(t),c=i*Math.sin(t),h<d&&(d=h),h>u&&(u=h),c<p&&(p=c),c>g&&(g=c)}if(m(r),m(n),n!==r)if((r%=s.tau)<0&&(r+=s.tau),(n%=s.tau)<0&&(n+=s.tau),n<r&&(a=!a,o=r,r=n,n=o),a)for(n-=s.tau,o=r-r%s.halfPi,l=0;l<4&&o>n;++l,o-=s.halfPi)m(o);else for(o=r-r%s.halfPi+s.halfPi,l=0;l<4&&o<n;++l,o+=s.halfPi)m(o);this.bounds.add(t+d,e+p),this.bounds.add(t+u,e+g)}arcTo(t,e,i,s,r){this.bounds.add(t,e)}bezierCurveTo(t,e,i,s,r,n){this.bounds.add(t,e),this.bounds.add(i,s),this.bounds.add(r,n)}closePath(){}ellipse(){throw new Error("不支持ellipse")}lineTo(t,e){this.bounds.add(t,e)}moveTo(t,e){this.bounds.add(t,e)}quadraticCurveTo(t,e,i,s){this.bounds.add(t,e),this.bounds.add(i,s)}rect(t,e,i,s){this.bounds.add(t,e),this.bounds.add(t+i,e+s)}clear(){this.bounds.clear()}release(...t){}}class At{constructor(){this._curves=[],this.bounds=new s.AABBBounds}get curves(){return this._curves}getCurveLengths(){return this._curves.map((t=>t.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Tt=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Ct={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},kt={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let wt,Mt,Et,Bt,Ot,Pt;var It,Rt,Dt,Lt,Ft,Nt;function Ut(t){const e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],l=t[7],h=l*n,c=-o*a,d=o*n,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(r),f=Math.sin(r),v=.5*(r-s),y=Math.sin(.5*v),_=8/3*y*y/Math.sin(v),b=e+p-_*g,S=i+g+_*p,x=e+m,A=i+f,T=x+_*f,C=A-_*m;return[h*b+c*S,d*b+u*S,h*T+c*C,d*T+u*C,h*x+c*A,d*x+u*A]}function jt(t,e,i,r){const n=function(t,e,i,r,n,a,o,l,h){const c=s.degreeToRadian(o),d=Math.sin(c),u=Math.cos(c),p=u*(l-t)*.5+d*(h-e)*.5,g=u*(h-e)*.5-d*(l-t)*.5;let m=p*p/((i=Math.abs(i))*i)+g*g/((r=Math.abs(r))*r);m>1&&(m=Math.sqrt(m),i*=m,r*=m);const f=u/i,v=d/i,y=-d/r,_=u/r,b=f*l+v*h,S=y*l+_*h,x=f*t+v*e,A=y*t+_*e;let T=1/((x-b)*(x-b)+(A-S)*(A-S))-.25;T<0&&(T=0);let C=Math.sqrt(T);a===n&&(C=-C);const k=.5*(b+x)-C*(A-S),w=.5*(S+A)+C*(x-b),M=Math.atan2(S-w,b-k);let E=Math.atan2(A-w,x-k)-M;E<0&&1===a?E+=s.tau:E>0&&0===a&&(E-=s.tau);const B=Math.ceil(Math.abs(E/(s.halfPi+.001))),O=[];for(let t=0;t<B;++t){const e=M+t*E/B,s=M+(t+1)*E/B;O[t]=[k,w,e,s,i,r,d,u]}return O}(r[5],r[6],r[0],r[1],r[3],r[4],r[2],e,i);for(let e=0;e<n.length;++e){const i=Ut(n[e]);t.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5])}}!function(t){t[t.NONE=0]="NONE",t[t.UPDATE_BOUNDS=1]="UPDATE_BOUNDS",t[t.UPDATE_SHAPE=2]="UPDATE_SHAPE",t[t.CLEAR_SHAPE=253]="CLEAR_SHAPE",t[t.UPDATE_SHAPE_AND_BOUNDS=3]="UPDATE_SHAPE_AND_BOUNDS",t[t.INIT=179]="INIT",t[t.CLEAR_BOUNDS=254]="CLEAR_BOUNDS",t[t.UPDATE_GLOBAL_MATRIX=32]="UPDATE_GLOBAL_MATRIX",t[t.CLEAR_GLOBAL_MATRIX=223]="CLEAR_GLOBAL_MATRIX",t[t.UPDATE_LOCAL_MATRIX=16]="UPDATE_LOCAL_MATRIX",t[t.CLEAR_LOCAL_MATRIX=239]="CLEAR_LOCAL_MATRIX",t[t.UPDATE_GLOBAL_LOCAL_MATRIX=48]="UPDATE_GLOBAL_LOCAL_MATRIX",t[t.UPDATE_PAINT=64]="UPDATE_PAINT",t[t.CLEAR_PAINT=191]="CLEAR_PAINT",t[t.UPDATE_LAYOUT=128]="UPDATE_LAYOUT",t[t.CLEAR_LAYOUT=127]="CLEAR_LAYOUT"}(It||(It={})),function(t){t[t.GLOBAL=1]="GLOBAL",t[t.LOCAL=16]="LOCAL",t[t.GLOBAL_ACCURATE=3]="GLOBAL_ACCURATE",t[t.LOCAL_ACCURATE=48]="LOCAL_ACCURATE"}(Rt||(Rt={})),function(t){t[t.INIT=0]="INIT",t[t.DEFAULT=1]="DEFAULT",t[t.STATE=2]="STATE",t[t.ANIMATE_BIND=10]="ANIMATE_BIND",t[t.ANIMATE_PLAY=11]="ANIMATE_PLAY",t[t.ANIMATE_START=12]="ANIMATE_START",t[t.ANIMATE_UPDATE=13]="ANIMATE_UPDATE",t[t.ANIMATE_END=14]="ANIMATE_END",t[t.TRANSLATE=20]="TRANSLATE",t[t.TRANSLATE_TO=21]="TRANSLATE_TO",t[t.SCALE=22]="SCALE",t[t.SCALE_TO=23]="SCALE_TO",t[t.ROTATE=24]="ROTATE",t[t.ROTATE_TO=25]="ROTATE_TO"}(Dt||(Dt={})),function(t){t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(Lt||(Lt={})),function(t){t[t.CubicBezierCurve=0]="CubicBezierCurve",t[t.QuadraticBezierCurve=1]="QuadraticBezierCurve",t[t.ArcCurve=2]="ArcCurve",t[t.LineCurve=3]="LineCurve",t[t.EllipseCurve=4]="EllipseCurve",t[t.MoveCurve=5]="MoveCurve"}(Ft||(Ft={})),function(t){t[t.beforeFillStroke=0]="beforeFillStroke",t[t.afterFillStroke=1]="afterFillStroke"}(Nt||(Nt={}));const Vt=[(t,e,i,s,r,n,a)=>e.arc(t[1]*r+i,t[2]*n+s,t[3]*(r+n)/2,t[4],t[5],t[6],a),(t,e,i,s,r,n,a)=>e.arcTo(t[1]*r+i,t[2]*n+s,t[3]*r+i,t[4]*n+s,t[5]*(r+n)/2,a),(t,e,i,s,r,n,a)=>e.bezierCurveTo(t[1]*r+i,t[2]*n+s,t[3]*r+i,t[4]*n+s,t[5]*r+i,t[6]*n+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,r,n)=>e.ellipse(t[1]*r+i,t[2]*n+s,t[3]*r,t[4]*n,t[5],t[6],t[7],t[8]),(t,e,i,s,r,n,a)=>e.lineTo(t[1]*r+i,t[2]*n+s,a),(t,e,i,s,r,n,a)=>e.moveTo(t[1]*r+i,t[2]*n+s,a),(t,e,i,s,r,n,a)=>e.quadraticCurveTo(t[1]*r+i,t[2]*n+s,t[3]*r+i,t[4]*n+s,a),(t,e,i,s,r,n,a)=>e.rect(t[1]*r+i,t[2]*n+s,t[3]*r,t[4]*n,a)];function Gt(t,e,i=0,s=0,r=1,n=1,a){for(let o=0;o<t.length;o++){const l=t[o];Vt[l[0]](l,e,i,s,r,n,a)}}class zt{getLength(t){return null!=t?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function Kt(t,e){let i=0;const r=t.length;for(let n=0;n<r;n++){const a=t[n],o=e[n],l=t[(n+1)%r],h=e[(n+1)%r];i+=s.PointService.distanceNN(a,o,l,h)}return i/2}function Ht(t,e,i,s,r){const n=1-r;return n*n*n*t+3*e*r*n*n+3*i*r*r*n+s*r*r*r}function Wt(t,e,i,r,n){const a=Ht(t.x,e.x,i.x,r.x,n),o=Ht(t.y,e.y,i.y,r.y,n);return new s.Point(a,o)}function $t(t,e,i,s){const r=1-s;return r*r*t+2*r*s*e+s*s*i}function Yt(t,e,i,r){const n=$t(t.x,e.x,i.x,r),a=$t(t.y,e.y,i.y,r);return new s.Point(n,a)}class Xt extends zt{constructor(t,e,i,s){super(),this.type=Ft.CubicBezierCurve,this.p0=t,this.p1=e,this.p2=i,this.p3=s}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y+this.p3.x+this.p3.y)}getPointAt(t){if(!1!==this.defined)return Wt(this.p0,this.p1,this.p2,this.p3,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,s=this.p3,Kt([t.x,e.x,i.x,s.x],[t.y,e.y,i.y,s.y])):60;var t,e,i,s}calcProjLength(t){return t===Lt.ROW?s.abs(this.p0.x-this.p3.x):t===Lt.COLUMN?s.abs(this.p0.y-this.p3.y):0}getAngleAt(t){const e=s.max(t-.01,0),i=s.min(t+.01,1),r=this.getPointAt(e),n=this.getPointAt(i);return s.atan2(n.y-r.y,n.x-r.x)}draw(t,e,i,r,n,a){if(t.moveTo(this.p0.x*r+e,this.p0.y*n+i),a>=1)t.bezierCurveTo(this.p1.x*r+e,this.p1.y*n+i,this.p2.x*r+e,this.p2.y*n+i,this.p3.x*r+e,this.p3.y*n+i);else if(a>0){const[o]=function(t,e){const{p0:i,p1:r,p2:n,p3:a}=t,o=Wt(i,r,n,a,e),l=s.PointService.pointAtPP(i,r,e),h=s.PointService.pointAtPP(r,n,e),c=s.PointService.pointAtPP(n,a,e),d=s.PointService.pointAtPP(l,h,e),u=s.PointService.pointAtPP(h,c,e);return[new Xt(i,l,d,o),new Xt(o,u,c,a)]}(this,a);t.bezierCurveTo(o.p1.x*r+e,o.p1.y*n+i,o.p2.x*r+e,o.p2.y*n+i,o.p3.x*r+e,o.p3.y*n+i)}}includeX(t){const e=s.min(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=s.max(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=s.min(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(s.max(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}class qt extends zt{constructor(t,e){super(),this.type=Ft.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return s.PointService.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=s.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?s.PointService.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Lt.ROW?s.abs(this.p0.x-this.p1.x):t===Lt.COLUMN?s.abs(this.p0.y-this.p1.y):0}draw(t,e,i,s,r,n){if(t.moveTo(this.p0.x*s+e,this.p0.y*r+i),n>=1)t.lineTo(this.p1.x*s+e,this.p1.y*r+i);else if(n>0){const a=this.getPointAt(n);t.lineTo(a.x*s+e,a.y*r+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class Zt{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,r,n,a,o,l){const h=new Xt(new s.Point(this._lastX,this._lastY),new s.Point(t,e),new s.Point(i,r),new s.Point(n,a));h.originP1=this._lastOriginP,h.originP2=l,h.defined=o,this.curves.push(h),this._lastX=n,this._lastY=a,this._lastOriginP=l}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const r=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(r),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,r,n){const a=new qt(new s.Point(this._lastX,this._lastY),new s.Point(t,e));return a.originP1=r,a.originP2=n,a.defined=i,a}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Lt.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],r=null!==(e=i.p3)&&void 0!==e?e:i.p1;return s.abs(t.p0.y-r.y)}if(t===Lt.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],r=null!==(i=e.p3)&&void 0!==i?i:e.p1;return s.abs(t.p0.x-r.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Jt extends Zt{bezierCurveTo(t,e,i,s,r,n,a,o){return super.bezierCurveTo(e,t,s,i,n,r,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Qt(t,e,i=1){let s=!1;for(let i=0,r=e.length;i<=r;i++)i>=r===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function te(t,e,i){const r=null!=e?e:s.abs(i[i.length-1].x-i[0].x)>s.abs(i[i.length-1].y-i[0].y)?Lt.ROW:Lt.COLUMN;return"monotoneY"===t?new Jt(t,r):new Zt(t,r)}class ee{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function ie(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const r=te("linear",i,t);return function(t,e){Qt(t,e,1)}(new ee(r,s),t),r}function se(t,e,i,s,r){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class re{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&se(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:se(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function ne(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return ie(t,e);const r=te("basis",i,t);return function(t,e){Qt(t,e,2)}(new re(r,s),t),r}function ae(t){return t<0?-1:1}function oe(t,e,i){const s=t._x1-t._x0,r=e-t._x1,n=(t._y1-t._y0)/(s||Number(r<0&&-0)),a=(i-t._y1)/(r||Number(s<0&&-0)),o=(n*r+a*s)/(s+r);return(ae(n)+ae(a))*Math.min(Math.abs(n),Math.abs(a),.5*Math.abs(o))||0}function le(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function he(t,e,i,s,r){const n=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-n)/3;t.context.bezierCurveTo(n+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class ce{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:he(this,this._t0,le(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,he(this,le(this,e=oe(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:he(this,this._t0,e=oe(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class de extends ce{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function ue(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return ie(t,e);const r=te("monotoneX",i,t);return function(t,e){Qt(t,e,2)}(new ce(r,s),t),r}function pe(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return ie(t,e);const r=te("monotoneY",i,t);return function(t,e){Qt(t,e,2)}(new de(r,s),t),r}let ge=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0<this._t&&this._t<1&&2===this._point&&this.context.lineTo(this._x,this._y,!1!==this._lastDefined,this.lastPoint),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class me extends ge{lineEnd(){this.context.closePath()}}function fe(t,e,i={}){const{direction:r,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const a=new Zt("step",null!=r?r:s.abs(t[t.length-1].x-t[0].x)>s.abs(t[t.length-1].y-t[0].y)?Lt.ROW:Lt.COLUMN);return ve(new ge(a,e,n),t),a}function ve(t,e){return Qt(t,e,1)}class ye extends ee{lineEnd(){this.context.closePath()}}function _e(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const r=te("linear",i,t);return function(t,e){Qt(t,e,1)}(new ye(r,s),t),r}function be(t,e,i,r,n){let a=t._x1,o=t._y1,l=t._x2,h=t._y2;if(t._l01_a>s.epsilon){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);a=(a*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,o=(o*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>s.epsilon){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,r=3*t._l23_a*(t._l23_a+t._l12_a);l=(l*s+t._x1*t._l23_2a-e*t._l12_2a)/r,h=(h*s+t._y1*t._l23_2a-i*t._l12_2a)/r}t.context.bezierCurveTo(a,o,l,h,t._x2,t._y2,r,t.lastPoint1)}function Se(t,e){return function(i,s,r={}){const{direction:n,startPoint:a}=r;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return ie(i,r);const o=te(t,n,i);return Qt(new e(o,s,a),i,2),o}}const xe=Se("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:be(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Ae=Se("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:be(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Te extends zt{constructor(t,e,i){super(),this.type=Ft.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Yt(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,Kt([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Lt.ROW?s.abs(this.p0.x-this.p2.x):t===Lt.COLUMN?s.abs(this.p0.y-this.p2.y):0}getAngleAt(t){const e=s.max(t-.01,0),i=s.min(t+.01,1),r=this.getPointAt(e),n=this.getPointAt(i);return s.atan2(n.y-r.y,n.x-r.x)}draw(t,e,i,r,n,a){if(t.moveTo(this.p0.x*r+e,this.p0.y*n+i),a>=1)t.quadraticCurveTo(this.p1.x*r+e,this.p1.y*n+i,this.p2.x*r+e,this.p2.y*n+i);else if(a>0){const[o]=function(t,e){const{p0:i,p1:r,p2:n}=t,a=Yt(i,r,n,e),o=s.PointService.pointAtPP(i,r,e),l=s.PointService.pointAtPP(r,n,e);return[new Te(i,o,a),new Te(a,l,n)]}(this,a);t.quadraticCurveTo(o.p1.x*r+e,o.p1.y*n+i,o.p2.x*r+e,o.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Ce{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new qt(new s.Point(this._lastX,this._lastY),new s.Point(t,e))}quadraticCurveTo(t,e,i,r){const n=new Te(new s.Point(this._lastX,this._lastY),new s.Point(t,e),new s.Point(i,r));this.path.addCurve(n),this._lastX=i,this._lastY=r}bezierCurveTo(t,e,i,r,n,a){const o=new Xt(new s.Point(this._lastX,this._lastY),new s.Point(t,e),new s.Point(i,r),new s.Point(n,a));this.path.addCurve(o),this._lastX=n,this._lastY=a}arcTo(t,e,i,s,r){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,r,n,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,r,n){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function ke(t,e,i){var r,n;switch(e){case"linear":default:return ie(t,i);case"basis":return ne(t,i);case"monotoneX":return ue(t,i);case"monotoneY":return pe(t,i);case"step":return fe(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:r,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const a=new Zt("step",null!=r?r:s.abs(t[t.length-1].x-t[0].x)>s.abs(t[t.length-1].y-t[0].y)?Lt.ROW:Lt.COLUMN);return ve(new me(a,e,n),t),a}(t,.5,i);case"stepBefore":return fe(t,0,i);case"stepAfter":return fe(t,1,i);case"catmullRom":return xe(t,null!==(r=null==i?void 0:i.curveTension)&&void 0!==r?r:.5,i);case"catmullRomClosed":return Ae(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return _e(t,i)}}class we extends At{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new xt(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([kt.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([kt.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([kt.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,r,n){return this.commandList.push([kt.C,t,e,i,s,r,n]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,r,n),this}arcTo(t,e,i,s,r){return this.commandList.push([kt.AT,t,e,i,s,r]),this._ctx&&this._ctx.arcTo(t,e,i,s,r),this}ellipse(t,e,i,s,r,n,a,o){return this.commandList.push([kt.E,t,e,i,s,r,n,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,r,n,a,o),this}rect(t,e,i,s){return this.commandList.push([kt.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,r,n){return this.commandList.push([kt.A,t,e,i,s,r,n]),this._ctx&&this._ctx.arc(t,e,i,s,r,n),this}closePath(){return this.commandList.push([kt.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Ce(this);Gt(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[kt.M]=t=>`M${t[1]} ${t[2]}`,t[kt.L]=t=>`L${t[1]} ${t[2]}`,t[kt.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[kt.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[kt.A]=t=>{const e=[],i=t[1],s=t[2],r=t[3];((t,e,i,s,r,n,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e<u;e++){const i=h+p*e,l=h+p*(e+1),c=4/3*Math.tan(Math.abs(p)/4),d=Math.cos(i),u=Math.sin(i),g=Math.cos(l),m=Math.sin(l),f=d*n+s,v=u*a+r,y=g*n+s,_=m*a+r,b=o?-1:1,S=n*c*b,x=a*c*b;t.push(f-S*u,v+x*d,y+S*m,_-x*g,y,_)}})(e,t[4],t[5],i,s,r,r,t[6]);let n="";for(let t=0;t<e.length;t+=6)n+=`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`;return n},t[kt.R]=t=>`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[kt.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,r){this.clear();const n=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const r=[];for(let t=0,n=e.length;t<n;t++)if(wt=e[t],Mt=wt.slice(1),Et=wt[0],i=[Et],s=Mt.match(Tt),null!==s){for(let t=0,e=s.length;t<e;t++)Bt=s[t],Ot=parseFloat(Bt),Number.isNaN(Ot)||i.push(Ot);if(Pt=Ct[Et],i.length-1>Pt){let t,e=Et;for(let s=1,n=i.length;s<n;s+=Pt){t=[e];for(let e=s,r=s+Pt;e<r;e++)t.push(i[e]);r.push(t),"m"===e?e="l":"M"===e&&(e="L")}}else r.push(i)}else r.push(i);return r}(t);return this._runCommandStrList(n,e,i,s,r),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const r=ke(e,i);"x"===s?this.direction=Lt.ROW:"y"===s?this.direction=Lt.COLUMN:"auto"===s&&(this.direction=r.direction),this._curves=r.curves}fromCustomPath2D(t,e,i,s,r){return this.clear(),this._runCommandList(t.commandList,e,i,s,r),this._updateBounds(),this}transform(t,e,i,s){const r=this.commandList;if(!this.transformCbList){const t=[];t[kt.M]=this.moveToTransform,t[kt.L]=this.lineToTransform,t[kt.Q]=this.quadraticCurveToTransform,t[kt.C]=this.bezierCurveToTransform,t[kt.AT]=this.arcToTransform,t[kt.E]=this.ellipseTransform,t[kt.R]=this.rectTransform,t[kt.A]=this.arcTransform,t[kt.Z]=this.closePathTransform,this.transformCbList=t}r.forEach((r=>{this.transformCbList[r[0]](r,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i}lineToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i}quadraticCurveToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s+e,t[4]=t[4]*r+i}bezierCurveToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s+e,t[4]=t[4]*r+i,t[5]=t[5]*s+e,t[6]=t[6]*r+i}arcToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s+e,t[4]=t[4]*r+i,t[5]=t[5]*(s+r)/2}ellipseTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s,t[4]=t[4]*r}rectTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s,t[4]=t[4]*r}arcTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*(s+r)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,r=1){let n,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m<f;++m){switch(n=t[m],1===s&&1===r||(n=Ee(n,s,r)),n[0]){case"l":d+=n[1],u+=n[2],this.lineTo(d+e,u+i);break;case"L":d=n[1],u=n[2],this.lineTo(d+e,u+i);break;case"h":d+=n[1],this.lineTo(d+e,u+i);break;case"H":d=n[1],this.lineTo(d+e,u+i);break;case"v":u+=n[1],this.lineTo(d+e,u+i);break;case"V":u=n[1],this.lineTo(d+e,u+i);break;case"m":d+=n[1],u+=n[2],this.moveTo(d+e,u+i);break;case"M":d=n[1],u=n[2],this.moveTo(d+e,u+i);break;case"c":a=d+n[5],o=u+n[6],p=d+n[3],g=u+n[4],this.bezierCurveTo(d+n[1]+e,u+n[2]+i,p+e,g+i,a+e,o+i),d=a,u=o;break;case"C":d=n[5],u=n[6],p=n[3],g=n[4],this.bezierCurveTo(n[1]+e,n[2]+i,p+e,g+i,d+e,u+i);break;case"s":a=d+n[3],o=u+n[4],null===c[0].match(/[CcSs]/)?(p=d,g=u):(p=2*d-p,g=2*u-g),l=d+n[1],h=u+n[2],this.bezierCurveTo(p+e,g+i,l+e,h+i,a+e,o+i),p=l,g=h,d=a,u=o;break;case"S":a=n[3],o=n[4],null===c[0].match(/[CcSs]/)?(p=d,g=u):(p=2*d-p,g=2*u-g),l=n[1],h=n[2],this.bezierCurveTo(p+e,g+i,l+e,h+i,a+e,o+i),p=l,g=h,d=a,u=o;break;case"q":a=d+n[3],o=u+n[4],p=d+n[1],g=u+n[2],this.quadraticCurveTo(p+e,g+i,a+e,o+i),d=a,u=o;break;case"Q":a=n[3],o=n[4],this.quadraticCurveTo(n[1]+e,n[2]+i,a+e,o+i),d=a,u=o,p=n[1],g=n[2];break;case"t":a=d+n[1],o=u+n[2],null===c[0].match(/[QqTt]/)?(p=d,g=u):"t"===c[0]?(p=2*d-l,g=2*u-h):"q"===c[0]&&(p=2*d-p,g=2*u-g),l=p,h=g,this.quadraticCurveTo(p+e,g+i,a+e,o+i),d=a,u=o,p=d+n[1],g=u+n[2];break;case"T":a=n[1],o=n[2],p=2*d-p,g=2*u-g,this.quadraticCurveTo(p+e,g+i,a+e,o+i),d=a,u=o;break;case"a":jt(this,d+e,u+i,[n[1],n[2],n[3],n[4],n[5],n[6]+d+e,n[7]+u+i]),d+=n[6],u+=n[7];break;case"A":jt(this,d+e,u+i,[n[1],n[2],n[3],n[4],n[5],n[6]+e,n[7]+i]),d=n[6],u=n[7];break;case"z":case"Z":this.closePath()}c=n}}_runCommandList(t,e=0,i=0,s=1,r=1){if(0!==e||0!==i||1!==s||1!==r)for(let n=0,a=t.length;n<a;++n){const a=t[n].slice();switch(a[0]){case kt.L:this.lineToTransform(a,e,i,s,r);break;case kt.M:this.moveToTransform(a,e,i,s,r);break;case kt.C:this.bezierCurveToTransform(a,e,i,s,r);break;case kt.Q:this.quadraticCurveToTransform(a,e,i,s,r);break;case kt.A:this.arcToTransform(a,e,i,s,r);break;case kt.E:this.ellipseTransform(a,e,i,s,r);break;case kt.R:this.rectTransform(a,e,i,s,r);break;case kt.AT:this.arcToTransform(a,e,i,s,r);break;case kt.Z:this.closePath()}}else this.commandList=t.map((t=>t.slice()))}_updateBounds(){this.bounds.clear(),Gt(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Lt.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return s.abs(t.p0.y-e.p1.y)}if(this.direction===Lt.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return s.abs(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e<this.curves.length;e++){const i=this.curves[e];if(i.includeX(t))return i.getYAt(t)}return 1/0}getAttrAt(t){if(!this._curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s<this._curves.length;s++){e=this._curves[s];const r=e.getLength(this.direction);if(i+r>=t)break;i+=r}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,r){this.tryBuildCurves();const n=this.getLength()*r;let a=0;for(let r=0;r<this._curves.length;r++){const o=this._curves[r],l=o.getLength(this.direction);if(!(a+l<=n)){const r=1-(a+l-n)/l;o.draw(t,i,s,e,e,r);break}o.draw(t,i,s,e,e,1),a+=l}}}const Me=["l",0,0,0,0,0,0,0];function Ee(t,e,i){const s=Me[0]=t[0];if("a"===s||"A"===s)Me[1]=e*t[1],Me[2]=i*t[2],Me[3]=t[3],Me[4]=t[4],Me[5]=t[5],Me[6]=e*t[6],Me[7]=i*t[7];else if("h"===s||"H"===s)Me[1]=e*t[1];else if("v"===s||"V"===s)Me[1]=i*t[1];else for(let s=1,r=t.length;s<r;++s)Me[s]=(s%2==1?e:i)*t[s];return Me}var Be,Oe,Pe,Ie;!function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Be||(Be={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Oe||(Oe={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Pe||(Pe={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Ie||(Ie={}));const Re={x:0,y:0,z:0,dx:0,dy:0,dz:0,scrollX:0,scrollY:0,scaleX:1,scaleY:1,scaleZ:1,angle:0,alpha:0,beta:0,scaleCenter:[0,0],anchor:[0,0],anchor3d:[0,0],postMatrix:new s.Matrix},De={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},Le=Object.assign({outerBorder:Object.assign(Object.assign({},De),{distance:0}),innerBorder:Object.assign(Object.assign({},De),{distance:0})},De),Fe={text:"",maxLineWidth:1/0,maxWidth:1/0,textAlign:"left",textBaseline:"alphabetic",fontSize:16,fontFamily:"PingFang SC,Microsoft Yahei,system-ui,'-apple-system',segoe ui,\n Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",fontWeight:"",ellipsis:"…",fontVariant:"",fontStyle:"",lineHeight:void 0,underline:0,lineThrough:0,scaleIn3d:!1,direction:"horizontal",wordBreak:"break-all",ignoreBuf:!1,verticalMode:0,wrap:!1,whiteSpace:"no-wrap",heightLimit:1/0,lineClamp:1/0,suffixPosition:"end",underlineDash:[],underlineOffset:0,disableAutoClipedPoptip:void 0,measureMode:Be.fontBounding,keepCenterInLine:!1},Ne=Object.assign(Object.assign(Object.assign(Object.assign({forceBoundsWidth:void 0,forceBoundsHeight:void 0,opacity:1,background:null,autoAnimateTexture:!1,textureRatio:1,textureOptions:null,backgroundOpacity:1,backgroundCornerRadius:0,texture:null,textureColor:"black",textureSize:10,texturePadding:2,backgroundMode:"no-repeat",backgroundFit:!0,backgroundKeepAspectRatio:!1,backgroundClip:!0,backgroundScale:1,backgroundOffsetX:0,backgroundOffsetY:0,backgroundPosition:"top-left",blur:0,filter:"",cursor:null,html:null,react:null,vue:null},{fillOpacity:1,fill:!1,shadowBlur:0,shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0}),Le),{alignSelf:"auto"}),{pickStrokeBuffer:0}),Ue={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},je=Object.assign(Object.assign(Object.assign({strokeSeg:null,renderable:!0,pickable:!0,shadowGraphic:void 0,childrenPickable:!0,fillPickable:!0,strokePickable:!0,visible:!0,zIndex:0,layout:null,boundsPadding:0,fillStrokeOrder:0,renderStyle:"default",pickMode:"accurate",customPickShape:null,boundsMode:"accurate",keepDirIn3d:!0,shadowRootIdx:1,globalZIndex:1,globalCompositeOperation:"",overflow:"hidden",shadowPickMode:"graphic",keepStrokeScale:!1,clipConfig:null,roughStyle:null},{_debug_bounds:!1}),Ne),Re),Ve=Object.assign(Object.assign({},je),{startAngle:0,endAngle:s.pi2,innerRadius:0,outerRadius:1,innerPadding:0,outerPadding:0,cornerRadius:0,padRadius:0,padAngle:0,clipRange:1,cap:!1,forceShowCap:!1}),Ge=Object.assign(Object.assign(Object.assign({},je),Ue),{points:[],segments:[],curveType:"linear",clipRange:1,closePath:!1,curveTension:1}),ze=Object.assign(Object.assign({},je),{radius:1,startAngle:0,endAngle:s.pi2}),Ke=Object.assign(Object.assign({},je),{width:0,height:0,cornerRadius:0,path:[],clip:!1,visibleAll:!0,display:"relative",flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-start",alignItems:"flex-start",alignContent:"flex-start",baseOpacity:1,cornerType:"round"}),He=Object.assign(Object.assign({},je),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),We=Object.assign(Object.assign(Object.assign({},je),Ue),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default",closePath:!1,curveTension:1}),$e=Object.assign(Object.assign({},je),{path:new we,fillStrokeOrder:1,clipRange:1,customPath:()=>{s.Logger.getInstance().warn("空函数")}}),Ye=Object.assign(Object.assign({},je),{points:[],cornerRadius:0,closePath:!0}),Xe=Object.assign(Object.assign({},je),{width:100,height:100,spikes:5,thickness:.5}),qe=Object.assign(Object.assign({},je),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},je),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const Ze=Object.assign(Object.assign({},je),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),Je=Object.assign(Object.assign(Object.assign({},je),Fe),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Qe=Object.assign(Object.assign(Object.assign({},je),Fe),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ti=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},je),{fill:!0,cornerRadius:0,cornerType:"round"}),ei=Object.assign(Object.assign({},ti),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});class ii{static GetImage(t,e){var i;const s=ii.cache.get(t);s?"fail"===s.loadState?dt.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):ii.loadImage(t,e)}static GetSvg(t,e){var i;let s=ii.cache.get(t);s?"fail"===s.loadState?dt.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},ii.cache.set(t,s),s.dataPromise=dt.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,r)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=ii.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},ii.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=dt.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=dt.global.loadBlob(t):"json"===e&&(i.dataPromise=dt.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!ii.isLoading&&ii.toLoadAueue.length){ii.isLoading=!0;const t=ii.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,r={type:"image",loadState:"init"};if(ii.cache.set(i,r),r.dataPromise=dt.global.loadImage(i),r.dataPromise){r.waitingMark=s;const t=r.dataPromise.then((t=>{var e;r.loadState=(null==t?void 0:t.data)?"success":"fail",r.data=null==t?void 0:t.data,null===(e=r.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(r.loadState="success",r.data=t.data,e.imageLoadSuccess(i,t.data)):(r.loadState="fail",e.imageLoadFail(i))})),r.waitingMark&&(r.waitingMark=[])}));e.push(t)}else r.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{ii.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),ii.loading()})).catch((t=>{console.error(t),ii.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),ii.loading()}))}}),0)}static loadImage(t,e){const i=si(t,ii.toLoadAueue);if(-1!==i)return ii.toLoadAueue[i].marks.push(e),void ii.loading();ii.toLoadAueue.push({url:t,marks:[e]}),ii.loading()}static improveImageLoading(t){const e=si(t,ii.toLoadAueue);if(-1!==e){const t=ii.toLoadAueue.splice(e,1);ii.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function si(t,e){for(let i=0;i<e.length;i++)if(e[i].url===t)return i;return-1}var ri;ii.cache=new Map,ii.isLoading=!1,ii.toLoadAueue=[],ii.onLoadSuccessCb=[],function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(ri||(ri={}));const ni=[0,0,0,0],ai=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],oi=[1,2,3,0,1,2,3,0];function li(t,e,i,r){for(;t>=s.pi2;)t-=s.pi2;for(;t<0;)t+=s.pi2;for(;t>e;)e+=s.pi2;ai[0].x=i,ai[1].y=i,ai[2].x=-i,ai[3].y=-i;const n=Math.ceil(t/s.halfPi)%4,a=Math.ceil(e/s.halfPi)%4;if(r.add(s.cos(t)*i,s.sin(t)*i),r.add(s.cos(e)*i,s.sin(e)*i),n!==a||e-t>s.pi){let t=!1;for(let e=0;e<oi.length;e++)if(t||n!==oi[e]){if(t&&a===oi[e])break;if(t){const t=ai[oi[e]];r.add(t.x,t.y)}}else{t=!0;const e=ai[n];r.add(e.x,e.y)}}}function hi(t,e,i){const{x:r,y:n}=s.pointAt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=s.pointAt(t.x1,t.y1,e.x1,e.y1,i),l=new s.Point(r,n,a,o);return l.defined=e.defined,l}function ci(t,e,i){if(!t||!e)return[];Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]);let r=[];if(t.length>e.length){r=e.map((t=>{const e=new s.Point(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s<e.length;s++)r[s]=hi(t[s],e[s],i)}else{r=e.map((t=>{const e=new s.Point(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s<t.length;s++)r[s]=hi(t[s],e[s],i)}return r}class di{bounds(t,e){if(s.isNumber(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return s.isNumber(t)?t:Math.min(t[0],t[1])}}function ui(t,e,i,r,n){return n?t.arc(i,r,e,0,s.tau,!1,n):t.arc(i,r,e,0,s.tau),!1}var pi=new class extends di{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,r){return ui(t,this.parseSize(e)/2,i,s,r)}drawOffset(t,e,i,s,r,n){return ui(t,this.parseSize(e)/2+r,i,s,n)}drawToSvgPath(t,e,i,s){const r=this.parseSize(t)/2;return`M ${e-r}, ${i} a ${r},${r} 0 1,0 ${2*r},0 a ${r},${r} 0 1,0 -${2*r},0`}};var gi=new class extends di{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,r){return function(t,e,i,s,r){return t.moveTo(-3*e+i,-e+s,r),t.lineTo(-e+i,-e+s,r),t.lineTo(-e+i,-3*e+s,r),t.lineTo(e+i,-3*e+s,r),t.lineTo(e+i,-e+s,r),t.lineTo(3*e+i,-e+s,r),t.lineTo(3*e+i,e+s,r),t.lineTo(e+i,e+s,r),t.lineTo(e+i,3*e+s,r),t.lineTo(-e+i,3*e+s,r),t.lineTo(-e+i,e+s,r),t.lineTo(-3*e+i,e+s,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,r)}drawOffset(t,e,i,s,r,n){return function(t,e,i,s,r,n){return t.moveTo(-3*e+i-r,-e+s-r,n),t.lineTo(-e+i-r,-e+s-r,n),t.lineTo(-e+i-r,-3*e+s-r,n),t.lineTo(e+i+r,-3*e+s-r,n),t.lineTo(e+i+r,-e+s-r,n),t.lineTo(3*e+i+r,-e+s-r,n),t.lineTo(3*e+i+r,e+s+r,n),t.lineTo(e+i+r,e+s+r,n),t.lineTo(e+i+r,3*e+s+r,n),t.lineTo(-e+i-r,3*e+s+r,n),t.lineTo(-e+i-r,e+s+r,n),t.lineTo(-3*e+i-r,e+s+r,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,r,n)}};function mi(t,e,i,s,r){return t.moveTo(i,s-e,r),t.lineTo(e+i,s,r),t.lineTo(i,s+e,r),t.lineTo(i-e,s,r),t.closePath(),!0}var fi=new class extends di{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,r){return mi(t,this.parseSize(e)/2,i,s,r)}drawFitDir(t,e,i,s,r){return mi(t,this.parseSize(e)/2,i,s,r)}drawOffset(t,e,i,s,r,n){return mi(t,this.parseSize(e)/2+r,i,s,n)}};function vi(t,e,i,s){const r=2*e;return t.rect(i-e,s-e,r,r),!1}var yi=new class extends di{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return vi(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return vi(t,this.parseSize(e)/2+r,i,s)}};function _i(t,e,i,s,r=0){return t.moveTo(i+e+2*r,e+s+r),t.lineTo(i-e-2*r,e+s+r),t.lineTo(i,s-e-2*r),t.closePath(),!0}class bi extends di{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return _i(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return _i(t,this.parseSize(e)/2,i,s,r)}}var Si=new bi;var xi=new class extends bi{constructor(){super(...arguments),this.type="triangle"}};const Ai=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Ti=Math.sin(s.tau/10)*Ai,Ci=-Math.cos(s.tau/10)*Ai;function ki(t,e,i,r){const n=Ti*e,a=Ci*e;t.moveTo(i,-e+r),t.lineTo(n+i,a+r);for(let o=1;o<5;++o){const l=s.tau*o/5,h=Math.cos(l),c=Math.sin(l);t.lineTo(c*e+i,-h*e+r),t.lineTo(h*n-c*a+i,c*n+h*a+r)}return t.closePath(),!0}var wi=new class extends di{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return ki(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return ki(t,this.parseSize(e)/2+r,i,s)}};const Mi=s.sqrt(3);function Ei(t,e,i,s){const r=e,n=r/Mi,a=n/5,o=e;return t.moveTo(0+i,-r+s),t.lineTo(n/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-n/2+i,s),t.closePath(),!0}var Bi=new class extends di{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Ei(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Ei(t,this.parseSize(e)/2+r,i,s)}};function Oi(t,e,i,s){const r=2*e;return t.moveTo(i,-e+s),t.lineTo(r/3/2+i,e+s),t.lineTo(-r/3/2+i,e+s),t.closePath(),!0}var Pi=new class extends di{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Oi(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Oi(t,this.parseSize(e)/2+r,i,s)}};function Ii(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Ri=new class extends di{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Ii(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Ii(t,this.parseSize(e)/2+r,i,s)}};const Di=-.5,Li=s.sqrt(3)/2,Fi=1/s.sqrt(12);function Ni(t,e,i,s){const r=e/2,n=e*Fi,a=r,o=e*Fi+e,l=-a,h=o;return t.moveTo(r+i,n+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Di*r-Li*n+i,Li*r+Di*n+s),t.lineTo(Di*a-Li*o+i,Li*a+Di*o+s),t.lineTo(Di*l-Li*h+i,Li*l+Di*h+s),t.lineTo(Di*r+Li*n+i,Di*n-Li*r+s),t.lineTo(Di*a+Li*o+i,Di*o-Li*a+s),t.lineTo(Di*l+Li*h+i,Di*h-Li*l+s),t.closePath(),!1}var Ui=new class extends di{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Ni(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Ni(t,this.parseSize(e)/2+r,i,s)}};function ji(t,e,i,s,r){return t.moveTo(-e+i-2*r,s),t.lineTo(e+i+r,e+s+2*r),t.lineTo(e+i+r,s-e-2*r),t.closePath(),!0}var Vi=new class extends di{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return ji(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,r){return ji(t,this.parseSize(e)/2,i,s,r)}};function Gi(t,e,i,s,r=0){return t.moveTo(i-e-r,e+s+2*r),t.lineTo(e+i+2*r,s),t.lineTo(i-e-r,s-e-2*r),t.closePath(),!0}var zi=new class extends di{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return Gi(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Gi(t,this.parseSize(e)/2,i,s,r)}};function Ki(t,e,i,s,r=0){return t.moveTo(i-e-2*r,s-e-r),t.lineTo(i+e+2*r,s-e-r),t.lineTo(i,s+e+2*r),t.closePath(),!0}var Hi=new class extends di{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return Ki(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Ki(t,this.parseSize(e)/2,i,s,r)}};const Wi=s.sqrt(3);function $i(t,e,i,s){const r=e*Wi;return t.moveTo(i,s+-r/3*2),t.lineTo(e+i,s+r),t.lineTo(i-e,s+r),t.closePath(),!0}var Yi=new class extends di{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return $i(t,this.parseSize(e)/2/Wi,i,s)}drawOffset(t,e,i,s,r){return $i(t,this.parseSize(e)/2/Wi+r,i,s)}};function Xi(t,e,i,s){const r=2*e;return t.moveTo(e+i,s-r),t.lineTo(i-e,s),t.lineTo(e+i,r+s),!0}var qi=new class extends di{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return Xi(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,r){return Xi(t,this.parseSize(e)/4+r,i,s)}};function Zi(t,e,i,s){const r=2*e;return t.moveTo(i-e,s-r),t.lineTo(i+e,s),t.lineTo(i-e,r+s),!0}var Ji=new class extends di{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return Zi(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,r){return Zi(t,this.parseSize(e)/4+r,i,s)}};function Qi(t,e,i,s){const r=2*e;return t.moveTo(i-r,s+e),t.lineTo(i,s-e),t.lineTo(i+r,s+e),!0}var ts=new class extends di{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return Qi(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,r){return Qi(t,this.parseSize(e)/4+r,i,s)}};function es(t,e,i,s){const r=2*e;return t.moveTo(i-r,s-e),t.lineTo(i,s+e),t.lineTo(i+r,s-e),!0}var is=new class extends di{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return es(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,r){return es(t,this.parseSize(e)/4+r,i,s)}};function ss(t,e,i,s,r){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var rs=new class extends di{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,r){return ss(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r,n){return ss(t,this.parseSize(e)/2+r,i,s)}drawToSvgPath(t,e,i,s){const r=this.parseSize(t)/2;return`M ${e}, ${i-r} L ${e},${i+r}`}};function ns(t,e,i,s,r){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var as=new class extends di{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,r){return ns(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r,n){return ns(t,this.parseSize(e)/2+r,i,s)}drawToSvgPath(t,e,i,s){const r=this.parseSize(t)/2;return`M ${e-r}, ${i} L ${e+r},${i}`}};function os(t,e,i,s,r){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var ls=new class extends di{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,r){return os(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r,n){return os(t,this.parseSize(e)/2+r,i,s)}drawToSvgPath(t,e,i,s){const r=this.parseSize(t)/2;return`M ${e-r}, ${i-r} L ${e+r},${i+r} M ${e+r}, ${i-r} L ${e-r},${i+r}`}};function hs(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function cs(t,e,i,s){const r=e,n=e/2;return t.rect(i-r/2,s-n/2,r,n),!1}var ds=new class extends di{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,r){return s.isNumber(e)?cs(t,e,i,r):hs(t,e,i,r)}drawWithClipRange(t,e,i,r,n,a,o){s.isNumber(e)&&(e=[e,e/2]);const l=2*(e[0]+e[1])*n,h=[{x:i+e[0]/2,y:r-e[1]/2},{x:i+e[0]/2,y:r+e[1]/2},{x:i-e[0]/2,y:r+e[1]/2},{x:i-e[0]/2,y:r-e[1]/2}];let c=0,d=h[3];t.moveTo(d.x,d.y);for(let e=0;e<h.length;e++){const i=h[e],s=Math.sqrt((i.x-d.x)*(i.x-d.x)+(i.y-d.y)*(i.y-d.y));if(c+s>l){const e=(i.x-d.x)*(l-c)/s,r=(i.y-d.y)*(l-c)/s;t.lineTo(d.x+e,d.y+r);break}t.lineTo(i.x,i.y),d=i,c+=s}return!1}drawOffset(t,e,i,r,n){return s.isNumber(e)?cs(t,e+2*n,i,r):hs(t,[e[0]+2*n,e[1]+2*n],i,r)}};const us=new s.AABBBounds;class ps{constructor(t,e,i=!1){this.pathStr="",this.type=t,s.isArray(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,r,n,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{t.beginPath(),Gt(r.path.commandList,t,i,s,e,e),a&&a(r.path,r.attribute)})),!1):(Gt(this.path.commandList,t,i,s,e+r,e+r),!1)}draw(t,e,i,s,r,n){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,r,n)}parseSize(t){return s.isNumber(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,r,n,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{n.path.drawWithClipRange(t,e,i,s,r),a&&a(n.path,n.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,r),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{us.x1=i.bounds.x1*t,us.y1=i.bounds.y1*t,us.x2=i.bounds.x2*t,us.y2=i.bounds.y2*t,e.union(us)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const gs={};[pi,gi,fi,yi,Yi,xi,wi,Bi,Pi,Ri,Ui,Vi,zi,Si,Hi,qi,Ji,ts,is,ds,rs,as,ls].forEach((t=>{gs[t.type]=t}));const ms={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"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",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class fs{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function vs(t,e,i,s){const r=t.indexOf(e,i);if(-1===r)throw new Error(s);return r+e.length-1}function ys(t,e,i,s=">"){const r=function(t,e,i=">"){let s,r="";for(let n=e;n<t.length;n++){let e=t[n];if(s)e===s&&(s="");else if('"'===e||"'"===e)s=e;else if(e===i[0]){if(!i[1])return{data:r,index:n};if(t[n+1]===i[1])return{data:r,index:n}}else"\t"===e&&(e=" ");r+=e}}(t,e+1,s);if(!r)return;let n=r.data;const a=r.index,o=n.search(/\s/);let l=n,h=!0;-1!==o&&(l=n.substr(0,o).replace(/\s\s*$/,""),n=n.substr(o+1));const c=l;if(i){const t=l.indexOf(":");-1!==t&&(l=l.substr(t+1),h=l!==r.data.substr(t+1))}return{tagName:l,tagExp:n,closeIndex:a,attrExpPresent:h,rawTagName:c}}const _s=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class bs{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const r=function(t,e){const i=[];let s=e.exec(t);for(;s;){const r=[];r.startIndex=e.lastIndex-s[0].length;const n=s.length;for(let t=0;t<n;t++)r.push(s[t]);i.push(r),s=e.exec(t)}return i}(t,_s),n=r.length;for(let t=0;t<n;t++){const e=r[t][1],i=r[t][4];e&&(s[e]=void 0===i||(isNaN(i)?i:Number(i)))}return s}parseXml(t){t=t.replace(/\r\n?/g,"\n");const e=new fs("!xml");let i=e,s="",r="";for(let n=0;n<t.length;n++)if("<"===t[n])if("/"===t[n+1]){const e=vs(t,">",n,"Closing Tag is not closed."),a=r.lastIndexOf(".");r=r.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",n=e}else if("?"===t[n+1])n=ys(t,n,!1,"?>").closeIndex+1;else if("!--"===t.substr(n+1,3))n=vs(t,"--\x3e",n+4,"Comment is not closed.");else{const a=ys(t,n,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(r+=r?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),r=r.substr(0,r.length-1),l=o):l=l.substr(0,l.length-1);const t=new fs(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,r,o)),this.addChild(i,t,r),r=r.substr(0,r.lastIndexOf("."))}else{const t=new fs(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,r,o)),this.addChild(i,t,r),i=t}s="",n=c}else s+=t[n];return e.child}}function Ss(t,e){return xs(t)}function xs(t,e){const i={};for(let e=0;e<t.length;e++){const r=t[e],n=As(r);if(void 0!==n&&r[n]){const t=xs(r[n]);s=t,Object.keys(s).length,r[":@"]&&Ts(t,r[":@"]),void 0!==i[n]&&i.hasOwnProperty(n)?(Array.isArray(i[n])||(i[n]=[i[n]]),i[n].push(t)):i[n]=t}}var s;return i}function As(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function Ts(t,e,i){if(e){const i=Object.keys(e),s=i.length;for(let r=0;r<s;r++){const s=i[r];t[s]=e[s]}}}class Cs{constructor(t){this.options=Object.assign({},Cs.defaultOptions,t)}valid(t){return t.startsWith("<")}parse(t){if(!this.valid)return!1;return Ss(new bs(this.options).parseXml(t),this.options)}}function ks(t,e,i,s=0){return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}Cs.defaultOptions={};let ws=0;function Ms(){return ws++}var Es;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(Es||(Es={}));const Bs=new Map;["…","(",")","—","【","】","「","」","《","》"].forEach((t=>Bs.set(t,!0)));const Os=new Map;[""].forEach((t=>Os.set(t,!0)));const Ps=Ms(),Is=Ms();Ms(),Ms(),Ms();const Rs=Ms();Ms(),Ms(),Ms();const Ds=Ms(),Ls=Ms(),Fs=Ms(),Ns=Ms();Ms(),Ms();const Us=Ms();Ms();const js=Symbol.for("GraphicService"),Vs=Symbol.for("GraphicCreator"),Gs={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},zs=Object.keys(Gs),Ks={duration:200,easing:"cubicOut"};function Hs(t){return function(){var t,e;const i=null===(t=dt.global)||void 0===t?void 0:t.env,s=i?null===(e=dt.canvasFactory)||void 0===e?void 0:e.call(dt,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const Ws=1e-4,$s=Math.sqrt(3),Ys=1/3;function Xs(t){return t>-lr&&t<lr}function qs(t){return t>lr||t<-lr}const Zs=[0,0],Js=[0,0],Qs=[0,0];function tr(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function er(t,e,i,s){const r=1-s;return r*(r*t+2*s*e)+s*s*i}function ir(t,e,i,s,r){const n=1-r;return n*n*(n*t+3*r*e)+r*r*(r*s+3*n*i)}function sr(t){return(t%=s.pi2)<0&&(t+=s.pi2),t}function rr(t,e,i,s,r,n,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>n+h||l<e-h&&l<s-h&&l<n-h||o>t+h&&o>i+h&&o>r+h||o<t-h&&o<i-h&&o<r-h)&&function(t,e,i,s,r,n,a,o,l){let h=0,c=.005,d=1/0;Zs[0]=a,Zs[1]=o;for(let a=0;a<1;a+=.05){Js[0]=er(t,i,r,a),Js[1]=er(e,s,n,a);const o=tr(Zs,Js);o<d&&(h=a,d=o)}d=1/0;for(let a=0;a<32&&!(c<Ws);a++){const a=h-c,o=h+c;Js[0]=er(t,i,r,a),Js[1]=er(e,s,n,a);const l=tr(Js,Zs);if(a>=0&&l<d)h=a,d=l;else{Qs[0]=er(t,i,r,o),Qs[1]=er(e,s,n,o);const a=tr(Qs,Zs);o<=1&&a<d?(h=o,d=a):c*=.5}}return l&&(l[0]=er(t,i,r,h),l[1]=er(e,s,n,h)),Math.sqrt(d)}(t,e,i,s,r,n,o,l,null)<=h/2}function nr(t,e,i,s,r,n,a,o,l,h,c){if(0===l)return!1;const d=l;return!(c>e+d&&c>s+d&&c>n+d&&c>o+d||c<e-d&&c<s-d&&c<n-d&&c<o-d||h>t+d&&h>i+d&&h>r+d&&h>a+d||h<t-d&&h<i-d&&h<r-d&&h<a-d)&&function(t,e,i,s,r,n,a,o,l,h,c){let d,u,p,g,m=0,f=.005,v=1/0;Zs[0]=l,Zs[1]=h;for(let l=0;l<1;l+=.05)Js[0]=ir(t,i,r,a,l),Js[1]=ir(e,s,n,o,l),p=tr(Zs,Js),p<v&&(m=l,v=p);v=1/0;for(let l=0;l<32&&!(f<Ws);l++)d=m-f,u=m+f,Js[0]=ir(t,i,r,a,d),Js[1]=ir(e,s,n,o,d),p=tr(Js,Zs),d>=0&&p<v?(m=d,v=p):(Qs[0]=ir(t,i,r,a,u),Qs[1]=ir(e,s,n,o,u),g=tr(Qs,Zs),u<=1&&g<v?(m=u,v=g):f*=.5);return c&&(c[0]=ir(t,i,r,a,m),c[1]=ir(e,s,n,o,m)),Math.sqrt(v)}(t,e,i,s,r,n,a,o,h,c,null)<=d/2}function ar(t,e,i,r,n,a,o,l,h){if(0===o)return!1;const c=o;l-=t,h-=e;const d=Math.sqrt(l*l+h*h);if(d-c>i||d+c<i)return!1;if(Math.abs(r-n)%s.pi2<1e-4)return!0;if(a){const t=r;r=sr(n),n=sr(t)}else r=sr(r),n=sr(n);r>n&&(n+=s.pi2);let u=Math.atan2(h,l);return u<0&&(u+=s.pi2),u>=r&&u<=n||u+s.pi2>=r&&u+s.pi2<=n}function or(t,e,i,s,r,n,a){if(0===r)return!1;const o=r,l=r/2;let h=0,c=t;if(a>e+l&&a>s+l||a<e-l&&a<s-l||n>t+l&&n>i+l||n<t-l&&n<i-l)return!1;if(t===i)return Math.abs(n-t)<=o/2;h=(e-s)/(t-i),c=(t*s-i*e)/(t-i);const d=h*n-a+c;return d*d/(h*h+1)<=o/2*o/2}const lr=1e-4;function hr(t,e,i,s,r){const n=6*i-12*e+6*t,a=9*e+3*s-3*t-9*i,o=3*e-3*t;let l=0;if(Xs(a)){if(qs(n)){const t=-o/n;t>=0&&t<=1&&(r[l++]=t)}}else{const t=n*n-4*a*o;if(Xs(t))r[0]=-n/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-n+e)/(2*a),s=(-n-e)/(2*a);i>=0&&i<=1&&(r[l++]=i),s>=0&&s<=1&&(r[l++]=s)}}return l}const cr=[-1,-1,-1],dr=[-1,-1];function ur(){const t=dr[0];dr[0]=dr[1],dr[1]=t}function pr(t,e,i,s,r,n,a,o,l,h){if(h>e&&h>s&&h>n&&h>o||h<e&&h<s&&h<n&&h<o)return 0;const c=function(t,e,i,s,r,n){const a=s+3*(e-i)-t,o=3*(i-2*e+t),l=3*(e-t),h=t-r,c=o*o-3*a*l,d=o*l-9*a*h,u=l*l-3*o*h;let p=0;if(Xs(c)&&Xs(d))if(Xs(o))n[0]=0;else{const t=-l/o;t>=0&&t<=1&&(n[p++]=t)}else{const t=d*d-4*c*u;if(Xs(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(n[p++]=e),i>=0&&i<=1&&(n[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Ys):Math.pow(i,Ys),s=s<0?-Math.pow(-s,Ys):Math.pow(s,Ys);const r=(-o-(i+s))/(3*a);r>=0&&r<=1&&(n[p++]=r)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),r=(-o-2*i*s)/(3*a),l=(-o+i*(s+$s*Math.sin(e)))/(3*a),h=(-o+i*(s-$s*Math.sin(e)))/(3*a);r>=0&&r<=1&&(n[p++]=r),l>=0&&l<=1&&(n[p++]=l),h>=0&&h<=1&&(n[p++]=h)}}return p}(e,s,n,o,h,cr);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h<c;h++){const c=cr[h],m=0===c||1===c?.5:1;ir(t,i,r,a,c)<l||(u<0&&(u=hr(e,s,n,o,dr),dr[1]<dr[0]&&u>1&&ur(),p=ir(e,s,n,o,dr[0]),u>1&&(g=ir(e,s,n,o,dr[1]))),2===u?c<dr[0]?d+=p<e?m:-m:c<dr[1]?d+=g<p?m:-m:d+=o<g?m:-m:c<dr[0]?d+=p<e?m:-m:d+=o<p?m:-m)}return d}function gr(t,e,i,s,r,n,a,o){if(o>e&&o>s&&o>n||o<e&&o<s&&o<n)return 0;const l=function(t,e,i,s,r){const n=t-2*e+i,a=2*(e-t),o=t-s;let l=0;if(Xs(n)){if(qs(a)){const t=-o/a;t>=0&&t<=1&&(r[l++]=t)}}else{const t=a*a-4*n*o;if(Xs(t)){const t=-a/(2*n);t>=0&&t<=1&&(r[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*n),s=(-a-e)/(2*n);i>=0&&i<=1&&(r[l++]=i),s>=0&&s<=1&&(r[l++]=s)}}return l}(e,s,n,o,cr);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,n);if(h>=0&&h<=1){let o=0;const c=er(e,s,n,h);for(let s=0;s<l;s++){const l=0===cr[s]||1===cr[s]?.5:1;er(t,i,r,cr[s])<a||(cr[s]<h?o+=c<e?l:-l:o+=n<c?l:-l)}return o}const c=0===cr[0]||1===cr[0]?.5:1;return er(t,i,r,cr[0])<a?0:n<e?c:-c}function mr(t,e,i,r,n,a,o,l){if((l-=e)>i||l<-i)return 0;const h=Math.sqrt(i*i-l*l);cr[0]=-h,cr[1]=h;const c=Math.abs(r-n);if(c<1e-4)return 0;if(c>=s.pi2-1e-4){r=0,n=s.pi2;const e=a?1:-1;return o>=cr[0]+t&&o<=cr[1]+t?e:0}if(r>n){const t=r;r=n,n=t}r<0&&(r+=s.pi2,n+=s.pi2);let d=0;for(let e=0;e<2;e++){const i=cr[e];if(i+t>o){let t=Math.atan2(l,i),e=a?1:-1;t<0&&(t=s.pi2+t),(t>=r&&t<=n||t+s.pi2>=r&&t+s.pi2<=n)&&(t>s.pi/2&&t<1.5*s.pi&&(e=-e),d+=e)}}return d}function fr(t){return Math.round(t/s.pi*1e8)/1e8%2*s.pi}function vr(t,e){let i=fr(t[0]);i<0&&(i+=s.pi2);const r=i-t[0];let n=t[1];n+=r,!e&&n-i>=s.pi2?n=i+s.pi2:e&&i-n>=s.pi2?n=i-s.pi2:!e&&i>n?n=i+(s.pi2-fr(i-n)):e&&i<n&&(n=i-(s.pi2-fr(n-i))),t[0]=i,t[1]=n}const yr=[0,0];function _r(t,e,i,r,n){const a=t,o=t.length;let l,h,c=0,d=0,u=0,p=0,g=0;for(let t=0;t<o;t++){const o=a[t],m=0===t;o[0]===kt.M&&t>1&&(i||(c+=s.isPointInLine(d,u,p,g,r,n))),m&&(d=o[1],u=o[2],p=d,g=u);const f=o[0],v=o[1],y=o[2],_=o[3],b=o[4],S=o[5],x=o[6];let A=b,T=S;yr[0]=A,yr[1]=T,vr(yr,Boolean(o[6])),A=yr[0],T=yr[1];const C=A,k=T-A,w=!!(1-(o[6]?0:1)),M=(r-v)*_/_+v;switch(f){case kt.M:p=v,g=y,d=p,u=g;break;case kt.L:if(i){if(or(d,u,v,y,e,r,n))return!0}else c+=s.isPointInLine(d,u,v,y,r,n)||0;d=v,u=y;break;case kt.C:if(i){if(nr(d,u,v,y,_,b,S,x,e,r,n))return!0}else c+=pr(d,u,v,y,_,b,S,x,r,n)||0;d=S,u=x;break;case kt.Q:if(i){if(rr(d,u,v,y,_,b,e,r,n))return!0}else c+=gr(d,u,v,y,_,b,r,n)||0;d=_,u=b;break;case kt.A:if(l=Math.cos(C)*_+v,h=Math.sin(C)*_+y,m?(p=l,g=h):c+=s.isPointInLine(d,u,l,h,r,n),i){if(ar(v,y,_,C,C+k,w,e,M,n))return!0}else c+=mr(v,y,_,C,C+k,w,M,n);d=Math.cos(C+k)*_+v,u=Math.sin(C+k)*_+y;break;case kt.R:if(p=d=v,g=u=y,l=p+_,h=g+b,i){if(or(p,g,l,g,e,r,n)||or(l,g,l,h,e,r,n)||or(l,h,p,h,e,r,n)||or(p,h,p,g,e,r,n))return!0}else c+=s.isPointInLine(l,g,l,h,r,n),c+=s.isPointInLine(p,h,p,g,r,n);break;case kt.Z:if(i){if(or(d,u,p,g,e,r,n))return!0}else c+=s.isPointInLine(d,u,p,g,r,n);d=p,u=g}}return i||(m=u,f=g,Math.abs(m-f)<lr)||(c+=s.isPointInLine(d,u,p,g,r,n)||0),0!==c;var m,f}const br=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return r("linear",t.linearGradient,n)||r("radial",t.radialGradient,o)||r("conic",t.conicGradient,a)}function r(e,s,r){return function(s,n){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const n=r();return n&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:n,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function n(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,r=l();return r&&(i=[],i.push(r),s=e,v(t.comma)&&(r=l(),r?i.push(r):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const r=[];if(s)for(r.push(s);v(t.comma);)s=e(),s?r.push(s):i("One extra comma");return r}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&y(i[0].length);const s=t.exec(e);return s&&y(s[0].length),s}function y(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class Sr{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Sr.IsGradientStr(t))try{const e=br(t)[0];if(e){if("linear"===e.type)return Sr.ParseLinear(e);if("radial"===e.type)return Sr.ParseRadial(e);if("conic"===e.type)return Sr.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t<e.length-1;t++)if(e[t].offset<0){const i=t-1;let s=t+1;for(;s<e.length&&e[s].offset<0;)s++;const r=e[i].offset,n=e[s].offset,a=s-i;for(let t=1;t<a;t++)e[i+t].offset=r+(n-r)*t/a;t=s-1}return e}return t.map(((e,i)=>{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,r=s.pi/2,n=parseFloat(e.value)/180*s.pi-r;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+s.pi2,stops:Sr.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:Sr.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,r=s.pi/2;let n="angular"===e.type?parseFloat(e.value)/180*s.pi:0;for(;n<0;)n+=s.pi2;for(;n>=s.pi2;)n-=s.pi2;let a=0,o=0,l=0,h=0;return n<r?(a=0,o=1,l=Math.sin(n),h=o-Math.cos(n)):n<s.pi?(a=0,o=0,l=Math.cos(n-r),h=Math.sin(n-r)):n<s.pi+r?(a=1,o=0,l=a-Math.sin(n-s.pi),h=Math.cos(n-s.pi)):(a=1,l=a-Math.cos(n-r-s.pi),h-=Math.sin(n-r-s.pi)),{gradient:"linear",x0:a,y0:o,x1:l,y1:h,stops:Sr.processColorStops(i)}}}function xr(t,e,i,r=0,n=0){var a,o,l,h;if(!e||!0===e)return"black";let c,d;if(s.isArray(e))for(let t=0;t<e.length&&(d=e[t],!d);t++);else d=e;if(d=Sr.Parse(d),"string"==typeof d)return d;if(i.AABBBounds&&(!i.attribute||0!==i.attribute.scaleX||0!==i.attribute.scaleY)){const e=i.AABBBounds;let s=e.x2-e.x1,u=e.y2-e.y1,p=e.x1-r,g=e.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1,angle:r=0}=i.attribute;s/=t,u/=e,p/=t,g/=e,(r||1!==t||1!==e)&&(p=null!==(a=i.x1WithoutTransform)&&void 0!==a?a:0,g=null!==(o=i.y1WithoutTransform)&&void 0!==o?o:0,s=null!==(l=i.widthWithoutTransform)&&void 0!==l?l:s,u=null!==(h=i.heightWithoutTransform)&&void 0!==h?h:u)}"linear"===d.gradient?c=function(t,e,i,s,r,n){var a,o,l,h;const c=t.createLinearGradient(i+(null!==(a=e.x0)&&void 0!==a?a:0)*r,s+(null!==(o=e.y0)&&void 0!==o?o:0)*n,i+(null!==(l=e.x1)&&void 0!==l?l:1)*r,s+(null!==(h=e.y1)&&void 0!==h?h:0)*n);return e.stops.forEach((t=>{c.addColorStop(t.offset,t.color)})),c}(t,d,p,g,s,u):"conical"===d.gradient?c=function(t,e,i,s,r,n){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*r,s+(null!==(o=e.y)&&void 0!==o?o:0)*n,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(r+i,n+s,void 0):l}(t,d,p,g,s,u):"radial"===d.gradient&&(c=function(t,e,i,s,r,n){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*r,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*n,Math.max(r,n)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*r,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*n,Math.max(r,n)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,d,p,g,s,u))}return c||"orange"}function Ar(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Tr(t,e,i){const s=i[0],r=i[1],n=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*r+e[8]*n+e[12],t[13]=e[1]*s+e[5]*r+e[9]*n+e[13],t[14]=e[2]*s+e[6]*r+e[10]*n+e[14],t[15]=e[3]*s+e[7]*r+e[11]*n+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*r+g*n+e[12],t[13]=o*s+d*r+m*n+e[13],t[14]=l*s+u*r+f*n+e[14],t[15]=h*s+p*r+v*n+e[15]),t}function Cr(t,e,i){const s=e[0],r=e[1],n=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],S=i[2],x=i[3];return t[0]=_*s+b*o+S*d+x*m,t[1]=_*r+b*l+S*u+x*f,t[2]=_*n+b*h+S*p+x*v,t[3]=_*a+b*c+S*g+x*y,_=i[4],b=i[5],S=i[6],x=i[7],t[4]=_*s+b*o+S*d+x*m,t[5]=_*r+b*l+S*u+x*f,t[6]=_*n+b*h+S*p+x*v,t[7]=_*a+b*c+S*g+x*y,_=i[8],b=i[9],S=i[10],x=i[11],t[8]=_*s+b*o+S*d+x*m,t[9]=_*r+b*l+S*u+x*f,t[10]=_*n+b*h+S*p+x*v,t[11]=_*a+b*c+S*g+x*y,_=i[12],b=i[13],S=i[14],x=i[15],t[12]=_*s+b*o+S*d+x*m,t[13]=_*r+b*l+S*u+x*f,t[14]=_*n+b*h+S*p+x*v,t[15]=_*a+b*c+S*g+x*y,t}function kr(t,e,i){const s=e[0],r=e[1],n=e[2];let a=i[3]*s+i[7]*r+i[11]*n+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*r+i[8]*n+i[12])/a,t[1]=(i[1]*s+i[5]*r+i[9]*n+i[13])/a,t[2]=(i[2]*s+i[6]*r+i[10]*n+i[14])/a,t}class wr{constructor(){this.pools=[]}static identity(t){return Ar(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return wr.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i<e.length;i++)e[i]=t[i];return e}free(t){t&&this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const Mr=new class{constructor(){this.pools=[]}allocate(t,e,i,r,n,a){if(!this.pools.length)return new s.Matrix(t,e,i,r,n,a);const o=this.pools.pop();return o.a=t,o.b=e,o.c=i,o.d=r,o.e=n,o.f=a,o}allocateByObj(t){if(!this.pools.length)return new s.Matrix(t.a,t.b,t.c,t.d,t.e,t.f);const e=this.pools.pop();return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.e=t.e,e.f=t.f,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}},Er=new wr,Br=new s.Matrix(1,0,0,1,0,0),Or={x:0,y:0};class Pr{get nativeContext(){return this.path}constructor(t,e){this.matrix=new s.Matrix(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new s.Matrix(1,0,0,1,0,0),this.path=new we,this._clearMatrix=new s.Matrix(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Mr.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new s.Matrix(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(Mr.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Mr.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,r=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),r&&this.setTransformForCurrent()}setTransform(t,e,i,s,r,n,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*r,o*n),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,r,n,a=!0){this.matrix.multiply(t,e,i,s,r,n),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,r,n){this.path.arc(t,e,i,s,r,n)}arcTo(t,e,i,s,r){this.path.arcTo(t,e,i,s,r)}bezierCurveTo(t,e,i,s,r,n){this.path.bezierCurveTo(t,e,i,s,r,n)}closePath(){this.path.closePath()}ellipse(t,e,i,s,r,n,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,r,n){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Or),function(t,e,i){return _r(t,0,!1,e,i)}(this.path.commandList,Or.x,Or.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Or);const i=function(t,e,i){let s=e;const{a:r,b:n,c:a,d:o}=t.currentMatrix,l=Math.sign(r)*Math.sqrt(r*r+n*n),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}(this,this.lineWidth,this.dpr);return function(t,e,i,s){return _r(t,e,!0,i,s)}(this.path.commandList,i,Or.x,Or.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,r){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,r){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(Br,t,e)}setClearMatrix(t,e,i,s,r,n){this._clearMatrix.setValue(t,e,i,s,r,n)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Mr.free(t))),this.stack.length=0}}const Ir=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Rr(t){return null==t?void 0:t}class Dr{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const r=null!==(i=t.priority)&&void 0!==i?i:0,n=null!==(s=e.priority)&&void 0!==s?s:0;return r!==n?r-n:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const r=new Map;return e.forEach((([,t])=>{var e,i,n,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),r.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Rr(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(n=t.exclude)&&void 0!==n?n:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(r,"exclude"),this.expandRelationClosure(r,"suppress"),r}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Ir.has(t)))){const r=e;return{name:null!==(i=r.name)&&void 0!==i?i:t,priority:null!==(s=r.priority)&&void 0!==s?s:0,patch:Rr(r.patch),resolver:r.resolver,declaredAffectedKeys:r.declaredAffectedKeys,exclude:r.exclude,suppress:r.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const r=new Set,n=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||r.has(t)||(r.add(t),e.add(t),n(t,e),e.delete(t))}))};n(s,new Set([s])),t[e]=r}))}}function Lr(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Fr(t){if(!Lr(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Fr(t[i])})),e}function Nr(t,e){var i;const s=null!==(i=Fr(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],r=s[t];Lr(r)&&Lr(i)?s[t]=Nr(r,i):s[t]=Fr(i)})),s}class Ur{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),r=s.active,n=r.filter((t=>!s.suppressedSet.has(t))),a=r.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,r)||!this.sameArray(this._effectiveStates,n)||!this.sameArray(this._suppressed,a);return this._activeStates=r,this._effectiveStates=n,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(n),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],r=this.compiledDefinitions.get(s);r&&(r.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s<t&&(t-=1))})),r.suppress.forEach((t=>{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const r=this.compiledDefinitions.get(t);if(r&&(r.patch&&this.mergeInto(i,r.patch),r.hasResolver)){const n=s?this.resolverPatchCache.get(t):null===(e=r.resolver)||void 0===e?void 0:e.call(r,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});n&&(s||this.resolverPatchCache.set(t,n),this.mergeInto(i,n))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Fr(e[i])})):Object.keys(e).forEach((i=>{var s;const r=e[i],n=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];Lr(n)&&Lr(r)?t[i]=Nr(n,r):!Lr(n)&&Lr(a)&&Lr(r)?t[i]=Nr(a,r):t[i]=Fr(r)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}}var jr;!function(t){t[t.NONE=0]="NONE",t[t.PAINT=1]="PAINT",t[t.SHAPE=2]="SHAPE",t[t.BOUNDS=4]="BOUNDS",t[t.TRANSFORM=8]="TRANSFORM",t[t.LAYOUT=16]="LAYOUT",t[t.PICK=32]="PICK"}(jr||(jr={}));const Vr={fill:jr.PAINT,opacity:jr.PAINT,fillOpacity:jr.PAINT,strokeOpacity:jr.PAINT,lineDash:jr.PAINT,lineDashOffset:jr.PAINT,lineCap:jr.PAINT,lineJoin:jr.PAINT,miterLimit:jr.PAINT,shadowColor:jr.PAINT,x:jr.TRANSFORM|jr.BOUNDS,y:jr.TRANSFORM|jr.BOUNDS,scaleX:jr.TRANSFORM|jr.BOUNDS,scaleY:jr.TRANSFORM|jr.BOUNDS,angle:jr.TRANSFORM|jr.BOUNDS,anchor:jr.TRANSFORM|jr.BOUNDS,anchor3d:jr.TRANSFORM|jr.BOUNDS,postMatrix:jr.TRANSFORM|jr.BOUNDS,layout:jr.LAYOUT,zIndex:jr.PAINT,visible:jr.PAINT|jr.PICK,lineWidth:jr.SHAPE|jr.BOUNDS|jr.PICK,width:jr.SHAPE|jr.BOUNDS,height:jr.SHAPE|jr.BOUNDS},Gr={stroke:(t,e)=>(null!=t&&!1!==t)!=(null!=e&&!1!==e)?jr.PAINT|jr.BOUNDS|jr.PICK:jr.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?jr.PAINT|jr.BOUNDS:jr.PAINT}};class zr{analyzeTransition(t,e,i={}){var s,r;const n={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return n;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(r=i.animateConfig)||void 0===r?void 0:r.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])n.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;n.animateAttrs[e]=l(e)}else n.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return n}applyTransition(t,e,i,s={}){var r,n,a;if(i){const i=null!==(r=s.animateConfig)&&void 0!==r?r:Ks;null===(n=t.applyAnimationState)||void 0===n||n.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:Dt.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:Dt.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:Dt.STATE}),e}applyClearTransition(t,e,i,s={}){var r;const n=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(r=s.shouldSkipDefaultAttribute)&&void 0!==r?r:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,n,i,s)}}const Kr=new Dr;function Hr(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,Wr(t),!0)}function Wr(t,e=t.revision+1){var i;const s=(r=t.parentScope,n=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},r?r.effectiveSourceDefinitions:a,n));var r,n,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=Kr.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function $r(t){if(t)return t.parentScope&&$r(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&Wr(t),t}function Yr(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function Xr(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}const qr=new s.AABBBounds,Zr=new s.Matrix,Jr=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Qr=["x","y"],tn=["scaleX","scaleY"],en=["angle"],sn=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),rn=new s.Point,nn=[],an=jr.PAINT|jr.SHAPE|jr.BOUNDS|jr.TRANSFORM|jr.LAYOUT;function on(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function ln(t){if(!on(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=on(s)?ln(s):s})),i}function hn(t,e){return t===e||!!(on(t)||on(e)||Array.isArray(t)||Array.isArray(e))&&s.isEqual(t,e)}function cn(t,e){var i;const s=null!==(i=ln(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],r=s[t];on(r)&&on(i)?s[t]=cn(r,i):s[t]=ln(i)})),s}const dn={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class un extends bt{static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const s=e[i];Object.defineProperty(un.prototype,s,Object.getOwnPropertyDescriptor(t,s))}}get AABBBounds(){return this.tryUpdateAABBBounds()}get OBBBounds(){return this.tryUpdateOBBBounds()}get globalAABBBounds(){return this.tryUpdateGlobalAABBBounds()}get transMatrix(){return this.tryUpdateLocalTransMatrix(!0)}get globalTransMatrix(){return this.tryUpdateGlobalTransMatrix(!0)}get baseAttributes(){var t;return null!==(t=this._baseAttributes)&&void 0!==t?t:this.attribute}set baseAttributes(t){t!==this.attribute?this._baseAttributes=t:this._baseAttributes=void 0}constructor(t={}){var e;super(),this._AABBBounds=new s.AABBBounds,this._updateTag=It.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background&&this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0),t.texture&&pn(t.texture)&&this.loadImage(t.texture,!1),t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}get normalAttrs(){return this.baseAttributes}set normalAttrs(t){}getBaseAttributesStorage(){var t;return null!==(t=this._baseAttributes)&&void 0!==t?t:this.attribute}getGraphicService(){var t,e;return null!==(e=null===(t=this.stage)||void 0===t?void 0:t.graphicService)&&void 0!==e?e:dt.graphicService}getAttributes(){return this.attribute}getStateTransitionOrchestrator(){return this.stateTransitionOrchestrator||(this.stateTransitionOrchestrator=new zr),this.stateTransitionOrchestrator}resolveBoundSharedStateScope(){var t;let e=this.parent;for(;e;){if(e.sharedStateScope)return e.sharedStateScope;e=e.parent}return null===(t=this.stage)||void 0===t?void 0:t.rootSharedStateScope}syncSharedStateScopeBindingFromTree(t=!0){var e;const i=this.resolveBoundSharedStateScope();return this.boundSharedStateScope===i?(this.syncSharedStateActiveRegistrations(),!1):(this.boundSharedStateScope=i,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.syncSharedStateActiveRegistrations(),t&&(null===(e=this.currentStates)||void 0===e?void 0:e.length)&&this.markSharedStateDirty(),!0)}syncSharedStateScopeBindingOnTreeChange(t=!0){var e,i;return!!((null===(e=this.currentStates)||void 0===e?void 0:e.length)||this.boundSharedStateScope||(null===(i=this.registeredActiveScopes)||void 0===i?void 0:i.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingFromTree(t)}syncSharedStateActiveRegistrations(){var t;const e=this.registeredActiveScopes;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.boundSharedStateScope)return(null==e?void 0:e.size)&&(e.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,Xr(this.stage,this),Yr(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&$r(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Dt.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&($r(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new Dr).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),r=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,n=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...r],this.resolvedStatePatch=n,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=ln(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],r=e[t];"deep"===this.stateMergeMode&&on(r)&&on(s)?e[t]=cn(r,s):e[t]=ln(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),r=s;return Object.keys(e).forEach((e=>{const n=Object.prototype.hasOwnProperty.call(t,e);if(n&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,r)||(i[e]=void 0===t?t:ln(t))};if(n)a(this.getStateTransitionDefaultAttribute(e,r));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,r):t)}else a(this.getStateTransitionDefaultAttribute(e,r))})),i}syncObjectToSnapshot(t,e,i){const s=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((r=>{if(!0===(null==i?void 0:i[r]))return;const n=Object.prototype.hasOwnProperty.call(e,r),a=t[r];if(!n)return void(Object.prototype.hasOwnProperty.call(t,r)&&(s.set(r,{prev:a,next:void 0}),delete t[r]));const o=e[r];hn(a,o)||(s.set(r,{prev:a,next:o}),t[r]=ln(o))})),s}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,s){var r;let n="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const r=Gr[t];return r?r(e,i):null!==(s=Vr[t])&&void 0!==s?s:jr.PAINT}(e,i,s):null!==(r=Vr[e])&&void 0!==r?r:jr.PAINT;return n&jr.PICK&&(n|=jr.BOUNDS),n===jr.PAINT&&this.needUpdateTag(e)&&(n=jr.SHAPE|jr.BOUNDS),t|n}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&an)!==an?(t&jr.SHAPE?this.addUpdateShapeAndBoundsTag():t&jr.BOUNDS&&this.addUpdateBoundTag(),t&jr.PAINT&&this.addUpdatePaintTag(),t&jr.TRANSFORM&&this.addUpdatePositionTag(),t&jr.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=jr.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,r;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(r=this.stateEngine)||void 0===r||r.invalidateResolverCache(),this.recomputeCurrentStatePatch());const n=this._syncAttribute();this.submitUpdateByDelta(n,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!on(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=on(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,r=this.getBaseAttributesStorage();let n=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(n=!0,r[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));n&&(this.attribute=r,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const s=e[i];this.getBaseAttributesStorage()[s]=t[s]}}_commitAnimationStaticAttributes(t,e){if(!t)return;const i=t,s=this.getBaseAttributesStorage(),r=this.attribute,n=new Map;let a=!1;for(const t in i){if(!Object.prototype.hasOwnProperty.call(i,t))continue;a=!0;const e=r[t],o=i[t];s[t]=o,r[t]=o,hn(e,o)||n.set(t,{prev:e,next:o})}a&&(this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!0,this.submitUpdateByDelta(n),this.onAttributeUpdate(e))}applyAnimationTransientAttributes(t,e=!1,i){const s=t;let r,n=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r||(this.detachAttributeFromBaseAttributes(),r=this.attribute),r[t]=s[t],!n&&this.needUpdateTag(t)&&(n=!0));r&&(this.attributeMayContainTransientAttrs=!0,this.valid=this.isValid(),this.submitTouchedUpdate(n),this.onAttributeUpdate(i))}applyTransientAttributes(t,e=!1,i){this.detachAttributeFromBaseAttributes();const s=new Map,r=Object.keys(t);for(let e=0;e<r.length;e++){const i=r[e],n=this.attribute[i],a=t[i];hn(n,a)||(s.set(i,{prev:n,next:a}),this.attribute[i]=a)}s.size&&(this.attributeMayContainTransientAttrs=!0),this.valid=this.isValid(),this.submitUpdateByDelta(s,e),this.onAttributeUpdate(i)}_restoreAttributeFromStaticTruth(t,e){this._syncFinalAttributeFromStaticTruth(e);const i=this._syncAttribute(e);this.submitUpdateByDelta(i),this.onAttributeUpdate(t)}collectStatePatchDeltaKeys(t,e){const i=t?Object.keys(t):[];if(!e)return i;for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(null!=t?t:{},s)&&i.push(s);return i}getStaticTruthValueForStateKey(t,e){var i;const s=null!==(i=this.baseAttributes)&&void 0!==i?i:{},r=e;if(r&&Object.prototype.hasOwnProperty.call(r,t)){const e=r[t],i=s[t];return"deep"===this.stateMergeMode&&on(i)&&on(e)?{hasValue:!0,value:cn(i,e)}:{hasValue:!0,value:e}}return Object.prototype.hasOwnProperty.call(s,t)?{hasValue:!0,value:s[t]}:{hasValue:!1,value:void 0}}syncStatePatchDeltaToTarget(t,e,i,s=!1){let r=jr.NONE;for(let n=0;n<e.length;n++){const a=e[n],o=t[a],l=this.getStaticTruthValueForStateKey(a,i);if(!l.hasValue){Object.prototype.hasOwnProperty.call(t,a)&&(delete t[a],s&&(r=this.mergeAttributeDeltaCategory(r,a,o,void 0)));continue}if(hn(o,l.value))continue;const h=ln(l.value);t[a]=h,s&&(r=this.mergeAttributeDeltaCategory(r,a,o,h))}return r}restoreAttributeFromStatePatchDelta(t,e,i){this.detachAttributeFromBaseAttributes();const s=this.collectStatePatchDeltaKeys(t,e),r=this.finalAttribute;r&&this.syncStatePatchDeltaToTarget(r,s,e,!1);const n=this.syncStatePatchDeltaToTarget(this.attribute,s,e,!0);this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitUpdateByCategory(n),this.onAttributeUpdate(i)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t,e=!1){var i,s;const{dx:r=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;rn.x=r+(null!==(i=t.scrollX)&&void 0!==i?i:0),rn.y=n+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else rn.x=r,rn.y=n;return rn}onAnimateBind(t){this.detachAttributeFromBaseAttributes(),this._emitCustomEvent("animate-bind",t)}visitTrackedAnimates(t){const e=this.forEachTrackedAnimate;"function"!=typeof e?this.animates&&this.animates.forEach(t):e.call(this,t)}hasAnyTrackedAnimate(){var t;const e=this.hasTrackedAnimate;if("function"==typeof e)return e.call(this);const i=this.getTrackedAnimates;return"function"==typeof i?i.call(this).size>0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&It.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new s.OBBBounds),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=gs[t];if(e)return e;if(e=un.userSymbolMap[t],e)return e;if(!0===((i=t=ms[t]||t).startsWith("<svg")||i.startsWith("<?xml"))){const e=new Cs,{svg:i}=e.parse(t);if(!i)return null;const r=s.isArray(i.path)?i.path:[i.path];qr.clear();const n=[];r.forEach((t=>{const e=(new we).fromString(t.d),i={};zs.forEach((e=>{t[e]&&(i[Gs[e]]=t[e])})),n.push({path:e,attribute:i}),qr.union(e.bounds)}));const a=qr.width(),o=qr.height(),l=1/s.max(a,o);n.forEach((t=>t.path.transform(0,0,l,l)));const h=new ps(t,n,!0);return un.userSymbolMap[t]=h,h}var i;const r=(new we).fromString(t),n=r.bounds.width(),a=r.bounds.height(),o=1/s.max(n,a);r.transform(0,0,o,o);const l=new ps(t,r);return un.userSymbolMap[t]=l,l}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const r=this.attribute,n=this.updateAABBBounds(r,i,this._AABBBounds,t),{boundsPadding:a=i.boundsPadding}=r,o=(l=a)?s.isArray(l)?0===l.length?0:1===l.length?l[0]:2===l.length?(ni[0]=l[0],ni[2]=l[0],ni[1]=l[1],ni[3]=l[1],ni):l:l:0;var l;return o&&n.expand(o),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new xt(t);return Gt(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new s.Matrix),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&It.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&It.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&It.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&It.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&It.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&It.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=It.CLEAR_SHAPE}containsPoint(t,e,i,r){if(!r)return!1;if(i===Rt.GLOBAL){const i=new s.Point(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return r.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const r=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,r,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(r)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===Dt.STATE||null!=i&&i>=Dt.ANIMATE_BIND&&i<=Dt.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,r=this.setFinalAttributes;s&&"function"==typeof r&&r.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var r,n;const a=this.context,o=null!==(r=null==a?void 0:a.diffAttrs)&&void 0!==r?r:t,l=null==i?void 0:i.type;if(!e.length||!o||l===Dt.STATE||null!=l&&l>=Dt.ANIMATE_BIND&&l<=Dt.ANIMATE_END)return;const h=this.transientFromAttrsBeforePreventAnimateDiffAttrs===o;let c=h&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;h||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let d=!1;for(let i=0;i<e.length;i++){const r=e[i];if(!Object.prototype.hasOwnProperty.call(o,r))continue;const n=this.attribute[r],a=t[r];s.isEqual(n,a)||(null!=c||(c={}),c[r]=ln(n),d=!0)}d&&(this.transientFromAttrsBeforePreventAnimate=c,this.transientFromAttrsBeforePreventAnimateDiffAttrs=o)}consumeTransientFromAttrsBeforePreventAnimate(t){const e=this.transientFromAttrsBeforePreventAnimate,i=this.transientFromAttrsBeforePreventAnimateDiffAttrs;if(!e||!i)return null;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&(!Object.prototype.hasOwnProperty.call(i,e)||!s.isEqual(i[e],t[e])))return null;let r=null,n=!1;for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)?(null!=r||(r={}),r[i]=e[i]):n=!0);if(n){const i={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=e[s]);this.transientFromAttrsBeforePreventAnimate=i}else this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null;return r}setAttributes(t,e=!1,i){t&&((t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),t.texture&&pn(t.texture)&&this.loadImage(t.texture,!1),t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i))}_setAttributes(t,e=!1,i){this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,e,i):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(e,i))}setAttribute(t,e,i,s){const r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(r)this._setAttributes(r,i,s);else if(this.canCommitBaseAttributesByTouchedKeys())this.commitBaseAttributeBySingleKey(t,e,!!i,s);else{const r={[t]:e};this.applyBaseAttributes(r),this.commitBaseAttributeMutation(!!i,s)}"background"===t?this.loadImage(e,!0):"texture"===t&&pn(e)?this.loadImage(e,!1):"shadowGraphic"===t&&this.setShadowGraphic(e)}needUpdateTags(t,e=Jr){for(let i=0;i<e.length;i++){const s=e[i];if(-1!==t.indexOf(s))return!0}return!1}needUpdateTag(t,e=Jr){for(let i=0;i<e.length;i++)if(t===e[i])return!0;return!1}initAttributes(t){const e={type:Dt.INIT};t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,e)||t,this.attribute=t,this._baseAttributes=void 0,this.resolvedStatePatch=void 0,this.attributeMayContainTransientAttrs=!1,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0),t.texture&&pn(t.texture)&&this.loadImage(t.texture,!1),t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._updateTag=It.INIT,this.valid=this.isValid(),this.onAttributeUpdate(e)}translate(t,e){var i,s;if(0===t&&0===e)return this;const r={type:Dt.TRANSLATE},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Qr,r);n&&(t=n.x,e=n.y,delete n.x,delete n.y);const a=this.baseAttributes,o=a.postMatrix,l=n||{};if(o){const i=o.clone();dt.transformUtil.fromMatrix(i,i).translate(t,e),l.postMatrix=i}else l.x=(null!==(i=a.x)&&void 0!==i?i:Re.x)+t,l.y=(null!==(s=a.y)&&void 0!==s?s:Re.y)+e;return this.commitInternalBaseAttributes(l,r),this}translateTo(t,e){const i=this.baseAttributes;if(i.x===t&&i.y===e)return this;const s={type:Dt.TRANSLATE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Qr,s);return r?(this.commitInternalBaseAttributes(r,s),this):(this.commitInternalBaseAttributes({x:t,y:e},s),this)}scale(t,e,i){var r,n;if(1===t&&1===e)return this;const a={type:Dt.SCALE},o=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e,scaleCenter:i},this.attribute,tn,a);o&&(t=o.scaleX,e=o.scaleY,delete o.scaleX,delete o.scaleY);const l=this.baseAttributes,h=o||{};if(i){let{postMatrix:r}=this.baseAttributes;r=r?r.clone():new s.Matrix,dt.transformUtil.fromMatrix(r,r).scale(t,e,i),h.postMatrix=r}else h.scaleX=(null!==(r=l.scaleX)&&void 0!==r?r:Re.scaleX)*t,h.scaleY=(null!==(n=l.scaleY)&&void 0!==n?n:Re.scaleY)*e;return this.commitInternalBaseAttributes(h,a),this}scaleTo(t,e){const i=this.baseAttributes;if(i.scaleX===t&&i.scaleY===e)return this;const s={type:Dt.SCALE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e},this.attribute,tn,s);return r?(this.commitInternalBaseAttributes(r,s),this):(this.commitInternalBaseAttributes({scaleX:t,scaleY:e},s),this)}rotate(t,e){var i;if(0===t)return this;const r={type:Dt.ROTATE},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({angle:t,rotateCenter:e},this.attribute,en,r);n&&delete n.angle;const a=this.baseAttributes,o=n||{};if(e){let{postMatrix:i}=this.baseAttributes;i=i?i.clone():new s.Matrix,dt.transformUtil.fromMatrix(i,i).rotate(t,e),o.postMatrix=i}else o.angle=(null!==(i=a.angle)&&void 0!==i?i:Re.angle)+t;return this.commitInternalBaseAttributes(o,r),this}rotateTo(t){if(this.baseAttributes.angle===t)return this;const e={type:Dt.ROTATE_TO},i=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,en,e);return i?(this.commitInternalBaseAttributes(i,e),this):(this.commitInternalBaseAttributes({angle:t},e),this)}skewTo(t,e){return this}onAttributeUpdate(t){t&&t.skipUpdateCallback||(this.getGraphicService().onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds(),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds(),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!s.isNil(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}getStateResolveBaseAttrs(){var t;return null!==(t=this.baseAttributes)&&void 0!==t?t:this.attribute}syncStateResolveContext(t=this.getStateResolveBaseAttrs()){var e;return null===(e=this.stateEngine)||void 0===e||e.setResolveContext(this,t),t}ensureStateEngine(t=this.getStateResolveBaseAttrs()){const{compiledDefinitions:e}=this.resolveEffectiveCompiledDefinitions();return this.compiledStateDefinitions=e,e?this.stateEngine&&this.stateEngineCompiledDefinitions===e&&this.stateEngineStateSort===this.stateSort&&this.stateEngineMergeMode===this.stateMergeMode||(this.stateEngine=new Ur({compiledDefinitions:e,stateSort:this.stateSort,mergeMode:this.stateMergeMode}),this.stateEngineCompiledDefinitions=e,this.stateEngineStateSort=this.stateSort,this.stateEngineMergeMode=this.stateMergeMode):(this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0),this.syncStateResolveContext(t),this.stateEngine&&this.currentStates&&!this.sameStateNames(this.stateEngine.activeStates,this.currentStates)&&this.stateEngine.applyStates(this.currentStates),this.stateEngine}toGraphicStateTransition(t){return{changed:t.changed,states:[...t.activeStates],effectiveStates:[...t.effectiveStates]}}sortLocalStates(t){return this.stateSort?[...t].sort(this.stateSort):[...t]}resolveLocalUseStatesTransition(t){var e;if(!t.length)return this.resolveLocalClearStatesTransition();const i=null!==(e=this.currentStates)&&void 0!==e?e:nn,s=i.length!==t.length||t.some(((t,e)=>i[e]!==t)),r=this.sortLocalStates(t);return{changed:s,states:s?r:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const r=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(r)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),r=this.ensureStateEngine(s);e&&(null==r||r.invalidateResolverCache());const n=r?this.toGraphicStateTransition(r.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:n,effectiveStates:null!==(i=n.effectiveStates)&&void 0!==i?i:n.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},r=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of r){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!hn(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const r=null!==(s=this.currentStates)&&void 0!==s?s:nn,n=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(n,l);h&&!this.beforeStateUpdate(l,r,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Dt.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:Dt.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:Ks}applyStateAttrs(t,e,i,s,r,n){const a=i?this.resolveStateAnimateConfig(r):void 0,o=a?{animateConfig:a,extraAnimateAttrs:n,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:n,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const r=null!==(e=this.currentStates)&&void 0!==e?e:nn,n=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===r.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?ln(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,r,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Dt.STATE}):this.restoreAttributeFromStatePatchDelta(n,void 0,{type:Dt.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,r;const{hasAnimation:n,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:nn,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(r=this.registeredActiveScopes)||void 0===r?void 0:r.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,n,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,n)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(n)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:nn,r=this.resolvedStatePatch,{transition:n,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!n.changed&&this.sameStateNames(s,n.states)||this.beforeStateUpdate(o,s,n.states,e,!1)&&(this.currentStates=n.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,n.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Dt.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:Dt.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Dt.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!==s[t])return!1;return!0}addUpdateBoundTag(){this._updateTag|=It.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdatePaintTag(){this._updateTag|=It.UPDATE_PAINT}addUpdateShapeTag(){this._updateTag|=It.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=It.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addBroadUpdateTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=It.UPDATE_SHAPE_AND_BOUNDS|It.UPDATE_PAINT|It.UPDATE_GLOBAL_LOCAL_MATRIX|It.UPDATE_LAYOUT,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&It.UPDATE_SHAPE_AND_BOUNDS)===It.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=It.CLEAR_BOUNDS}clearUpdatePaintTag(){this._updateTag&=It.CLEAR_PAINT}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=It.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=It.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=It.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=It.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=It.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=It.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&It.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],r=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=r();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=r();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Re.x,y:e=Re.y,scaleX:i=Re.scaleX,scaleY:r=Re.scaleY,angle:n=Re.angle,scaleCenter:a,anchor:o,postMatrix:l}=this.attribute;let h=[0,0];const c={};if(o&&n&&(h=this.getAnchor(o,c)),!a||1===i&&1===r)s.normalTransform(this._transMatrix,this._transMatrix.reset(),t,e,i,r,n,o&&h);else{const s=this._transMatrix;s.reset(),s.translate(h[0],h[1]),s.rotate(n),s.translate(-h[0],-h[1]),s.translate(t,e),h=this.getAnchor(a,c,!0),dt.transformUtil.fromMatrix(s,s).scale(i,r,{x:h[0],y:h[1]})}const d=this.getOffsetXY(Re);if(this._transMatrix.e+=d.x,this._transMatrix.f+=d.y,l){const t=Zr.setValue(l.a,l.b,l.c,l.d,l.e,l.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){var i,s,r,n,a,o,l,h,c,d;const u=null!==(r=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==r?r:dt.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(n=this.currentStates)||void 0===n?void 0:n.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:Dt.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:Dt.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=dt.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return s.isString(t,!0)?this.pathProxy=(new we).fromString(t):this.pathProxy=new we,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("<svg")||s.isValidUrl(t)||t.includes("/")||s.isBase64(t)):!!(t.fill||t.stroke||"string"==typeof t.gradient&&Array.isArray(t.stops))}(t)))return void(this.backgroundImg=!1);if(!t)return;const i=t;this.resources||(this.resources=new Map);const r={data:"init",state:null};this.resources.set(i,r),"string"==typeof t?(r.state="loading",t.startsWith("<svg")?(ii.GetSvg(t,this),this.backgroundImg=this.backgroundImg||e):(s.isValidUrl(t)||t.includes("/")||s.isBase64(t))&&(ii.GetImage(t,this),this.backgroundImg=this.backgroundImg||e)):s.isObject(t)?(r.state="success",r.data=t,this.backgroundImg=this.backgroundImg||e):r.state="fail"}setShadowGraphic(t){t?this.attachShadow().add(t):this.detachShadow()}imageLoadSuccess(t,e,i){if(!this.resources)return;const s=this.resources.get(t);s&&(s.state="success",s.data=e,i&&i(),this.addUpdateBoundTag(),this.stage&&this.stage.renderNextFrame())}imageLoadFail(t,e){if(!this.resources)return;const i=this.resources.get(t);i&&(i.state="fail",e&&e())}_stopAnimates(){if(!this.mayHaveTrackedAnimates())return;const t=[];this.visitTrackedAnimates((e=>{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const r=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:dt.graphicService;null===(s=null==r?void 0:r.onRelease)||void 0===s||s.call(r,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const r=new vt(t,e);r.bubbles=!1;const n=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return n?(r.manager=n,this.dispatchEvent(r)):bt.prototype.dispatchEvent.call(this,r)}return!0}beforeStateUpdate(t,e,i,s,r){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:Dt.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!r})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:Dt.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||dt.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Pr(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}function pn(t){return!!t&&("string"==typeof t?!sn.has(t)&&(t.startsWith("<svg")||s.isValidUrl(t)||t.includes("/")||s.isBase64(t)):s.isObject(t))}un.userSymbolMap={},un.mixin(yt);const gn={arc:Ve,area:Ge,circle:ze,line:We,path:$e,symbol:Ze,text:Je,rect:qe,polygon:Ye,star:Xe,richtext:Qe,richtextIcon:ei,image:ti,group:Ke,glyph:He},mn=Object.keys(gn);function fn(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const vn={arc:Object.assign({},gn.arc),area:Object.assign({},gn.area),circle:Object.assign({},gn.circle),line:Object.assign({},gn.line),path:Object.assign({},gn.path),symbol:Object.assign({},gn.symbol),text:Object.assign({},gn.text),rect:Object.assign({},gn.rect),polygon:Object.assign({},gn.polygon),star:Object.assign({},gn.star),richtext:Object.assign({},gn.richtext),richtextIcon:Object.assign({},gn.richtextIcon),image:Object.assign({},gn.image),group:Object.assign({},gn.group),glyph:Object.assign({},gn.glyph)};class yn{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},mn.forEach((t=>{this._defaultTheme[t]=Object.create(vn[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const r=this.getParentWithTheme(t);if(r){const t=r.theme;(t.dirty||i)&&t.applyTheme(r,e,!0)}this.userTheme?this.doCombine(r&&r.theme.combinedTheme):(r?this.combinedTheme=r.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,s.Logger.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;mn.forEach((s=>{const r=Object.create(vn[s]);t&&t[s]&&fn(r,t[s]),i[s]&&fn(r,i[s]),e[s]&&fn(r,e[s]),this.combinedTheme[s]=r})),e.common&&mn.forEach((t=>{fn(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const _n=new yn;function bn(t,e){return t.glyphHost?bn(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):_n.getTheme()}return null}(t)||t.attachedThemeGraphic&&bn(t.attachedThemeGraphic)||_n.getTheme()}var Sn;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Sn||(Sn={}));class xn extends un{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Rs,this._childUpdateTag=It.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;var i,s;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(Hr(this.sharedStateScope,t),i=this.sharedStateScope,s=this.stage,i.subtreeActiveDescendants.size&&(i.subtreeActiveDescendants.forEach((t=>{var e;t.sharedStateDirty=!0,Xr(null!==(e=null!=s?s:t.stage)&&void 0!==e?e:i.ownerStage,t)})),Yr(null!=s?s:i.ownerStage))),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new yn),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new yn)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Rt.GLOBAL){const i=new s.Point(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&It.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Re.x,y:e=Re.y,dx:i=Re.dx,dy:s=Re.dy,scaleX:r=Re.scaleX,scaleY:n=Re.scaleY,angle:a=Re.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==r||1!==n||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return bn(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:r,height:n,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=n&&i.set(0,0,Math.max(0,r),Math.max(0,n)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return dt.graphicService.updateTempAABBBounds(i),dt.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=It.CLEAR_BOUNDS,this._childUpdateTag&=It.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=It.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&It.UPDATE_BOUNDS||(this._childUpdateTag|=It.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,r,n,a,o;const l=null!==(r=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==r?r:dt.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(n=this.currentStates)||void 0===n?void 0:n.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&It.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=dt.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new xn(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xn.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&Hr(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return Wr({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}}function An(t){return new xn(t)}xn.NOWORK_ANIMATE_ATTR=dn;var Tn=function(t,e,i,s){return new(i||(i=Promise))((function(r,n){function a(t){try{l(s.next(t))}catch(t){n(t)}}function o(t){try{l(s.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function Cn(t,e,i){const s={},r=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],r.push(i))}),i),r.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:r}}function kn(t,e,i,s=!1){return Tn(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function wn(t,e,i,s=!1){let r=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return r=!0,!0;return!1}),s);let n=null,a=!1;if(r){const{childMap:r,zIdxArray:o}=Cn(t,i,s);let l=!1;for(let t=0;t<o.length&&!l;t++){const i=r[o[t]];for(let t=0;t<i.length;t++){if(a){l=!0,n=i[t];break}i[t]._uid!==e||(a=!0)}}}else t.forEachChildren((t=>a?(n=t,!0):(t._uid===e&&(a=!0),!1)),s);return n}const Mn=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new s.AABBBounds)}allocate(t,e,i,r){if(!this.pools.length)return(new s.AABBBounds).setValue(t,e,i,r);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=r,n}allocateByObj(t){if(!this.pools.length)return new s.AABBBounds(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const En=new class{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Hs(Object.assign({nativeCanvas:dt.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Hs(Object.assign({nativeCanvas:dt.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Bn{constructor(){this.time=Nt.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,r,n,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:y=l.backgroundFit,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:S=l.backgroundOffsetX,backgroundOffsetY:x=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:T=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const r=t.resources.get(Pn(g));if(!r||"success"!==r.state||!r.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=bn(t.parent).group,{scrollX:s=i.scrollX,scrollY:r=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,r)}A&&e.clip();const n=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,r.data,n,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:S,backgroundOffsetY:x,backgroundPosition:T}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){Nn(t,e,i,s)}}new Bn;const On=new Set(["top","center","bottom"]);function Pn(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function In({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Rn={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Dn(t,e,i,s,r){if("number"==typeof t&&Number.isFinite(t))return t;const n=`${null!=t?t:""}`.trim().toLowerCase();if(!n||n===i)return 0;if(n===s)return e/2;if(n===r)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(n))return e*parseFloat(n)/100;const a=Number(n);return Number.isFinite(a)?a:0}function Ln(t,e,i){const[s,r]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:On.has(t)?["center",t]:[t,"center"]}let r,n;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):n=e:r=e}return null==r&&a.length&&(r=a.shift()),null==n&&a.length&&(n=a.shift()),[null!=r?r:"left",null!=n?n:"top"]}(t);return{x:Dn(s,e,"left","center","right"),y:Dn(r,i,"top","center","bottom")}}function Fn(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Nn(t,e,i,s){var r,n;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),m=function(t){if(!t)return null;const e=Fn(t.naturalWidth,t.videoWidth,t.width),i=Fn(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}(e),{backgroundRepeatMode:f,backgroundSizing:v}=function({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Rn[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:In({backgroundFit:e,backgroundKeepAspectRatio:i})}}({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===f){let s=null!==(r=null==m?void 0:m.width)&&void 0!==r?r:p,a=null!==(n=null==m?void 0:m.height)&&void 0!==n?n:g;if("cover"!==v&&"contain"!==v||!m)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/m.width,g/m.height):Math.min(p/m.width,g/m.height);s=m.width*t,a=m.height*t}s*=h,a*=h;const{x:o,y:l}=Ln(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==f&&m){const i=m.width,s=m.height;"repeat-x"===f?(y=i*(g/s),_=g):"repeat-y"===f&&(_=s*(p/i),y=p);const r=t.dpr,n=En.allocate({width:y,height:_,dpr:r}),a=n.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=n.nativeCanvas),En.free(n)}const b=t.dpr,S=t.createPattern(e,f);S.setTransform&&S.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=S,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class Un{constructor(t){this.subRenderContribitions=t,this.time=Nt.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,r,n,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,r,n,a,o,l,h,c,d,u)}))}}const jn=new class{constructor(){this.time=Nt.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,r,n,a,o,l,h,c,d,u){var p,g;const{clipConfig:m}=t.attribute;if(!m)return;const f=t.getClipPath();if(!f)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===f.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Vn=new class{constructor(){this.time=Nt.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,r,n,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}},Gn={getContributions:()=>[]};class zn{constructor(t=[],e=Gn,i={}){var r,n,a,o,l,h;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var r;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):function(t,e,i,s=!1,r=!1){let n=!1;if(r)n=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:r=e}=t.attribute;if(0===s)i=r;else if(i!==r)return n=!0,!0;return!1}),s)}if(n){const{childMap:n,zIdxArray:a}=Cn(t,e,s);let o=!1;for(let t=0;t<a.length&&!o;t++){const e=n[a[t]];r&&e.sort(((t,e)=>{var i,r;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(r=t.attribute.z)&&void 0!==r?r:0))}));for(let t=0;t<e.length;t++)if(i(e[t],t)){o=!0;break}}}else t.forEachChildren(i,s)}(e,je.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(r=i.context)||void 0===r?void 0:r.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new s.Bounds,this.backupDirtyBounds=new s.Bounds,this.global=null!==(r=i.global)&&void 0!==r?r:dt.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:dt.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(o=null===(a=this.rendererRegistry)||void 0===a?void 0:a.getAll())&&void 0!==o?o:this.contributions,this.drawItemInterceptorContributions=null!==(h=null!==(l=i.drawItemInterceptorContributions)&&void 0!==l?l:this.drawItemInterceptorContributions)&&void 0!==h?h:Gn,s.isArray(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:r,stage:n,viewBox:a,transMatrix:o}=e;if(!r)return;const l=this.dirtyBounds.setValue(0,0,a.width(),a.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=s.getRectIntersect(l,n.dirtyBounds,!1);l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}const h=r.dpr%1;(h||.5!==h)&&(l.x1=Math.floor(l.x1*r.dpr)/r.dpr,l.y1=Math.floor(l.y1*r.dpr)/r.dpr,l.x2=Math.ceil(l.x2*r.dpr)/r.dpr,l.y2=Math.ceil(l.y2*r.dpr)/r.dpr),this.backupDirtyBounds.copy(l),r.reset(!1),r.save(),r.setClearMatrix(o.a,o.b,o.c,o.d,o.e,o.f),r.clearMatrix(!1),r.translate(a.x1,a.y1,!0),r.beginPath(),r.rect(l.x1,l.y1,l.width(),l.height()),r.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,r,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:je.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:je.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Mr.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),r.restore(),r.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=wn(e,i,je.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,r){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!s.isRectIntersect(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,a=i;if(this.useDirtyBounds){n=Mn.allocateByObj(this.dirtyBounds);const e=t.transMatrix;a=Mr.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(a.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:r,nextM:a},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Mn.free(n),Mr.free(a))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:r}=i;let n=r.get(t._uid);n||(n={layer:this.layerService.createLayer(s),zIndex:r.size,group:t},r.set(t._uid,n));const a=n.layer.getNativeHandler().getContext(),o=n.drawContribution||function(){const t=dt.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:n.layer,context:a,startAtId:t._uid,break:!1})),n.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=r.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:r.size},r.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s<this.InterceptorContributions.length;s++){const r=this.InterceptorContributions[s];if(r.beforeDrawItem&&r.beforeDrawItem(t,this.currentRenderService,e,this,i))return}const r=this.getRenderContribution(t);if(!r)return;let n,a=!1;if(e.isGroupScroll){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;a=!0,this.scrollMatrix||(this.scrollMatrix=Mr.allocate(1,0,0,1,0,0)),this.scrollMatrix.translate(-e,-i)}if(a&&(n=this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix)),this.useDirtyBounds&&!t.isContainer&&"empty"!==t.attribute.boundsMode&&!s.isRectIntersect(t.AABBBounds,null!=n?n:this.dirtyBounds,!1)){if(a&&t.parent){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;this.scrollMatrix&&this.scrollMatrix.translate(e,i)}return}const o=null!=e.startAtId&&t._uid!==e.startAtId;if(t._uid===e.startAtId&&(e.startAtId=null),i&&(i.skipDraw=o),o?t.isContainer&&r.draw(t,this.currentRenderService,e,i):r.draw(t,this.currentRenderService,e,i),a&&t.parent){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;this.scrollMatrix&&this.scrollMatrix.translate(e,i)}if(this.InterceptorContributions.length)for(let i=0;i<this.InterceptorContributions.length;i++){const s=this.InterceptorContributions[i];if(s.afterDrawItem&&s.afterDrawItem(t,this.currentRenderService,e,this))return}}selectRenderByType(t){return s.Logger.getInstance().warn("未知错误,不应该走到这里"),null}selectRenderByNumberType(t,e){let i;if(e.attribute.renderStyle){const s=this.styleRenderMap.get(e.attribute.renderStyle);i=s&&s.get(t)}return i||this.currentRenderMap.get(t)||this.defaultRenderMap.get(t)}clearScreen(t,e,i){var s,r,n,a,o,l,h,c,d,u,p;const{clear:g,viewBox:m}=i,f=m.width(),v=m.height();if(g){e.clearRect(0,0,f,v),(null===(s=t.drawParams)||void 0===s?void 0:s.stage)&&t.drawParams.stage.hooks.afterClearRect.call(t.drawParams);const i=null===(r=t.drawParams)||void 0===r?void 0:r.stage;if(i&&(e.globalAlpha=(null!==(n=i.attribute.opacity)&&void 0!==n?n:1)*(null!==(a=i.attribute.backgroundOpacity)&&void 0!==a?a:1)),i&&i.backgroundImg&&i.resources){const t=i.resources.get(Pn(g));if(t&&"success"===t.state&&t.data){const s=Mn.allocate(0,0,0+f,0+v);Nn(e,t.data,s,{backgroundMode:null!==(o=i.attribute.backgroundMode)&&void 0!==o?o:je.backgroundMode,backgroundFit:null!==(l=i.attribute.backgroundFit)&&void 0!==l?l:je.backgroundFit,backgroundKeepAspectRatio:null!==(h=i.attribute.backgroundKeepAspectRatio)&&void 0!==h?h:je.backgroundKeepAspectRatio,backgroundScale:null!==(c=i.attribute.backgroundScale)&&void 0!==c?c:je.backgroundScale,backgroundOffsetX:null!==(d=i.attribute.backgroundOffsetX)&&void 0!==d?d:je.backgroundOffsetX,backgroundOffsetY:null!==(u=i.attribute.backgroundOffsetY)&&void 0!==u?u:je.backgroundOffsetY,backgroundPosition:null!==(p=i.attribute.backgroundPosition)&&void 0!==p?p:je.backgroundPosition}),Mn.free(s)}}else e.fillStyle=xr(e,g,{AABBBounds:{x1:0,y1:0,x2:0+f,y2:0+v}},0,0),e.fillRect(0,0,f,v)}}afterDraw(t,e){}}class Kn{constructor(t=new zn){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class Hn{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}const Wn={getContributions:()=>[]};class $n{constructor(t=Wn,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new Hn}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}let Yn;function Xn(t){const e=dt.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}class qn{static GenerateLayerId(){return`${qn.idprefix}_${qn.prefix_count++}`}constructor(t=dt.global,e=new oa,i=Xn){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const r=this.getLayerHandler(s),n=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:qn.GenerateLayerId(),layerHandler:r})}),a=this.layerMap.get(t)||[];return a.push(n),this.layerMap.set(t,a),this.staticLayerCountInEnv--,n}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}}qn.idprefix="visactor_layer",qn.prefix_count=0;class Zn{constructor(){this.registry=new Map}create(t,e){const i=this.registry.get(t);if(!i)throw new Error(`GraphicFactory has no creator registered for type "${t}"`);return new i(e)}register(t,e){if(!t)throw new Error("GraphicFactory requires a non-empty graphic type");this.registry.set(t,e)}}class Jn{constructor(){this.store=new Map}registerStore(t,e){this.store.set(t,e),this[t]=e}RegisterGraphicCreator(t,e){ia(t,e)}CreateGraphic(t,e){return this.store.has(t)?sa(t,e):null}}const Qn=Symbol.for("@visactor/vrender-core/graphic-registry");const ta=function(){const t=globalThis;return t[Qn]||(t[Qn]={graphicCreator:new Jn,graphicFactory:new Zn}),t[Qn]}(),ea=ta.graphicCreator;function ia(t,e){if(!t)throw new Error("Graphic registration requires a non-empty graphic type");ea.registerStore(t,e),ta.graphicFactory.register(t,function(t){return class{constructor(e){try{return new t(e)}catch(i){return t(e)}}}}(e))}function sa(t,e){return ta.graphicFactory.create(t,e)}function ra(t,e,i){var s;const{x:r=i.x,y:n=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,y=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=f[1];y[2]=null!==(s=f[2])&&void 0!==s?s:0}if(Ar(t),Tr(t,t,[r+o,n+l,a+h]),Tr(t,t,[y[0],y[1],y[2]]),function(t,e,i){const s=Math.sin(i),r=Math.cos(i),n=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=n*r+h*s,t[5]=a*r+c*s,t[6]=o*r+d*s,t[7]=l*r+u*s,t[8]=h*r-n*s,t[9]=c*r-a*s,t[10]=d*r-o*s,t[11]=u*r-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),r=Math.cos(i),n=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=n*r-h*s,t[1]=a*r-c*s,t[2]=o*r-d*s,t[3]=l*r-u*s,t[8]=n*s+h*r,t[9]=a*s+c*r,t[10]=o*s+d*r,t[11]=l*s+u*r}(t,t,p),Tr(t,t,[-y[0],-y[1],y[2]]),function(t,e,i){const s=i[0],r=i[1],n=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=Er.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}Tr(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),r=Math.cos(i),n=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=n*r+h*s,t[1]=a*r+c*s,t[2]=o*r+d*s,t[3]=l*r+u*s,t[4]=h*r-n*s,t[5]=c*r-a*s,t[6]=d*r-o*s,t[7]=u*r-l*s}(i,i,m),Tr(i,i,[-s[0],-s[1],0]),Cr(t,t,i)}}class na{constructor(t=ea){this.creator=t,this.hooks={onAttributeUpdate:new lt(["graphic"]),onSetStage:new lt(["graphic","stage"]),onRemove:new lt(["graphic"]),onRelease:new lt(["graphic"]),onAddIncremental:new lt(["graphic","group","stage"]),onClearIncremental:new lt(["graphic","group","stage"]),beforeUpdateAABBBounds:new lt(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new lt(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new lt(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new s.AABBBounds,this.tempAABBBounds2=new s.AABBBounds,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,r){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,r)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updateHTMLTextAABBBounds(t,e,i,r){const{textAlign:n,textBaseline:a}=t;if(null!=t.forceBoundsHeight){const e=s.isNumber(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),r=function(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}(a,e,e);i.set(i.x1,r,i.x2,r+e)}if(null!=t.forceBoundsWidth){const e=s.isNumber(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),r=function(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}(n,e);i.set(r,i.y1,r+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,r,n){if(!e.empty()){const{scaleX:s=i.scaleX,scaleY:n=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){ks(d,(l+h)/Math.abs(s+n),r,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:r=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;ks(d,o/Math.abs(s+n)*2,!1,c+1),d.translate(r,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let a=!0;const o=n.transMatrix;n&&n.isContainer&&(a=!(1===o.a&&0===o.b&&0===o.c&&1===o.d&&0===o.e&&0===o.f)),a&&s.transformBoundsWithMatrix(e,e,o)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:r=e.visible}=t;return!(!s.valid||!r)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}class aa extends xn{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var r;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(r=s.zIndex)&&void 0!==r?r:0}),this.layer=this,this.subLayers=new Map,this.theme=new yn,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{dt.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{dt.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}class oa{constructor(t=aa){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let la=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};la._pluginClasses=function(){const t=globalThis;return t[nt]||(t[nt]={pluginClasses:{}}),t[nt]}().pluginClasses;class ha{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Z.Get(e,q.Color1),this.ambient=i;const r=s.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/r,t[1]/r,t[2]/r]}computeColor(t,e){const i=this.formatedDir,r=s.min(s.max((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=s.isString(e)?Z.Get(e,q.Color1):e;const a=this.colorRgb;return`rgb(${a[0]*n[0]*r}, ${a[1]*n[1]*r}, ${a[2]*n[2]*r})`}}const ca=()=>{la.registerPlugin("DirectionalLight",ha)};class da{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=Er.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Er.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,r){let n,a,o,l,h,c,d,u,p,g;const m=e[0],f=e[1],v=e[2],y=r[0],_=r[1],b=r[2],S=i[0],x=i[1],A=i[2];Math.abs(m-S)<s.epsilon&&Math.abs(f-x)<s.epsilon&&Math.abs(v-A)<s.epsilon?Ar(t):(d=m-S,u=f-x,p=v-A,g=1/Math.hypot(d,u,p),d*=g,u*=g,p*=g,n=_*p-b*u,a=b*d-y*p,o=y*u-_*d,g=Math.hypot(n,a,o),g?(g=1/g,n*=g,a*=g,o*=g):(n=0,a=0,o=0),l=u*o-p*a,h=p*n-d*o,c=d*a-u*n,g=Math.hypot(l,h,c),g?(g=1/g,l*=g,h*=g,c*=g):(l=0,h=0,c=0),t[0]=n,t[1]=l,t[2]=d,t[3]=0,t[4]=a,t[5]=h,t[6]=u,t[7]=0,t[8]=o,t[9]=c,t[10]=p,t[11]=0,t[12]=-(n*m+a*f+o*v),t[13]=-(l*m+h*f+c*v),t[14]=-(d*m+u*f+p*v),t[15]=1)}(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Er.allocate()),this._vp=Cr(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Er.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Er.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return function(t,e,i,s,r,n,a){const o=1/(e-i),l=1/(s-r),h=1/(n-a);t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+i)*o,t[13]=(r+s)*l,t[14]=(a+n)*h,t[15]=1}(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=Er.allocate()),this._vp=Cr(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return kr(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:r}=this._params.viewParams;kr(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const n=this.getProjectionScale(i);return{x:t*n+r[0],y:e*n+r[1]}}}const ua=()=>{la.registerPlugin("OrthoCamera",da)};class pa{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=at.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const r=t.page.x-this.pageX,n=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=r/100,o=n/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}let ga=0;function ma(){return ga>=9999999&&(ga=0),ga++}class fa{constructor(t){this.id=ma(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}var va;const ya=Symbol.for("@visactor/vchart/factory-registry@2.1.1"),_a=globalThis,ba=null!==(va=_a[ya])&&void 0!==va?va:_a[ya]={charts:{},series:{},components:{},graphicComponents:{},marks:{},regions:{},animations:{},implements:{},chartPlugin:{},vChartPlugin:{},componentPlugin:{},transforms:{fields:i.fields,filter:i.filter,fold:i.fold},dataParser:{csv:i.csvParser,dsv:i.dsvParser,tsv:i.tsvParser},layout:{},grammarTransforms:{},stageEventPlugins:{},interactionTriggers:{},composedEventMap:{},tooltipProcessors:{},formatter:void 0};class Sa{static registerChart(t,e){Sa._charts[t]=e}static registerSeries(t,e){Sa._series[t]=e}static registerComponent(t,e,i,s){Sa._components[t]={cmp:e,alwaysCheck:i,createOrder:null!=s?s:0}}static registerGraphicComponent(t,e){Sa._graphicComponents[t]=e}static createGraphicComponent(t,e,i){const s=Sa._graphicComponents[t];return s?s(e,i):null}static registerMark(t,e){Sa._marks[t]=e}static registerRegion(t,e){Sa._regions[t]=e}static registerTransform(t,e){Sa.transforms[t]=e}static registerGrammarTransform(t,e){Sa._grammarTransforms[t]=e}static getGrammarTransform(t){return Sa._grammarTransforms[t]}static registerLayout(t,e){Sa._layout[t]=e}static registerAnimation(t,e){Sa._animations[t]=e}static registerImplement(t,e){Sa._implements[t]=e}static registerChartPlugin(t,e){Sa._chartPlugin[t]=e}static registerVChartPlugin(t,e){Sa._vChartPlugin[t]=e}static registerComponentPlugin(t,e){Sa._componentPlugin[t]=e}static createChart(t,e,i){return Sa._charts[t]?new Sa._charts[t](e,i):null}static getChart(t){return Sa._charts[t]}static createChartSpecTransformer(t,e){if(!Sa._charts[t])return null;const i=Sa._charts[t];return new i.transformerConstructor(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){return Sa._regions[t]?new Sa._regions[t](e,i):null}static createRegionSpecTransformer(t,e){return Sa._regions[t]?new Sa._regions[t].transformerConstructor(e):null}static createSeries(t,e,i){return Sa._series[t]?new Sa._series[t](e,i):null}static createSeriesSpecTransformer(t,e){return Sa._series[t]?new Sa._series[t].transformerConstructor(e):null}static createMark(t,e,i){if(!Sa._marks[t])return null;const s=new Sa._marks[t](e,i);return"group"===s.type&&s.setMarkConfig({interactive:!1}),s}static getComponents(){return Object.values(Sa._components)}static getComponentInKey(t){return Sa._components[t].cmp}static getLayout(){return Object.values(Sa._layout)}static getLayoutInKey(t){return Sa._layout[t]}static getSeries(){return Object.values(Sa._series)}static getSeriesInType(t){return Sa._series[t]}static getRegionInType(t){return Sa._regions[t]}static getAnimationInKey(t){return Sa._animations[t]}static getImplementInKey(t){return Sa._implements[t]}static getSeriesMarkMap(t){return Sa._series[t]?Sa._series[t].mark:{}}static getSeriesBuiltInTheme(t){for(const e in Sa._series){const i=Sa._series[e];if(i&&i.builtInTheme&&i.builtInTheme[t])return i.builtInTheme[t]}return null}static getComponentBuiltInTheme(t){for(const e in Sa._components){const i=Sa._components[e];if(i&&i.cmp&&i.cmp.builtInTheme&&i.cmp.builtInTheme[t])return i.cmp.builtInTheme[t]}return null}static getChartPlugins(){return Object.values(Sa._chartPlugin)}static getVChartPlugins(){return Object.values(Sa._vChartPlugin)}static getComponentPlugins(){return Object.values(Sa._componentPlugin)}static getComponentPluginInType(t){return Sa._componentPlugin[t]}static registerFormatter(t){this._formatter=t,ba.formatter=t}static getFormatter(){var t;return null!==(t=ba.formatter)&&void 0!==t?t:this._formatter}static createInteractionTrigger(t,e){const i=Sa._interactionTriggers[t];return i?new i(e):null}static hasInteractionTrigger(t){return!!Sa._interactionTriggers[t]}static getComposedEvent(t){return Sa._composedEventMap[t]}}Sa._charts=ba.charts,Sa._series=ba.series,Sa._components=ba.components,Sa._graphicComponents=ba.graphicComponents,Sa._marks=ba.marks,Sa._regions=ba.regions,Sa._animations=ba.animations,Sa._implements=ba.implements,Sa._chartPlugin=ba.chartPlugin,Sa._vChartPlugin=ba.vChartPlugin,Sa._componentPlugin=ba.componentPlugin,Sa.transforms=ba.transforms,Sa.dataParser=ba.dataParser,Sa._layout=ba.layout,Sa._grammarTransforms=ba.grammarTransforms,Sa._stageEventPlugins=ba.stageEventPlugins,Sa.registerStageEventPlugin=(t,e)=>{Sa._stageEventPlugins[t]=e},Sa.getStageEventPlugin=t=>Sa._stageEventPlugins[t],Sa._interactionTriggers=ba.interactionTriggers,Sa.registerInteractionTrigger=(t,e)=>{Sa._interactionTriggers[t]=e},Sa._composedEventMap=ba.composedEventMap,Sa.registerComposedEvent=(t,e)=>{Sa._composedEventMap[t]=e},Sa._tooltipProcessors=ba.tooltipProcessors,Sa.registerTooltipProcessor=(t,e)=>{Sa._tooltipProcessors[t]=e},Sa.createTooltipProcessor=(t,e)=>{const i=Sa._tooltipProcessors[t];return i?new i(e):null};const xa=t=>t.zField||t.series&&t.series.some((t=>t.zField));class Aa extends fa{constructor(){super(Aa.type),this.type="VChart3dPlugin"}onInit(t,e){var i,s;if(this._is3d=!!(s=e)&&((t=>"bar3d"===t||"funnel3d"===t||"histogram3d"===t||"pie3d"===t||"rangeColumn3d"===t||"wordCloud3d"===t)(s.type)||xa(s),!0),this._is3d){const{globalInstance:e}=t;e.getCompiler().getStage().set3dOptions(Object.assign({},null===(i=e._option)||void 0===i?void 0:i.options3d))}}onBeforeInitChart(t,e,i){this._is3d&&xa(e)&&(e.layout={type:"layout3d"})}}Aa.pluginType="chart",Aa.type="VChart3dPlugin";const Ta=()=>{var t;t=Aa,Sa.registerChartPlugin(t.type,t),ca(),ua(),la.registerPlugin("ViewTransform3dPlugin",pa)},Ca={label:{name:"label",type:"text"},bar3d:{name:"bar3d",type:"rect3d"}};class ka extends e.BarSeriesSpecTransformer{_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar3d")}}const wa=(t,e,i)=>{const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+(r+a)/2)}return i},Ma=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...Jr];class Ea extends un{constructor(t){super(t),this.type="arc",this.numberType=Ps}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:r=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:a=t.innerRadius}=this.attribute;if(n+=r,a-=i,0===e||"0%"===e)return 0;const o=Math.abs(n-a),l=t=>Math.min(s.isNumber(t,!0)?t:o*parseFloat(t)/100,o/2);if(s.isArray(e)){const t=e.map((t=>l(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return l(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:r=t.cap,clipRange:n=t.clipRange}=this.attribute,a=i-e>=0?1:-1;let o=i-e;if(o*=Math.max(0,Math.min(n,1)),e=s.clampAngleByRadian(e),i=e+o,r&&s.abs(o)>s.epsilon&&s.abs(o)<s.pi2-s.epsilon){let n=1,o=1;r.length&&(n=Number(r[0]),o=Number(r[1]));let{outerRadius:l=t.outerRadius,innerRadius:h=t.innerRadius}=this.attribute;const{outerPadding:c=t.outerPadding,innerPadding:d=t.innerPadding}=this.attribute;l+=c,h-=d;const u=Math.abs(l-h)/2,p=u/l;if(u>s.epsilon&&l>s.epsilon)return{startAngle:e-a*p*n,endAngle:i+a*p*o,sc:a*p*n,ec:a*p*o}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:r=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:a=i.padAngle}=this.attribute;let{outerRadius:o=i.outerRadius,innerRadius:l=i.innerRadius}=this.attribute;o+=n,l-=r;const{padRadius:h=s.sqrt(o*o+l*l)}=this.attribute,c=s.abs(e-t);let d=t,u=e,p=t,g=e;const m=a/2;let f=c,v=c;if(m>s.epsilon&&h>s.epsilon){const i=e>t?1:-1;let r=s.asin(Number(h)/l*s.sin(m)),n=s.asin(Number(h)/o*s.sin(m));return(f-=2*r)>s.epsilon?(r*=i,p+=r,g-=r):(f=0,p=g=(t+e)/2),(v-=2*n)>s.epsilon?(n*=i,d+=n,u-=n):(v=0,d=u=(t+e)/2),{outerStartAngle:d,outerEndAngle:u,innerStartAngle:p,innerEndAngle:g,innerDeltaAngle:f,outerDeltaAngle:v}}return{outerStartAngle:d,outerEndAngle:u,innerStartAngle:p,innerEndAngle:g,innerDeltaAngle:f,outerDeltaAngle:v}}getGraphicTheme(){return bn(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:r,tb2:n}=dt.graphicService.updateTempAABBBounds(i);wa(t,e,r),i.union(r),r.setValue(n.x1,n.y1,n.x2,n.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return dt.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:n=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=n,r-=a,s<r&&(s=r),i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i){let{outerRadius:r=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:o=e.innerPadding}=t;if(r+=a,n-=o,r<n){const t=r;r=n,n=t}let{endAngle:l=e.endAngle,startAngle:h=e.startAngle}=t;if(h>l){const t=h;h=l,l=t}return r<=s.epsilon?i.set(0,0,0,0):Math.abs(l-h)>s.pi2-s.epsilon?i.set(-r,-r,r,r):(li(h,l,r,i),li(h,l,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Ma)}needUpdateTag(t){return super.needUpdateTag(t,Ma)}toCustomPath(){var t,e,i,r;let n=super.toCustomPath();if(n)return n;const a=this.attribute,{startAngle:o,endAngle:l}=this.getParsedAngle();let h=(null!==(t=a.innerRadius)&&void 0!==t?t:0)-(null!==(e=a.innerPadding)&&void 0!==e?e:0),c=(null!==(i=a.outerRadius)&&void 0!==i?i:0)-(null!==(r=a.outerPadding)&&void 0!==r?r:0);const d=s.abs(l-o),u=l>o;if(c<h){const t=c;c=h,h=t}if(n=new we,c<=s.epsilon)n.moveTo(0,0);else if(d>=s.pi2-s.epsilon)n.moveTo(0+c*s.cos(o),0+c*s.sin(o)),n.arc(0,0,c,o,l,!u),h>s.epsilon&&(n.moveTo(0+h*s.cos(l),0+h*s.sin(l)),n.arc(0,0,h,l,o,u));else{const t=c*s.cos(o),e=c*s.sin(o),i=h*s.cos(l),r=h*s.sin(l);n.moveTo(0+t,0+e),n.arc(0,0,c,o,l,!u),n.lineTo(0+i,0+r),n.arc(0,0,h,l,o,u),n.closePath()}return n}clone(){return new Ea(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ea.NOWORK_ANIMATE_ATTR}}Ea.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},dn);const Ba=["points","cornerRadius",...Jr];class Oa extends un{constructor(t){super(t),this.type="polygon",this.numberType=Ds}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return bn(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),dt.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return dt.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,r){"points"===t&&(r.points=ci(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Ba)}needUpdateTag(t){return super.needUpdateTag(t,Ba)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new we,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new Oa(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Oa.NOWORK_ANIMATE_ATTR}}Oa.NOWORK_ANIMATE_ATTR=dn;const Pa=["width","x1","y1","height","cornerRadius",...Jr];class Ia extends un{constructor(t){super(t),this.type="rect",this.numberType=Fs}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return bn(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:r,y1:n,x:a,y:o}=t;e=null!=e?e:r-a,s=null!=s?s:n-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:r}=dt.graphicService.updateTempAABBBounds(i);return wa(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,dt.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Pa)}needUpdateTag(t){return super.needUpdateTag(t,Pa)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,r=t=>null!=s[t],n=t=>null==s[t];switch(t){case"width":return n("width")&&r("x")&&r("x1");case"height":return n("height")&&r("y")&&r("y1");case"x1":return n("x1")&&r("x")&&r("width");case"y1":return n("y1")&&r("y")&&r("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,r=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},n=r("x"),a=r("y"),o=r("x1"),l=r("y1"),h=r("width"),c=r("height");switch(t){case"width":if(null==h&&null!=n&&null!=o)return o-n;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=n&&null!=h)return n+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:r,width:n,height:a}=(t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=s.isNil(t.width)?t.x1-t.x:t.width,i=s.isNil(t.height)?t.y1-t.y:t.height,r=0,n=0;return e<0?(r=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:r,y:n,width:e,height:i}})(e);return t=new we,t.moveTo(i,r),t.rect(i,r,n,a),t}clone(){return new Ia(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ia.NOWORK_ANIMATE_ATTR}}Ia.NOWORK_ANIMATE_ATTR=dn;const Ra=Symbol.for("EnvContribution"),Da=Symbol.for("VGlobal"),La=/\w|\(|\)|-/,Fa=/[.?!,;:/,。?!、;:]/;function Na(t,e,i=!1){let s=e;for(;La.test(t[s-1])&&La.test(t[s])||Fa.test(t[s]);)if(s--,s<=0)return i?Ua(t,e):e;return s}function Ua(t,e){let i=e;for(;La.test(t[i+1])&&La.test(t[i])||Fa.test(t[i]);)if(i++,i>=t.length)return i;return i+1}class ja extends xn{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Va(t){return new ja(t)}const Ga=["symbolType","size",...Jr];let za=class t extends un{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Us}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const r=this.getParsedPath();if(!r)return null;r.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return s.isArray(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return bn(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:r,tb2:n}=dt.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:n=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;ks(i,a+(r+o)/2,!0,n)}})(t,e,r),i.union(r),r.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return dt.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:r=e.size}=t;if(s.isArray(r))i.set(-r[0]/2,-r[1]/2,r[0]/2,r[1]/2);else{const t=r/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,r=this.getParsedPath();return r?(r.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Ga)}needUpdateTag(t){return super.needUpdateTag(t,Ga)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=s.isArray(e)?e:[e,e];return t.path?(new we).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new we).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};za.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},dn);let Ka=0;class Ha{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=dt.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Ka,t),this.tryRunAnimationFrameNextFrame(),Ka}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}var Wa,$a=function(t,e,i,s){return new(i||(i=Promise))((function(r,n){function a(t){try{l(s.next(t))}catch(t){n(t)}}function o(t){try{l(s.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Ya extends ut{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=at.GenAutoIncrementId(),this.hooks={onSetEnv:new lt(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Ha);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Ha),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return $a(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}class Xa{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=dt.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=En.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const r=this.global.measureTextMethod;this.global.measureTextMethod=i;const n={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Fe.fontSize};return this.global.measureTextMethod=r,n}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new s.TextMeasure(Object.assign({defaultFontParams:{fontFamily:Fe.fontFamily,fontSize:Fe.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+s.TextMeasure.ALPHABET_CHAR_SET+s.TextMeasure.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,r;if(!e.defaultLayer)return null;const n=null!==(r=null===(s=dt.windowFactory)||void 0===s?void 0:s.call(dt))&&void 0!==r?r:new mt(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;n.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(n,[t],{transMatrix:n.getViewBoxTransform(),viewBox:n.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=n.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Wa||(Wa={}));const qa=new s.Matrix;class Za{constructor(){this.matrix=new s.Matrix}init(t){return this.mode=Wa.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Wa.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(qa.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:r}=i;this.outTargetMatrix.translate(s,r),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-r)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(qa.a,qa.b,qa.c,qa.d,qa.e,qa.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(qa.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(qa.a,qa.b,qa.c,qa.d,qa.e,qa.f),this}scale(t,e,i){return this.mode===Wa.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Wa.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return qa.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(qa.a,qa.b,qa.c,qa.d,qa.e,qa.f),this}translate(t,e){return this.mode===Wa.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Wa.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}const Ja=Symbol.for("TransformUtil"),Qa=Symbol.for("GraphicUtil"),to=Symbol.for("LayerService"),eo=Symbol.for("StaticLayerHandlerContribution"),io=Symbol.for("@visactor/vrender-core/contribution-store-state");const so=Symbol("ContributionProvider");class ro{constructor(t,e){this.serviceIdentifier=t,this.container=e,oo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function no(t,e){return new ro(t,e)}function ao(t,e){t(so).toDynamicValue((({container:t})=>no(e,t))).inSingletonScope().whenTargetNamed(e)}class oo{static getStore(t){var e;return null===(e=this.store.get(t))||void 0===e?void 0:e.values().next().value}static setStore(t,e){let i=this.store.get(t);i||(i=new Set,this.store.set(t,i)),i.add(e)}static refreshAllContributions(){this.store.forEach((t=>{t.forEach((t=>{t.refresh()}))}))}}oo.store=function(){const t=globalThis;return t[io]||(t[io]={store:new Map}),t[io]}().store;class lo{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=Je.fontSize}){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}}measureTextWidth(t,e,i){return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e)).width:this.estimate(t,e).width}measureTextBoundsWidth(t,e,i){return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e)).width:this.estimate(t,e).width}measureTextBoundsLeftRight(t,e,i){return this.context?{left:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).actualBoundingBoxLeft,right:i.actualBoundingBoxRight}:this.measureTextBoundLeftRightEstimate(e)}measureTextPixelHeight(t,e,i){var s;return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(i.actualBoundingBoxAscent-i.actualBoundingBoxDescent)):null!==(s=e.fontSize)&&void 0!==s?s:Fe.fontSize}measureTextPixelADscent(t,e,i){return this.context?{ascent:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent}:this.measureTextBoundADscentEstimate(e)}measureTextBoundHieght(t,e,i){var s;return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(i.fontBoundingBoxAscent-i.fontBoundingBoxDescent)):null!==(s=e.fontSize)&&void 0!==s?s:Fe.fontSize}measureTextBoundADscent(t,e,i){return this.context?{ascent:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).fontBoundingBoxAscent,descent:i.fontBoundingBoxDescent}:this.measureTextBoundADscentEstimate(e)}measureTextBoundADscentEstimate(t){var e;const i=null!==(e=t.fontSize)&&void 0!==e?e:Fe.fontSize;return{ascent:.79*i,descent:.21*i}}measureTextBoundLeftRightEstimate(t){var e;const i=null!==(e=t.fontSize)&&void 0!==e?e:Fe.fontSize,{textAlign:s}=t;return"center"===s?{left:i/2,right:i/2}:"right"===s||"end"===s?{left:i,right:0}:{left:0,right:i}}measureTextPixelADscentAndWidth(t,e,i){if(!this.context)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(e)),{width:this.estimate(t,e).width});const s=this._measureTextWithoutAlignBaseline(t,e,!0);if(i===Be.actualBounding)return{ascent:s.actualBoundingBoxAscent,descent:s.actualBoundingBoxDescent,width:s.width};if(i===Be.estimate)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(e)),{width:s.width});if(i===Be.fontBounding){let t=s.fontBoundingBoxAscent,e=s.fontBoundingBoxDescent;if(s.actualBoundingBoxDescent&&e<s.actualBoundingBoxDescent){const i=s.actualBoundingBoxDescent-e;e+=i,t-=i}else if(s.actualBoundingBoxAscent&&t<s.actualBoundingBoxAscent){const i=s.actualBoundingBoxAscent-t;t+=i,e-=i}return{ascent:t,descent:e,width:s.width}}return{ascent:s.actualBoundingBoxAscent,descent:s.actualBoundingBoxDescent,width:s.width}}measureText(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t)):this.estimate(t,e)}clipTextVertical(t,e,i,s){if(0===t.length)return{verticalList:t,width:0};const{fontSize:r=12}=e;t.forEach((t=>{t.width=0===t.direction?r:this.measureTextWidth(t.text,e)}));const n=[];let a=0,o=0;for(;o<t.length&&a+t[o].width<i;o++)a+=t[o].width,n.push(t[o]);if(t[o]&&t[o].text.length>1){const r=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&r.str!==t[o].text){let i="",s=0;for(let e=0;e<o;e++){const r=t[e];i+=r.text,s+=r.text.length}i+=t[o].text;let n=Na(i,s+r.str.length);n-=s,n!==r.str.length-1&&(r.str=r.str.substring(0,n),r.width=this.measureTextWidth(r.str,e))}n.push(Object.assign(Object.assign({},t[o]),{text:r.str,width:r.width})),a+=r.width}return{verticalList:n,width:a}}clipText(t,e,i,s,r){if(0===t.length)return{str:"",width:0};let n=this.measureTextWidth(t,e);if(n<=i)return{str:t,width:n};if(n=this.measureTextWidth(t[0],e),n>i)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Na(t,a.str.length,r);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,r,n,a){let o;if("start"===n)o=this._clipTextStart(t,e,i,s,r),a&&(o.result=a+o.str);else if("middle"===n){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,r),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,r,n){if(r===n){s.Logger.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${r}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const a=Math.floor((r+n)/2),o=t.substring(0,a+1),l=this.measureTextWidth(o,e);let h;if(l>i){if(o.length<=1)return{str:"",width:0};const s=t.substring(0,a);return h=this.measureTextWidth(s,e),h<=i?{str:s,width:h}:this._clipTextEnd(t,e,i,r,a)}if(l<i){if(a>=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,a+2);return h=this.measureTextWidth(s,e),h>=i?{str:o,width:l}:this._clipTextEnd(t,e,i,a,n)}return{str:o,width:l}}_clipTextStart(t,e,i,s,r){const n=Math.ceil((s+r)/2),a=t.substring(n-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(n,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,n,t.length)}if(o<i){if(n<=0)return{str:t,width:this.measureTextWidth(t,e)};const r=t.substring(n-2,t.length);return l=this.measureTextWidth(r,e),l>=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,n)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,r,n,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:r,width:n+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:r,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,r,n){if(""===s)return this.clipTextVertical(t,e,i,r);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,r);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===n){const n=this.revertVerticalList(t);l=this.clipTextVertical(n,e,i,r);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===n){const n=this.clipTextVertical(t,e,i/2,r),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,r);n.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>n.verticalList.push(t))),l={verticalList:n.verticalList,width:n.width+h.width}}else l=this.clipTextVertical(t,e,i,r),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,r,n,a=!1){if(""===s)return this.clipText(t,e,i,r);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,n,s);if(r&&h.str!==t){const i=Na(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}}const ho=Symbol.for("TextMeasureContribution");class co extends lo{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}const uo=Symbol.for("RenderService");const po=Symbol.for("PickerService"),go=Symbol.for("GlobalPickerService"),mo=Symbol.for("PickItemInterceptor"),fo=Symbol.for("PickServiceInterceptor"),vo=(t,e,i,r)=>{let n,a=!1,o=!1;if(e.forEachChildren((t=>(a=t.numberType===Is,!a))),e.forEachChildren((t=>(o=!!t.findFace,!o))),a){const t=e.getChildren(),l=[...t];l.sort(((t,e)=>{var i,r,n,a;let o=(null!==(r=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==r?r:0)/2,l=(null!==(a=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==a?a:0)/2;for(;o<0;)o+=s.pi2;for(;l<0;)l+=s.pi2;return l-o})),l.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),l.forEach((t=>{e.appendChild(t)})),r.hack_pieFace="outside",n=i(a,o),n&&n.graphic||(r.hack_pieFace="inside",n=i(a,o)),n&&n.graphic||(r.hack_pieFace="top",n=i(a,o)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(o){const s=e.getChildren(),r=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));r.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),r.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),r.forEach((t=>{e.add(t.g)})),n=i(a,o),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(a,o);return n},yo=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class _o extends Ia{constructor(t){super(t),this.type="rect3d",this.numberType=Ns}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:r,x:n,y:a,length:o=s.min(e.width,e.height)}=this.attribute;let{width:l,height:h}=this.attribute;l=null!=l?l:i-n,h=null!=h?h:r-a;for(let e=0;e<yo.length;e++){const i=yo[e];t.vertices.push([i[0]*l,i[1]*h,i[2]*o])}return t.polygons.push({polygon:[0,1,5,4],normal:[0,-1,0]}),t.polygons.push({polygon:[2,3,7,6],normal:[0,1,0]}),t.polygons.push({polygon:[4,7,3,0],normal:[-1,0,0]}),t.polygons.push({polygon:[1,2,6,5],normal:[1,0,0]}),t.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),t.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),t.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],t}getNoWorkAnimateAttr(){return _o.NOWORK_ANIMATE_ATTR}}function bo(t){return new _o(t)}_o.NOWORK_ANIMATE_ATTR=dn;class So extends Ea{constructor(t){super(t),this.type="arc3d",this.numberType=Is}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:n=0}=t,a=r+n;return i.setValue(-a,-a,a,a),dt.graphicService.updateTempAABBBounds(i),dt.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return So.NOWORK_ANIMATE_ATTR}}function xo(t){return new So(t)}So.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},dn);class Ao extends Oa{constructor(t){super(t),this.type="pyramid3d",this.numberType=Ls}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),dt.graphicService.updateTempAABBBounds(i),dt.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],r=e.x-s.x;return 0===r?0:(e.y-s.y)/r})),i=t.map((t=>({p:t,d:0})));let r=!1,n=0;for(let t=0;t<e.length-1;t++){for(let a=t+1;a<e.length;a++){if(e[t]===e[a]){r=!0;const e=s.PointService.distancePP(i[t].p,i[t+1].p);i[t].d=e,i[t+1].d=e,n=s.max(n,e);const o=s.PointService.distancePP(i[a].p,i[a+1].p);i[a].d=o,i[a+1].d=o,n=s.max(n,o)}if(r)break}if(r)break}for(let e=t.length-1;e>=0;e--){const s=t[e];i.unshift({p:s,d:0})}for(let e=0;e<t.length;e++){const s=(n-i[e+t.length].d)/2;i[e].d+=s,i[e+t.length].d+=s}const a={polygons:[],vertices:[],edges:[]};return i.forEach((t=>{a.vertices.push([t.p.x,t.p.y,t.d])})),a.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),a.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),a.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),a.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),a.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),a.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),a.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],a}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return Ao.NOWORK_ANIMATE_ATTR}}function To(t){return new Ao(t)}Ao.NOWORK_ANIMATE_ATTR=dn;class Co{constructor(){this.order=1}afterPickItem(t,e,i,s,r){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class ko{constructor(){this.order=1}afterPickItem(t,e,i,s,r){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,r):null}beforePickItem(t,e,i,s,r){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,r):null}_pickItem(t,e,i,r,n){var a;if(!t.shadowRoot)return null;const{parentMatrix:o}=n||{};if(!o)return null;const l=e.pickContext;l.highPerformanceSave();const h=null===(a=bn(t))||void 0===a?void 0:a[t.type],{shadowPickMode:c=(null==h?void 0:h.shadowPickMode)}=t.attribute,d=t.shadowRoot,u=Mr.allocateByObj(o),p=new s.Point(u.a*i.x+u.c*i.y+u.e,u.b*i.x+u.d*i.y+u.f),g=e.pickGroup(d,p,u,r);return l.highPerformanceRestore(),!g.graphic&&g.group&&"full"===c&&(g.graphic=g.group),g}}class wo{constructor(){this.order=1}beforePickItem(t,e,i,r,n){const a=t.baseGraphic;if(a&&a.parent){const t=new s.Point(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const o=a.parent.globalTransMatrix;o.transformPoint(t,t);const l=a.isContainer?e.pickGroup(a,t.clone(),o,r):e.pickItem(a,t.clone(),o,r);return n.highPerformanceRestore(),l}return null}}class Mo{constructor(){this.order=1}beforePickItem(t,e,i,s,r){if(!t.in3dMode||s.in3dInterceptor)return null;const n=e.pickContext,a=t.stage;if(!n||!a)return null;if(s.in3dInterceptor=!0,n.save(),this.initCanvasCtx(n),n.camera=a.camera,t.isContainer){const a=vo(n,t,(()=>e.pickGroup(t,i,r.parentMatrix,s)),s);return n.camera=null,s.in3dInterceptor=!1,n.restore(),a}return n.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}const Eo=Symbol.for("AutoEnablePlugins"),Bo=Symbol.for("PluginService");function Oo({bind:t}){t(Bo).to($n),function(t,e){t(so).toDynamicValue((({container:t})=>no(e,t))).whenTargetNamed(e)}(t,Eo)}class Po{constructor(){this.type="static",this.offscreen=!1,this.global=dt.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,r=Hs({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});r.applyPosition(),this.canvas=r,this.context=r.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const r=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:r},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}}function Io(t){(function({bind:t}){ao(t,Ra)})({bind:t.bind}),function({bind:t}){t(ho).to(co).inSingletonScope(),ao(t,ho)}({bind:t.bind}),function({bind:t}){t(Po).toSelf(),t(eo).toService(Po)}({bind:t.bind})}const Ro=s.pi/2;function Do(t,e){return!(!t&&!e)}function Lo(t,e){let i;return i=s.isArray(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Fo(t,e,i){return i&&t*e>0}function No(t,e,i,s,r){return r&&t*e>0&&0!==i&&0!==s}function Uo(t,e){return t*e>0}function jo(t,e,i,s,r){return r?t*e>0:t*e>0&&0!==i&&0!==s}const Vo=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class Go{constructor(){this.time=Nt.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,r){const n=(t-2*e)/2,a=s.dpr,o=En.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),r(n,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),En.free(o),h}createCirclePattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,s.pi2),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const r=t/2,n=r;s.fillStyle=i,s.moveTo(r,n-e),s.lineTo(e+r,n),s.lineTo(r,n+e),s.lineTo(r-e,n),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const r=e,n=r;s.fillStyle=i,s.fillRect(r,n,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,r)=>{const n=e;r.fillStyle=i,r.fillRect(n,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,r)=>{const n=e;r.fillStyle=i,r.fillRect(0,n,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const r=t/2,n=-r;s.moveTo(r,n),s.lineTo(r+t,n+t),s.moveTo(-r,-n),s.lineTo(-r+t,-n+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const r=t/2,n=r;s.moveTo(t+r,n),s.lineTo(r,n+t),s.moveTo(t-r,-n),s.lineTo(-r,-n+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const r=e,n=r;s.fillStyle=i,s.fillRect(r,n,t,t),s.fillRect(r+t,n+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,r,n,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,r,n,a,o,l){var h,c,d,u,p,g;const{textureRatio:m=n.textureRatio,textureOptions:f=null}=e.attribute;let v=null;const y=null!==(h=null==f?void 0:f.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&f&&f.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=f,u=e.AABBBounds;s=u.x1,r=u.y1;const p=i;let g;if(d){g=En.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,r=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,r,n),p.clip();const v=u.width(),y=u.height(),_=l,b=o,S=h.columns?h.columns:Math.ceil(v/b),x=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,T=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=new za({}));const C=h.columns?v/h.columns:b,k=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,k-T],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t<x;t++)for(let n=0;n<S;n++){const o=s+b/2+n*b,l=r+b/2+t*b;null===(c=f.beforeDynamicTexture)||void 0===c||c.call(f,i,t,n,x,S,m,e,u.width(),u.height()),i.beginPath(),!1===w.draw(i,Math.min(C-A,k-T),o,l,0)&&i.closePath(),i.fillStyle=a,f.dynamicTexture(i,t,n,x,S,m,e,u.width(),u.height())}d&&(p.globalAlpha=1,p.drawImage(g.nativeCanvas,0,0,g.nativeCanvas.width,g.nativeCanvas.height,u.x1,u.y1,u.width()*p.dpr,u.height()*p.dpr)),p.restore()}else if(v){if(v.setTransform){const t=!!(null==f?void 0:f.alignToGraphic),e=null!==(d=null==f?void 0:f.alignOffsetX)&&void 0!==d?d:0,n=null!==(u=null==f?void 0:f.alignOffsetY)&&void 0!==u?u:0;let a=0,o=0;if(t){const t=i.currentMatrix;a=(null!==(p=null==t?void 0:t.e)&&void 0!==p?p:0)+s+e,o=(null!==(g=null==t?void 0:t.f)&&void 0!==g?g:0)+r+n}else(e||n)&&(a=e,o=n);v.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,a,o]))}i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,r,n),i.fillStyle=v,i.fill(),i.highPerformanceRestore()}else if("wave"===t){i.save(),i.setCommonStyle(e,e.attribute,s,r,n),i.clip();const t=e.AABBBounds;(function(t,e,i,s,r,n,a){const{fill:o="orange",percent:l=.6,frequency:h=4,opacity:c,phi:d=0}=r;let{amplitude:u=10}=r;u*=function(t){return t<=.5?4*t-1:-4*t+3}(e);const p=s*(1-l),g=i,m=Math.max(Math.round(g/70),2);t.beginPath(),t.moveTo(0+n,s+a),t.lineTo(0+n,p+a);const f=g/h*e,v=g/Math.PI/(2*h);for(let e=0;e<g;e+=m){const i=u*Math.sin((e+f+d)/v+d);t.lineTo(e+n,p+i+a)}t.lineTo(g+n,s+a),t.closePath(),t.fillStyle=o,isFinite(c)&&(t.globalAlpha=c),t.fill()})(i,m,t.width(),t.height(),Object.assign(Object.assign({},f||{}),{fill:a}),s+t.x1-s,r+t.y1-r),i.restore()}}getPatternCacheKey(t,e,i,s,r,n){return"string"!=typeof t?i>0||n>0?null:t:"wave"===t?null:Vo.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${r}`:`resource:${t}|padding:${i}|radius:${n}|dpr:${r}`}createResourcePattern(t,e,i,s,r){var n;const a=null===(n=e.resources)||void 0===n?void 0:n.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||r>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const n=t+2*s,a=e+2*s,l=En.allocate({width:n,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,n,a),r>0){const i=Math.max(0,Math.min(r,Math.min(t,e)/2)),n=s,a=s,o=n+t,l=a+e;h.beginPath(),h.moveTo(n+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(n+i,l),h.quadraticCurveTo(n,l,n,l-i),h.lineTo(n,a+i),h.quadraticCurveTo(n,a,n+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),En.free(l),c}En.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}new Go;const zo=new class extends Bn{constructor(){super(...arguments),this.time=Nt.beforeFillStroke}drawShape(t,e,i,s,r,n,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:m=l.backgroundMode,backgroundFit:f=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:S=l.backgroundClip,backgroundPosition:x=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(Pn(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,S&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:m,backgroundFit:f,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:x}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};class Ko{constructor(t){this.groupRenderContribitions=t,this.numberType=Rs}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(zo)}drawShape(t,e,i,r,n,a,o,l,h){const{clip:c,fill:d,stroke:u,background:p}=t.attribute;if(!(c||d||u||p))return;h=null!=h?h:bn(t,null==a?void 0:a.theme).group;const{opacity:g=h.opacity,width:m=h.width,height:f=h.height,fillOpacity:v=h.fillOpacity,strokeOpacity:y=h.strokeOpacity,cornerRadius:_=h.cornerRadius,path:b=h.path,lineWidth:S=h.lineWidth,visible:x=h.visible,fillStrokeOrder:A=h.fillStrokeOrder,cornerType:T=h.cornerType,x:C=h.x,y:k=h.y}=t.attribute,w=No(g,v,m,f,d),M=jo(g,y,m,f),E=Do(d,p),B=Lo(u,S);if(!t.valid||!x)return;if(!c){if(!E&&!B)return;if(!(w||M||o||l||p))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,a)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||s.isArray(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,r,m,f)):(e.beginPath(),function(t,e,i,r,n,a,o=!0,l){let h;if(Array.isArray(o)&&(l=o,o=!0),r<0&&(e+=r,r=-r),n<0&&(i+=n,n=-n),s.isNumber(a,!0))h=[a=s.abs(a),a,a,a];else if(Array.isArray(a)){const t=a;let e,i;switch(t.length){case 0:h=[0,0,0,0];break;case 1:e=s.abs(t[0]),h=[e,e,e,e];break;case 2:case 3:e=s.abs(t[0]),i=s.abs(t[1]),h=[e,i,e,i];break;default:h=t,h[0]=s.abs(h[0]),h[1]=s.abs(h[1]),h[2]=s.abs(h[2]),h[3]=s.abs(h[3])}}else h=[0,0,0,0];if(r<0||h[0]+h[1]+h[2]+h[3]<1e-12)return t.rect(e,i,r,n);const[c,d,u,p]=[[e,i],[e+r,i],[e+r,i+n],[e,i+n]],g=Math.min(r/2,n/2),m=[Math.min(g,h[0]),Math.min(g,h[1]),Math.min(g,h[2]),Math.min(g,h[3])],f=[c[0]+m[0],c[1]],v=[c[0],c[1]+m[0]],y=[d[0]-m[1],d[1]],_=[d[0],d[1]+m[1]],b=[u[0]-m[2],u[1]],S=[u[0],u[1]-m[2]],x=[p[0]+m[3],p[1]],A=[p[0],p[1]-m[3]];if(t.moveTo(f[0],f[1]),o){if(l&&l[0]?l[0](f[0],f[1],y[0],y[1]):t.lineTo(y[0],y[1]),!s.arrayEqual(y,_)){l&&l[0]&&t.moveTo(y[0],y[1]);const e=y[0],i=y[1]+m[1];t.arc(e,i,m[1],-Ro,0,!1)}if(l&&l[1]?l[1](_[0],_[1],S[0],S[1]):t.lineTo(S[0],S[1]),!s.arrayEqual(b,S)){const e=S[0]-m[2],i=S[1];l&&l[1]&&t.moveTo(S[0],S[1]),t.arc(e,i,m[2],0,Ro,!1)}if(l&&l[2]?l[2](b[0],b[1],x[0],x[1]):t.lineTo(x[0],x[1]),!s.arrayEqual(x,A)){const e=x[0],i=x[1]-m[3];l&&l[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,m[3],Ro,s.pi,!1)}if(l&&l[3]?l[3](A[0],A[1],v[0],v[1]):t.lineTo(v[0],v[1]),!s.arrayEqual(f,v)){const e=f[0],i=f[1]+m[0];l&&l[3]&&t.moveTo(v[0],v[1]),t.arc(e,i,m[0],s.pi,s.pi+Ro,!1)}}else l&&l[0]?l[0](f[0],f[1],y[0],y[1]):t.lineTo(y[0],y[1]),l&&l[1]?l[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),l&&l[2]?l[2](b[0],b[1],x[0],x[1]):t.lineTo(x[0],x[1]),l&&l[2]?l[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);!l&&t.closePath()}(e,i,r,m,f,_,"bevel"!==T));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(zo));const O={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this._groupRenderContribitions.forEach((s=>{s.time===Nt.beforeFillStroke&&s.drawShape(t,e,i,r,E,B,w,M,h,n,o,l,O)})),c&&e.clip();const P=()=>{O.doFill&&(o?o(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,C-i,k-r,h),e.fill()))},I=()=>{O.doStroke&&(l?l(e,t.attribute,h):M&&(e.setStrokeStyle(t,t.attribute,C-i,k-r,h),e.stroke()))};A?(I(),P()):(P(),I()),this._groupRenderContribitions.forEach((s=>{s.time===Nt.afterFillStroke&&s.drawShape(t,e,i,r,E,B,w,M,h,n,o,l)}))}draw(t,e,i,s){var r,n;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:r}=t.attribute,n=a.canvas,o=dt.global.createCanvas({width:n.width,height:n.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,n.width,n.height),l.beginPath(),l.rect(e,i,s,r),l.clip(),l.drawImage(n.nativeCanvas,0,0,n.width,n.height,0,0,n.displayWidth,n.displayHeight),l.restore()),a.nativeContext=l,n.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=bn(t,null==s?void 0:s.theme).group,i=Er.allocate(),r=Er.allocate();ra(r,t,e),Cr(i,p||i,r),a.modelMatrix=i,Er.free(r),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:m}=t.attribute;let f;if((g||m)&&a.translate(g,m),s&&s.renderInGroup&&(f=s.renderInGroup(null===(r=s.renderInGroupParams)||void 0===r?void 0:r.skipSort,t,i,null===(n=s.renderInGroupParams)||void 0===n?void 0:n.nextM)),a.modelMatrix!==p&&Er.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:r}=t.attribute,n=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&n.rect(e,i,s,r),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=n.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}f&&f.then?f.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var Ho,Wo=function(t,e,i,s){return new(i||(i=Promise))((function(r,n){function a(t){try{l(s.next(t))}catch(t){n(t)}}function o(t){try{l(s.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(Ho||(Ho={}));class $o extends zn{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=Ho.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new lt([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return Wo(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:r}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(r.x1,r.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:je.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:je.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return Wo(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return Wo(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Wo(this,void 0,void 0,(function*(){if(2!==t.count)yield kn(t,je.zIndex,((i,s)=>{if(this.status===Ho.STOP)return!0;if(i.isContainer)return!1;if(s<this.currentIdx)return!1;const r=this.currFrameStartAt+t.incremental;return s<r&&(this.currentIdx=s+1,this.renderItem(i,e)),s===r-1&&(this.currFrameStartAt=this.currentIdx,this.waitToNextFrame())})),i(!1);else{const s=t.getChildAt(0);if(s.incremental&&s.attribute.segments)for(s.incrementalAt||(s.incrementalAt=0);s.incrementalAt<s.attribute.segments.length;)e.multiGraphicOptions={startAtIdx:s.incrementalAt,length:s.incremental},this.renderItem(s,e),s.incrementalAt+=s.incremental,yield this.waitToNextFrame();else this.renderItem(s,e);i(!1)}}))})})),this.hooks.completeDraw.call()}))}waitToNextFrame(){return Wo(this,void 0,void 0,(function*(){return new Promise((t=>{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return Wo(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return Wo(this,void 0,void 0,(function*(){this.rendering&&(this.status=Ho.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=Ho.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return Wo(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Wo(this,void 0,void 0,(function*(){yield kn(t,je.zIndex,(t=>Wo(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const Yo=Symbol.for("IncrementalDrawContribution"),Xo=Symbol.for("Arc3dRender"),qo=Symbol.for("GraphicRender"),Zo=Symbol.for("GroupRender"),Jo=Symbol.for("Rect3DRender"),Qo=Symbol.for("Pyramid3dRender"),tl=Symbol.for("DrawContribution"),el=Symbol.for("DrawItemInterceptor"),il=new s.AABBBounds,sl=new s.AABBBounds;class rl{constructor(){this.order=1}afterDrawItem(t,e,i,s,r){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,r),!1}beforeDrawItem(t,e,i,s,r){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,r),!1}drawItem(t,e,i,s,r){if(!t.shadowRoot)return!1;const{context:n}=i;if(n.highPerformanceSave(),n.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){il.copy(s.dirtyBounds),sl.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,Mr.allocate(1,0,0,1,0,0)),n.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(il),s.backupDirtyBounds.copy(sl)),!0}}class nl{constructor(){this.order=1}afterDrawItem(t,e,i,s,r){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,r),!1}drawItem(t,e,i,s,r){if(!t.attribute._debug_bounds)return!1;const{context:n}=i;n.highPerformanceSave(),t.parent&&n.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&n.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(n,t),n.strokeRect(a.x1,a.y1,a.width(),a.height()),n.highPerformanceRestore(),!0}}class al{constructor(){this.order=1,this.interceptors=[new rl,new ll,new ol,new nl]}afterDrawItem(t,e,i,s,r){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let n=0;n<this.interceptors.length;n++)if(this.interceptors[n].afterDrawItem&&this.interceptors[n].afterDrawItem(t,e,i,s,r))return!0;return!1}beforeDrawItem(t,e,i,s,r){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let n=0;n<this.interceptors.length;n++)if(this.interceptors[n].beforeDrawItem&&this.interceptors[n].beforeDrawItem(t,e,i,s,r))return!0;return!1}}class ol{constructor(){this.order=1}beforeDrawItem(t,e,i,s,r){return!this.processing&&(t.baseGraphic?this.beforeDrawInteractive(t,e,i,s,r):this.beforeSetInteractive(t,e,i,s,r))}beforeSetInteractive(t,e,i,s,r){let n=t.interactiveGraphic;if(t.attribute.globalZIndex){n||(n=t.clone(),t.interactiveGraphic=n,n.baseGraphic=t),n.setAttributes({globalZIndex:0,zIndex:t.attribute.globalZIndex},!1,{skipUpdateCallback:!0}),i.stage.tryInitInteractiveLayer();const e=i.stage.getLayer("_builtin_interactive");return e&&this.getShadowRoot(e).add(n),!0}if(n){i.stage.tryInitInteractiveLayer();const e=i.stage.getLayer("_builtin_interactive");e&&this.getShadowRoot(e).removeChild(n),t.interactiveGraphic=null,n.baseGraphic=null}return!1}beforeDrawInteractive(t,e,i,s,r){const n=t.baseGraphic;let a=!!n.stage,o=n.parent;for(;a&&o&&o.stage!==o;)a=!!o.stage,o=o.parent;if(!a){const e=i.stage.getLayer("_builtin_interactive");return e&&this.getShadowRoot(e).removeChild(t),!0}if(n){this.processing=!0;const{context:t}=i;return t.highPerformanceSave(),t.setTransformFromMatrix(n.parent.globalTransMatrix,!0),n.isContainer?s.renderGroup(n,i,n.parent.globalTransMatrix):s.renderItem(n,i),t.highPerformanceRestore(),this.processing=!1,!0}return!1}getShadowRoot(t){var e;let i=t.getElementById("_interactive_group");return i||(i=sa("group",{}),i.id="_interactive_group",t.add(i)),null!==(e=i.shadowRoot)&&void 0!==e?e:i.attachShadow()}}class ll{constructor(){this.order=1}beforeDrawItem(t,e,i,s,r){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:n,stage:a}=e.drawParams;n.save(),this.initCanvasCtx(n),n.camera=a.camera;const o=n.currentMatrix;o.a/=n.dpr,o.b/=n.dpr,o.c/=n.dpr,o.d/=n.dpr,o.e/=n.dpr,o.f/=n.dpr;const l=Er.allocate();var h,c;c=o,(h=l)[0]=c.a,h[1]=c.b,h[2]=0,h[3]=0,h[4]=c.c,h[5]=c.d,h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[10]=1,h[11]=0,h[12]=c.e,h[13]=c.f,h[14]=0,h[15]=1;const d=n.modelMatrix;if(d){if(l){const t=Er.allocate();n.modelMatrix=Cr(t,d,l)}}else n.modelMatrix=l;return n.setTransform(1,0,0,1,0,0,!0),t.isContainer?vo(n,t,((e,r)=>s.renderGroup(t,i,t.parent.globalTransMatrix,!e&&r)),i):s.renderItem(t,i),n.camera=null,n.restore(),n.modelMatrix!==d&&Er.free(n.modelMatrix),n.modelMatrix=d,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const hl=Symbol.for("GroupRenderContribution"),cl=Symbol.for("InteractiveSubRenderContribution");function dl(t){!function({bind:t}){t(Bn).toSelf().inSingletonScope(),t(Go).toSelf().inSingletonScope(),t(tl).to(zn),t(Yo).to($o),t(Zo).toDynamicValue((({container:t})=>new Ko(no(hl,t)))).inSingletonScope(),t(qo).toService(Zo),ao(t,hl),ao(t,cl),t(Un).toDynamicValue((({container:t})=>new Un(no(cl,t)))).inSingletonScope(),ao(t,qo),t(al).toSelf().inSingletonScope(),t(el).toService(al),ao(t,el)}({bind:t.bind})}class ul{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class pl{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new ul(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}const gl=Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");const ml=function(){const t=globalThis;return t[gl]||(t[gl]={legacyBindingContext:new pl,preloaded:!1}),t[gl]}(),fl=ml.legacyBindingContext;function vl(){ml.preloaded||(ml.preloaded=!0,function({bind:t}){t(Da).toDynamicValue((({container:t})=>new Ya(no(Ra,t)))).inSingletonScope(),t(pt).to(mt),t(Qa).toDynamicValue((({container:t})=>new Xa(no(ho,t)))).inSingletonScope(),t(Ja).to(Za).inSingletonScope(),t(to).to(qn).inSingletonScope()}({bind:fl.bind}),function({bind:t}){t(js).to(na),t(Vs).toConstantValue(ea)}({bind:fl.bind}),function({bind:t}){t(uo).to(Kn)}({bind:fl.bind}),function({bind:t,isBound:e}){e(po)||(t(go).toSelf(),t(po).toService(go)),t(Mo).toSelf().inSingletonScope(),t(mo).toService(Mo),t(ko).toSelf().inSingletonScope(),t(mo).toService(ko),t(wo).toSelf().inSingletonScope(),t(mo).toService(wo),ao(t,mo),t(Co).toSelf().inSingletonScope(),t(fo).toService(Co),ao(t,fo)}({bind:fl.bind,isBound:fl.isBound}),Oo({bind:fl.bind}),Io(fl),dl(fl))}function yl(){return fl}const _l=function(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}((()=>function(t){vl();const[e]=fl.getAll(t);return e}(Da)));dt.global=_l;class bl{constructor(){this.transitions=new Map,this.registerDefaultTransitions()}static getInstance(){return bl.instance||(bl.instance=new bl),bl.instance}registerDefaultTransitions(){this.registerTransition("appear","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,r,n,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(r=this.transitions.get(t))||void 0===r?void 0:r.get("*"),o?o(i,t):(o=null===(n=this.transitions.get("*"))||void 0===n?void 0:n.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function Sl(t){if(!t||!s.isFunction(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}function xl(t,e,i,s){const r=function(t,e,i,s){var r;const n=t,a=null===(r=n.context)||void 0===r?void 0:r.finalAttrs,o=n.getFinalAttribute();let l=null;for(let t=0;t<e.length;t++){const r=e[t];i&&!i.validAttr(r)||(a&&Object.prototype.hasOwnProperty.call(a,r)?(null!=l||(l={}),l[r]=a[r]):o&&Object.prototype.hasOwnProperty.call(o,r)?(null!=l||(l={}),l[r]=o[r]):s&&Object.prototype.hasOwnProperty.call(s,r)&&(null!=l||(l={}),l[r]=s[r]))}return l}(t,e,i,s);if(!r)return!1;t.setFinalAttributes(r);const n=t._commitAnimationStaticAttributes;return"function"==typeof n?n.call(t,r,{type:Dt.ANIMATE_END}):t.setAttributes(r,!1,{type:Dt.ANIMATE_END}),!0}bl.getInstance();class Al{static registerBuiltInAnimate(t,e){Al.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._activeConfigList=null,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e<this._animates.length;e++){const i=this._animates[e];if(i.status===Ie.END)continue;const s=i.getEndProps();if(s)for(const e in s)Object.prototype.hasOwnProperty.call(s,e)&&t.indexOf(e)<0&&t.push(e)}return t}hasActiveAttrs(){for(let t=0;t<this._animates.length;t++){const e=this._animates[t];if(e.status===Ie.END)continue;const i=e.getEndProps();if(i)for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t))return!0}return!1}preventAttrs(t){if(!(null==t?void 0:t.length))return this.hasActiveAttrs();for(let e=0;e<this._animates.length;e++){const i=this._animates[e];i.status!==Ie.END&&i.preventAttrs(t)}return this.hasActiveAttrs()}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var r,n;const a=this.resolveValue(t.totalTime,i,void 0),o=this.resolveValue(t.startTime,i,0),l=Object.assign({},t);l.oneByOneDelay=0,l.startTime=o,l.totalTime=a;const h=this.resolveValue(t.oneByOne,i,!1);if(e){const t=l.timeSlices;s.isArray(t)||(l.timeSlices=[t]);let e=0;l.timeSlices=l.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),r=this.resolveValue(t.delayAfter,i,0),n=this.resolveValue(t.duration,i,300);return e+=s+n+r,Object.assign(Object.assign({},t),{delay:s,delayAfter:r,duration:n})}));let r=0;h&&(r="number"==typeof h?h:h?e:0),l.oneByOneDelay=r;let n=1;if(a){const t=e+r*(this._target.count-2);n=a?a/t:1}l.timeSlices=l.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:Al.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],r=Sl(s);return Object.assign(Object.assign({},t),{custom:s,customType:r})}))})})),l.oneByOneDelay=r*n,l.startTime=o*n}else{const e=this.resolveValue(t.delay,i,0),c=this.resolveValue(t.delayAfter,i,0),d=this.resolveValue(t.duration,i,300);let u=0;h&&(u="number"==typeof h?h:h?e+c+d:0),l.oneByOneDelay=u,l.custom=null!==(r=t.custom)&&void 0!==r?r:Al.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const p=Sl(l.custom);l.customType=p;const g=e+c+d+u*(this._target.count-2),m=s.isValidNumber(a)?a/g:1;l.delay=e*m,l.delayAfter=c*m,l.duration=d*m,l.oneByOneDelay=u*m,l.startTime=o}return l}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,r,n,a;return t.sort(null===(r=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],null===(a=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,r)=>{const n=this.parseParams(t,e,i),a=this.executeTimelineItem(n,i,s,r);a&&this._trackAnimation(a)}:(i,s,r)=>{const n=this.parseParams(t,e,i),a=this.executeTypeConfigItem(n,i,s,r);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,r){var n,a,o,l,h,c,d,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:m,easing:f="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:S=0,loop:x,bounce:A,priority:T=0,options:C,custom:k,customType:w,controlOptions:M}=t,E=e.animate();E.priority=T;const B=s.isFunction(v)?v(null===(a=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===a?void 0:a[0],e,{}):v,O=null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],P=null===(h=e.context)||void 0===h?void 0:h.indexKey;O&&P&&(i=null!==(c=O[P])&&void 0!==c?c:i),E.startAt(b);const I=i*S+B;I>0&&E.wait(I);let R=null,D=t.to,L=t.from;const F=this.shouldCommitAttrOutChannel(p);D||(R||(R=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=R.props),L||(R||(R=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=R.from),R.attrOutChannel&&e.setAttributes(R.attrOutChannel),this._handleRunAnimate(E,k,w,L,D,_,f,m,M,C,p,e),this.commitAnimatedUpdateDiffAttrsOnEnd(E,e,p,D);let N=0;S&&(N=S*(r-i-1));const U=s.isFunction(y)?y(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):y;return U>0&&(N+=U),N>0&&E.wait(N),x&&x>0&&E.loop(x),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,r,n,a,o,l,h,c,d,u){var p,g,m,f,v,y,_,b;if(e&&i){i=Sl(e);let d=this.resolveValue(l,u);"function"==typeof d&&(d=d(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),d=Object.assign({width:(null===(m=u.stage)||void 0===m?void 0:m.width)||0,height:(null===(f=u.stage)||void 0===f?void 0:f.height)||0,group:this._target.parent},d);const S=s.isFunction(c)?c.call(null,null!==(y=d&&(null===(v=d.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,d):c;d.options=S,d.controlOptions=h,1===i?this.createCustomAnimation(t,e,r,n,a,o,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,a,o,d)}else"to"===d?t.to(n,a,o):"from"===d&&t.from(n,a,o)}executeTimelineItem(t,e,i,s){var r,n,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,m=null===(n=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===n?void 0:n[0],f=null===(a=e.context)||void 0===a?void 0:a.indexKey;m&&f&&(i=null!==(o=m[f])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,r){var n,a,o,l;const{effects:h,duration:c=300,delay:d=0,delayAfter:u=0}=t,p=s.isFunction(d)?d(null===(a=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===a?void 0:a[0],i,{}):d,g=s.isFunction(u)?u(null===(l=null===(o=i.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(h)?h:[h]).forEach((t=>{var s;const{type:n="fromTo",channel:a,customParameters:o,easing:l="linear",options:h}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(n);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const m=null!==(s=t.custom)&&void 0!==s?s:Al.builtInAnimateMap[n],f=t.custom?t.customType:Sl(m);this._handleRunAnimate(e,m,f,p,u,c,l,o,r,h,n,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,r,n){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,r,a,o)=>{e(r,i,s,a,o,t.target,n)},t.to(i,s,r)}shouldCommitAttrOutChannel(t){return"update"!==t}commitAnimatedUpdateDiffAttrsOnEnd(t,e,i,s){if("update"===i||!s||!this.isUpdateDiffContext(e))return;const r=this.collectAnimatedUpdateDiffAttrKeys(e,s);(null==r?void 0:r.length)&&t.onEnd((()=>{xl(e,r,t,s)}))}isUpdateDiffContext(t){const e=t.context;return"update"===(null==e?void 0:e.diffState)||"update"===(null==e?void 0:e.animationState)}collectAnimatedUpdateDiffAttrKeys(t,e){var i;const s=null===(i=t.context)||void 0===i?void 0:i.diffAttrs;if(!s)return null;let r=null;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(s,t)&&void 0!==s[t]&&(null!=r||(r=[]),r.push(t));return r}createCustomAnimation(t,e,i,s,r,n,a){const o=new e(i,s,r,n,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var r;const n={};let a=null;if(!t)return{from:a,props:n,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(r=e.context)||void 0===r?void 0:r.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,r,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?n[i]=h.to(null===(r=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],e,{}):n[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(n.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:n,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,r;return void 0===t?i:"function"==typeof t&&e?t(null===(r=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let r=null;for(let e=0;e<i.length;e++)r=this.collectAnimatedDiffKeys(i[e],t,s,r);return r}collectAnimatedDiffKeys(t,e,i,s){if("timeSlices"in t){const r=Array.isArray(t.timeSlices)?t.timeSlices:[t.timeSlices];for(let t=0;t<r.length;t++){const n=Array.isArray(r[t].effects)?r[t].effects:[r[t].effects];for(let t=0;t<n.length;t++)s=this.collectAnimatedDiffKeysFromEffect(n[t],e,i,s)}return s}return this.collectAnimatedDiffKeysFromEffect(t,e,i,s)}collectAnimatedDiffKeysFromEffect(t,e,i,s){var r;if("update"===(null!==(r=t.type)&&void 0!==r?r:"fromTo")){const r=this.resolveValue(t.options,e,void 0),n=null==r?void 0:r.excludeChannels;for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&void 0!==i[t]&&!this.includesChannel(n,t)&&(null!=s||(s={}),s[t]=!0);return s}return s=this.collectExplicitAnimatedKeys(t.to,i,s),s=this.collectExplicitAnimatedKeys(t.from,i,s),this.collectChannelAnimatedKeys(t.channel,i,s)}collectExplicitAnimatedKeys(t,e,i){if(!t)return i;for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&Object.prototype.hasOwnProperty.call(e,s)&&void 0!==e[s]&&(null!=i||(i={}),i[s]=!0);return i}collectChannelAnimatedKeys(t,e,i){if(!t)return i;if(Array.isArray(t)){for(let s=0;s<t.length;s++){const r=t[s];Object.prototype.hasOwnProperty.call(e,r)&&void 0!==e[r]&&(null!=i||(i={}),i[r]=!0)}return i}for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&Object.prototype.hasOwnProperty.call(e,s)&&void 0!==e[s]){const e=t[s];void 0===e.to&&void 0===e.from||(null!=i||(i={}),i[s]=!0)}return i}includesChannel(t,e){if(!(null==t?void 0:t.length))return!1;for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1}syncFinalAttrsFromContext(t){var e;const i=null===(e=t.context)||void 0===e?void 0:e.finalAttrs;i&&t.setFinalAttributes(i)}executeItem(t,e,i=0,s=1){if(Array.isArray(t)){const r=this._activeConfigList;this._activeConfigList=t;try{return t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=r}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const r="timeSlices"in t;let n=null;const a=this.parseParams(t,r);return n=r?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),n&&this._trackAnimation(n),n}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Ie.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}Al.builtInAnimateMap={};const Tl="appear",Cl="disappear",kl="update",wl="highlight",Ml="unhighlight";class El{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class Bl{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1}takeOverUpdateAttrs(t,e,i){if(t.state!==kl||!e.length)return;const s=t.executor.getActiveAttrKeys();if(s.length)for(let r=0;r<e.length;r++){const n=e[r];n.state!==kl||n===t||this.hasStateInfo(i,n)||n.executor.preventAttrs(s)||(n.executor.stop(null,!1),i.push(n))}}applyState(t,e,i){var r;const n=bl.getInstance(),a=null!==(r=this.stateList)&&void 0!==r?r:[],o=[],l=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const r={allowTransition:!0,stopOriginalTransition:!0};a.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);r.allowTransition=r.allowTransition&&i.allowTransition})),r.allowTransition&&(l.push({state:t,animationConfig:s.isArray(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new Al(this.graphic)}),a.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&o.push(e)})))})):t.forEach(((t,i)=>{l.push({state:t,animationConfig:s.isArray(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new Al(this.graphic)})})),o.forEach((t=>{t.executor.stop(null,!1)})),l.length){l[0].executor.execute(l[0].animationConfig),this.takeOverUpdateAttrs(l[0],a,o);for(let t=0;t<l.length;t++){const e=l[t+1],s=l[t];s.executor.onEnd((()=>{var r;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(r=this.stateList)&&void 0!==r?r:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===l.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!o.includes(t))):this.stateList=[],this.stateList.push(...l)}applyAppearState(t,e){this.applyState([Tl],[{name:Tl,animation:t}],e)}applyDisappearState(t,e){this.applyState([Cl],[{name:Cl,animation:t}],e)}applyUpdateState(t,e){this.applyState([kl],[{name:kl,animation:t}],e)}applyHighlightState(t,e){this.applyState([wl],[{name:wl,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([Ml],[{name:Ml,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class Ol{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new Bl(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new El(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class Pl{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-Pl.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Pl.bounceIn(2*t):.5*Pl.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const r=e/s.pi2*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-r)*s.pi2/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const r=e/s.pi2*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-r)*s.pi2/e)+1}}static getElasticInOut(t,e){return function(i){const r=e/s.pi2*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-r)*s.pi2/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-r)*s.pi2/e)*.5+1}}static registerFunc(t,e){Pl[t]=e}}function Il(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const r=s*t/i;return r>0?r:1+r}Pl.quadIn=Pl.getPowIn(2),Pl.quadOut=Pl.getPowOut(2),Pl.quadInOut=Pl.getPowInOut(2),Pl.cubicIn=Pl.getPowIn(3),Pl.cubicOut=Pl.getPowOut(3),Pl.cubicInOut=Pl.getPowInOut(3),Pl.quartIn=Pl.getPowIn(4),Pl.quartOut=Pl.getPowOut(4),Pl.quartInOut=Pl.getPowInOut(4),Pl.quintIn=Pl.getPowIn(5),Pl.quintOut=Pl.getPowOut(5),Pl.quintInOut=Pl.getPowInOut(5),Pl.backIn=Pl.getBackIn(1.7),Pl.backOut=Pl.getBackOut(1.7),Pl.backInOut=Pl.getBackInOut(1.7),Pl.elasticIn=Pl.getElasticIn(1,.3),Pl.elasticOut=Pl.getElasticOut(1,.3),Pl.elasticInOut=Pl.getElasticInOut(1,.3*1.5),Pl.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),Pl.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},Pl.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)Pl[`flicker${t}`]=e=>Il(e,t);for(let t=2;t<10;t++)Pl[`aIn${t}`]=e=>t*e*e+(1-t)*e;function Rl(t,e,i){return t+(e-t)*i}const Dl=new class{constructor(){this.opacity=(t,e,i,s,r,n)=>{n.attribute.opacity=Rl(e,i,s)},this.baseOpacity=(t,e,i,s,r,n)=>{n.attribute.baseOpacity=Rl(e,i,s)},this.fillOpacity=(t,e,i,s,r,n)=>{n.attribute.fillOpacity=Rl(e,i,s)},this.strokeOpacity=(t,e,i,s,r,n)=>{n.attribute.strokeOpacity=Rl(e,i,s)},this.zIndex=(t,e,i,s,r,n)=>{n.attribute.zIndex=Rl(e,i,s)},this.backgroundOpacity=(t,e,i,s,r,n)=>{n.attribute.backgroundOpacity=Rl(e,i,s)},this.shadowOffsetX=(t,e,i,s,r,n)=>{n.attribute.shadowOffsetX=Rl(e,i,s)},this.shadowOffsetY=(t,e,i,s,r,n)=>{n.attribute.shadowOffsetY=Rl(e,i,s)},this.shadowBlur=(t,e,i,s,r,n)=>{n.attribute.shadowBlur=Rl(e,i,s)},this.fill=(t,e,i,s,r,n)=>{n.attribute.fill=Q(e,i,s,!1)},this.fillPure=(t,e,i,s,r,n)=>{n.attribute.fill=r.fromParsedProps.fill?et(r.fromParsedProps.fill,r.toParsedProps.fill,s):r.toParsedProps.fill},this.stroke=(t,e,i,s,r,n)=>{n.attribute.stroke=Q(e,i,s,!1)},this.strokePure=(t,e,i,s,r,n)=>{n.attribute.stroke=r.fromParsedProps.stroke?et(r.fromParsedProps.stroke,r.toParsedProps.stroke,s):r.toParsedProps.stroke},this.width=(t,e,i,s,r,n)=>{n.attribute.width=Rl(e,i,s),n.addUpdateBoundTag()},this.height=(t,e,i,s,r,n)=>{n.attribute.height=Rl(e,i,s),n.addUpdateBoundTag()},this.x=(t,e,i,s,r,n)=>{n.attribute.x=Rl(e,i,s),n.addUpdateBoundTag(),n.addUpdatePositionTag()},this.y=(t,e,i,s,r,n)=>{n.attribute.y=Rl(e,i,s),n.addUpdateBoundTag(),n.addUpdatePositionTag()},this.dx=(t,e,i,s,r,n)=>{n.attribute.dx=Rl(e,i,s),n.addUpdateBoundTag(),n.addUpdatePositionTag()},this.dy=(t,e,i,s,r,n)=>{n.attribute.dy=Rl(e,i,s),n.addUpdateBoundTag(),n.addUpdatePositionTag()},this.angle=(t,e,i,s,r,n)=>{n.attribute.angle=Rl(e,i,s),n.addUpdateBoundTag(),n.addUpdatePositionTag()},this.scaleX=(t,e,i,s,r,n)=>{n.attribute.scaleX=Rl(e,i,s),n.addUpdateBoundTag(),n.addUpdatePositionTag()},this.scaleY=(t,e,i,s,r,n)=>{n.attribute.scaleY=Rl(e,i,s),n.addUpdateBoundTag(),n.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,r,n)=>{n.attribute.lineWidth=Rl(e,i,s),n.addUpdateBoundTag()},this.startAngle=(t,e,i,s,r,n)=>{n.attribute.startAngle=Rl(e,i,s),n.addUpdateBoundTag()},this.endAngle=(t,e,i,s,r,n)=>{n.attribute.endAngle=Rl(e,i,s),n.addUpdateBoundTag()},this.radius=(t,e,i,s,r,n)=>{n.attribute.radius=Rl(e,i,s),n.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,r,n)=>{n.attribute.outerRadius=Rl(e,i,s),n.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,r,n)=>{n.attribute.innerRadius=Rl(e,i,s),n.addUpdateBoundTag()},this.size=(t,e,i,s,r,n)=>{n.attribute.size=Rl(e,i,s),n.addUpdateBoundTag()},this.points=(t,e,i,s,r,n)=>{n.attribute.points=ci(e,i,s),n.addUpdateBoundTag()}}};function Ll(t,e,i,s,r,n){if(Number.isFinite(i)&&Number.isFinite(e))return n.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const r=[];let a=!0;for(let t=0;t<i.length;t++){const n=e[t],o=n+(i[t]-n)*s;if(!Number.isFinite(o)){a=!1;break}r.push(o)}return a&&(n.attribute[t]=r),!0}return!1}const Fl={type:Dt.ANIMATE_UPDATE},Nl={type:Dt.ANIMATE_BIND},Ul={type:Dt.ANIMATE_START};function jl(t){const e=t;return e.attribute||(e.attribute={}),e.attribute===e.baseAttributes&&e.detachAttributeFromBaseAttributes(),e.attributeMayContainTransientAttrs=!0,e.attribute}function Vl(t){t.onAttributeUpdate(Fl)}function Gl(t,e){if(!e)return;const i=jl(t);for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(i[t]=e[t]);Vl(t)}function zl(t,e,i,s,r){const n=jl(t);for(let t=0;t<e.length;t++){const a=e[t];n[a]=i[a]+(s[a]-i[a])*r}Vl(t)}function Kl(t,e,i=Dt.ANIMATE_UPDATE){if(!e)return;const s=function(t){switch(t){case Dt.ANIMATE_UPDATE:return Fl;case Dt.ANIMATE_BIND:return Nl;case Dt.ANIMATE_START:return Ul;default:return{type:t}}}(i);t.applyAnimationTransientAttributes(e,!1,s)}function Hl(t,e){Kl(t,e,Dt.ANIMATE_BIND)}function Wl(){}function $l(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1}class Yl{constructor(t,e,i,s){var r;this._startTime=0,this._hasFirstRun=!1,this._syncAttributeUpdate=()=>{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:Dt.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(r=Pl[s])&&void 0!==r?r:Pl.linear:Pl.linear,"wait"===t&&(this.onUpdate=Wl),this.id=at.GenAutoIncrementId(),this.syncAttributeUpdate=Wl}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],r=this.props[e];if(s.isString(i)&&s.isString(r)){const s=Z.Get(i,q.Color255),n=Z.Get(r,q.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=s,this.toParsedProps[e]=n,t.push(Dl["fill"===e?"fillPure":"strokePure"])}else Dl[e]?t.push(Dl[e]):t.push(Ll)}else Dl[e]?t.push(Dl[e]):t.push(Ll)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,r=this.propKeys;if(s&&r)for(let n=0;n<s.length;n++){const a=r[n],o=t[a],l=e[a];s[n](a,o,l,i,this,this.target)}}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let r=null;for(let t=0;t<i.length;t++){const e=i[t];null!=s[e]&&(null!=r?r:r=[]).push(e)}r&&e.preventAttrs(r)}))}removeKeysFromRecord(t,e){if(!t)return t;let i=!1;for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&$l(e,s)){i=!0;break}if(!i)return t;const s={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&!$l(e,i)&&(s[i]=t[i]);return s}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;if((null==t?void 0:t.length)&&(this.props=this.removeKeysFromRecord(this.props,t),this.fromProps=this.removeKeysFromRecord(this.fromProps,t),this.fromParsedProps=this.removeKeysFromRecord(this.fromParsedProps,t),this.toParsedProps=this.removeKeysFromRecord(this.toParsedProps,t),null===(e=this.propKeys)||void 0===e?void 0:e.length)){const e=this.interpolateUpdateFunctions;let i=0;for(let s=0;s<this.propKeys.length;s++){const r=this.propKeys[s];$l(t,r)||(i!==s&&(this.propKeys[i]=r,e&&(e[i]=e[s])),i++)}this.propKeys.length=i,e&&(e.length=i)}}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class Xl extends Yl{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();Kl(this.target,t,Dt.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class ql extends s.EventEmitter{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=at.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Ie.END?this.removeAnimate(t,!0):t.status!==Ie.RUNNING&&t.status!==Ie.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const Zl=new ql;Zl.isGlobal=!0;class Jl extends Yl{constructor(t,e,i,s,r){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=r,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Ql extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Ie.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class th extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r),this.from=null!=t?t:{}}applyTransientFromAttributes(){Kl(this.target,this.from,Dt.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function eh(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1}function ih(t,e){if(!t)return t;let i=!1;for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&eh(e,s)){i=!0;break}if(!i)return t;const s={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&!eh(e,i)&&(s[i]=t[i]);return s}function sh(t,e){var i;const s=null==t?void 0:t.getTrackedAnimates;if("function"==typeof s){const e=s.call(t);if(e&&e.size<=1)return}const r=null==t?void 0:t.forEachTrackedAnimate;if("function"!=typeof r)return;let n;const a=null===(i=e.getEndProps)||void 0===i?void 0:i.call(e);return r.call(t,(t=>{var i;if(t===e||t.status===Ie.END)return;const s=null===(i=t.getEndProps)||void 0===i?void 0:i.call(t);if(s)for(const t in s)!Object.prototype.hasOwnProperty.call(s,t)||a&&Object.prototype.hasOwnProperty.call(a,t)||((null!=n?n:n=Object.create(null))[t]=!0)})),n}class rh{constructor(t=at.GenAutoIncrementId(),e=Zl,i){this.id=t,this.status=Ie.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){this.target=t;const e=this.target;return e.detachAttributeFromBaseAttributes(),e.trackAnimate(this),this.onRemove((()=>{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(sh(e,this)),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new Yl(Pe.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new Xl(Pe.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new th(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Ie.RUNNING&&(this.status=Ie.PAUSED)}resume(){this.status===Ie.PAUSED&&(this.status=Ie.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;e<t.length;e++)this._preventAttrs.add(t[e]);this._startProps=ih(this._startProps,t),this._endProps=ih(this._endProps,t);let e=this._firstStep;for(;e;)e.deleteSelfAttrs(t),e=e.next}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,r,n){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Ie.END&&this.onEnd(),this.status=Ie.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Ie.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Ie.END)return void console.warn("aaa 动画已经结束,不能推进");const r=this.currentTime+t;if(r<this._startTime)return void(this.currentTime=r);if(r>=this._startTime+this._totalDuration){null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Ie.END;const t=this.target;return t.restoreStaticAttribute(sh(t,this)),void(this.__skipRestoreStaticAttributeOnRemove=!0)}this.status=Ie.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=r;let n=r-this._startTime,a=!1,o=!1;if(this._loopCount>0){n=(r-this._startTime)%this._duration;const t=Math.floor((r-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(n=this._duration-n)}a&&!o&&Kl(this.target,this._startProps,Dt.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(n>=e&&n<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(n-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const nh=new Ha;class ah{constructor(){this.released=!1}tick(t,e){nh.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class oh extends s.EventEmitter{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const r=s-this.lastFrameTime,n=this.checkSkip(r);return n||(this._handlerTick(r),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!n},this._handlerTick=t=>{this.status===Oe.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Oe.INITIAL,dt.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),dt.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new ah;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Oe.INITIAL&&(this.status=Oe.PAUSE,!0)}resume(){return this.status!==Oe.INITIAL&&(this.status=Oe.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Oe.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Oe.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Oe.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Oe.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Oe.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Oe.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,dt.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t<this.interval+2*(Math.random()-.5)*this._jitter}}class lh{visitTrackedAnimates(t){this.forEachTrackedAnimate(t)}getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const r=new rh(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:Zl,null==t?void 0:t.slience);if(r.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&r.onStart(e),null!=i&&r.onEnd(i),null!=s&&r.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),r}createTimeline(){return new ql}createTicker(t){return new oh(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new Al(this))}applyFinalAttributeToAttribute(){const t=this.getFinalAttribute();t&&this.setAttributesAndPreventAnimate(t,!1,{type:Dt.ANIMATE_BIND})}restoreStaticAttribute(t){this._restoreAttributeFromStaticTruth({type:Dt.ANIMATE_END},t)}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.visitTrackedAnimates((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function hh(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const ch={x:0,y:0,z:0,lastModelMatrix:null};class dh{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(jn),e(Vn),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Nt.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Nt.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,r,n,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,r,n,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,r,n,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,r,n,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,r,n,a,o){if(!t.pathProxy)return!1;const l=bn(t,null==n?void 0:n.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,y=Fo(d,u,h),_=Uo(d,g),b=Do(h),S=Lo(c,p);if(!m)return!0;if(!b&&!S)return!0;if(!(y||_||a||o))return!0;e.beginPath();return Gt(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,S,y,_,l,r,a,o),S&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,S,y,_,l,r,a,o),!0}valid(t,e,i,s){const{fill:r=e.fill,background:n,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Fo(o,l,r),p=Uo(o,c),g=Do(r,n),m=Lo(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||n)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i,s=!1){const{x:r=e.x,y:n=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;ch.x=r,ch.y=n,ch.z=a,ch.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Er.allocate(),r=Er.allocate();ra(r,t,e),Cr(s,d||s,r),ch.x=0,ch.y=0,ch.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Er.free(r)}if(g&&!d){const s=t.getOffsetXY(e);ch.x+=s.x,ch.y+=s.y,ch.z=a,i.setTransformForCurrent()}else if(p)ch.x=0,ch.y=0,ch.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);ch.x+=s.x,ch.y+=s.y,this.transformWithoutTranslate(i,ch.x,ch.y,ch.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),ch.x=0,ch.y=0,ch.z=0;return ch}transformUseContext2d(t,e,i,s){const r=s.camera;if(this.camera=r,r){const e=t.AABBBounds,r=e.x2-e.x1,n=e.y2-e.y1,a=s.project(0,0,i),o=s.project(r,0,i),l=s.project(r,n,i),h={x:0,y:0},c={x:r,y:0},d={x:r,y:n};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,y,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,r,n,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(r,n,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,r,n){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,r)||(this.drawShape(t,a,h,c,s,r,null,null,n),this.z=0,a.modelMatrix!==u&&Er.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class uh extends dh{constructor(){super(...arguments),this.numberType=Is}drawShape(t,e,i,r,n,a,o,l){var h;const c=bn(t,null==a?void 0:a.theme).arc,{fill:d=c.fill}=t.attribute,u=this.valid(t,c,o,l);if(!u)return;const{fVisible:p,sVisible:g,doFill:m,doStroke:f}=u,v=null!==(h=this.z)&&void 0!==h?h:0,{outerPadding:y=c.outerPadding,innerPadding:_=c.innerPadding,height:b=10}=t.attribute;let{outerRadius:S=c.outerRadius,innerRadius:x=c.innerRadius}=t.attribute;S+=y,x-=_;const A=Z.Get(d,q.Color255),{light:T}=n.stage||{},C=n.hack_pieFace,k={top:v,bottom:v+b},w={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===C||"top"===C?(e.beginPath(),function(t,e,i,r,n,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=s.abs(h-l),d=h>l;let u=!1;if(a<o){const t=a;a=o,o=t}if(a<=s.epsilon)e.moveTo(i,r,n);else if(c>=s.pi2-s.epsilon)e.moveTo(i+a*s.cos(l),r+a*s.sin(l),n),e.arc(i,r,a,l,h,!d,n),o>s.epsilon&&(e.moveTo(i+o*s.cos(h),r+o*s.sin(h),n),e.arc(i,r,o,h,l,d,n));else{const{outerDeltaAngle:c,innerDeltaAngle:p,outerStartAngle:g,outerEndAngle:m,innerEndAngle:f,innerStartAngle:v}=t.getParsePadAngle(l,h),y=a*s.cos(g),_=a*s.sin(g),b=o*s.cos(f),S=o*s.sin(f);c<.001?u=!0:(e.moveTo(i+y,r+_,n),e.arc(i,r,a,g,m,!d,n)),!(o>s.epsilon)||p<.001?(e.lineTo(i+b,r+S,n),u=!0):(e.lineTo(i+b,r+S,n),e.arc(i,r,o,f,v,d,n))}e.closePath()}(t,e,i,r,k[C],S,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,c),m&&(o?o(e,t.attribute,c):p&&(e.setCommonStyle(t,t.attribute,i,r,c),e.fillStyle=T?T.computeColor(w[C],A):d,e.fill())),f&&(l?l(e,t.attribute,c):g&&(e.setStrokeStyle(t,t.attribute,i,r,c),e.stroke()))):"outside"!==C&&"inside"!==C||("inside"===C&&(e.save(),e.beginPath(),e.arc(i,r,x,0,s.pi2,!0,k.top),e.clip()),e.beginPath(),function(t,e,i,r,n,a,o,l){const{startAngle:h,endAngle:c}=t.getParsedAngle(),d=s.abs(c-h),u=c>h;let p=!1;if(o<=s.epsilon)e.moveTo(i,r,n);else if(d>=s.pi2-s.epsilon)e.moveTo(i+o*s.cos(h),r+o*s.sin(h),n),e.arc(i,r,o,h,c,!u,n),e.lineTo(i+o*s.cos(c),r+o*s.sin(c),a),e.arc(i,r,o,c,h,u,a);else{const{innerouterDeltaAngle:t,innerouterStartAngle:d,innerouterEndAngle:g}=l(h,c),m=o*s.cos(d),f=o*s.sin(d),v=o*s.cos(g),y=o*s.sin(g);t<.001?p=!0:(e.moveTo(i+m,r+f,n),e.arc(i,r,o,d,g,!u,n),e.lineTo(i+v,r+y,a),e.arc(i,r,o,g,d,u,a))}e.closePath()}(t,e,i,r,k.top,k.bottom,"outside"===C?S:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:r,outerStartAngle:n,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===C?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:n}:{innerouterDeltaAngle:r,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,c),m&&(o?o(e,t.attribute,c):p&&(e.setCommonStyle(t,t.attribute,i,r,c),e.fillStyle=T?T.computeColor(w[C],A):d,e.fill())),f&&(l?l(e,t.attribute,c):g&&(e.setStrokeStyle(t,t.attribute,i,r,c),e.stroke())),"inside"===C&&e.restore())}draw(t,e,i,s){const r=bn(t,null==s?void 0:s.theme).arc;this._draw(t,r,!1,i,s)}}const ph=new WeakSet;const gh=function({bind:t}){hh(ph,t)||(t(uh).toDynamicValue((()=>new uh)).inSingletonScope(),t(Xo).toService(uh),t(qo).toService(Xo))};class mh extends dh{stroke(t,e,i,s,r){const n=s.vertices;s.edges.forEach((s=>{const a=n[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=n[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};r.beginPath(),r.moveTo(o.x,o.y,o.z),r.lineTo(h.x,h.y,h.z),r.stroke()}))}fill(t,e,i,s,r,n,a,o,l,h,c){const d=Z.Get(n,q.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(r&&!r[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],n=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+n+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:r,normal:p}=s.polygon,g=u[r[0]],m=u[r[1]],f=u[r[2]],v=u[r[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+m[0],y:e+m[1],z:i+m[2]},b={x:t+f[0],y:e+f[1],z:i+f[2]},S={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(S.x,S.y,S.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):n,a.fill())}))}}class fh extends mh{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=Ls}drawShape(t,e,i,s,r,n,a,o){var l;const h=bn(t,null==n?void 0:n.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=r.stage||{},m=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let r=c;"string"!=typeof r&&(r="black"),this.fill(i,s,p,m,u,r,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,m,e))}draw(t,e,i){const s=bn(t).polygon;this._draw(t,s,!1,i)}}const vh=new WeakSet;const yh=function({bind:t}){hh(vh,t)||(t(fh).toDynamicValue((()=>new fh)).inSingletonScope(),t(Qo).toService(fh),t(qo).toService(Qo))};class _h extends mh{constructor(){super(...arguments),this.type="rect3d",this.numberType=Ns}drawShape(t,e,i,s,r,n,a,o){var l,h;const c=bn(t,null==n?void 0:n.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:m,y:f,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:S=c.visible,drawStrokeWhenZeroWH:x=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:T}=t.attribute;A=(null!=A?A:p-m)||0,T=(null!=T?T:g-f)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,k=No(v,y,A,T,d),w=jo(v,b,A,T,x),M=Do(d),E=Lo(u,_);if(!t.valid||!S)return;if(!M&&!E)return;if(!(k||w||a||o))return;const{light:B}=r.stage||{},O=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let r=d;"string"!=typeof r&&(r="black"),this.fill(i,s,C,O,null,r,e,B,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,O,e))}draw(t,e,i){const s=bn(t).rect;this._draw(t,s,!1,i)}}const bh=new WeakSet;const Sh=function({bind:t}){hh(bh,t)||(t(_h).toDynamicValue((()=>new _h)).inSingletonScope(),t(Jo).toService(_h),t(qo).toService(Jo))};function xh(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}const Ah=Symbol.for("CanvasArc3dPicker"),Th=Symbol.for("CanvasRect3dPicker"),Ch=Symbol.for("CanvasPyramid3dPicker"),kh=Symbol.for("CanvasPickerContribution");class wh extends r.BaseRender{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const a=this.transform(t,n,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,i,null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u))),this.canvasRenderer.z=0,s.modelMatrix!==c&&r.mat4Allocate.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}class Mh extends wh{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=r.ARC3D_NUMBER_TYPE,this.themeType="arc"}}let Eh=!1;function Bh(){if(Bh.__loaded)return;Bh.__loaded=!0;const t=yl();ia("arc3d",xo),ca(),ua(),gh({bind:t.bind}),function(t){var e;Eh||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Xo))&&(Eh=!0,t.bind(Ah).toDynamicValue((()=>new Mh(xh(t,Xo)))).inSingletonScope(),t.bind(kh).toService(Ah))}(t)}Bh.__loaded=!1;const Oh=Bh;class Ph extends wh{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=r.PYRAMID3D_NUMBER_TYPE,this.themeType="polygon"}}let Ih=!1;function Rh(){if(Rh.__loaded)return;Rh.__loaded=!0;const t=yl();ia("pyramid3d",To),ca(),ua(),yh({bind:t.bind}),function(t){var e;Ih||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Qo))&&(Ih=!0,t.bind(Ch).toDynamicValue((()=>new Ph(xh(t,Qo)))).inSingletonScope(),t.bind(kh).toService(Ch))}(t)}Rh.__loaded=!1;const Dh=Rh;class Lh extends wh{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=r.RECT3D_NUMBER_TYPE,this.themeType="rect"}}let Fh=!1;function Nh(){if(Nh.__loaded)return;Nh.__loaded=!0;const t=yl();ia("rect3d",bo),Sh({bind:t.bind}),function(t){var e;Fh||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Jo))&&(Fh=!0,t.bind(Th).toDynamicValue((()=>new Lh(xh(t,Jo)))).inSingletonScope(),t.bind(kh).toService(Th))}(t)}Nh.__loaded=!1;const Uh=Nh;function jh(){jh.__loaded||(jh.__loaded=!0,ia("shadowRoot",Va))}jh.__loaded=!1;const Vh=jh,Gh=t=>(Oh(),sa("arc3d",t)),zh=t=>(Dh(),sa("pyramid3d",t)),Kh=t=>(Uh(),sa("rect3d",t));class Hh extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),r=null!==(t=this.target.attribute)&&void 0!==t?t:{},n={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;n[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:r[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=n,this.propKeys=this.keys,this.from=a,this.to=n,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&Hl(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Gl(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Wh extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var r;e[s]=0,i[s]=null!==(r=t[s])&&void 0!==r?r:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Kl(this.target,i,Dt.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Gl(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class $h extends Hh{constructor(t,e,i,s,r){super(t,e,i,s,r),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class Yh extends Wh{constructor(t,e,i,s,r){super(t,e,i,s,r),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const Xh=(t,e,i)=>{var r;return!1!==(null!==(r=null==e?void 0:e.overall)&&void 0!==r&&r)?((t,e,i)=>{const r=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=s.isNumber(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==r?void 0:r.startAngle,endAngle:null==r?void 0:r.endAngle}}}const n=s.isNumber(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==r?void 0:r.startAngle,endAngle:null==r?void 0:r.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class qh extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){Gl(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){Gl(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class Zh extends qh{onBind(){var t,e,i;super.onBind();const{from:s,to:r}=Xh(this.target,this.params.options,this.params),n=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=r,this.propKeys=Object.keys(r).filter((t=>null!=r[t])),this.from=n,this.to=r,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&Hl(this.target,n),this.determineUpdateFunction()}}class Jh extends qh{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,r=this.params.options,this.params,!1!==(null!==(n=null==r?void 0:r.overall)&&void 0!==n&&n)?((t,e,i)=>{const r=t.attribute;if(e&&"anticlockwise"===e.orient){const t=s.isNumber(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:r.startAngle,endAngle:r.endAngle},to:{startAngle:t,endAngle:t}}}const n=s.isNumber(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:r.startAngle,endAngle:r.endAngle},to:{startAngle:n,endAngle:n}}})(i,r):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,r));var i,r,n;const a=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=a?a:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class Qh extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t,e,i;super.onBind();const{from:r,to:n}=((t,e,i)=>{const r=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=r.x,e=r.x1,i=r.width;return{from:s.isValid(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=r.y,e=r.y1,i=r.height;return{from:s.isValid(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=r.x,e=r.x1,i=r.width,n=r.y,a=r.y1,o=r.height,l={};return s.isValid(i)?(l.x=t+i/2,l.width=0,l.x1=void 0):(l.x=(t+e)/2,l.x1=(t+e)/2,l.width=void 0),s.isValid(o)?(l.y=n+o/2,l.height=0,l.y1=void 0):(l.y=(n+a)/2,l.y1=(n+a)/2,l.height=void 0),{from:l,to:{x:t,y:n,x1:e,y1:a,width:i,height:o}}}}})(this.target,this.params.options,this.params),a=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:r;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=a,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&Hl(this.target,a)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Gl(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class tc extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const r=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=r.x,e=r.x1,i=r.width;return{to:s.isValid(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=r.y,e=r.y1,i=r.height;return{to:s.isValid(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=r.x,e=r.y,i=r.x1,n=r.y1,a=r.width,o=r.height,l={};return s.isValid(a)?(l.x=t+a/2,l.width=0,l.x1=void 0):(l.x=(t+i)/2,l.x1=(t+i)/2,l.width=void 0),s.isValid(o)?(l.y=e+o/2,l.height=0,l.y1=void 0):(l.y=(e+n)/2,l.y1=(e+n)/2,l.height=void 0),{to:l}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Gl(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const ec=(t,e,i)=>{var r;return!1!==(null!==(r=null==e?void 0:e.overall)&&void 0!==r&&r)?function(t,e,i){var r,n,a;const o=t.getFinalAttribute(),l=o.y,h=o.y1,c=o.height;let d;return e&&"negative"===e.orient?s.isNumber(e.overall)?d=e.overall:i.group?(d=null!==(a=null!==(r=i.groupHeight)&&void 0!==r?r:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==a?a:i.group.getBounds().height(),i.groupHeight=d):d=i.height:d=s.isNumber(null==e?void 0:e.overall)?e.overall:0,{from:{y:d,y1:s.isNil(h)?void 0:d,height:s.isNil(c)?void 0:0},to:{y:l,y1:h,height:c}}}(t,e,i):function(t,e,i){const r=t.getFinalAttribute(),n=r.y,a=r.y1,o=r.height;if(e&&"negative"===e.orient){const t=s.isValid(o)?Math.max(n,n+o):Math.max(n,a);return{from:{y:t,y1:s.isNil(a)?void 0:t,height:s.isNil(o)?void 0:0},to:{y:n,y1:a,height:o}}}const l=s.isValid(o)?Math.min(n,n+o):Math.min(n,a);return{from:{y:l,y1:s.isNil(a)?void 0:l,height:s.isNil(o)?void 0:0},to:{y:n,y1:a,height:o}}}(t,e)};class ic extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t,e,i;super.onBind();const{from:s,to:r}=ec(this.target,this.params.options,this.params),n=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=r,this.propKeys=Object.keys(r).filter((t=>null!=r[t])),this.from=n,this.to=r,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&Hl(this.target,n)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){zl(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sc extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,r=this.params.options,n=this.params,!1!==(null!==(a=null==r?void 0:r.overall)&&void 0!==a&&a)?function(t,e,i){var r,n,a;const o=t.getFinalAttribute(),l=o.y1,h=o.height;let c;return e&&"negative"===e.orient?s.isNumber(e.overall)?c=e.overall:i.group?(c=null!==(a=null!==(r=i.groupHeight)&&void 0!==r?r:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==a?a:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=s.isNumber(null==e?void 0:e.overall)?e.overall:0,{to:{y:c,y1:s.isNil(l)?void 0:c,height:s.isNil(h)?void 0:0}}}(i,r,n):function(t,e,i){const r=t.getFinalAttribute(),n=r.y,a=r.y1,o=r.height;if(e&&"negative"===e.orient){const t=s.isValid(o)?Math.max(n,n+o):Math.max(n,a);return{to:{y:t,y1:s.isNil(a)?void 0:t,height:s.isNil(o)?void 0:0}}}const l=s.isValid(o)?Math.min(n,n+o):Math.min(n,a);return{to:{y:l,y1:s.isNil(a)?void 0:l,height:s.isNil(o)?void 0:0}}}(i,r));var i,r,n,a;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){zl(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const rc=(t,e,i)=>{const r=t.getFinalAttribute().points,n={x:0,y:0};return r.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=r.length,n.y/=r.length,e&&e.center&&(s.isValidNumber(e.center.x)&&(n.x=e.center.x),s.isValidNumber(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),r.map((t=>Object.assign({},t,n)))};class nc extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r)}onUpdate(t,e,i){var s,n;const a=null===(s=this.from)||void 0===s?void 0:s.points,o=null===(n=this.to)||void 0===n?void 0:n.points;a&&o&&(Gl(this.target,{points:a.map(((t,i)=>r.pointInterpolation(a[i],o[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class ac extends nc{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:r}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:rc(t,e)}});this.props=r,this.propKeys=Object.keys(r).filter((t=>null!=r[t])),this.from=s||i,this.to=r}else this.valid=!1;var t,e}}const oc=(t,e,i)=>{var r;return!1!==(null!==(r=null==e?void 0:e.overall)&&void 0!==r&&r)?((t,e,i)=>{const r=t.getFinalAttribute(),n=s.isNumber(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==r?void 0:r.innerRadius,outerRadius:null==r?void 0:r.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class lc extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Gl(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class hc extends lc{onBind(){var t,e,i;super.onBind();const{from:s,to:r}=oc(this.target,this.params.options,this.params),n=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=r,this.propKeys=Object.keys(r).filter((t=>null!=r[t])),this.from=n,this.to=r,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&Hl(this.target,n)}}class cc extends lc{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(r=null==i?void 0:i.overall)&&void 0!==r&&r)?((t,e,i)=>{const r=t.getFinalAttribute(),n=s.isNumber(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==r?void 0:r.innerRadius,outerRadius:null==r?void 0:r.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,r;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const dc=(t,e,i)=>{var r;return!1!==(null!==(r=null==e?void 0:e.overall)&&void 0!==r&&r)?function(t,e,i){var r;const n=t.getFinalAttribute(),a=n.x,o=n.x1,l=n.width;let h;return e&&"negative"===e.orient?s.isNumber(e.overall)?h=e.overall:i.group?(h=null!==(r=i.groupWidth)&&void 0!==r?r:i.group.getBounds().width(),i.groupWidth=h):h=i.width:h=s.isNumber(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:h,x1:s.isNil(o)?void 0:h,width:s.isNil(l)?void 0:0},to:{x:a,x1:o,width:l}}}(t,e,i):function(t,e,i){const r=t.getFinalAttribute(),n=r.x,a=r.x1,o=r.width;if(e&&"negative"===e.orient){const t=s.isValid(o)?Math.max(n,n+o):Math.max(n,a);return{from:{x:t,x1:s.isNil(a)?void 0:t,width:s.isNil(o)?void 0:0},to:{x:n,x1:a,width:o}}}const l=s.isValid(o)?Math.min(n,n+o):Math.min(n,a);return{from:{x:l,x1:s.isNil(a)?void 0:l,width:s.isNil(o)?void 0:0},to:{x:n,x1:a,width:o}}}(t,e)};class uc extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t,e,i;super.onBind();const{from:s,to:r}=dc(this.target,this.params.options,this.params),n=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=r,this.propKeys=Object.keys(r).filter((t=>null!=r[t])),this.from=n,this.to=r,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&Hl(this.target,n)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){zl(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class pc extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,r=this.params.options,n=this.params,!1!==(null!==(a=null==r?void 0:r.overall)&&void 0!==a&&a)?function(t,e,i){var r;const n=t.getFinalAttribute(),a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?s.isNumber(e.overall)?l=e.overall:i.group?(l=null!==(r=i.groupWidth)&&void 0!==r?r:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=s.isNumber(null==e?void 0:e.overall)?e.overall:0,{to:{x:l,x1:s.isNil(a)?void 0:l,width:s.isNil(o)?void 0:0}}}(i,r,n):function(t,e,i){const r=t.getFinalAttribute(),n=r.x,a=r.x1,o=r.width;if(e&&"negative"===e.orient){const t=s.isValid(o)?Math.max(n,n+o):Math.max(n,a);return{to:{x:t,x1:s.isNil(a)?void 0:t,width:s.isNil(o)?void 0:0}}}const l=s.isValid(o)?Math.min(n,n+o):Math.min(n,a);return{to:{x:l,x1:s.isNil(a)?void 0:l,width:s.isNil(o)?void 0:0}}}(i,r));var i,r,n,a;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){zl(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class gc extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Gl(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class mc extends gc{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var r,n,a,o;const{offset:l=0,orient:h,direction:c,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,m=0;"negative"===h&&(g=null!==(r=p.width)&&void 0!==r?r:t.stage.viewWidth,m=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=l,m+=l;const f=s.isFunction(d)?d.call(null,null===(o=null===(a=t.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],t,i):d,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:f&&s.isValidNumber(f.x)?f.x:g,b=u.includes("y")?y:f&&s.isValidNumber(f.y)?f.y:m;switch(c){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&Hl(this.target,e)}}class fc extends gc{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var r,n,a,o;const{offset:l=0,orient:h,direction:c,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(r=u.width())&&void 0!==r?r:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,m=("negative"===h?p:0)+l,f=("negative"===h?g:0)+l,v=s.isFunction(d)?d.call(null,null===(o=null===(a=t.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],t,i):d,y=v&&s.isValidNumber(v.x)?v.x:m,_=v&&s.isValidNumber(v.y)?v.y:f;switch(c){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class vc extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Gl(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yc extends vc{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const r=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=s.isNumberClose(r/(2*Math.PI),0)?Math.round(r/(2*Math.PI))*Math.PI*2:s.isValidNumber(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(r/(2*Math.PI))*Math.PI*2:Math.floor(r/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:r}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&Hl(this.target,e)}}class _c extends vc{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const r=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=s.isNumberClose(r/(2*Math.PI),0)?Math.round(r/(2*Math.PI))*Math.PI*2:s.isValidNumber(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(r/(2*Math.PI))*Math.PI*2:Math.floor(r/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class bc extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t,e,i,s,r,n,a,o,l,h,c,d,u,p,g,m,f,v,y,_,b,S,x;let A,T;super.onBind();const C=this.target.getFinalAttribute(),k=null!==(t=this.target.attribute)&&void 0!==t?t:{},w=null===(e=this.params)||void 0===e?void 0:e.options,M=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==w?void 0:w.direction,E=null!==(l=null!==(a=null!==(n=null===(r=this.params)||void 0===r?void 0:r.fromScaleX)&&void 0!==n?n:null==w?void 0:w.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==w?void 0:w.fromScale,B=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==w?void 0:w.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==w?void 0:w.fromScale;switch(M){case"x":A={scaleX:null!==(g=null!=E?E:k.scaleX)&&void 0!==g?g:0},T={scaleX:null!==(m=null==C?void 0:C.scaleX)&&void 0!==m?m:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(f=null!=B?B:k.scaleY)&&void 0!==f?f:0},T={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=E?E:k.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=B?B:k.scaleY)&&void 0!==_?_:0},T={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(S=null==C?void 0:C.scaleY)&&void 0!==S?S:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=T,this.from=A,this.to=T,!1!==(null===(x=this.params.controlOptions)||void 0===x?void 0:x.immediatelyApply)&&Hl(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),Gl(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class Sc extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t,e,i,s,r;let n,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":n={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":n={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:n={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(r=null==o?void 0:o.scaleY)&&void 0!==r?r:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=n,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Gl(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class xc extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const Ac={x:!0,y:!0,x1:!0,y1:!0,width:!0,height:!0};function Tc(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1}class Cc extends Jl{constructor(t,e,i,s,r){super(t,e,i,s,r),this.updateFromAttrs=null,this.clipPathSyncKeys=null,this.clipPathSyncParent=null,this.clipPathSyncChildIndex=-1,this.clipPathSyncDisabled=!1}onBind(){var t;super.onBind();const e=null!==(t=this.target.context)&&void 0!==t?t:{};let{diffAttrs:i={}}=e;const{options:s}=this.params;i=function(t,e){if(!(null==e?void 0:e.length))return t;const i={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&!Tc(e,s)&&(i[s]=t[s]);return i}(i,null==s?void 0:s.excludeChannels),this.props=i,this.updateFromAttrs=this.target.consumeTransientFromAttrsBeforePreventAnimate(i),this.clipPathSyncKeys=Object.keys(i).filter((t=>Ac[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&xl(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,r=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(r)||!r.length)return;const n=this.getClipPathSyncChildIndex(s);if(n<0||n>=r.length)return;const a=r[n];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(Gl(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,r=this.getTargetFinalAttrs(),n=t.getFinalAttribute(),a=null!==(e=null!=n?n:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&r&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=r[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var r;const n=null===(r=i.attribute)||void 0===r?void 0:r[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==n&&!this.isSameClipPathValue(t.attribute[e],n)&&(s[e]=n)})),Object.keys(s).length?s:null}}class kc extends Ql{constructor(t,e,i,s,r){super(t,e,i,s,r),this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}afterStageRender(t,e){var i,s;return null===(s=null===(i=this.params)||void 0===i?void 0:i.callBack)||void 0===s?void 0:s.call(i,t,e,this.currentAnimationRatio,this.animationTime)}}var wc,Mc;!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(wc||(wc={})),function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(Mc||(Mc={}));const Ec=(t,e)=>(s.isFunction(Oc.warnHandler)&&Oc.warnHandler.call(null,t,e),e?s.Logger.getInstance().warn(`[VChart warn]: ${t}`,e):s.Logger.getInstance().warn(`[VChart warn]: ${t}`)),Bc=(t,e,i)=>{if(!Oc.silent){if(!s.isFunction(Oc.errorHandler))throw new Error(t);Oc.errorHandler.call(null,t,e)}},Oc={silent:!1,warnHandler:!1,errorHandler:!1},Pc=function(){!function(){if(null==Yn)try{const t=document.createElement("canvas"),e=t.getContext("2d");Yn=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),Yn&&(Yn=!!document.createElement)}catch(t){Yn=!1}}();const t=dt.global&&dt.global.env;return t?"browser"===t:Yn}();function Ic(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}function Rc(t){return null!=t&&""!==t&&(!!s.isNumber(t)||+t==+t)}function Dc(t){return!(!t||0===t.length)&&!s.isNil(t[0])&&!s.isNil(t[0].dataId)&&s.isArray(t[0].fields)}function Lc(t){return function(e){let i;return i=s.isArray(t)?t.reduce(((t,e)=>null==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var Fc;!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(Fc||(Fc={}));const Nc={};function Uc(t){switch(t){case Fc.Linear:case Fc.Log:case Fc.Pow:case Fc.Sqrt:case Fc.Symlog:case Fc.Time:return!0;default:return!1}}function jc(t){return!!Nc[t]}function Vc(t){switch(t){case Fc.Ordinal:case Fc.Point:case Fc.Band:return!0;default:return!1}}function Gc(t){return t}function zc(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function Kc(t,e,i){const s=t[0],r=t[1],n=e[0],a=e[1];let o,l;return r<s?(o=zc(r,s),l=i(a,n)):(o=zc(s,r),l=i(n,a)),t=>l(o(t))}function Hc(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Wc(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function $c(t,e,i){const r=Math.min(t.length,e.length)-1,n=new Array(r),a=new Array(r);let o=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<r;)n[o]=zc(t[o],t[o+1]),a[o]=i(e[o],e[o+1]);return function(e){const i=s.bisect(t,e,1,r)-1;return a[i](n[i](e))}}Object.values(Fc).forEach((t=>{Nc[t]=!0}));const Yc=(t,e=!1)=>{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let r;return r=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,r*Math.pow(10,i)};class Xc{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:s.isValid(this._rangeFactorStart)&&s.isValid(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=Wc(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):s.isValid(this._rangeFactorStart)&&s.isValid(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return s.isNil(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!s.isNil(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return s.isNil(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!s.isNil(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:r}=this._fishEyeOptions,n=this.range(),a=n[0],o=n[n.length-1],l=Math.min(a,o),h=Math.max(a,o),c=s.clamp(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,l,h),d=s.isNil(r)?(h-l)*i:r;let u=Math.exp(e);u=u/(u-1)*d;const p=e/d;this._fishEyeTransform=t=>{const e=Math.abs(t-c);if(e>=d)return t;if(e<=1e-6)return c;const i=u*(1-Math.exp(-e*p))/e*.75+.25;return c+(t-c)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const qc=Symbol("implicit");class Zc extends Xc{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=Fc.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=qc}clone(){const t=(new Zc).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return s.isValid(this._rangeFactorStart)&&s.isValid(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==qc)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const r=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(r):r}invert(t){let e=0;for(;e<this._ordinalRange.length&&this._ordinalRange[e]!==t;)e++;return this._domain[(e-1)%this._domain.length]}domain(t){if(!t)return this._domain.slice();this._domain=[],this._index=new Map;for(const e of t){const t=`${e}`;this._index.has(t)||this._index.set(t,this._domain.push(e))}return this}range(t){if(!t)return this._ordinalRange.slice();const e=Array.from(t);return this._ordinalRange=e,this}index(t){var e;return this._index&&null!==(e=this._index.get(`${t}`))&&void 0!==e?e:-1}}function Jc(t,e,i,s){const r=[];let n=t;for(;n<=e;)r.push(n),n+=i;return s&&r.reverse(),r}function Qc(t,e,i,r){let n,a;if(e=Math.floor(+e),t=Math.floor(+t),!(i=Math.floor(+i)))return[];if(t===e)return[t];if(n=e<t){const i=t;t=e,e=i}let o=s.clamper(1,e-t+1)(i);if(a=Math.floor((e-t+1)/o),!r)for(;Math.ceil((e-t+1)/a)>i&&o>1;)o-=1,a=Math.floor((e-t)/o);return Jc(t,e,a,n)}class td extends Zc{constructor(t){super(),this.type=Fc.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),r=super.domain().length,n=i[1]<i[0];let a=i[Number(n)-0];const o=i[1-Number(n)],l=Hc(r,this._paddingInner,this._paddingOuter);return this._step=(o-a)/Math.max(1,l||1),this._round&&(this._step=Math.floor(this._step)),a+=(o-a-this._step*(r-this._paddingInner))*this._align,this.isBandwidthFixed()||(this._bandwidth=this._step*(1-this._paddingInner)),this._round&&(a=Math.round(a),this.isBandwidthFixed()||(this._bandwidth=Math.round(this._bandwidth))),this._bandRangeState={reverse:n,start:n?s.clamp(a+this._step*(r-1),i[1],i[0]):s.clamp(a,i[0],i[1]),min:n?i[1]:i[0],max:o,count:r},this.generateFishEyeTransform(),this}scale(t){if(!this._bandRangeState)return;const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let r=this._index.get(e);if(!r){if(this._unknown!==qc)return this._unknown;r=this._domain.push(t),this._index.set(e,r)}const{count:n,start:a,reverse:o,min:l,max:h}=this._bandRangeState,c=a+(r-1)%n*(o?-1:1)*this._step;return s.clamp(this._fishEyeTransform?this._fishEyeTransform(c):c,l,h)}_calculateWholeRange(t,e){if(this._wholeRange)return this._wholeRange;if((this._minBandwidth||this._maxBandwidth)&&!this._isBandwidthFixedByUser()){let e;if(s.isValid(this._rangeFactorStart)&&s.isValid(this._rangeFactorEnd)&&2===t.length){const i=Wc(t,[this._rangeFactorStart,this._rangeFactorEnd]);e=Math.abs(i[1]-i[0])}else e=Math.abs(t[1]-t[0]);const i=function(t,e,i,s,r){const n=Hc(t,i,s);let a=e/Math.max(1,n||1);r&&(a=Math.floor(a));let o=a*(1-i);return r&&(o=Math.round(o)),o}(super.domain().length,e,this._paddingInner,this._paddingOuter,this._round);i<this._minBandwidth?(this._bandwidth=this._minBandwidth,this._isFixed=!0):i>this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const o=(i=super.domain().length,r=this._bandwidth,n=this._paddingInner,a=this._paddingOuter,1===n&&(n=0),Hc(i,n,a)*(r/(1-n))*Math.sign(t[1]-t[0])),l=Math.min((t[1]-t[0])/o,1);if(s.isValid(this._rangeFactorStart)&&s.isValid(this._rangeFactorEnd)){const i=this._rangeFactorStart+l<=1,s=this._rangeFactorEnd-l>=0;if("rangeFactorStart"===e&&i?this._rangeFactorEnd=this._rangeFactorStart+l:"rangeFactorEnd"===e&&s?this._rangeFactorStart=this._rangeFactorEnd-l:t[0]<=t[1]?i?this._rangeFactorEnd=this._rangeFactorStart+l:s?this._rangeFactorStart=this._rangeFactorEnd-l:(this._rangeFactorStart=0,this._rangeFactorEnd=l):s?this._rangeFactorStart=this._rangeFactorEnd-l:i?this._rangeFactorEnd=this._rangeFactorStart+l:(this._rangeFactorStart=1-l,this._rangeFactorEnd=1),o>0){const e=t[0]-o*this._rangeFactorStart,i=e+o;this._wholeRange=[e,i]}else{const e=t[1]+o*(1-this._rangeFactorEnd),i=e-o;this._wholeRange=[i,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=l,this._wholeRange=[t[0],t[0]+o];return this._wholeRange}var i,r,n,a;return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(s.isValid(this._rangeFactorStart)&&s.isValid(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[s.toNumber(t[0]),s.toNumber(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[s.toNumber(t[0]),s.toNumber(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:Qc(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return Qc(0,e.length-1,t,!0).filter((t=>t<e.length)).map((t=>e[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let r;if(e=Math.floor(+e),t=Math.floor(+t),i=s.clamper(1,e-t+1)(Math.floor(+i)),r=e<t){const i=t;t=e,e=i}return Jc(t,e,i,r)}(0,e.length-1,t).map((t=>e[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,r=this.bandwidth()/2,n=this._domain.length,a=this.range(),o=a[0]>a[a.length-1];for(e=0;e<n;e++){const a=this.scale(this._domain[e])+r;if(0===e&&(!o&&!s.isGreater(t,a+i)||o&&!s.isLess(t,a-i)))break;if(e===n-1)break;if(!s.isLess(t,a-i)&&!s.isGreater(t,a+i))break}return e>=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return s.isNil(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return s.isNil(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&s.isNumber(this._userBandwidth)}clone(){var t,e,i;return new td(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:ed}=s.ColorUtil;function id(t,e){const i=typeof e;let r;if(s.isNil(e)||"boolean"===i)return()=>e;if("number"===i)return s.interpolateNumber(t,e);if("string"===i){if(r=s.ColorUtil.Color.parseColorString(e)){const e=ed(s.ColorUtil.Color.parseColorString(t),r);return t=>e(t).formatRgb()}return s.interpolateNumber(Number(t),Number(e))}return e instanceof s.ColorUtil.RGB?ed(t,e):e instanceof s.ColorUtil.Color?ed(t.color,e.color):e instanceof Date?s.interpolateDate(t,e):s.interpolateNumber(Number(t),Number(e))}class sd extends Xc{constructor(t=Gc,e=Gc){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Gc,this._piecewise=Kc,this._interpolate=id}calculateVisibleDomain(t){var e;return s.isValid(this._rangeFactorStart)&&s.isValid(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),s.interpolateNumber)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const r=Array.from(t,s.toNumber);return this._domain=r,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=s.interpolateNumberRound,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,r=i.length,n=this._range.length;let a=Math.min(r,n);if(r&&r<n&&this._forceAlign){const t=n-r+1,e=i[r-1],s=r>=2?(e-i[r-2])/t:0;for(let n=1;n<=t;n++)i[r-2+n]=e-s*(t-n);a=n}return this._autoClamp&&(this._clamp=s.clamper(i[0],i[a-1])),this._piecewise=a>2?$c:Kc,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:Gc),this.rescale(i)):this._clamp!==Gc}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return s.isNil(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return s.isNil(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const rd=Math.sqrt(50),nd=Math.sqrt(10),ad=Math.sqrt(2),od=[1,2,5,10],ld=(t,e,i)=>{let r=1,n=t;const a=Math.floor((e-1)/2),o=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&o<1?r=ud(o).step:(i||o>1)&&(n=Math.floor(t)-a*r),r>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*r)),s.range(0,e).map((t=>n+t*r))):t>0?cd(0,-(e-1)/r,r):cd((e-1)/r,0,r)},hd=s.memoize(((t,e,i,s)=>{let r,n,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((r=e<t)&&(n=t,t=e,e=n),o=pd(t,e,i).step,!isFinite(o))return[];if(o>0){let i=Math.round(t/o),s=Math.round(e/o);for(i*o<t&&++i,s*o>e&&--s,a=new Array(n=s-i+1);++l<n;)a[l]=(i+l)*o}else if(o<0&&(null==s?void 0:s.noDecimals)){o=1;const i=Math.ceil(t),s=Math.floor(e);if(!(i<=s))return[];for(a=new Array(n=s-i+1);++l<n;)a[l]=i+l}else{o=-o;let i=Math.round(t*o),s=Math.round(e*o);for(i/o<t&&++i,s/o>e&&--s,a=new Array(n=s-i+1);++l<n;)a[l]=(i+l)/o}return r&&a.reverse(),a})),cd=(t,e,i)=>{let s,r,n=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*i<t&&++a,(o-1)*i>e&&--o,r=new Array(s=o-a+1);++n<s;)r[n]=(a+n)*i}else{i=-i;let a=Math.floor(t*i),o=Math.ceil(e*i);for((a+1)/i<t&&++a,(o-1)/i>e&&--o,r=new Array(s=o-a+1);++n<s;)r[n]=(a+n)/i}return r},dd=s.memoize(((t,e,i,s)=>{let r,n,a;if(i=+i,(t=+t)==(e=+e))return ld(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return ld(t,i,null==s?void 0:s.noDecimals);(r=e<t)&&(a=t,t=e,e=a);const o=pd(t,e,i);let l=o.step;if(!isFinite(l))return[];if(l>0){let s=1;const{power:r,gap:a}=o,h=10===a?2*10**r:1*10**r;for(;s<=5&&(n=cd(t,e,l),n.length>i+1)&&i>2;)l+=h,s+=1;i>2&&n.length<i-1&&(n=((t,e,i)=>{let s;const r=t[0],n=t[t.length-1],a=e-t.length;if(n<=0){const e=[];for(s=a;s>=1;s--)e.push(r-s*i);return e.concat(t)}if(r>=0){for(s=1;s<=a;s++)t.push(n+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[r-Math.floor(s/2)*i].concat(o):l.push(n+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(n,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),n=cd(t,e,l);return r&&n.reverse(),n})),ud=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=od[0];return i>=rd?s=od[3]:i>=nd?s=od[2]:i>=ad&&(s=od[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function pd(t,e,i){const s=(e-t)/Math.max(0,i);return ud(s)}function gd(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const r=new Array(i);for(let e=0;e<i;e++)r[e]=t+e*s;return r}function md(t,e,i){let s,r,n=-1;if(i=+i,(r=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++n<a;)o[n]=t+n*i;return r&&o.reverse(),o}function fd(t,e=10){let i,s,r=0,n=t.length-1,a=t[r],o=t[n],l=10;for(o<a&&(s=a,a=o,o=s,s=r,r=n,n=s);l-- >0;){if(s=pd(a,o,e).step,s===i)return t[r]=a,t[n]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}const vd=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i);s.memoize(((t,e,i,s,r,n,a)=>{let o=t,l=e;const h=l<o;h&&([o,l]=[l,o]);let c,d,u=r(o),p=r(l),g=[];if(!(s%1)&&p-u<i){if(u=Math.floor(u),p=Math.ceil(p),o>0){for(;u<=p;++u)for(c=1;c<s;++c)if(d=u<0?c/n(-u):c*n(u),!(d<o)){if(d>l)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/n(-u):c*n(u),!(d<o)){if(d>l)break;g.push(d)}2*g.length<i&&(g=dd(o,l,i))}else g=dd(u,p,Math.min(p-u,i)).map(n);return g=g.filter((t=>0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),s.memoize(((t,e,i,s,r,n)=>{const a=[],o={},l=r(t),h=r(e);let c=[];if(Number.isInteger(s))c=dd(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e<i;e++)c.push(l+e*t)}return c.forEach((i=>{const r=n(i),l=Number.isInteger(s)?vd(t,e,r):vd(t,e,Yc(r)),h=vd(t,e,((t,e)=>{let i,s;return e[0]<e[1]?(i=e[0],s=e[1]):(i=e[1],s=e[0]),Math.min(Math.max(t,i),s)})(l,[t,e]));!o[h]&&!isNaN(h)&&c.length>1&&(o[h]=1,a.push(h))})),a})),s.memoize(((t,e,i,s,r)=>gd(s(t),s(e),i).map((t=>Yc(r(t)))))),s.memoize(((t,e,i,s,r)=>md(s(t),s(e),i).map((t=>Yc(r(t))))));class yd extends sd{constructor(){super(...arguments),this.type=Fc.Linear}clone(){var t;const e=new yd;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return hd(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(s.isFunction(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(s.isValid(this._rangeFactorStart)&&s.isValid(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const r=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,a=r[0],o=r[r.length-1];let l=dd(n[0],n[n.length-1],t,e);if(!l.length)return l;if(this._domainValidator)l=l.filter(this._domainValidator);else if((l[0]!==a||l[l.length-1]!==o)&&this._niceType){const t=r.slice();if("all"===this._niceType?(t[0]=l[0],t[t.length-1]=l[l.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&l[0]!==a?(t[0]=l[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&l[l.length-1]!==o&&(t[t.length-1]=l[l.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);l=l.filter((t=>t>=e&&t<=i))}}return l}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return gd(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return md(e[0],e[e.length-1],t)}nice(t=10,e){var i,r;const n=this._domain;let a=[];if(e){const t=function(t,e){const i=s.isNumber(e.forceMin),r=s.isNumber(e.forceMax);let n=null;const a=[];let o=null;const l=i&&r?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:r?t=>t<=e.forceMax:null;return i?a[0]=e.forceMin:s.isNumber(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(a[0]=e.min),r?a[1]=e.forceMax:s.isNumber(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(a[1]=e.max),s.isNumber(a[0])&&s.isNumber(a[1])?(o=t.slice(),o[0]=a[0],o[o.length-1]=a[1]):n=s.isNumber(a[0])||s.isNumber(a[1])?s.isNumber(a[0])?"max":"min":"all",{niceType:n,niceDomain:o,niceMinMax:a,domainValidator:l}}(n,e);if(a=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=fd(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=a[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(r=a[0])&&void 0!==r?r:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(t=10){this._niceType="min";const e=this._domain[this._domain.length-1],i=fd(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(t=10){this._niceType="max";const e=this._domain[0],i=fd(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}class _d{constructor(){this.type=Fc.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!s.isNil(t)&&s.isValidNumber(+t)?this._range[s.bisect(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new _d).domain(this._domain).range(this._range).unknown(this._unknown)}}var bd,Sd;function xd(t){var e,i;const{type:s}=t;return s===bd.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(bd||(bd={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(Sd||(Sd={}));const Ad={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},Td={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function Cd(t,e){var i;if(!t)return[];const r=Bd(t,e);if(!r||s.isArray(r))return null!==(i=r)&&void 0!==i?i:[];if(s.isObject(r)){const{dataScheme:i}=r;return i?Ed(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>Md(i)?wd(t,i,e):i)).filter(s.isValid)}))):i.map((i=>Md(i)?wd(t,i,e):i)).filter(s.isValid):[]}return[]}function kd(t,e){var i,r;return Ed(t)?null!==(r=null===(i=t.find((t=>s.isValid(t.isAvailable)?s.isFunction(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!s.isValid(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==r?r:t[t.length-1].scheme:t}function wd(t,e,i){var r;const n=Bd(t,i);if(!n)return;let a;const{palette:o}=n;if(s.isObject(o)&&(a=null!==(r=function(t,e){const i=Ad[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=Td[e];return s?t[s]:void 0}(o,e.key))&&void 0!==r?r:e.default),!a)return;if(s.isNil(e.a)&&s.isNil(e.l)||!s.isString(a))return a;let l=new s.Color(a);if(s.isValid(e.l)){const{r:t,g:i,b:r}=l.color,{h:n,s:a}=s.rgbToHsl(t,i,r),o=s.hslToRgb(n,a,e.l),h=new s.Color(`rgb(${o.r}, ${o.g}, ${o.b})`);h.setOpacity(l.color.opacity),l=h}return s.isValid(e.a)&&l.setOpacity(e.a),l.toRGBA()}function Md(t){return t&&"palette"===t.type&&!!t.key}function Ed(t){return!(!s.isArray(t)||0===t.length)&&t.every((t=>s.isValid(t.scheme)))}function Bd(t,e){var i,r;const{type:n}=null!=e?e:{};let a;if(!e||s.isNil(n))a=null==t?void 0:t.default;else{const s=xd(e);a=null!==(r=null!==(i=null==t?void 0:t[`${n}_${s}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==r?r:null==t?void 0:t.default}return a}class Od extends Zc{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!Ed(this._range))return void super.range(this._range);const t=kd(this._range,this._domain);super.range(t)}}const Pd={linear:yd,band:td,point:class extends td{constructor(t){super(!1),this.type=Fc.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:Zc,threshold:_d,colorOrdinal:Od};function Id(t){const e=Pd[t];return e?new e:null}function Rd(t){return s.isValid(null==t?void 0:t.field)&&s.isValid(null==t?void 0:t.scale)}function Dd(t){return!!s.isString(t)&&!!t.endsWith("%")&&Rc(t.substring(0,t.length-1))}function Ld(t,e,i,r=0){var n,a;return s.isNumber(t)?t:Dd(t)?Number(t.substring(0,t.length-1))*e/100:s.isFunction(t)?t(i):s.isObject(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(a=t.offset)&&void 0!==a?a:0):r}function Fd(t){let e={};return s.isArray(t)?(s.isNil(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),s.isNil(t[1])||(e.left=e.right=t[1]),s.isNil(t[2])||(e.bottom=t[2]),s.isNil(t[3])||(e.left=t[3]),e):s.isNumber(t)||Dd(t)||s.isFunction(t)||(i=t,s.isObject(i)&&("percent"in i||"offset"in i))?(e.top=e.left=e.bottom=e.right=t,e):s.isObject(t)?(e=Object.assign({},t),e):e;var i}const Nd=(t,e,i)=>{if(s.isNil(e))return t;const r=e[0];return s.isNil(r)?t:1===e.length?(t[r]=i,t):(s.isNil(t[r])&&("number"==typeof e[1]?t[r]=[]:t[r]={}),Nd(t[r],e.slice(1),i))};function Ud(t,...e){let i=-1;const r=e.length;for(;++i<r;){const r=e[i];s.baseMerge(t,r,!0,!0)}return t}const jd="__VCHART",Vd=500,Gd=500,zd=`${jd}_DEFAULT_DATA_INDEX`,Kd=`${jd}_DEFAULT_DATA_KEY`,Hd=`${jd}_DEFAULT_DATA_SERIES_FIELD`,Wd=`${jd}_DEFAULT_SERIES_STYLE_NAME`,$d=`${jd}_STACK_START`,Yd=`${jd}_STACK_END`,Xd=`${jd}_STACK_START_PERCENT`,qd=`${jd}_STACK_END_PERCENT`,Zd=`${jd}_KEY`;function Jd(t,e){for(let i=0;i<e.length;i++){const s=e[i],r=Qd(t,s.key);r?r.operations=[...new Set(r.operations.concat(s.operations))]:t.push(s)}return t}function Qd(t,e){return t.find((t=>t.key===e))}const tu=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return"line"===(s=i)||"area"===s?e:null==e?void 0:e[0];var s};let eu=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},r=Sa.getComposedEvent(t);if(r){const e=new r(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,r,n;const a=null!=i?i:e;if(Sa.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(r=this._composedEventMap.get(e[0]))||void 0===r||r.event.unregister(),this._composedEventMap.delete(e[0]));else if(a){const i=null!==(n=this._getEventHandler(t,a))&&void 0!==n?n:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var iu,su,ru,nu;function au(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function ou(t,e=!1){let r=e;return t.latestData instanceof i.DataView&&(r=!1),r?s.cloneDeep(t.latestData):t.latestData&&t.latestData.slice()}!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(iu||(iu={})),function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleRawDomainUpdate="scaleRawDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(su||(su={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(ru||(ru={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(nu||(nu={})),nu.mark,nu.model,nu.chart,nu.vchart;const lu=(t,e)=>0===t.length?[]:1===t.length?ou(t[0],null==e?void 0:e.deep):t.map((t=>ou(t,null==e?void 0:e.deep)));function hu(t,e,s){au(e=e instanceof i.DataSet?e:t.dataSet,"copyDataView",lu);const r=new i.DataView(e,s);return r.parse([t],{type:"dataview"}),r.transform({type:"copyDataView",level:uu.copyDataView}),r}function cu(t,e,r=[]){var n;if(t instanceof i.DataView)return t;const{id:a,values:o=[],fromDataIndex:l,fromDataId:h,transforms:c=[]}=t,d=t.parser?s.cloneDeep(t.parser):{clone:!0},u=s.cloneDeep(t.fields);let p;d.clone=!(!1===d.clone);const g=r.find((t=>t.name===a));if(g)p=g;else{const t={name:a};if(u&&(t.fields=u),p=new i.DataView(e,t),"string"==typeof h){const t=r.find((t=>t.name===h));if(!t)return Ec(`no data matches fromDataId ${h}`),null;p.parse([t],{type:"dataview"}),p.transform({type:"copyDataView"})}else if("number"==typeof l){const t=r[l];if(!t)return Ec(`no data matches fromDataIndex ${l}`),null;p.parse([t],{type:"dataview"}),p.transform({type:"copyDataView"})}else Array.isArray(o)?p.parse(o,d):!s.isString(o)||d&&!["csv","dsv","tsv"].includes(d.type)?(p.parse([]),Ec("values should be array")):p.parse(o,null!==(n=d)&&void 0!==n?n:{type:"csv"});c&&c.length&&c.forEach((t=>{e.getTransform(t.type)&&p.transform(t)}))}return p}function du(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var uu,pu,gu;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(uu||(uu={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(pu||(pu={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(gu||(gu={}));const mu=["line","area","trail"];function fu(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(Zd,i?t.slice().sort(i):t.slice()),{keys:[Zd],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const r=new Set;return t.forEach(((t,i)=>{var n;const a=e(t,i),o=null!==(n=s.get(a))&&void 0!==n?n:[];o.push(t),s.set(a,o),r.add(a)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}const vu=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function yu(t,e,i){var r;const{width:n,height:a}=t;if(s.isValid(n)&&s.isValid(a))return{width:n,height:a};let o=i.width,l=i.height;const h=e.container,c=e.canvas;if(h){const{width:t,height:e}=s.getContainerSize(h,i.width,i.height);o=t,l=e}else if(c&&(("desktop-browser"===(d=e.mode)||"mobile-browser"===d)&&Pc)){let t;t=s.isString(c)?_l.getElementById(c):c;const{width:e,height:r}=s.getContainerSize(t,i.width,i.height);o=e,l=r}else if(Ic(e.mode)&&(null===(r=e.modeParams)||void 0===r?void 0:r.domref)){const t=e.modeParams.domref;o=t.width,l=t.height}var d;return o=null!=n?n:o,l=null!=a?a:l,{width:o,height:l}}const _u=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function bu(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function Su(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;_u.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}var xu,Au,Tu;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(xu||(xu={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(Au||(Au={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(Tu||(Tu={}));class Cu{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){s.isNil(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,s.merge({},Cu.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=s.array(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}Cu.defaultMarkInfo={};class ku{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class wu{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const r=this._getDefaultSpecFromChart(e),n=t=>Ud({},i,r,t);return s.isArray(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}var Mu,Eu,Bu,Ou=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]])}return i};class Pu extends ku{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=wu,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new Cu,this._lastLayoutRect=null,this.id=ma(),this.userId=t.id,this._spec=t,this.effect={},this.event=new eu(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,r){s.isValid(t)&&s.isValid(e)&&t.setStyle(this._convertMarkStyle(e),i,r)}initMarkStyleWithSpec(t,e){if(!s.isValid(t)||!s.isValid(e))return;const{style:i,state:r}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),r&&(n.state={},Object.keys(r).forEach((t=>{n.state[t]=this._convertMarkStyle(r[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${jd}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={},i){const{type:s,name:r}=t,{parent:n}=e,a=Ou(e,["parent"]),o=Sa.createMark(s,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},a));return n?n.addMark(o):this.getCompiler().addRootMark(o),o&&(o.created(),i&&o.setMarkConfig(i)),o}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!s.isNil(e))return s.get(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}function Iu(t){const e=[],i=[],r=[];return t.forEach((t=>{s.isNil(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&r.push(t)})),{startItems:e,endItems:r,middleItems:i}}function Ru(t,e,i){e?t.forEach((t=>{const e=s.last(t),r=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-r)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=s.last(t),r=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-r)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function Du(t,e,i,s){let r;t.forEach(((t,n)=>{t.length>1&&(r=i[n],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),n="middle"===t.alignSelf?.5:1,a=e?r-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):r-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*n,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*n})})))}))}function Lu(t,e,i,s,r,n){if(t.length){let a=0;const o="right"===r,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=ju(t,e,n),r=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+m,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=r,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+r,t.setLayoutStartPosition({x:h+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),Du(d,!0,p,l),s&&Ru(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function Fu(t,e,i,s,r){if(t.length){let i=0;const n="right"===s,a=n?-1:1;let o=n?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=ju(t,e,r),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l<u&&c.length?(d.push(i),o+=a*i,i=p,l=e.bottomCurrent,t.setLayoutStartPosition({x:o+t.layoutOffsetX+g,y:l+t.layoutOffsetY-s.height-t.layoutPaddingBottom}),h.push(c),c=[t]):(t.setLayoutStartPosition({x:o+t.layoutOffsetX+g,y:l+t.layoutOffsetY-s.height-t.layoutPaddingBottom}),i=Math.max(i,p),l-=u,c.push(t))})),d.push(i),h.push(c),Du(h,!0,d,a),n?e.rightCurrent=o+a*i:e.leftCurrent=o+a*i}}function Nu(t,e,i,s,r,n){if(t.length){const a="top"===r,o=a?1:-1;let l=0,h=e.leftCurrent,c=a?e.topCurrent:e.bottomCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=ju(t,e,n),r=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+m}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=r,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+m}),d.push(u),u=[t]):(l=Math.max(l,r),u.push(t))})),p.push(l),d.push(u),Du(d,!1,p,o),s&&Ru(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function Uu(t,e,i,s,r){if(t.length){const i="top"===s,n=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=ju(t,e,r),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;o<g&&c.length?(o=e.rightCurrent,l+=n*a,a=p,t.setLayoutStartPosition({x:e.rightCurrent+t.layoutOffsetX-u.width-t.layoutPaddingRight,y:l+t.layoutOffsetY+m}),h.push(c),c=[t]):(c.push(t),t.setLayoutStartPosition({x:o+t.layoutOffsetX-u.width-t.layoutPaddingRight,y:l+t.layoutOffsetY+m}),a=Math.max(a,p),o-=g)})),d.push(a),h.push(c),Du(h,!1,d,n),i?e.topCurrent=l+n*a:e.bottomCurrent=l+n*a}}function ju(t,e,i,r=!0){let n,a,o="recomputeHeight",l="recomputeWidth",h="width";"top"!==t.layoutOrient&&"bottom"!==t.layoutOrient||(o="recomputeWidth",l="recomputeHeight",h="height");let c=!(!t.willLayoutTag&&!1===i[o]);if(c){const o=Object.assign({},t.getLayoutRect()),d=t.lastComputeRect;n=e.getItemComputeLayoutRect(t),!t.willLayoutTag&&s.isEqual(n,d)?(c=!1,a=t.getLayoutRect()):(a=t.computeBoundsInRect(n),s.isEqual(o[h],a[h])?c=!1:(r&&t.setLayoutRect(a),i[l]=!0))}else n=t.getLastComputeOutBounds(),a=t.getLayoutRect();return{layoutRect:n,rect:a,layoutTag:c}}class Vu{constructor(t,e){this.leftCurrent=0,this.topCurrent=0,this.rightCurrent=0,this.bottomCurrent=0,this.recomputeWidth=!1,this.recomputeHeight=!1,this._onError=null==e?void 0:e.onError}_layoutInit(t,e,i,s){this._chartLayoutRect=i,this._chartViewBox=s,this.leftCurrent=i.x,this.topCurrent=i.y,this.rightCurrent=i.x+i.width,this.bottomCurrent=i.height+i.y,this.recomputeWidth=!1,this.recomputeHeight=!1,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),r=i.concat(s),n={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{n[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:r,overlapItems:n}}layoutItems(t,e,i,s){var r,n,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(n=null===(r=null==t?void 0:t.getSpec())||void 0===r?void 0:r.layout)||void 0===n?void 0:n.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},r,n,a,o=!1){if(r.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(r,n);(l||h||c||d)&&(this.topCurrent=n.top+l,this.bottomCurrent=n.bottom-h,this.leftCurrent=n.left+c,this.rightCurrent=n.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=ju(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),r=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:r,middleItems:n,endItems:a}=Iu(t);r.length&&Lu(r,e,i,!1,"left",s),n.length&&Lu(n,e,i,!0,"left",s),a.length&&Fu(a,e,0,"left",s)}(i,this,o,e),r.length&&function(t,e,i,s){const{startItems:r,middleItems:n,endItems:a}=Iu(t);r.length&&Nu(r,e,i,!1,"top",s),n.length&&Nu(n,e,i,!0,"top",s),a.length&&Uu(a,e,0,"top",s)}(r,this,a,e),s.length&&function(t,e,i,s){const{startItems:r,middleItems:n,endItems:a}=Iu(t);r.length&&Lu(r,e,i,!1,"right",s),n.length&&Lu(n,e,i,!0,"right",s),a.length&&Fu(a,e,0,"right",s)}(s,this,o,e),n.length&&function(t,e,i,s){const{startItems:r,middleItems:n,endItems:a}=Iu(t);r.length&&Nu(r,e,i,!1,"bottom",s),n.length&&Nu(n,e,i,!0,"bottom",s),a.length&&Uu(a,e,0,"bottom",s)}(n,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=ju(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{s.isEqual(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=ju(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),r=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=r-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:r,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},r,n=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,r)})),this._layoutRelativeOverlap("left",s.left,r),this._layoutRelativeOverlap("right",s.right,r),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,r)})),this._layoutRelativeOverlap("top",s.top,r),this._layoutRelativeOverlap("bottom",s.bottom,r),h=this.bottomCurrent-this.topCurrent,n&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,r)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Bc)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds(),n=this._getOutInLayout(r,t,e);s?(i.top=Math.max(i.top,n.top),i.bottom=Math.max(i.bottom,n.bottom)):(i.left=Math.max(i.left,n.left),i.right=Math.max(i.right,n.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:r}=e.getLayoutStartPoint(),{width:n,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+n+t.x2-i.right,top:i.top-(r-t.y1),bottom:r+a+t.y2-i.bottom}}}Vu.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(Mu||(Mu={})),function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}(Eu||(Eu={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(Bu||(Bu={}));const Gu=["linear","radial","conical"],zu={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const Ku={};Object.values(Eu).forEach((t=>{Ku[t]=!0})),Eu.STATE_HOVER,Eu.STATE_HOVER_REVERSE,Eu.STATE_SELECTED,Eu.STATE_SELECTED_REVERSE,Eu.STATE_DIMENSION_HOVER,Eu.STATE_DIMENSION_HOVER_REVERSE;class Hu extends ku{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(s.merge(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class Wu extends Hu{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;i<this._stateInfoList.length;i++){const s=this._stateInfoList[i].level;if(s&&s>t.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const r=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];s.isValid(r.domain)&&(n.domain=r.domain),s.isValid(r.type)&&(n.type=r.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||function(t){return mu.includes(t)}(this._mark.type)}checkOneState(t,e,i){var r;let n=!1,a=!1;if(s.isValid(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),a=!0;else if(i.items)n=null!==(r=this.checkItemsState(i,t))&&void 0!==r&&r,a=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),a=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),a=!0}return a?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!Ku[t])).map((t=>[t,10]));for(let i=0;i<this._stateInfoList.length;i++){const r=this._stateInfoList[i],n=this.checkOneState(t,e,r);"skip"!==n&&"in"===n&&s.push([r.stateValue,r.level])}return s.map((t=>t[0]))}checkDatumState(t,e){let i=!1;const r=e[0];if(s.isArray(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(jd)));i=t.datums.some((t=>e&&s.isArray(null==t?void 0:t.items)?n.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==r?void 0:r[e])})):n.every((e=>(null==t?void 0:t[e])===(null==r?void 0:r[e])))))}else if(s.isObject(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(jd))),s=this._isMultiMark();i=e.every((e=>{var i,n;return s?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===r[e]:(null===(n=t.datums)||void 0===n?void 0:n[e])===r[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let r=!0;for(const n in t.fields){const a=t.fields[n],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[n];if(Uc(o)&&l.length>1){if(this.checkLinearFieldState(l,n,e,i)){r=!1;break}r=!0}else{if(!l.some((t=>t===h))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s){var r;const n=this._isMultiMark()?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return n<t[0]||n>t[t.length-1]}release(){}}class $u extends ku{constructor(){super(...arguments),this.id=ma(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=Sa.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class Yu extends $u{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const Xu=1e3,qu="quadInOut",Zu=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Ju=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=r.interpolateColor(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Qu=(t,e,i)=>{const s=[],r=[];e.clear();for(let n=0;n<t.length;n++){const a=t[n],o=a.from,l=a.to,h=a.rotation*i,c=a.fromCp,d=a.toCp,u=Math.sin(h),p=Math.cos(h);r[0]=c[0]+(d[0]-c[0])*i,r[1]=c[1]+(d[1]-c[1])*i;for(let t=0;t<o.length;t+=2){const e=o[t],n=o[t+1],a=e*(1-i)+l[t]*i,h=n*(1-i)+l[t+1]*i;s[t]=a*p-h*u+r[0],s[t+1]=a*u+h*p+r[1]}let g=s[0],m=s[1];e.moveTo(g,m);for(let t=2;t<o.length;t+=6){const i=s[t],r=s[t+1],n=s[t+2],a=s[t+3],o=s[t+4],l=s[t+5];g===i&&m===r&&n===o&&a===l?e.lineTo(o,l):e.bezierCurveTo(i,r,n,a,o,l),g=o,m=l}}},tp=(t,e,i)=>{const s=t?r.pathToBezierCurves(t):[],n=r.pathToBezierCurves(e);i&&s&&(i.fromTransform&&r.applyTransformOnBezierCurves(s,i.fromTransform.clone().getInverse()),r.applyTransformOnBezierCurves(s,i.toTransfrom));const[a,o]=r.alignBezierCurves(s,n);return t?r.findBestMorphingRotation(a,o,10,Math.PI):o.map(((t,e)=>({from:a[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},ep=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],ip=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((a=>{if(!ep.includes(a))return;const o=e[a];if(!s.isNil(o)&&!s.isNil(t[a])&&o!==t[a]){if("fill"===a||"stroke"===a){const e=t=>"string"==typeof t?r.ColorStore.Get(t,r.ColorType.Color255):t;i.push({from:s.isArray(t[a])?t[a].map(e):e(t[a]),to:s.isArray(o)?o.map(e):e(o),key:a})}else i.push({from:t[a],to:o,key:a});n=!0}})),n?i:null};class sp extends Jl{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,r="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Qu(this.morphingData,r,e),this.otherAttrs&&this.otherAttrs.length&&Ju(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):Kl(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const rp=(t,e,i,s)=>{var r,n,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=tp(null===(r=null==t?void 0:t.toCustomPath)||void 0===r?void 0:r.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=ip(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new sp({morphingData:l,otherAttrs:h},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Xu,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:qu);return c.play(d),c};class np extends Jl{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Qu(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&Ju(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const ap=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Zu.includes(t))(i)||(e[i]=t[i])})),e},op=(t,e,i)=>{const s=ap(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const a=t.AABBBounds,o=a.width(),l=a.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=r.application.graphicService.creator.rect({x:0,y:0,width:o,height:l,pickable:!1});n.appendChild(i),e.push(i)}))}},lp=(t,e,i)=>{const s=[],n=i?null:ap(t.attribute),a=t.toCustomPath();for(let t=0;t<e;t++){const t={path:(new r.CustomPath2D).fromCustomPath2D(a)};s.push(r.application.graphicService.creator.path(i?t:Object.assign({},n,t)))}return i&&op(t,s,e),s},hp=(t,e,i)=>{const s=[],n=i?null:ap(t.attribute);if("rect"===t.type)r.splitRect(t,e).forEach((t=>{s.push(r.application.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)r.splitArc(t,e).forEach((t=>{s.push(r.application.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)r.splitCircle(t,e).forEach((t=>{s.push(r.application.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const a=r.splitLine(t,e),o={size:10,symbolType:"circle"};a.forEach((t=>{s.push(r.application.graphicService.creator.symbol(i?Object.assign({},t,o):Object.assign({},n,t,o)))}))}else"polygon"===t.type?r.splitPolygon(t,e).forEach((t=>{s.push(r.application.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?r.splitArea(t,e).forEach((t=>{s.push(r.application.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&r.splitPath(t,e).forEach((t=>{"path"in t?s.push(r.application.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(r.application.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&op(t,s,e),s},cp=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,dp=(t,e,i,n,a)=>{var o;const l={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},h={prev:t.slice(),next:e.slice()},c=null!==(o=i.animation)&&void 0!==o?o:{},d=c.easing,u=cp(c.delay,a,l,h),p=cp(c.duration,a,l,h),g=cp(c.oneByOne,a,l,h),m=cp(c.splitPath,a,l,h),f=s.isValidNumber(g)&&g>0?t=>s.isNumber(g)?t*g:!0===g?t*p:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const r=e.filter((t=>t&&t.toCustomPath&&t.valid));r.length||console.error(r," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const n=("clone"===(null==i?void 0:i.splitPath)?lp:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:hp)(t,r.length,!1),a=null==i?void 0:i.onEnd;let o=r.length;const l=()=>{o--,0===o&&a&&a()};r.forEach(((e,s)=>{var a;const o=n[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,r.length,o,e):0);rp(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:u,duration:p,easing:d,onEnd:n,individualDelay:f,splitPath:m}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,a;const o=t.filter((t=>t.toCustomPath&&t.valid));o.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const l=("clone"===(null==i?void 0:i.splitPath)?lp:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:hp)(e,o.length,!0),h=e.attribute;e.setAttribute("visible",!1);const c=o.map(((t,e)=>tp(t.toCustomPath(),l[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:l[e].globalTransMatrix}))),d=o.map(((t,e)=>ip(t.attribute,h)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=o.length;const a=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:r.AttributeUpdateType.ANIMATE_END}),e.detachShadow(),s&&s())};l.forEach(((e,s)=>{var r,n,l;const h=(null!==(r=i.delay)&&void 0!==r?r:0)+i.individualDelay(s,o.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:a}));u.wait(h),u.play(new sp({morphingData:c[s],saveOnEnd:!0,otherAttrs:d[s]},null!==(n=i.duration)&&void 0!==n?n:Xu,null!==(l=i.easing)&&void 0!==l?l:qu))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:r.AttributeUpdateType.ANIMATE_END}),e.detachShadow(),t&&t()};const o=e.animate(s);(null==i?void 0:i.delay)&&o.wait(i.delay),o.play(new np({morphingData:c,otherAttrs:d},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Xu,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:qu))}})(t,e[0],{delay:u,duration:p,easing:d,onEnd:n,individualDelay:f,splitPath:m}):rp(t[0],e[0],{delay:u,duration:p,easing:d,onEnd:n})},up=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,r)=>t.slice(i*r,r===e-1?t.length:i*(r+1))))},pp=t=>{const e=t.getMarkConfig();s.isValid(e.morphElementKey)&&t.getGraphics().forEach((t=>{var i,s;const r=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];r&&(t.context.morphKey=r[e.morphElementKey])}))},gp=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const r=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,r)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):r.length?t.useStates(r,i):t.clearStates(i)},mp=(t,e,i=!0,s)=>{var r;if(!e)return;const n=i&&null!==(r=t.currentStates)&&void 0!==r?r:[],a=i?Array.from(new Set([...n,e])):[e];gp(t,a,s)},fp=(t,e,i)=>{var s;const r=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!r.length)return;const n=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!r.includes(t)));gp(t,n,i)};var vp=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]])}return i};const yp=Symbol("statesClearedBeforeReInit");class _p extends $u{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){s.isValid(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){s.isNil(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const r=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,a;const o="function"==typeof r?r(t,e,i):r;if(e&&e.context&&e.context.compiler&&s.isValid(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},o),{layoutRect:null===(a=null==t?void 0:t.getLayoutRect)||void 0===a?void 0:a.call(t)})}return Object.assign({},o)}})},r={};Object.keys(t).forEach((e=>{const n=t[e];s.isArray(n)?r[e]=n.map(i):s.isValid(n)&&(r[e]=i(n))})),this._animationConfig=r}disableAnimationByState(t){const e=s.array(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=s.array(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new Yu(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(s.isValid(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}s.isNil(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else s.isValid(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=An("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){s.isNil(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:xu.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new we)),i&&(s.isFunction(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,r;const n=t.context.diffState===Mu.enter||t.context.diffState===Mu.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(r=t.registeredActiveScopes)||void 0===r?void 0:r.size));((null==n?void 0:n.length)||a)&&gp(t,n,e)},this.name=t,this.model=e.model,this.key=e.key,this.state=new Wu(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(s.isValid(t.id)&&(this._userId=t.id),s.isBoolean(t.interactive)&&(this._markConfig.interactive=t.interactive),s.isValid(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),s.isBoolean(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,s.degreeToRadian)}isUserLevel(t){return[Tu.User_Mark,Tu.User_Series,Tu.User_Chart,Tu.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(s.isNil(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const r=this.isUserLevel(i);Object.keys(t).forEach((n=>{let a=t[n];s.isNil(a)||(a=this._filterAttribute(n,a,e,i,r),this.setAttribute(n,a,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,r){let n=this._styleConvert(e);if(r)switch(t){case"angle":n=this.convertAngleToRadian(n);break;case"innerPadding":case"outerPadding":n=this._transformStyleValue(n,(t=>-t));break;case"curveType":n=this._transformStyleValue(n,(t=>function(t,e){return"monotone"===t?"horizontal"===e?"monotoneY":"monotoneX":t}(t,this._option.model.direction)))}return n}setReferer(t,e,i){var s;if(t)if(e&&i){const r=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",r=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:r,style:e,referer:void 0});const a=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;s.isValid(a)&&a<=r&&Ud(this.stateStyle[i][t],{style:e,level:r}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(jc(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return s.isString(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=Id(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let r=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];r||(r=this.stateStyle.normal[t]);const n=this._computeStateAttribute(r,t,e),a=s.isFunction(null==r?void 0:r.postProcess),o=t in this._computeExChannel;if(a&&o){const i=this._computeExChannel[t];return s=>{let a=n(s);return a=r.postProcess(a,s,this._attributeContext,this.getDataView()),i(t,s,e,a)}}if(a)return t=>r.postProcess(n(t),t,this._attributeContext,this.getDataView());if(o){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):Gu.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):jc(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",Tu.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let r={stateValue:t};"level"in i&&(r.level=i.level),"filter"in i&&(r=s.isFunction(i.filter)?Object.assign({filter:i.filter},r):Object.assign(Object.assign({},i.filter),r)),this.state.addStateInfo(r),this.setStyle(e,t,Tu.User_Mark)}else this.setStyle(i,t,Tu.User_Mark)}))}_computeGradientAttr(t){var e,i,r,n,a;const{gradient:o,scale:l,field:h}=t,c=vp(t,["gradient","scale","field"]);let d=l,u=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(d=t),u||(u=e)}const p=kd(Cd(this.model.getColorScheme(),"series"===this.model.modelType?null===(i=(e=this.model).getSpec)||void 0===i?void 0:i.call(e):void 0),null!==(a=null===(n=null===(r=this.model)||void 0===r?void 0:r.getDefaultColorDomain)||void 0===n?void 0:n.call(r))&&void 0!==a?a:[]),g=Object.assign(Object.assign({},zu[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(g).forEach((r=>{const n=g[r];"stops"===r?e.stops=n.map((e=>{const{opacity:r,color:n,offset:a}=e;let o=null!=n?n:null==d?void 0:d.scale(t[u]);return s.isFunction(n)&&(o=n(t,this._attributeContext,i)),s.isValid(r)&&(o=s.Color.SetOpacity(o,r)),{offset:s.isFunction(a)?a(t,this._attributeContext,i):a,color:o||p[0]}})):s.isFunction(n)?e[r]=n(t,this._attributeContext,i):e[r]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:e,field:i}=t,r=vp(t,["scale","field"]);return t=>{var n,a,o;const l={};if(Object.keys(r).forEach((e=>{const i=r[e];s.isFunction(i)?l[e]=i(t,this._attributeContext,this.getDataView()):l[e]=i})),"stroke"in l)Gu.includes(null===(o=r.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(r.stroke)(t));else{const s=kd(Cd(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(n=this.model).getSpec)||void 0===a?void 0:a.call(n):void 0),this.model.getDefaultColorDomain());let r=e,o=i;if(!(e&&i||"series"!==this.model.modelType)){const{scale:i,field:n}=this.model.getColorAttribute();e||(r=i),o||(o=n),l.stroke=(null==r?void 0:r.scale(t[o]))||s[0]}}return l}}_getDataByKey(t){return fu(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep<this._markConfig.progressiveThreshold,i=this._markConfig.large&&this._markConfig.largeThreshold>0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return Sa.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=s.isFunction(this.key)?this.key:s.isValid(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[Kd],this._groupKeyGetter=s.isValid(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=fu(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===pu.appear))?pu.appear:t.every((t=>t===pu.disappear))?pu.disappear:t[0];return null!=e?e:pu.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],r=[];t.forEach((t=>{pp(t),s.push(...t.getGraphics())})),e.forEach((t=>{pp(t),r.push(...t.getGraphics())}));const n=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=n(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),r.forEach((t=>{const e=n(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);dp([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),r=Math.min(e.length,s.length);if(r>0){const t=up(e,r),n=up(s,r);for(let e=0;e<r;e++)dp(t[e],n[e],i,d,{}),c+=1}})),0===c&&d(),!0})([this._lastMark],[this],{});return this._lastMark=null,e}return!1}_runStateAnimation(t){var e,i;if(!this._animationConfig||0===t.length)return;if(this.tryRunMorphing(t))return;const s=this.getAnimationConfig();if(null!==(e=this._markConfig.useSequentialAnimation)&&void 0!==e&&e&&this._runSequentialAnimations)return void this._runSequentialAnimations(t);const r=t.every((t=>"appear"===t.context.animationState)),n=this.createAnimationStateList("appear",s);if(r&&this._product){const t=n?["appear"]:[],e=n?[{name:"appear",animation:n}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const r=[e];t.applyAnimationState(r,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const r=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===pu.exit?pu.exit:i===pu.update?pu.update:pu.appear}),n=r(t);t.context.animationState=null!=n?n:t.context.diffState,t.context.animationState===Mu.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,r=[],n=new Set(this._graphics.filter((t=>t.context.diffState===Mu.enter))),a=(t,e,i)=>{var a,o,l,h,c,d,u,p,g;let m,f;return s.isNil(e)?(m=this._graphicMap.get(t),m&&(f=Mu.exit)):s.isNil(i)?(m=this._graphicMap.has(t)?this._graphicMap.get(t):{},f=Mu.enter,m.isExiting=!1,this._graphicMap.set(t,m),r.push(m)):(m=this._graphicMap.get(t),m&&(f=Mu.update,r.push(m))),m&&(n.delete(m),m.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:f,reusing:null===(a=m.context)||void 0===a?void 0:a.reusing,originalFieldX:null===(o=m.context)||void 0===o?void 0:o.originalFieldX,originalFieldY:null===(l=m.context)||void 0===l?void 0:l.originalFieldY,fieldX:null===(h=m.context)||void 0===h?void 0:h.fieldX,fieldY:null===(c=m.context)||void 0===c?void 0:c.fieldY,data:null!=e?e:null===(d=m.context)||void 0===d?void 0:d.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=m.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=m.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(m)),m};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{a(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&a(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=a(t,e.data.get(t),null);i&&(i.context.animationState=pu.appear)})):i&&i.keys.forEach((t=>{a(t,null,i.data.get(t)).context.animationState=pu.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const o=r.length;r.forEach(((t,e)=>{t.context.graphicCount=o,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=r,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return vu(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=vu(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((r=>{this._unCompileChannel[r]||(this._option.noSeparateStyle||function(t,e,i){var r;const n=null===(r=e[t])||void 0===r?void 0:r.style;return!!function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n)||!!s.isFunction(n)||!(!(null==n?void 0:n.scale)||n.field===i)}(r,t,this._groupKey)?e[r]=t[r]:i[r]=t[r])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,r;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||s.isFunction(n.postProcess)||e in this._computeExChannel)return!1;const a=n.style;return!(s.isFunction(a)||Gu.includes(null==a?void 0:a.gradient)||["outerBorder","innerBorder"].includes(e)||jc(null===(r=null==a?void 0:a.scale)||void 0===r?void 0:r.type))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const r={},n=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),r[t]=c,n.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!n.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=n.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=r,this._product.sharedStateDefinitions=r)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const r=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);s.isNil(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==r?void 0:r[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_commitPreventedAnimationStaticAttrs(t,e){var i,s;if(!e||!Object.keys(e).length)return;const r=t;null===(i=r.setFinalAttributes)||void 0===i||i.call(r,e),r._commitAnimationStaticAttributes?r._commitAnimationStaticAttributes(e):null===(s=r.commitInternalBaseAttributes)||void 0===s||s.call(r,e)}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var r,n;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,((t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s})(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?(i.setAttributesAndPreventAnimate(t),this._commitPreventedAnimationStaticAttrs(i,t)):i.setAttributes(t)),!(null===(n=this.renderContext)||void 0===n?void 0:n.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const n=this._graphics===t?s:s+this._graphics.length-t.length;if(n>=0&&(this._graphics[n]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===Eu.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:r,overflow:n}=this._markConfig;if(s.isNil(e)||(t.zIndex=e),s.isNil(i)||(t.clip=i),!s.isNil(r)){const e=s.isArray(r)?r:r(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return s.isNil(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=Sa.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=Sa.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const r=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(r);let a;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();a=t.output()}else a=s.array(n),this._runGroupData(a),this.renderContext=this._parseProgressiveContext(a);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(a),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===gu.before||(this._product||this._initProduct(),((t,...e)=>{Oc.silent||s.Logger.getInstance().info(`[VChart log]: ${t}`,...e)})(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,r=s[yp],n=null==r?void 0:r.includes(t),a=!n&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?mp(i,t,!0,a):fp(i,t,a),n){const e=r.filter((e=>e!==t));e.length?s[yp]=e:delete s[yp]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===Mu.exit&&!e.isExiting)if(e.context.animationState===Mu.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const r=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===r.length?r[0]:r],(()=>{e.context.diffState===Mu.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex<this.renderContext.progressive.totalStep||this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.unfinished())}clearProgressive(){this.renderContext&&this.renderContext.progressive&&(this._graphics=[],this._product.children.forEach((t=>{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const r=this.renderContext.progressive.groupedData.get(s),n=this.renderContext.progressive.step,a=r.slice(t*n,(t+1)*n),o=[];a.forEach(((i,r)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:Mu.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*n+r}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=An({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const r=t.parent;r&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&r.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||s.isObject(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[yp]=t.currentStates.slice())}))}}const bp=()=>{s.mixin(un,Ol),s.mixin(un,lh),kp(),wp()},Sp=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};Eu.STATE_HIGHLIGHT,Eu.STATE_BLUR;const xp=(t,e,i,r)=>{if(s.isNil(t[e]))return;const n=s.isArray(t[e]),a=n?t[e]:[t[e]],o=[];return a.forEach(((t,s)=>{!t||r&&!r(t)||o.push({spec:t,specPath:n?[e,s]:[e],specInfoPath:["component",e,s],type:i})})),o},Ap=`${jd}_BuiltIn_CallBack_Disappear`;var Tp;!function(t){t.render="render",t.disappear="disappear"}(Tp||(Tp={}));const Cp={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},kp=()=>{Al.registerBuiltInAnimate("scaleIn",bc),Al.registerBuiltInAnimate("scaleOut",Sc),Al.registerBuiltInAnimate("fadeIn",$h),Al.registerBuiltInAnimate("fadeOut",Yh),Al.registerBuiltInAnimate("moveIn",mc),Al.registerBuiltInAnimate("moveOut",fc),Al.registerBuiltInAnimate("rotateIn",yc),Al.registerBuiltInAnimate("rotateOut",_c),Al.registerBuiltInAnimate("update",Cc),Al.registerBuiltInAnimate("state",xc),Al.registerBuiltInAnimate("fromTo",th)},wp=()=>{Al.registerBuiltInAnimate(Ap,kc)};class Mp extends _p{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}setDataLabelType(){return"rect"}constructor(t,e){super(t,e),this.type=Mp.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}Mp.type="rect3d";const Ep=()=>{Sa.registerMark(Mp.type,Mp),Vh(),Uh(),Al.registerBuiltInAnimate("growHeightIn",ic),Al.registerBuiltInAnimate("growHeightOut",sc),Al.registerBuiltInAnimate("growWidthIn",uc),Al.registerBuiltInAnimate("growWidthOut",pc),Al.registerBuiltInAnimate("growCenterIn",Qh),Al.registerBuiltInAnimate("growCenterOut",tc),Sa.registerGraphicComponent("rect3d",Kh)};class Bp extends e.BarSeries{constructor(){super(...arguments),this.type=$.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d",this.transformerConstructor=ka}}Bp.type=$.bar3d,Bp.mark=Ca,Bp.builtInTheme={bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}}},Bp.transformerConstructor=ka;const Op=()=>{e.Factory.registerAnimation("bar3d",((t,i)=>({appear:e.barPresetAnimation(t,i),enter:e.barGrowIn(t,!1),exit:e.barGrowOut(t,!1),disappear:e.barGrowOut(t)}))),Ep(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.Factory.registerSeries(Bp.type,Bp)};class Pp extends Vu{layoutItems(t,e,i,s){this._layoutInit(t,e,i,s);const r={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(e,r);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},a=e.filter((t=>"absolute"===t.layoutType)),o=a.filter((t=>"z"===t.layoutOrient));let l={width:0,height:0};if(o.length){l=o[0].getLayoutRect()}this.leftCurrent+=l.width/8,this.rightCurrent-=l.width/8,this.topCurrent+=l.height/8,this.bottomCurrent-=l.height/8;const{regionItems:h,relativeItems:c,relativeOverlapItems:d,allRelatives:u,overlapItems:p}=this._groupItems(e);this.layoutRegionItems(h,c,d,p,r),this._processAutoIndent(h,c,d,p,u,n,r);const g=a.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(g);const m=c.filter((t=>{return"axes"===t.model.specKey&&("bottom"===(e=t.layoutOrient)||"top"===e);var e}))[0],f=c.filter((t=>{return"axes"===t.model.specKey&&("left"===(e=t.layoutOrient)||"right"===e);var e}))[0];if(m&&o.length){const t=m.getLayoutStartPoint(),e=m.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};o[0].model.directionStr="left"===f.layoutOrient?"r2l":"l2r";const s=m.getLayoutRect(),r=f.getLayoutRect(),n={length:o[0].getLayoutRect().width,width:s.width,height:r.height};m.model.setLayout3dBox&&m.model.setLayout3dBox(n),f.model.setLayout3dBox&&f.model.setLayout3dBox(n),o[0].model.setLayout3dBox&&o[0].model.setLayout3dBox(n),this.layoutZAxisItems(o,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this.rightCurrent,s=this._chartViewBox.y2-this._chartViewBox.y1-this.bottomCurrent;return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const r="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds();r?(e.top=Math.max(e.top,n.y1-this.topCurrent),e.bottom=Math.max(e.bottom,n.y2-s)):(e.left=Math.max(e.left,n.x1-this.leftCurrent),e.right=Math.max(e.right,n.x2-i))})),e}}Pp.type="layout3d";const Ip=()=>{Sa.registerLayout(Pp.type,Pp)};class Rp extends e.BarChart{constructor(){super(...arguments),this.transformerConstructor=K,this.type="bar3d",this.seriesType=$.bar3d}}Rp.type="bar3d",Rp.seriesType=$.bar3d,Rp.transformerConstructor=K;const Dp=Object.assign(Object.assign({},e.baseSeriesMark),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class Lp extends e.FunnelSeriesSpecTransformer{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class Fp extends _p{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class Np extends Fp{_getDefaultStyle(){const t=super._getDefaultStyle();return t.stroke=!1,t}constructor(t,e){super(t,e),this.type=Np.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}Np.type="pyramid3d";const Up=()=>{Sa.registerMark(Np.type,Np),Vh(),Dh(),Al.registerBuiltInAnimate("growPointsOut",ac),Sa.registerGraphicComponent("pyramid3d",zh)},jp=e.getFunnelTheme(!0);class Vp extends e.FunnelSeries{constructor(){super(...arguments),this.type=$.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=Lp}initMark(){var t,e,i,s,r,n,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},Vp.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0},{support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},Vp.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(r=this._spec.outerLabel)&&void 0!==r?r:{},{line:e}=null!==(a=null===(n=this._theme)||void 0===n?void 0:n.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(Vp.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(Vp.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t})}}initMarkStyle(){super.initMarkStyle();const t=this._funnelMark;t&&this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",e.AttributeLevel.Series)}initLabelMarkStyle(t){var i,s;super.initLabelMarkStyle(t),this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",e.AttributeLevel.Series),this._labelMark=t,null===(i=this._funnelOuterLabelMark)||void 0===i||i.label,null===(s=this._funnelOuterLabelMark)||void 0===s||s.line}}Vp.type=$.funnel3d,Vp.mark=Dp,Vp.builtInTheme={funnel3d:jp},Vp.transformerConstructor=Lp;const Gp=()=>{Up(),e.registerTextMark(),e.registerRuleMark(),e.Factory.registerSeries(Vp.type,Vp)};class zp extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=e.FunnelChartSpecTransformer,this.type="funnel3d",this.seriesType=$.funnel3d}}zp.type="funnel3d",zp.seriesType=$.funnel3d,zp.transformerConstructor=e.FunnelChartSpecTransformer;class Kp extends e.BaseHistogramChart{constructor(){super(...arguments),this.transformerConstructor=e.HistogramChartSpecTransformer,this.type="histogram3d",this.seriesType=$.bar3d}_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}Kp.type="histogram3d",Kp.seriesType=$.bar3d,Kp.transformerConstructor=e.HistogramChartSpecTransformer;class Hp{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=s.array(t);for(let t=0;t<e.length;t++)this._dataArr.push(cu(e[t],this._dataSet,this._dataArr))}updateData(t,e=!1,i=!0){const r=s.array(t);return!(e&&r.length!==this._dataArr.length||(this._dataValueForEach(r,((t,e)=>{e.markRunning()})),this._dataValueForEach(r,((t,e)=>{du(e,t,i)})),0))}_dataValueForEach(t,e){t.forEach(((t,s)=>{if(t instanceof i.DataView)return;const r=this.getSeriesData(t.id,s);r&&e(t,r,s)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Ec(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Ec(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class Wp{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{Dc(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{Jd(e,[{key:t,operations:Uc(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const r=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&Jd(e,[{key:i.field,operations:Uc(r.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?Id("colorOrdinal"):Id(t.type)),e?(s.isArray(t.range)&&e.range(t.range),s.isArray(t.domain)&&(Dc(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(s.isEqual(t,this._spec))return e;e.change=!0;for(let i=0;i<t.length;i++){const r=t[i],n=this._scaleMap.get(r.id);if(!n)return e.reMake=!0,e;const a=this._spec.find((t=>t.id===r.id));if(!a.id)return e.reMake=!0,e;if(a.type!==r.type)return e.reMake=!0,e;if(!s.isEqual(a.specified,r.specified)){if("color"!==r.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(r.specified);else{if(!r.specified||!t.specified)return e.reMake=!0,e;t.specified(r.specified)}e.reRender=!0}r.range&&!s.isEqual(r.range,n.range())&&(n.range(r.range),e.reRender=!0),Dc(r.domain)?e.reRender=!0:s.isEqual(r.domain,n.domain())||(n.domain(r.domain),e.reRender=!0),this._scaleSpecMap.set(r.id,r)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i<e.length;i++){const s=e[i];if(s.getRawData().name===t)return s}return null}_getSeriesBySeriesId(t){const e=this._chart.getAllSeries();for(let i=0;i<e.length;i++){const s=e[i];if(s.id===t)return s}return null}updateScaleDomain(t){this._scaleSpecMap.forEach(((e,i)=>{const r=this._scaleMap.get(i);if(!r)return;if(!Dc(e.domain))return e.domain&&0!==e.domain.length||r.domain(t),void this._updateMarkScale(i,r,r.domain().slice());let n;n=Uc(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const r=Uc(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,r);e&&(r?(s.isNil(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),s.isNil(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const a=n;Uc(e.type)||(n=Array.from(n)),r.domain(n),this._updateMarkScale(i,r,a)}))}_updateMarkScale(t,e,i){const r=this._markAttributeScaleMap.get(t);r&&0!==r.length&&r.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(s.isNil(t.changeDomain)||"none"===t.changeDomain||s.isNil(t.seriesId))return void(Uc(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const r=this._getSeriesBySeriesId(t.seriesId),n=Uc(e.type),a=r.getRawDataStatisticsByField(t.field,n);if(!s.isEmpty(a))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],a.min),i[1]=Math.max(i[1],a.max)):(a.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([a.min,a.max]):t.markScale.domain(a.values)));Uc(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let r=this._markAttributeScaleMap.get(t.scale);r||(r=[],this._markAttributeScaleMap.set(t.scale,r));let n=i;return(s.isNil(t.field)||!s.isNil(t.changeDomain)&&"none"!==t.changeDomain&&!s.isNil(e))&&(n=i.clone()),r.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}var $p;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}($p||($p={}));class Yp{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){t&&[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,r){return this._disableTriggerEvent?[]:e&&e.length?(s&&r?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,r),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,r):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const r=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&r[s]&&r[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,r=i.hasAnimationByState&&i.hasAnimationByState("state");mp(t,s,!0,r)}})),e.forEach((t=>{var e;if(s&&r[s]&&r[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,r=i.hasAnimationByState&&i.hasAnimationByState("state");fp(t,s,r)}}))}toggleStateOfGraphics(t,e,i,s){const r=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&r[s]&&r[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,r=i.hasAnimationByState&&i.hasAnimationByState("state");fp(t,s,r)}})),e.forEach((t=>{var e;if(s&&r[s]&&r[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,r=i.hasAnimationByState&&i.hasAnimationByState("state");mp(t,s,!0,r)}}))}addBothStateOfGraphics(t,e,i,s){const r=t.getMarks(),n=t.getMarkIdByState();r.forEach((t=>{var r;const a=s&&n[s]&&n[s].includes(t.id),o=i&&n[i]&&n[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(r=t.getGraphics())||void 0===r||r.forEach((t=>{e&&e.includes(t)?o&&mp(t,i,!0,l):a&&mp(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),r=t.getMarkIdByState();s.forEach((t=>{var s;const n=i&&r[i]&&r[i].includes(t.id);if(!n)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&n&&mp(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const r=t.getMarks(),n=t.getMarkIdByState();r.forEach((t=>{if(t){const r=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");r&&r.length&&(i&&n[i]&&n[i].includes(t.id)&&r.forEach((t=>{fp(t,i,a)})),e&&n[e]&&n[e].includes(t.id)&&r.forEach((t=>{s.includes(t)&&fp(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const Xp=[...Object.keys(Cp),"normal"];function qp(t={},e,i){const r={};for(let n=0;n<Xp.length;n++){const a=Xp[n],o=e?e[a]:void 0;if(!1===o)continue;if("normal"===a){o&&(r.normal=o);continue}if("state"===a){!1!==o&&(r.state=null!=o?o:Cp.state);continue}if("update"!==a&&!o&&!t[a])continue;let l,h;l=s.isArray(t[a])?t[a]:[Object.assign(Object.assign({},Cp[a]),t[a])],"exit"===a&&l.forEach((t=>{t.controlOptions={stopWhenStateChange:!0}})),o?(h=s.isArray(o)?o.map(((t,e)=>{var s;let r=t;return eg(r)&&delete r.type,r.oneByOne&&(r=Jp(r,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Qp,null==i?void 0:i.dataCount)),r})):l.map(((t,e)=>{var s;let r=Ud({},l[e],o);return eg(r)&&delete r.type,r.oneByOne&&(r=Jp(r,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Qp,null==i?void 0:i.dataCount)),r})),r[a]=h):r[a]=l}return r}function Zp(t,e,i){var r,n,a,o,l,h;const c={};return s.isValid(e.animationAppear)&&(c.appear=null!==(r=e.animationAppear[t])&&void 0!==r?r:e.animationAppear),s.isValid(e.animationDisappear)&&(c.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),s.isValid(e.animationEnter)&&(c.enter=null!==(a=e.animationEnter[t])&&void 0!==a?a:e.animationEnter),s.isValid(e.animationExit)&&(c.exit=null!==(o=e.animationExit[t])&&void 0!==o?o:e.animationExit),s.isValid(e.animationUpdate)&&(c.update=null!==(l=e.animationUpdate[t])&&void 0!==l?l:e.animationUpdate),s.isValid(e.animationState)&&(c.state=null!==(h=e.animationState[t])&&void 0!==h?h:e.animationState),e.animationNormal&&e.animationNormal[t]&&(c.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return ig(t=s.cloneDeep(t,null,i),(t=>{var i;return s.isFunction(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t?(...i)=>t(...i,e):t}),i),t}(c,i)}function Jp(t,e,i){const{oneByOne:r,duration:n,delay:a,delayAfter:o}=t;return t.delay=(t,i,o)=>{const l=e(t,o),h=s.isFunction(n)?n(t,i,o):s.isValidNumber(n)?n:0,c=s.isFunction(a)?a(t,i,o):s.isValidNumber(a)?a:0;let d=s.isFunction(r)?r(t,i,o):r;return!1===d?c:(d=!0===d?0:d,c+l*(h+d))},t.delayAfter=(t,a,l)=>{const h=e(t,l),c=s.isFunction(n)?n(t,a,l):s.isValidNumber(n)?n:0,d=s.isFunction(o)?o(t,a,l):s.isValidNumber(o)?o:0;let u=s.isFunction(r)?r(t,a,l):r;return!1===u?d:(u=!0===u?0:u,d+((i?i():a.parent.count-1)-h)*(c+u))},delete t.oneByOne,t}function Qp(t,e){var i;return null!==(i=null==t?void 0:t[zd])&&void 0!==i?i:e.context.graphicIndex}function tg(t,e){var i,s,r,n,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(r=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==r?r:t.animationAppear),l=!1!==(null!==(a=null===(n=t.animationUpdate)||void 0===n?void 0:n[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function eg(t){return!function(t){return s.isValid(t.timeSlices)}(t)&&s.isValid(t.channel)}function ig(t,e,i=[]){if(s.isArray(t))t.forEach(((s,r)=>{t[r]=e(t[r],r),ig(t[r],e,i)}));else if(s.isObject(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),ig(t[s],e,i))}function sg(t){var e,i,s,r,n,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(r=t.getMarks())||void 0===r||r.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(n=t.getRawData())||void 0===n?void 0:n.latestData)||void 0===a?void 0:a.length)>=l)}var rg=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]])}return i};const ng={[Mc.markPoint]:!0,[Mc.markLine]:!0,[Mc.markArea]:!0},ag={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class og extends ku{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,r,n,a;super(e),this.type="chart",this.id=ma(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:Vd,height:Gd},this._viewRect={width:Vd,height:Gd},this._viewBox={x1:0,y1:0,x2:Vd,y2:Gd},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>s.array(t).some((t=>s.isValid(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(ag).some((t=>!s.isNil(e[t])))},this._paddingSpec=Fd(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new eu(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new Hp(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(r=this._option)||void 0===r?void 0:r.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(a=this._option)||void 0===a?void 0:a.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Yp;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const r=t.getInteractionTriggers();if(r&&r.length){const n=t.getRegion().id;r.forEach((({trigger:t,marks:r})=>{const a=i.find((e=>e.regionId===n&&s.isEqual(e.config,t)));if(a)a.trigger.marks.push(...r);else{const s=Object.assign(Object.assign({},t),{marks:[...r]});i.push({regionId:n,config:Object.assign({},t),trigger:s}),e.push(s)}}))}})),e.forEach((t=>{const e=Sa.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(qp({},Zp("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||s.isValid(t.gradient))return;const e=s.pickWithout(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=Sa.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:xu.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,e){if(!t)return;const{spec:i}=e,s=rg(e,["spec"]),r=new t(i,Object.assign(Object.assign({},this._modelOption),s));r&&(r.created(),this._regions.push(r))}_createSeries(t,e){if(!t)return;const{spec:i}=e,r=rg(e,["spec"]);let n;if(s.isValid(i.regionId)?n=this.getRegionsInUserId(i.regionId):s.isValid(i.regionIndex)&&(n=this.getRegionsInIndex([i.regionIndex])[0]),!n&&!(n=this._regions[0]))return;const a=new t(i,Object.assign(Object.assign(Object.assign({},this._modelOption),r),{type:i.type,region:n,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),n.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(s.isString(t))return this.getAllModels().find((e=>e.userId===t));if(s.isFunction(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=Sa.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(su.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(su.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(su.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof Pu)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;return this.getComponentByUserId(t)||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof _p))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof _p)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const r=this._dataSet.getDataView(t);r&&(r.markRunning(),r.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){s.array(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),s.array(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&du(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=yu(this._spec,this._option,{width:Vd,height:Gd})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const r=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(s.isArray(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=Cd(r),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new Wp(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){Su(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=Cd(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),r=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return r.length>0&&r.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const r={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return r.reMake=!0,this.setLayoutTag(!0,null,!1),r;const n=this._getSpecKeys(this._spec),a=this._getSpecKeys(t);if(!s.isEqual(n,a)&&!this._canChangeSpecKeysWithoutRemake(n,a))return r.reMake=!0,this.setLayoutTag(!0,null,!1),r;const o=Array.from(new Set([...n,...a])).sort();for(let e=0;e<o.length;e++){const i=o[e],n=this._spec[i],a=t[i];if(s.isArray(n)&&n.length!==s.array(a).length&&!this._canChangeMarkerComponentsWithoutRemake(i,n,a))return r.reMake=!0,this.setLayoutTag(!0,null,!1),r}const l=this._spec,h=this._isOnlyMarkerComponentsRemoved(this._spec,t,o),c=this._isOnlyComponentSpecsChanged(this._spec,t,o),d=this._isOnlySeriesSpecsChanged(this._spec,t,o),u=!(!c&&!d)||this._isOnlyComponentOrSeriesSpecsChanged(this._spec,t,o);if(this._spec=t,h)return this._removeMarkerComponentsForEmptySpecs(r),r;if(this.updateChartConfig(r,l),r.reMake)return this.setLayoutTag(!0,null,!1),r;if(this.updateGlobalScale(r),r.reMake)return this.setLayoutTag(!0,null,!1),r;if(this.updateRegionSpec(r),r.reMake)return this.setLayoutTag(!0,null,!1),r;const p=this.updateComponentSpec(r);return r.reMake?(this.setLayoutTag(!0,null,!1),r):(!c&&(null===(e=r.effects)||void 0===e?void 0:e.localOnly)&&delete r.effects.localOnly,function(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}(r)?r:c&&!p.hasNonComponentOnlyUpdate&&(bu(r)||this._isComponentScaleDomainOnlyUpdate(r))?(p.componentOnlyUpdatedComponents.forEach((t=>{t.reInit(t.getSpec())})),(null===(i=r.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),r):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(r),r.reMake||(this.reInit(),u&&this._canSkipChartDataStages(r)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),r))}updateChartConfig(t,e){var i,s;this._paddingSpec=Fd(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{Su(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const r={},n={[Mc.title]:!0,[Mc.brush]:!0,[Mc.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===Mc.label||l.type===Mc.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));n[l.type]&&(n[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(s.isArray(u)){if(r[d]=r[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);r[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},o=l.getSpec(),h=l.updateSpec(n,u);bu(h)||this._isComponentScaleDomainOnlyUpdate(h)?e.push(l):s.isEqual(o,n)||(i=!0),Su(t,h)}else{const r=l.getSpec(),n=l.updateSpec(u);bu(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):s.isEqual(r,u)||(i=!0),Su(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,r);for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)){const i=r[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(n).forEach((e=>{if(n[e]){const i=this._spec[e];(s.isArray(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(ng[t]&&s.isArray(e)&&s.isArray(i))&&!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake)}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return ng[t]&&s.isArray(e)&&e.length>0&&s.isArray(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let r=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(r=!0,!0):s.isEqual(t[i],e[i])));return r&&n}_isComponentSpecKey(t){return!!ng[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let r=!1;const n=t,a=e,o=i.every((t=>!!s.isEqual(n[t],a[t])||!!this._isComponentSpecKey(t)&&(r=!0,!0)));return r&&o}_isOnlySeriesSpecsChanged(t,e,i){var r,n;let a=!1;const o=t,l=e,h=null!==(n=null===(r=this._specTransformer)||void 0===r?void 0:r.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},c=i.every((t=>!!s.isEqual(o[t],l[t])||!!h[t]&&(a=!0,!0)));return a&&c}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var r,n;let a=!1;const o=t,l=e,h=null!==(n=null===(r=this._specTransformer)||void 0===r?void 0:r.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},c=i.every((t=>!!s.isEqual(o[t],l[t])||!(!this._isComponentSpecKey(t)&&!h[t])&&(a=!0,!0)));return a&&c}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,r=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,n)=>{if(t.reMake)return;const a=i.specKey||i.type;ng[a]&&!this._hasComponentForSpecInfo(a,n)&&(this._isMarkerAdditionSpecSafeWithoutRemake(n.spec)?(this._createComponent(i,n),e[a]&&e[a].componentCount++,s++,r=r||this._isAutoRangeMarkerSpec(n.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),r?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];Su(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:r,y2:n}=t;e={width:r-i,height:n-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=function(t,e,i){var r,n,a,o;const l={top:0,bottom:0,left:0,right:0};return Object.values(t).every((t=>s.isNumber(t)))?(l.top=null!==(r=t.top)&&void 0!==r?r:0,l.right=null!==(n=t.right)&&void 0!==n?n:0,l.bottom=null!==(a=t.bottom)&&void 0!==a?a:0,l.left=null!==(o=t.left)&&void 0!==o?o:0,l):([{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{l[s]=Ld(t[s],e.size,i)}))})),l)}(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(su.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const r in t){if(s.isEmpty(t[r]))continue;const n=t[r];let a={stateValue:r};a=s.isFunction(n.filter)?Object.assign({filter:n.filter},a):Object.assign(Object.assign({},n.filter),a),n.level&&(a.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[r]&&(e&&!e(t,i,r)||(i.state.changeStateInfo(a),i.updateMarkState(r)))}))}))}}setSelected(t,e,i){this._setStateInDatum(Eu.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum(Eu.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(Eu.STATE_SELECTED)}clearHovered(){this.clearState(Eu.STATE_HOVER)}_initEvent(){[su.dataZoomChange,su.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(iu.AFTER_MARK_RENDER_END,e)};this._event.on(iu.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const r=(t=t?s.array(t):null)?Object.keys(t[0]):null,n=[],a=null!==(i=e.getDatum)&&void 0!==i?i:tu;return this.getRegionsInQuerier(e.region).forEach((i=>{const o=[];t&&i.getSeries().forEach((l=>{l.getMarks().forEach((h=>{const c=h.getGraphics();if(c&&c.length&&(!e.filter||s.isFunction(e.filter)&&e.filter(l,h)))if((t=>"line"===t||"area"===t)(h.type))c.filter((s=>{const c=a(s,h,l,i);c&&t.every(((t,e)=>r.every((i=>t[i]==c[e][i]))))&&(o.push(s),n.push(s),e.callback&&e.callback(s,h,l,i))}));else if(t.length>1){const s=t.slice();c.forEach((t=>{const c=a(t,h,l,i),d=c&&s.findIndex((t=>r.every((e=>t[e]==c[e]))));d>=0&&(s.splice(d,1),o.push(t),n.push(t),e.callback&&e.callback(t,h,l,i))}))}else{const s=c.find((e=>{const s=a(e,h,l,i);return s&&r.every((e=>t[0][e]==s[e]))}));s&&(o.push(s),n.push(s),e.callback&&e.callback(s,h,l,i))}}))})),e.regionCallback&&e.regionCallback(o,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const r=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,r)}setDimensionIndex(t,e){var i,r;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===$p.dimensionHover||s===$p.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=s.isNil(t)||!n||n.every((t=>Vc(t.axis.getScale().type)&&s.isNil(t.index))),o=a||n.every((t=>Vc(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(Mc.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(r=(i=t).hideTooltip)||void 0===r||r.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:r}=t,n="left"===e.getOrient()||"right"===e.getOrient();r.forEach((t=>{var e,r,a;const o=n?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(r=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===r?void 0:r[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(Mc.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(Mc.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(Mc.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),r=[];s.forEach((e=>{const i=t(e);!1!==i&&r.push({axis:e,value:i})})),i.showCrosshair(r)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const lg=(t,e)=>{var i;const r=t.spec,{regionId:n,regionIndex:a}=r;if(s.isValid(n)){const t=s.array(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(s.isValid(a))return s.array(a).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(s.isValid)},hg={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class cg{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},hg),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),s.isValid(t.stackInverse)&&t.region.forEach((e=>{!s.isValid(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),s.isValid(t.stackSort)&&t.region.forEach((e=>{!s.isValid(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,r)=>{const{spec:n,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(n,t,r),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(n,t):Nd(t,a,c.spec),Nd(r,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,r;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=lg(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(r=n.component)&&void 0!==r?r:{}).forEach((t=>t.forEach(((t,e)=>{var i,r,a;if(t){if(!t.regionIndexes){const e=null!==(r=null!==(i=lg(t,n))&&void 0!==i?i:n.region)&&void 0!==r?r:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const r=t.spec,{seriesId:n,seriesIndex:a}=r;if(s.isValid(n)){const t=s.array(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(s.isValid(a))return s.array(a).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(s.isValid)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(a=t.regionIndexes)&&void 0!==a?a:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,r,n,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(r=this._option.globalInstance)||void 0===r?void 0:r.isAnimationEnable(),animationThreshold:null!==(n=t.animationThreshold)&&void 0!==n?n:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(Sa.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(Sa.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,n;const a=[],o=Sa.getComponents();let l,h,c,d;const u=[];for(let e=0;e<o.length;e++){const{cmp:i,alwaysCheck:r}=o[e];i.type.startsWith(Mc.cartesianAxis)?l=i:i.type.startsWith(Mc.polarAxis)?h=i:i.type===Mc.geoCoordinate?c=i:(r||t[null!==(s=i.specKey)&&void 0!==s?s:i.type])&&(i.type===Mc.tooltip?d=i:u.push(o[e]))}let p=!1;if(l){const s=l.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(p=!0,s.forEach((t=>{const s=Sa.getComponentInKey(t.type);a.push(e(s,t,i))})))}if(h&&!p){const s=h.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(p=!0,s.forEach((t=>{const s=Sa.getComponentInKey(t.type);a.push(e(s,t,i))})))}return c&&!p&&(null===(r=c.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{a.push(e(c,t,i))}))),u.sort(((t,e)=>t.createOrder-e.createOrder)),u.forEach((({cmp:s})=>{var r;null===(r=s.getSpecInfo?s.getSpecInfo(t,i):xp(t,s.specKey,s.type))||void 0===r||r.forEach((t=>{a.push(e(s,t,i))}))})),d&&(null===(n=xp(t,d.specKey,d.type))||void 0===n||n.forEach((t=>{a.push(e(d,t,i))}))),a}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const r="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!r.includes(i.orient))return!1;if(s.isValid(i.seriesId)){if(s.array(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(s.isValid(i.seriesIndex)){if(s.array(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:r,barMinWidth:n,barWidth:a,barGapInGroup:o}=i;let l=!1;s.isNumber(n)?(t.minBandSize=n,l=!0):s.isNumber(a)?(t.minBandSize=a,l=!0):s.isNumber(r)&&(t.minBandSize=r,l=!0),l&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:s.isArray(o)?o[o.length-1]:o})}}class dg extends cg{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,r;const n=s.array(t.indicator),a=null!==(e=t.innerRadius)&&void 0!==e?e:null===(r=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===r?void 0:r.innerRadius;return s.isValid(a)&&n.forEach((t=>{s.isNil(t.limitRatio)&&(t.limitRatio=a)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),s.isArray(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),s.isValid(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class ug extends dg{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),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 pg extends ug{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class gg extends og{constructor(){super(...arguments),this.transformerConstructor=ug}}gg.transformerConstructor=ug;const mg=(t,e,i,r)=>{let n;if(n=s.isFunction(t)?t(e,i):s.isPlainObject(t)&&s.isValid(t.field)?s.get(e,t.field):t,r){const{formatFunc:i,args:s}=function(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const r=Sa.getFormatter();return e&&r?{formatFunc:r,args:[i,s,e]}:{}}(void 0,r,t,e);i&&s&&(n=i(...s))}return n};var fg=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]])}return i};const vg=(t,e)=>!(e&&(!1===e.visible||e[t]&&!1===e[t].visible||e.activeType&&!(s.isArray(e.activeType)?e.activeType.includes(t):e.activeType===t)));function yg(t,e,i,r,n,a){const o=e=>{if(e){const o={datum:n},l=s.isNil(e.key)&&s.isNil(e.value)&&!s.isEmpty(e)?Object.assign(Object.assign(Object.assign({},r),i),e):Object.assign(Object.assign({},r),e),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:u,value:p,valueFormatter:g,valueTimeFormat:m,valueTimeFormatMode:f}=l,v=fg(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=bg(mg(h,n,a,c),d,u),o.value=bg(mg(p,n,a,g),m,f),Object.keys(v).forEach((t=>{o[t]=mg(l[t],n,a)})),!1!==o.visible&&(s.isValid(o.key)||s.isValid(o.value))&&t.push(o)}};s.isArray(e)?e.forEach((t=>{o(t)})):o(e)}function _g(t,e,i,r,n,a,o){s.isFunction(e)?yg(t,e(n,o),i,r,a,o):e&&yg(t,e,i,r,a,o)}const bg=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const r=s.TimeUtil.getInstance();return e=e||"%Y%m%d",("local"===(i=i||"local")?r.timeFormat:r.timeUTCFormat)(e,t)},Sg=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],xg=(t,e,i,r,n)=>{var a,o,l;const h={activeType:t};switch(t){case"mark":case"group":if(i){const l=null===(a=i.getSpec())||void 0===a?void 0:a.tooltip;return h.visible=!0,(null==l?void 0:l.handler)&&(h.handler=l.handler),(null===(o=h.handler)||void 0===o?void 0:o.showTooltip)?h:((null==l?void 0:l[t])&&Sg.forEach((e=>{s.isValid(l[t][e])&&(h[e]=l[t][e])})),Object.assign(Object.assign({},h),i.tooltipHelper.getTooltipData(t,e,r,r[0].datum,n)))}break;case"dimension":if(null==r?void 0:r.length){if(Ag(r).every((t=>{var e;return!vg("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?h.visible=!1:h.visible=!0,h.handler=e.handler,null===(l=h.handler)||void 0===l?void 0:l.showTooltip)return h;const i=[];return r.forEach((s=>s.data.forEach((s=>{const{series:a}=s,o=a.tooltipHelper.getTooltipData(t,e,r,s.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},Ag=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{s.isValid(t.series)&&e.push(t.series)}))})),e},Tg={key:"其他",value:"..."};var Cg;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(Cg||(Cg={}));class kg{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,r,n;if(s.isNil(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const a=this._cacheActiveSpec;if(s.isNil(a)||!1===a.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=a;const{title:o,content:l}=a,h=s.isNil(null==o?void 0:o.key)&&s.isNil(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(su.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:h,tooltipData:t,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(i=a.handler)||void 0===i?void 0:i.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(r=this.component.tooltipHandler)||void 0===r?void 0:r.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(n=c(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,r,n,a,o,l,h,c,d;const{changePositionOnly:u,model:p}=e;if(!u||!this._cacheActiveSpec){const u=this.component.getSpec();if(this._cacheActiveSpec=xg(this.activeType,this.component.getSpec(),p,t,e),this._cacheActiveSpec){s.isNil(this._cacheActiveSpec.handler)&&s.isValid(u.handler)&&(this._cacheActiveSpec.handler=u.handler);const p=null!==(i=u[this.activeType])&&void 0!==i?i:{},g=null!==(r=this._cacheActiveSpec.updateTitle)&&void 0!==r?r:p.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:p.updateContent,f=null!==(o=null!==(a=this._cacheActiveSpec.maxLineCount)&&void 0!==a?a:p.maxLineCount)&&void 0!==o?o:20;if(g&&(this._cacheActiveSpec.title=null!==(l=g(this._cacheActiveSpec.title,t,e))&&void 0!==l?l:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(h=m(this._cacheActiveSpec.content,t,e))&&void 0!==h?h:this._cacheActiveSpec.content;else if(f>=1&&(null===(c=this._cacheActiveSpec.content)||void 0===c?void 0:c.length)>f){const t=null!==(d=this._cacheActiveSpec.othersLine)&&void 0!==d?d:p.othersLine,e=t?Object.assign(Object.assign({},Tg),t):Tg;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,f-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[f-1]),e)]}}}}shouldHandleTooltip(t,e){var i,r;return!!this.component.enable&&!s.isNil(e)&&vg(this.activeType,null===(r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===r?void 0:r.spec)}clearCache(){this._cacheActiveSpec=void 0}}class wg extends kg{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,r,n;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(r=null==d?void 0:d.mark)||void 0===r?void 0:r.checkOverlap;let p=!1;if(!0===u||!0===(null===(n=l.mark)||void 0===n?void 0:n.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Rt.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(tu(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const r=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===r){const e=t.model,r=e.tooltipHelper,n=null==r?void 0:r.activeTriggerSet.mark,a=null==r?void 0:r.ignoreTriggerSet.mark;(null==n?void 0:n.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===r){const e=t.model,r=t.node;if("label"===e.name&&r){const t=e.getLabelInfoByTextGraphic(r),{baseMark:n,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:n,datum:r.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const Mg=`${jd}_ARC_TRANSFORM_VALUE`,Eg=`${jd}_ARC_RATIO`,Bg=`${jd}_ARC_START_ANGLE`,Og=`${jd}_ARC_END_ANGLE`,Pg=`${jd}_ARC_K`,Ig=`${jd}_ARC_MIDDLE_ANGLE`,Rg=`${jd}_ARC_QUADRANT`,Dg=`${jd}_ARC_RADIAN`,Lg=-Math.PI/2,Fg=3*Math.PI/2;class Ng extends _p{constructor(t,e){super(t,e),this.type=Ug.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var r;return s+(null!==(r=this.getAttribute("radiusOffset",e,i))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",r)=>s.polarToCartesian({x:0,y:0},this.getAttribute("centerOffset",e,i),e[Ig])[t]+r,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class Ug extends Ng{constructor(){super(...arguments),this.type=Ug.type}}Ug.type="arc";class jg extends Ng{setDataLabelType(){return"arc"}constructor(t,e){super(t,e),this.type=jg.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}jg.type="arc3d";const Vg=()=>{Al.registerBuiltInAnimate("growRadiusIn",hc),Al.registerBuiltInAnimate("growRadiusOut",cc),Al.registerBuiltInAnimate("growAngleIn",Zh),Al.registerBuiltInAnimate("growAngleOut",Jh),Vh(),Oh(),Sa.registerGraphicComponent("arc3d",Gh),Sa.registerMark("arc3d",jg)},Gg={label:{name:"label",type:"text"}},zg={data:!0},Kg={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},Hg=Object.assign(Object.assign({},Gg),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),Wg=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t};class $g{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:r}=this,n=r.getSeriesField();return{seriesFields:s.isValid(n)?s.array(n):null!==(t=r.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=r.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=r.getMeasureField())&&void 0!==i?i:[],type:r.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(s.isValid(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const r=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[r]},this._getSeriesStyle=(t,e,i)=>{var r;for(const i of s.array(e)){const e=null===(r=this.series.getSeriesStyle(t))||void 0===r?void 0:r(i);if(s.isValid(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,r,n,a,o,l,h,c,d,u,p,g;const m=e?"content":"title",f=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(r=null==i?void 0:i[t])||void 0===r?void 0:r[m]),null===(n=this.spec)||void 0===n?void 0:n[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[m]);return{shapeType:null!==(l=f.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=f.shapeFill)&&void 0!==h?h:f.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=f.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=f.shapeHollow)&&void 0!==u&&u,shapeLineWidth:f.shapeLineWidth,shapeSize:null!==(p=f.shapeSize)&&void 0!==p?p:f.size,hasShape:null!==(g=f.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,r,n,a){var o;return function(t,e,i,r,n,a){if(n&&n.length){const o=[];return n.forEach((n=>{s.isArray(t)?t.forEach((t=>{_g(o,t,e,i,r,n,a)})):s.isFunction(t)?_g(o,t,e,i,r,n,a):t&&yg(o,t,e,i,n,a)})),o}return null}(null!==(o=null==e?void 0:e.content)&&void 0!==o?o:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,r,n,a)}getTitleResult(t,e,i,r,n){let a=s.isFunction(e)?e(r,n):e;if(a?s.isNil(a.value)&&(a=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),a)):a=this.getDefaultTitlePattern(t),a&&!1!==a.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(r),e={visible:mg(a.visible,t,n),value:bg(mg(a.value,t,n,a.valueFormatter),a.valueTimeFormat,a.valueTimeFormatMode),valueStyle:mg(a.valueStyle,t,n),hasShape:a.hasShape};return Object.keys(i).forEach((s=>{e[s]=mg(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,r){var n,a;if(!(this.enableByType(t)&&vg(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(n=this.spec)||void 0===n?void 0:n[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;return"dimension"===t?(c=[],this.getContentList(t,o,l,i,s,r).forEach((t=>{c.push(t)}))):c=this.getContentList(t,o,l,i,s,r),{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,r),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const Yg={min:t=>t.length?s.minInArray(t.map((t=>1*t))):0,max:t=>t.length?s.maxInArray(t.map((t=>1*t))):0,"array-min":t=>t.length?s.minInArray(t.map((t=>1*t))):0,"array-max":t=>t.length?s.maxInArray(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},Xg=(t,e)=>{var i,r;let n=e.fields;if(s.isFunction(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=Jd([],n);const a="parser"===e.target?"parserData":"latestData",o=t[0][a]?t[0][a]:t||[],l=null===(r=(i=t[0]).getFields)||void 0===r?void 0:r.call(i);return qg(o,n,l)},qg=(t,e,i)=>{const r={};let n=[],a=[];return e.forEach((e=>{const o=e.key;r[o]={};const l=null==i?void 0:i[o],h=e.operations,c=h.some((t=>"min"===t||"max"===t||"allValid"===t));let d=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[o])}));const u=n.length;if(c){a.length=0,n.forEach(((t,e)=>{Rc(t)&&a.push(t)}));const t=n;n=a,a=t,d=n.length===u}else n=h.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{Rc(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),h.forEach((t=>{if(e.customize)r[o][t]=e.customize;else{if(l&&!0===l.lockStatisticsByDomain&&!s.isNil(l.domain)){if("values"===t)return void(r[o][t]=l.domain.slice())}else if("allValid"===t)return;r[o][t]=Yg[t](n),"array-max"===t&&(r[o].max=r[o][t]),"array-min"===t&&(r[o].min=r[o][t])}})),c&&(r[o].allValid=d)})),r},Zg=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:r}=i();return"zero"!==s||r&&r.length&&t.forEach((t=>{r.forEach((e=>{Rc(t[e])||(t[e]=0)}))})),t};function Jg(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function Qg(t,e,i){t&&(i.needDefaultSeriesField&&(t[Hd]=i.defaultSeriesField),t[zd]=e,t[Kd]=i.getKey(t,e,i))}class tm extends wu{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=s.array(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,r,n;const a=xd(t),o=null===(i=this._option)||void 0===i?void 0:i.getTheme,l=this._option.type,h=Sa.getSeriesMarkMap(l)?function(t,e,i){const r=Sa.getSeriesMarkMap(e);if(!r)return t;const n={};return Object.values(r).forEach((({type:e,name:r})=>{n[r]=Ud({},i("mark",s.array(e)[0]),i("markByName",r),null==t?void 0:t[r])})),Object.assign(Object.assign({},t),n)}(o("series",l),l,o):{},c=o("series",`${l}_${a}`);return Ud({},h,c,(null!==(n=null!==(r=this.stack)&&void 0!==r?r:null==c?void 0:c.stack)&&void 0!==n?n:null==h?void 0:h.stack)?o("series",`${l}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){s.isBoolean(t.stack)&&(this.stack=t.stack),s.isBoolean(t.percent)&&(this.stack=t.percent||this.stack),s.isNil(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",r="initLabelMarkStyle",n=!0,a){t&&s.array(t[i]).forEach((i=>{var o,l,h;if(i&&i.visible){const{animation:c=!0,animationUpdate:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:m=!0,animationExit:f=!0}=t,v=!!(null!==(h=null!==(l=null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&void 0!==l?l:t.animation)&&void 0!==h?h:i.animation)&&!!n;this.addLabelSpec(s.isFunction(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&c,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&m&&u)&&m,animationExit:!!(v&&m&&p)&&f,getStyleHandler:t=>{var e;return null===(e=t[r])||void 0===e?void 0:e.bind(t)}}),a)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:r,innerRadius:n,direction:a}=t;return s.isValid(r)&&(i.outerRadius=r),s.isValid(n)&&(i.innerRadius=n),s.isValid(a)&&(i.direction=a),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const r=this._getDefaultSpecFromChart(e),n=t=>{const e=Ud({},i,r,t),n=i.label;return n&&s.isObject(n)&&s.isArray(e.label)&&(e.label=e.label.map((t=>Ud({},n,t)))),e};return s.isArray(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}function em(t){return t===wc["desktop-browser"]||t===wc["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:function(t){return Ic(t)||"mobile-browser"===t}(t)||Ic(t)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null}const im=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(Kg[e]||(t[e]=!0),t)),{}),sm={compileOnlyKeys:Kg,dataRelatedKeys:im,seriesOnlyKeys:{tooltip:!0}},rm={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},nm=t=>(t=>s.isObject(t)&&!s.isArray(t)&&!s.isFunction(t))(t)?t:s.isNil(t)?{}:null,am=(t,e,i)=>{const r=nm(t),n=nm(e);if(!r||!n)return!1;let a=!1;const o=Array.from(new Set([...Object.keys(n),...Object.keys(r)]));for(const t of o)if(!s.isEqual(r[t],n[t])){if(!i[t])return!1;a=!0}return a};function om(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class lm extends Pu{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){s.isValid(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${jd}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=tm,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=xu.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(su.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=sg(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(su.afterInitEvent,{model:this})}_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)},seriesColor:t=>{var e;return s.isNil(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),s.isValid(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(au(this._rawData.dataSet,"invalidTravel",Zg),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=cu(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=hu(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=hu(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new Yu(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,r,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(s.isNil(this._rawStatisticsCache[t].min)||s.isNil(this._rawStatisticsCache[t].max))||!e&&s.isNil(this._rawStatisticsCache[t].values))if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(r=this._rawData.getFields())||void 0===r?void 0:r[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=s.minInArray(i.domain),this._rawStatisticsCache[t].max=s.maxInArray(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=qg(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=s.merge(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}return this._rawStatisticsCache[t]}_statisticViewData(){au(this._dataSet,"dimensionStatistics",Xg);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new i.DataView(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&Jd(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,s){au(this._dataSet,"dimensionStatistics",Xg);const r=new i.DataView(this._dataSet,{name:t});return r.parse([e],{type:"dataview"}),r.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const i=Jd(this.getStatisticFields(),null!==(t=null==s?void 0:s(e.name))&&void 0!==t?t:[]);return this._seriesField&&Jd(i,[{key:this._seriesField,operations:["values"]}]),i},target:"latest"}},!1),r}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new i.DataView(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:()=>({fields:this.getStackGroupFields()})},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return s.isNil(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,r=this._getSeriesDataKey(t);return void 0===s.get(r)?(s.set(r,0),r):(s.set(r,s.get(r)+1),`${r}_${s.get(r)}`)}:s.isString(t)?e=>e[t]:s.isArray(t)&&t.every((t=>s.isString(t)))?e=>t.map((t=>e[t])).join("-"):s.isFunction(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(au(this._rawData.dataSet,"addVChartProperty",Wg),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:Jg.bind(this),call:Qg}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(su.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(su.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(su.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(su.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||s.isNil(e)?null:t[e]}getDatumPositionValues(t,e){return!t||s.isNil(e)?[]:s.isString(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,r,n){var a;const o=this._createMark({type:t.type,name:s.isValid(t.name)?`${t.name}`:`${i}_${r}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(o){if(s.isValid(t.id)&&o.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=qp({},Zp(t.type,t,this._markAttributeContext));o.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${r}`,null===(a=t.children)||void 0===a||a.forEach(((t,e)=>{this._createExtensionMark(t,o,i,e,n)}))),!s.isNil(t.dataId)||!s.isNil(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?o.setData(this._data):(o.setDataView(e),e.target.addListener("change",(()=>{o.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:s.isValid(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=em(this._option.mode);let i=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const n=this._spec.hover;s.isBoolean(n)?i.enable=n:s.isObject(n)&&(i.enable=!0,i=Ud(i,n));const a=this._spec.select;s.isBoolean(a)?r.enable=a:s.isObject(a)&&(r.enable=!0,r=Ud(r,a));const o=[{trigger:{type:"dimension-hover"},marks:t}];if(i.enable){const e=Sp(i,t);e.length&&o.push({trigger:this._defaultHoverConfig(i),marks:e})}if(r.enable){const e=Sp(r,t);e.length&&o.push({trigger:this._defaultSelectConfig(r),marks:e})}return o}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:Eu.STATE_HOVER_REVERSE,highlightState:Eu.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=s.isValid(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:Eu.STATE_SELECTED_REVERSE,state:Eu.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=Sp(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:Hd;this.getMarksWithoutRoot().forEach((t=>{const r={},n={},a={};e.forEach((e=>{var i;const s=null===(i=e[t.name])||void 0===i?void 0:i.style;s&&(r[e.name]=!0,a[e.name]=a[e.name]||{},Object.keys(s).forEach((t=>{n[t]=!0,a[e.name][t]=s[t]})))})),t.state.addStateInfo({stateValue:Wd,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===r[t[0][i]]:!0===r[t[i]]});const o={};Object.keys(n).forEach((e=>{o[e]=r=>{var n,o;let l;if(Array.isArray(r)){if(0===r.length)return;l=null===(n=a[r[0][i]])||void 0===n?void 0:n[e]}return l=null===(o=a[r[i]])||void 0===o?void 0:o[e],s.isValid(l)?l:t.getAttribute(e,r)}})),this.setMarkStyle(t,o,Wd,Tu.User_SeriesStyle)}))}afterInitMark(){this.event.emit(su.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",Tu.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(Sa.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new $g(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!s.isEqual(e,t[i]))))&&(i.reCompile=!0,om(i))}_getSpecUpdatePolicy(){return sm}_compareSpec(t,e,i){var r,n,a,o,l;const h=super._compareSpec(t,e),c=Object.keys(e||{}).sort(),d=Object.keys(t||{}).sort();if(!s.isEqual(c,d))return h.reMake=!0,h;const u=this._getSpecUpdatePolicy(),p=null!==(r=u.compileOnlyKeys)&&void 0!==r?r:{},g=null!==(n=u.dataRelatedKeys)&&void 0!==n?n:{},m=null!==(a=u.compileOnlySubKeys)&&void 0!==a?a:{},f=null!==(o=u.seriesOnlyKeys)&&void 0!==o?o:{},v=Object.assign(Object.assign({},p),g),y=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},zg),v),f),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(s.array(t.extensionMark),s.array(e.extensionMark),h),!h.reMake&&this._compareLabelSpec(s.array(t.label),s.array(e.label),h),!h.reMake&&this._compareLabelSpec(s.array(t.totalLabel),s.array(e.totalLabel),h),h.reMake)return h;const _=this._getMarkSpecNamesForCompare().filter((i=>am(t[i],e[i],rm)));_.forEach((t=>{y[t]=!0})),!h.reCompile&&_.length&&(h.reCompile=!0);const b=c.filter((i=>v[i]&&!s.isEqual(t[i],e[i]))),S=c.filter((i=>f[i]&&!s.isEqual(t[i],e[i]))),x=c.filter((i=>m[i]&&am(t[i],e[i],m[i])));return x.forEach((t=>{y[t]=!0})),h.reCompile||!b.length&&!x.length||(h.reCompile=!0),b.some((t=>g[t]))?om(h,!0):h.reCompile&&!(null===(l=h.effects)||void 0===l?void 0:l.series)&&(b.length||x.length||_.length)&&om(h),S.length&&((A=h).change=!0,A.effects=Object.assign(Object.assign({},A.effects),{series:!0,render:!0})),c.some((i=>!y[i]&&!s.isEqual(t[i],e[i])))?(h.reMake=!0,h):h;var A}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof i.DataView||du(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec(),sg(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){s.isValidNumber(t.x)&&(this._layoutStartPoint.x=t.x),s.isValidNumber(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){s.isValidNumber(t)&&(this._layoutRect.width=t),s.isValidNumber(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),r=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,n=new Map;return null==r||r.forEach((e=>{const i=this.getSeriesFieldValue(e,t);n.has(i)||n.set(i,e)})),e.map((e=>{var i;const r=null!==(i=n.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:r,style:this.getSeriesStyle(r),shapeType:s}}))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:Hd,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new Od).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return Cd(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:Hd}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var r,n,a,o,l;const{key:h,groupKey:c,skipBeforeLayouted:d,themeSpec:u={},markSpec:p,dataView:g,parent:m,isSeriesMark:f,noSeparateStyle:v=!1}=e,y=super._createMark(t,{key:null!=h?h:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:v,parent:!1!==m?null!=m?m:this._rootMark:null});if(s.isValid(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),f&&(this._seriesMark=y),s.isNil(g)?y.setData(this._data):!1!==g&&y.setDataView(g),y.setSkipBeforeLayouted(!1!==d),s.isNil(c)||y.setGroupKey(c);const h=null!==(r=i.morph)&&void 0!==r&&r,m=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(h?1:0),v=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(h?`${this.getSpecIndex()}_${m}`:void 0),_=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:h,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(a=i.support3d)&&void 0!==a?a:e.support3d||!!e.zField,morphKey:v,morphElementKey:null!==(l=null===(o=e.morph)||void 0===o?void 0:o.morphElementKey)&&void 0!==l?l:i.morphElementKey});y.setMarkConfig(_),this.initMarkStyleWithSpec(y,Ud({},u,p||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:Kd}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),r=this.getDimensionField(),n=i?t[i]:void 0;let a,o=!1;for(let n=0;n<r.length;n++){const l=r[n],h=t[l];e+=`${n>0?"_":""}${s.isNil(h)?"":h}`,o||(o=l===i),a=h}return!i||o||r.length>1&&a===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==Yd&&t!==qd&&t!==$d&&t!==Xd||(t=this.getStackValueField()),null!==(e=function(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Rc(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:Hd]}}lm.mark=Gg,lm.transformerConstructor=tm;class hm extends lm{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=.6,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=s.isValid(t)?s.array(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=s.isValid(t)?s.array(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=s.array(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(s.isNil(t)||s.isNil(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(s.array(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const r=this.angleAxisHelper.dataToPosition(s.array(t));return this.angleAxisHelper.coordToPoint({angle:r,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}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}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Uc(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};Uc(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),s.isValid(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),s.isValid(this._spec.radius)&&(this._outerRadius=this._spec.radius),s.isValid(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),s.isValid(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(su.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&function(t,e,i){const s=t.getScale(0),r="isInverse"in t&&t.isInverse();Uc(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(r?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(r?-1:1)))}(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function cm(t){return Rc(t)?Number.parseFloat(t):0}const dm=(t,e)=>{const{asStartAngle:i,asEndAngle:r,asMiddleAngle:n,asRadian:a,asRatio:o,asQuadrant:l,asK:h,showAllZero:c,supportNegative:d,showEmptyCircle:u}=e,p=e.angleField(),g=e.startAngle(),m=e.endAngle(),f=e.minAngle(),v=t.map((t=>Object.assign({},t)));if(!v||0===v.length)return v;if(!c&&u&&um(v,p,d))return[];const y=(t,e,o)=>{t[i]=e,t[r]=e+o,t[n]=e+o/2,t[a]=o,t[l]=s.computeQuadrant(e+o/2)};let _=0,b=-1/0,S=!0;for(let t=0;t<v.length;t++){const e=d?Math.abs(cm(v[t][p])):cm(v[t][p]);_+=e,b=Math.max(e,b),S&&0!==e&&(S=!1),v[t][Mg]=e}const x=v.map((t=>Number(t[p]))),A=m-g;let T=g,C=A,k=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),r=t.map((t=>(isNaN(t)?0:t)/i*s*100)),n=100*s,a=r.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=r.map(((t,e)=>t-a[e]));for(;o<n;){let t=Number.NEGATIVE_INFINITY,e=null;for(let i=0;i<l.length;i++)l[i]>t&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(v.forEach(((t,e)=>{const i=t[Mg],s=_?i/_:0;let r=s*A;r<f?(r=f,C-=f):k+=i;const n=T,a=T+r;t[o]=s,t[h]=b?i/b:0,t._percent_=w[e],y(t,n,r),T=a})),C<A)if(C<=.001){const t=A/v.length;v.forEach(((e,i)=>{y(e,g+i*t,t)}))}else{const t=C/k;T=g,v.forEach((e=>{const i=e[a]===f?f:e[Mg]*t;y(e,T,i),T+=i}))}if(0!==_&&(v[v.length-1][r]=m),S&&c){const t=A/v.length;v.forEach(((e,i)=>{y(e,g+i*t,t)}))}return v},um=(t,e,i)=>!!s.isNil(t)||0===t.length||!!t.every((t=>0===cm(t[e])))||!i&&0===t.reduce(((t,i)=>t+cm(i[e])),0);function pm(t,e,i){return(s,r,n)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,r,i)}:{overall:!1}}const gm=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:pm(t,!0,pu.appear)}),mm={type:"fadeIn"},fm=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:pm(t,!0,pu.enter)}),vm=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:pm(t,!0,pu.exit)}),ym=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:pm(t,!0,pu.exit)});function _m(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mm;case"growRadius":return gm(Object.assign(Object.assign({},t),{growField:"radius"}));default:return gm(Object.assign(Object.assign({},t),{growField:"angle"}))}}const bm=Object.assign(Object.assign({},Gg),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class Sm extends tm{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let r=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);r=Ud({},this._theme,i,t);const n=(t,e)=>Ud({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);s.isArray(r.label)?r.label=r.label.map((t=>n(t.position,t))):r.label=n(r.label.position,r.label)}return{spec:r,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:r,centerY:n}=t;return s.isValid(r)&&(i.centerX=r),s.isValid(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const xm=`${jd}_LABEL_VISIBLE`,Am={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},Tm={outerRadius:!0};class Cm extends hm{constructor(){super(...arguments),this.transformerConstructor=Sm,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:Ld(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:Ld(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=Lg,this._endAngle=Fg,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[Ig];if(s.isNil(e))return null;const i=this.computeDatumRadius(t),r=this.computeDatumInnerRadius(t),n=this.computeCenter(t);return s.polarToCartesian(n,(i+r)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,r,n,a;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const o=function(t,e){let i=0,r=2*Math.PI;const n=s.isValid(t),a=s.isValid(e);for(n||a?a?n?(i=t,r=e):(i=e-2*Math.PI,r=e):(i=t,r=t+2*Math.PI):(i=0,r=2*Math.PI);r<=i;)r+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,r-=2*Math.PI;for(;r<0;)i+=2*Math.PI,r+=2*Math.PI;return{startAngle:i,endAngle:r}}(s.isValid(this._spec.startAngle)?s.degreeToRadian(this._spec.startAngle):this._startAngle,s.isValid(this._spec.endAngle)?s.degreeToRadian(this._spec.endAngle):this._endAngle);this._startAngle=o.startAngle,this._endAngle=o.endAngle,this._padAngle=s.isValid(this._spec.padAngle)?s.degreeToRadian(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(r=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==r&&r,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(a=this._spec.supportNegative)&&void 0!==a&&a}initData(){super.initData();const t=this.getViewData();if(!t)return;au(this._dataSet,"pie",dm),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>s.isValid(this._spec.minAngle)?s.degreeToRadian(this._spec.minAngle):0,asStartAngle:Bg,asEndAngle:Og,asRatio:Eg,asMiddleAngle:Ig,asRadian:Dg,asQuadrant:Rg,asK:Pg,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new i.DataView(this._dataSet,{name:`${jd}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new Yu(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},Cm.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:Kd,groupKey:this._seriesField,isSeriesMark:!0},{morph:tg(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return Lc(Bg)(t)}endAngleScale(t){return Lc(Og)(t)}_computeLayoutRadius(){return((t,e,i,r)=>{const n=t();if(s.isNumber(n))return n;if(s.isFunction(n))return n(e(),i());const a=e();if("auto"===n&&a.width>0&&a.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=r();return s.calculateMaxRadius(a,i(),t,e)}return Math.min(a.width/2,a.height/2)})((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:Rd(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:Rd(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",Tu.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",Tu.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,Tu.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",Tu.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:Lc(xm).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(su.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,r,n,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(n=this.getSpec()[(null===(r=this._pieMark)||void 0===r?void 0:r.name)||"pie"])||void 0===n?void 0:n.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,r,n,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(n=this.getSpec()[(null===(r=this._pieMark)||void 0===r?void 0:r.name)||"pie"])||void 0===n?void 0:n.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(s.isNil(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Tm),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Am)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const r=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(r.reRender=!0,r.change=!0),r}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[Ig];if(s.isNil(i))return null;if(e&&!this.isDatumInViewData(t))return null;const r=this.computeDatumRadius(t),n=this.computeCenter(t);return s.polarToCartesian(n,r,i)}initAnimation(){var t,e,i;const r={growFrom:(t,e,i)=>{var s,r;if(i===pu.appear)return this._startAngle;if(i===pu.disappear)return this._endAngle;const n=[pu.disappear,pu.exit],a=this._pieMark.getGraphics(),o=null==t?void 0:t[zd];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[zd])<o})))return this._startAngle;if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[zd])>o})))return this._endAngle;const l=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[zd])<o}));return n.includes(i)?null===(s=null==l?void 0:l.getFinalAttribute())||void 0===s?void 0:s.endAngle:null===(r=null==l?void 0:l.attribute)||void 0===r?void 0:r.endAngle}},n=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._pieMark){const t=qp(null===(e=Sa.getAnimationInKey("pie"))||void 0===e?void 0:e(r,n),Zp("pie",this._spec,this._markAttributeContext));t.normal&&t.normal.type&&(t.normal=function(t,e){var i,r,n,a;const o=null!==(r=null===(i=e.options)||void 0===i?void 0:i.distance)&&void 0!==r?r:10,l=s.isValidNumber(e.duration)?e.duration/2:1e3,h=null!==(n=e.options.easing)&&void 0!==n?n:"cubicOut";return{oneByOne:e.oneByOne,loop:null!==(a=e.loop)&&void 0!==a&&a,timeSlices:[{duration:l,effects:{easing:h,channel:{x:{from:e=>t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+s.polarToCartesian({x:0,y:0},o,e[Ig]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+s.polarToCartesian({x:0,y:0},o,e[Ig]).y}}}},{duration:l,effects:{easing:h,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+s.polarToCartesian({x:0,y:0},o,e[Ig]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+s.polarToCartesian({x:0,y:0},o,e[Ig]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=qp(null===(i=Sa.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(r,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}Cm.transformerConstructor=Sm,Cm.mark=bm,Cm.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};(class extends Cm{constructor(){super(...arguments),this.type=bd.pie}}).type=bd.pie;class km extends Sm{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class wm extends Cm{constructor(){super(...arguments),this.type=$.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=km}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const t=this._pieMark;t&&this.setMarkStyle(t,{beta:()=>this._angle3d},"normal",Tu.Series)}initLabelMarkStyle(t,e={}){t&&(super.initLabelMarkStyle(t),this.setMarkStyle(t,{support3d:!0},void 0,Tu.Mark))}}wm.type=$.pie3d,wm.mark=Hg,wm.builtInTheme={pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside"}}},wm.transformerConstructor=km;const Mm=()=>{Sa.registerAnimation("pie3d",((t,e)=>({appear:_m(t,e),enter:fm(t),exit:vm(t),disappear:ym(t)}))),Vg(),Sa.registerSeries(wm.type,wm)};class Em extends gg{constructor(){super(...arguments),this.transformerConstructor=pg,this.type="pie3d",this.seriesType=$.pie3d}}Em.type="pie3d",Em.seriesType=$.pie3d,Em.transformerConstructor=pg;const Bm="combinationCandlestick";class Om extends e.CartesianChartSpecTransformer{_getDefaultSeriesSpec(t){const e=[t.openField,t.highField,t.lowField,t.closeField],i=super._getDefaultSeriesSpec(t,["candlestick","openField","highField","lowField","closeField","rising","falling","doji"]);return i.yField=e,i}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),e.setDefaultCrosshairForCartesianChart(t)}}class Pm extends e.GlyphMark{constructor(){super(...arguments),this.type=Pm.type}setGlyphConfig(t){super.setGlyphConfig(t),this._subMarks={line:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"}},this._positionChannels=["x","boxWidth","open","close","high","low"],this._channelEncoder=null,this._positionEncoder=(t,e,i)=>{const{x:s=i.attribute.x,boxWidth:r=i.attribute.boxWidth,open:n=i.attribute.open,close:a=i.attribute.close,low:o=i.attribute.low,high:l=i.attribute.high}=t,h={};return h.line={points:[{x:s,y:o},{x:s,y:l}]},h.box={x:s-r/2,x1:s+r/2,y:Math.min(n,a),y1:Math.max(n,a),drawStrokeWhenZeroWH:!0},h}}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}}Pm.type="candlestick";class Im extends e.ACustomAnimate{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){const t=(t=>{const i=t.getFinalAttribute(),{x:s,y:r,open:n,high:a,low:o,close:l}=i,h={from:{x:s,y:r},to:{x:s,y:r}};return e.isValidNumber(n)&&e.isValidNumber(l)&&(n>l?(h.from.open=o,h.to.open=n,h.from.close=o,h.to.close=l,e.isValidNumber(a)&&(h.from.high=o,h.to.high=a)):(h.from.open=a,h.to.open=n,h.from.close=a,h.to.close=l,e.isValidNumber(o)&&(h.from.low=a,h.to.low=o))),h})(this.target,this.params,this.params.options);return t}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 Rm extends e.ACustomAnimate{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){const t=(t=>{const i=t.getFinalAttribute(),{x:s,y:r,open:n,high:a,low:o,close:l}=i,h={from:{x:s,y:r},to:{x:s,y:r}};return e.isValidNumber(n)&&e.isValidNumber(l)&&(n>l?(h.from.open=n,h.to.open=o,h.from.close=l,h.to.close=o,e.isValidNumber(a)&&(h.from.high=a,h.to.high=o)):(h.from.open=n,h.to.open=a,h.from.close=l,h.to.close=a,e.isValidNumber(o)&&(h.from.low=o,h.to.low=a))),h})(this.target,this.params,this.params.options);return t}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 Dm="candlestick";var Lm,Fm;!function(t){t.OPEN="open",t.HIGH="high",t.LOW="low",t.CLOSE="close",t.SERIES_FIELD="seriesField"}(Lm||(Lm={})),function(t){t.candlestick="candlestick"}(Fm||(Fm={}));const Nm=Object.assign(Object.assign({},e.baseSeriesMark),{candlestick:{name:"candlestick",type:"candlestick"}});class Um extends e.BaseSeriesTooltipHelper{constructor(){super(...arguments),this.getContentKey=t=>e=>{switch(t){case Lm.OPEN:return this.series.getOpenField();case Lm.HIGH:return this.series.getHighField();case Lm.LOW:return this.series.getLowField();case Lm.CLOSE:return this.series.getCloseField();case Lm.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{switch(t){case Lm.OPEN:return e[this.series.getOpenField()];case Lm.HIGH:return e[this.series.getHighField()];case Lm.LOW:return e[this.series.getLowField()];case Lm.CLOSE:return e[this.series.getCloseField()];case Lm.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>this.series.getMarkInName("candlestick").getAttribute("stroke",t)}getDefaultContentList(t){return[{key:this.getContentKey(Lm.OPEN),value:this.getContentValue(Lm.OPEN)},{key:this.getContentKey(Lm.HIGH),value:this.getContentValue(Lm.HIGH)},{key:this.getContentKey(Lm.LOW),value:this.getContentValue(Lm.LOW)},{key:this.getContentKey(Lm.CLOSE),value:this.getContentValue(Lm.CLOSE)},{key:this.getContentKey(Lm.SERIES_FIELD),value:this.getContentValue(Lm.SERIES_FIELD)}]}}const jm={rising:{style:{boxFill:"#FF0000",stroke:"#FF0000"}},falling:{style:{boxFill:"#00AA00",stroke:"#00AA00"}},doji:{style:{boxFill:"#000000",stroke:"#000000"}},candlestick:{style:{lineWidth:1}}};class Vm extends e.CartesianSeries{constructor(){super(...arguments),this.type=Dm,this._mergedStyles={rising:{},falling:{},doji:{}}}getOpenField(){return this._openField}getHighField(){return this._highField}getLowField(){return this._lowField}getCloseField(){return this._closeField}getBoxFill(){return this._boxFill}getStrokeColor(){return this._strokeColor}setAttrFromSpec(){var t,e,i,s,r,n,a,o;super.setAttrFromSpec();const l=this._spec,h=null!==(e=null===(t=l.candlestick)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._openField=l.openField,this._highField=l.highField,this._lowField=l.lowField,this._closeField=l.closeField,this._boxWidth=h.boxWidth,this._boxFill=h.boxFill,this._strokeColor=h.strokeColor,this._buildMergedStyles(h,null!==(s=null===(i=l.rising)||void 0===i?void 0:i.style)&&void 0!==s?s:{},null!==(n=null===(r=l.falling)||void 0===r?void 0:r.style)&&void 0!==n?n:{},null!==(o=null===(a=l.doji)||void 0===a?void 0:a.style)&&void 0!==o?o:{})}initMark(){this._candlestickMark=this._createMark(Vm.mark.candlestick,{groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var t;const i=this._candlestickMark;if(i){const s={fill:t=>this.mergeStyle(t).boxFill,stroke:t=>this.mergeStyle(t).stroke,lineWidth:t=>this.mergeStyle(t).lineWidth,boxWidth:null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth.bind(this),x:this.dataToPositionX.bind(this)};i.setGlyphConfig({}),this.setMarkStyle(i,s,e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}}initCandlestickMarkStyle(){var t;const i=this._candlestickMark,s=this._yAxisHelper;if(i&&s){const{dataToPosition:r}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{open:t=>e.valueInScaleRange(r(this.getDatumPositionValues(t,this._openField),{bandPosition:this._bandPosition}),n),high:t=>e.valueInScaleRange(r(this.getDatumPositionValues(t,this._highField),{bandPosition:this._bandPosition}),n),low:t=>e.valueInScaleRange(r(this.getDatumPositionValues(t,this._lowField),{bandPosition:this._bandPosition}),n),close:t=>e.valueInScaleRange(r(this.getDatumPositionValues(t,this._closeField),{bandPosition:this._bandPosition}),n)},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}}init(t){super.init(t),this.initCandlestickMarkStyle()}_initAnimationSpec(t={}){const i=e.merge({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{i[t]&&"scaleIn"===i[t].type?i[t].type="candlestickScaleIn":i[t]&&"scaleOut"===i[t].type&&(i[t].type="candlestickScaleOut")})),i}initAnimation(){var t;const i=e.getGroupAnimationParams(this);if(this._candlestickMark){const s=this._initAnimationSpec(null===(t=e.Factory.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),r=this._initAnimationSpec(e.userAnimationConfig(Dm,this._spec,this._markAttributeContext));this._candlestickMark.setAnimationConfig(e.animationConfig(s,r,i))}}initTooltip(){this._tooltipHelper=new Um(this),this._candlestickMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._candlestickMark)}_buildMergedStyles(t,i,s,r){this._mergedStyles.rising=e.merge({},t,i),this._mergedStyles.falling=e.merge({},t,s),this._mergedStyles.doji=e.merge({},t,r)}mergeStyle(t){const e=this.getDatumPositionValues(t,this._openField)[0],i=this.getDatumPositionValues(t,this._closeField)[0];return e<i?this._mergedStyles.rising:e>i?this._mergedStyles.falling:this._mergedStyles.doji}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._xAxisHelper,e=this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}getActiveMarks(){return[this._candlestickMark]}}Vm.type=Dm,Vm.builtInTheme={candlestick:jm},Vm.mark=Nm;const Gm=()=>{e.registerGlyphMark(),e.registerLine(),e.registerRect(),e.Factory.registerGraphicComponent("line",(t=>e.createLine(t))),e.Factory.registerGraphicComponent("rect",(t=>e.createRect(t))),e.Factory.registerMark(Pm.type,Pm),e.registerSymbolMark(),e.registerScaleInOutAnimation(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.AnimateExecutor.registerBuiltInAnimate("candlestickScaleIn",Im),e.AnimateExecutor.registerBuiltInAnimate("candlestickScaleOut",Rm),e.Factory.registerSeries(Vm.type,Vm)};class zm extends e.BaseChart{_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}zm.type="candlestick",zm.seriesType=Dm,zm.transformerConstructor=Om;function Km(t){t.yField=[t.openField,t.highField,t.lowField,t.closeField]}class Hm extends e.CartesianChartSpecTransformer{needAxes(){return!0}transformSpec(t){this.transformRegion(t),void 0===t.tooltip&&(t.tooltip={}),this.transformSeriesSpec(t),this._transformAxisSpec(t),this._transformLayout(t)}transformRegion(t){var e,i;const s=t;s.region=[null!==(e=t.candlestickRegion)&&void 0!==e?e:{}],t.previewSeries&&s.region.push(null!==(i=t.previewRegion)&&void 0!==i?i:{})}transformSeriesSpec(t){var i;t.series=null!==(i=t.series)&&void 0!==i?i:[],t.series.forEach((e=>{this._transformSeriesData(t,e),e.regionIndex=0}));const s=t.series.find((e=>e.id===t.candlestickSeries.id));let r;s?(e.merge(s,t.candlestickSeries),r=s):(t.series.push(t.candlestickSeries),r=t.candlestickSeries),Km(r),this._transformSeriesData(t,r),r.regionIndex=0,t.previewSeries&&e.array(t.previewSeries).forEach((i=>{const s=t.series.find((t=>t.id===i.id));let r;s?(e.merge(s,i),r=s):(t.series.push(i),r=i),r.regionIndex=1,this._transformSeriesData(t,r)}))}_transformSeriesData(t,i){var s;i.data&&(t.data=e.array(null!==(s=t.data)&&void 0!==s?s:[]),e.array(i.data).forEach(((e,s)=>{t.data.push(e),0===s&&(i.dataIndex=t.data.length-1,"id"in e?i.dataId=e.id:"name"in e&&(i.dataId=e.name))})),delete i.data)}_transformAxisSpec(t){super._transformAxisSpec(t),t.previewSeries&&(t.previewAxes||(t.previewAxes={type:"linear",orient:"left",visible:!1}),t.previewAxes.regionIndex=[1],t.axes.push(t.previewAxes),t.axes.forEach((e=>{e!==t.previewAxes&&("left"!==e.orient&&"right"!==e.orient||(e.regionIndex=[0]))})))}_transformDataZoomSpec(t){t.dataZoom&&e.array(t.dataZoom).forEach((t=>{"left"!==t.orient&&"right"!==t.orient||(t.regionIndex=[0])}))}_transformLayout(t){var i,s;const r={type:"grid",col:2,row:6,elements:[],colWidth:[],rowHeight:[]};let n=0,a=0;if(t.title&&!1!==(null===(i=t.title)||void 0===i?void 0:i.visible)&&n++,t.legends){const i=e.array(t.legends)[0];!1!==(null==i?void 0:i.visible)&&("top"===i.orient||"bottom"===i.orient?n++:a++)}if(t.dataZoom&&e.array(t.dataZoom).forEach((t=>{!1!==(null==t?void 0:t.visible)&&("top"===t.orient||"bottom"===t.orient?n++:a++)})),t.axes){const i={top:!1,bottom:!1,left:!1,right:!1,z:!1};e.array(t.axes).forEach((t=>{i[t.orient]||(i[t.orient]=!0,"top"===t.orient||"bottom"===t.orient?n++:a++)}))}n++,a++,t.previewSeries&&n++,r.row=n,r.col=a;const o={top:0,bottom:0,left:0,right:0};if(t.title&&!1!==(null===(s=t.title)||void 0===s?void 0:s.visible)&&this._layoutOrientItem(r,t.title,o,{specKey:"title",index:0},"total"),t.legends){const i=e.array(t.legends)[0];!1!==(null==i?void 0:i.visible)&&this._layoutOrientItem(r,i,o,{specKey:"legends",index:0},"less")}if(t.dataZoom&&e.array(t.dataZoom).forEach(((t,e)=>{!1!==(null==t?void 0:t.visible)&&this._layoutOrientItem(r,t,o,{specKey:"dataZoom",index:e},"one")})),t.axes){const e={left:!1,right:!1};t.axes.forEach(((t,i)=>{"left"!==t.orient&&"right"!==t.orient||e[t.orient]||(e[t.orient]=!0,this._layoutOrientItem(r,t,o,{specKey:"axes",index:i},"one"))}))}const l=this._layoutOrientItem(r,{orient:"top"},o,{specKey:"region",index:0},"one");if(t.previewSeries){const i=this._layoutOrientItem(r,{orient:"bottom"},o,{specKey:"region",index:1},"one"),s=t.axes.findIndex((e=>e===t.previewAxes));if(-1!==s){const t={col:i.col-1,row:i.row,modelKey:"axes",modelIndex:s};r.elements.push(t)}if(t.previewHeight)if("string"==typeof t.previewHeight){if(e.isPercent(t.previewHeight)){const e=t.previewHeight;r.rowHeight.push({index:i.row,size:t=>Number(e.substring(0,e.length-1))*t/100})}}else r.rowHeight.push({index:i.row,size:t.previewHeight})}const h=t.axes.findIndex((t=>"bottom"===t.orient));this._layoutOrientItem(r,t.axes[h],o,{specKey:"axes",index:h},"one"),t.axes.forEach(((e,i)=>{if(e===t.previewAxes)return;const s=r.elements.find((t=>"modelKey"in t&&"axes"===t.modelKey&&t.modelIndex===i));s&&("top"===e.orient||"bottom"===e.orient?s.col=l.col:s.row=l.row)})),e.array(t.dataZoom).forEach(((t,e)=>{const i=r.elements.find((t=>"modelKey"in t&&"dataZoom"===t.modelKey&&t.modelIndex===e));i&&("top"===t.orient||"bottom"===t.orient?i.col=l.col:i.row=l.row)})),t.layout=r}_layoutOrientItem(t,e,i,s,r){var n;const a={modelKey:s.specKey,modelIndex:s.index,col:0,row:0},o=null!==(n=e.orient)&&void 0!==n?n:"top",{span:l,index:h}=this._getLayoutElementCommon(t,i,r,o);return t.elements.push(a),"top"===o?(a.row=i.top,a.rowSpan=1,a.colSpan=l,a.col=h,i.top++):"bottom"===o?(a.row=t.row-i.bottom-1,a.rowSpan=1,a.colSpan=l,a.col=h,i.bottom++):"left"===o?(a.col=i.left,a.colSpan=1,a.rowSpan=l,a.row=h,i.left++):"right"===o&&(a.col=t.col-i.right-1,a.colSpan=1,a.rowSpan=l,a.row=h,i.right++),a}_getLayoutElementCommon(t,e,i,s){return"top"===s||"bottom"===s?{span:"total"===i?t.col:"one"===i?1:t.col-e.left-e.right,index:"total"===i?0:e.left}:{span:"total"===i?t.row:"one"===i?1:t.row-e.top-e.bottom,index:"total"===i?0:e.top}}}class Wm extends e.BaseChart{constructor(){super(...arguments),this.type=Bm,this.transformerConstructor=Hm}_setModelOption(){this._modelOption.getDimensionInfo=(t,i,s)=>{var r;return[...null!==(r=e.getCartesianDimensionInfo(t,i,s))&&void 0!==r?r:[]]},this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}Wm.type=Bm,Wm.transformerConstructor=Hm,e.mixin(Wm,e.StackChartMixin);const $m=t=>({custom:e.RotateBySphereAnimate,customParameters:()=>t,easing:"linear",loop:1/0,duration:6e3});class Ym extends e.BaseWordCloudSeries{constructor(){super(...arguments),this.type=$.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(e.BaseWordCloudSeries.mark.word,{groupKey:this._seriesField,isSeriesMark:!0},{support3d:!0})}initMarkStyle(){super.initMarkStyle();const t=this._wordMark;t&&this.setMarkStyle(t,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",e.AttributeLevel.Series)}initAnimation(){var t,i;const s=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(e.animationConfig(null===(i=e.Factory.getAnimationInKey("wordCloud3d"))||void 0===i?void 0:i((()=>{var t;const e=this.getCompiler().getStage(),i=e.width-s.left||0-s.right||0,r=e.height-s.top||0-s.bottom||0,n=Math.max(i,r)/2;return{center:{x:n,y:n,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:n},r:n}})),e.userAnimationConfig("word",this._spec,this._markAttributeContext)))}}Ym.type=$.wordCloud3d,Ym.builtInTheme={wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}}};const Xm=()=>{e.registerTextMark(),e.Factory.registerAnimation("wordCloud3d",(t=>({appear:$m(t)}))),e.Factory.registerSeries(Ym.type,Ym)},qm=()=>{Xm()};class Zm extends e.BaseWordCloudChartSpecTransformer{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.depth_3d=t.depth_3d,e}}class Jm extends e.BaseWordCloudChart{constructor(){super(...arguments),this.transformerConstructor=Zm,this.type="wordCloud3d",this.seriesType=$.wordCloud3d}}Jm.type="wordCloud3d",Jm.seriesType=$.wordCloud3d,Jm.transformerConstructor=Zm;const Qm=()=>{Ta(),Xm(),e.Factory.registerChart(Jm.type,Jm)},tf={label:{space:0}};class ef{setLayout3dBox(t){this.layout3dBox=t}_afterUpdateAttribute(t,i){const s=e.isZAxis(this._orient),r=e.isXAxis(this._orient),n=e.isYAxis(this._orient);let a=0,o=0;if(!i){const t=this.getRegions();let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,r=i+t[0].getLayoutRect().height;for(let n=1;n<t.length;n++){const a=t[n],{x:o,y:l}=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();e=Math.min(e,o),s=Math.max(s,h+o),i=Math.min(i,l),r=Math.max(r,c+l)}a=Math.abs(r-i),o=Math.abs(s-e)}let l=0,h=0;const{width:c,height:d}=this.getLayoutRect();let u={x:0,y:0};r?(u={x:c,y:0},l=a,h=c):n&&(u={x:0,y:d},l=o,h=d);const p=this.layout3dBox?this.layout3dBox.length:0;if(!s){const e=this.getLabelItems(h);return t.grid={length:l},t.start={x:0,y:0},t.text=this._spec.title.text||this._dataFieldText,t.maxWidth=this._getTitleLimit(r),t.items=e,t.grid={type:"line",start:{x:0,y:0},end:u,items:e[0],depth:p,length:l},t}return((t,i)=>{var s;const r=e.getCombinedSizeOfRegions(t.getRegions()),{width:n}=t.getLayoutRect(),a=n,o=t.layout3dBox?t.layout3dBox.length:0,l=t.layout3dBox?t.layout3dBox.width:0,h={x:o,y:0},c=t.getLabelItems(a),d={start:{x:0,y:0},end:h,title:{text:t._spec.title.text||t._dataFieldText,maxWidth:t._getTitleLimit(!1)},items:c,scale:t._scale.clone()},u=null!==(s=t.directionStr)&&void 0!==s?s:"r2l";let p=[0,0],g=-Math.PI/2,m=0;return"l2r"===u&&(m=t.layout3dBox.length,p=[0,0,0],g=Math.PI/2),d.z=m,d.alpha=g,d.anchor3d=p,i||(d.grid={type:"line",start:{x:0,y:0},end:h,items:c[0],verticalFactor:t._axisStyle.verticalFactor,depth:l,length:i?0:r.height,alpha:g,z:m,anchor3d:p}),d})(this,i)}}const sf=Object.assign(Object.assign({},Ca),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class rf extends e.RangeColumnSeries{constructor(){super(...arguments),this.type=$.rangeColumn3d,this._barMarkType="rect3d",this._barName=$.bar3d}}rf.type=$.rangeColumn3d,rf.mark=sf;const nf=()=>{Ep(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.Factory.registerSeries(rf.type,rf)};class af extends e.RangeColumnSeriesSpecTransformer{_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar3d")}}class of extends e.CartesianChartSpecTransformer{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bar3d","barGapInGroup"]);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}}class lf extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=of,this.type="rangeColumn3d",this.seriesType=$.rangeColumn3d}_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}lf.type="rangeColumn3d",lf.seriesType=$.rangeColumn3d,lf.transformerConstructor=of;const hf="pictogram",cf="pictogram";var df;!function(t){t.pictogram="pictogram"}(df||(df={}));const uf=Object.assign(Object.assign({},e.baseSeriesMark),{pictogram:{name:"pictogram",type:"group"}});class pf extends e.BaseChartSpecTransformer{_isValidSeries(t){return t===cf}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","svg","pictogram","defaultFillColor"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}const gf=new Map,mf="_vchartViewportRect";let ff;const vf=/-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi;function yf(t,i){gf.has(t)&&e.warn(`svg source key of '${t}' already exists, will be overwritten.`),ff||(ff=new e.DataSet,e.registerDataSetInstanceParser(ff,"svg",e.svgParser));const s=new e.DataView(ff);s.parse(i,{type:"svg"});const r=s.latestData,n=function(t){var e,i,s,r;const n=null===(e=t.match(/<svg\b[\s\S]*?>/i))||void 0===e?void 0:e[0],a=null===(i=null==n?void 0:n.match(/\benable-background\s*=\s*(['"])(.*?)\1/i))||void 0===i?void 0:i[2];if(!a||!/^\s*new\b/i.test(a))return null;const o=null!==(r=null===(s=a.match(vf))||void 0===s?void 0:s.map(Number))&&void 0!==r?r:[],[l,h,c,d]=o;return!Number.isFinite(l)||!Number.isFinite(h)||!Number.isFinite(c)||!Number.isFinite(d)||c<=0||d<=0?null:{x:l,y:h,width:c,height:d}}(i);r&&n&&!r.viewBoxRect&&!function(t){return Number.isFinite(t.width)&&Number.isFinite(t.height)&&t.width>0&&t.height>0}(r)&&(r[mf]=n),gf.set(t,s)}function _f(t){gf.has(t)?gf.delete(t):e.warn(`map type of '${t}' does not exists.`)}function bf(t){return gf.get(t)}class Sf extends e.BaseSeriesSpecTransformer{_getDefaultSpecFromChart(t){var i,s,r;const n=null!==(i=super._getDefaultSpecFromChart(t))&&void 0!==i?i:{},a=t.svg,o=null===(r=null===(s=gf.get(a))||void 0===s?void 0:s.latestData)||void 0===r?void 0:r.elements;if(o&&o.length){o.map((t=>t.name)).filter((t=>e.isValid(t))).forEach((e=>{t[e]&&(n[e]=t[e])}))}return n}}class xf extends e.BaseSeriesTooltipHelper{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)},this.markTooltipValueCallback=(t,e)=>{const{measureFields:i}=this._seriesCacheInfo;if(i[0]&&t.data)return t.data[i[0]]},this.markTooltipKeyCallback=t=>{var e;return null===(e=t.data)||void 0===e?void 0:e[this.series.getDimensionField()[0]]}}}const Af="element-highlight-by-graphic-name";class Tf extends e.ElementHighlight{constructor(){super(...arguments),this.type=Af,this.handleStart=t=>{if(t&&t.item&&this.isGraphicInMark(t.item)){if(this.options.shouldStart?this.options.shouldStart(t):this._filterByName(t)){const e=this._parseTargetKey(t);this.start(e)}}},this.handleReset=t=>{t&&t.item&&this.isGraphicInMark(t.item)&&this.reset()}}_filterByName(t){var e;return!!(null===(e=null==t?void 0:t.node)||void 0===e?void 0:e.name)}_parseTargetKey(t){return t.node.name}start(t){if(e.isNil(t))return;const{interaction:i,highlightState:s,blurState:r}=this.options,n=i.getStatedGraphics(this),a=[];this.getMarks().forEach((e=>{var i;null===(i=e.getGraphics())||void 0===i||i.forEach((e=>{e.name===t&&a.push(e)}))})),i.updateStates(this,a,n,s,r),i.setStatedGraphics(this,a)}reset(){const{highlightState:t,blurState:e,interaction:i}=this.options;i.clearAllStatesOfTrigger(this,t,e),i.setStatedGraphics(this,[])}}Tf.type=Af;const Cf="element-select-by-graphic-name";class kf extends e.ElementSelect{constructor(){super(...arguments),this.type=Cf}start(t){const e=null==t?void 0:t.name;e&&this.getMarks().forEach((t=>{var i;null===(i=t.getGraphics())||void 0===i||i.forEach((t=>{t.name===e&&super.start(t)}))}))}}kf.type=Cf;function wf(t){var i;return e.isValid(t)&&"none"!==t&&!(null===(i=t.includes)||void 0===i?void 0:i.call(t,"url"))}const Mf=t=>{const e=parseFloat(t.strokeWidth);if(!isNaN(e))return e;const i=t.stroke;return i&&wf(i)?1:0},Ef=(t,e)=>{var i;const s=null!==(i=t.fill)&&void 0!==i?i:e;return s&&wf(s)?s:void 0},Bf=(t,e)=>{var i;const s=null!==(i=t.stroke)&&void 0!==i?i:e;return!(!s||!wf(s))&&s},Of=t=>Object.assign(Object.assign({},t),{x:parseFloat(t.x)||void 0,y:parseFloat(t.y)||void 0,fillStrokeOrder:!1,fill:Ef(t),lineWidth:Mf(t),stroke:Bf(t)}),Pf={group:t=>{const e=Of(t);return Object.assign(Object.assign({},e),{visibleAll:!1!==e.visible})},rule:t=>Object.assign(Object.assign({},Of(t)),{x:parseFloat(t.x1),y:parseFloat(t.y1),x1:parseFloat(t.x2),y1:parseFloat(t.y2)}),rect:t=>Object.assign(Object.assign({},Of(t)),{fill:Ef(t,"#000"),width:parseFloat(t.width),height:parseFloat(t.height)}),polygon:t=>Object.assign(Object.assign({},Of(t)),{fill:Ef(t,"#000"),points:t.points.trim().split(/\s+/).map((t=>{const[e,i]=t.split(",").map(Number);return{x:e,y:i}}))}),line:t=>Object.assign(Object.assign({},Of(t)),{points:t.points.trim().split(/\s+/).map((t=>{const[e,i]=t.split(",").map(Number);return{x:e,y:i}}))}),path:t=>Object.assign(Object.assign({},Of(t)),{path:t.d,fillStrokeOrder:!1,fill:Ef(t,"#000")}),arc:t=>{var e;return Object.assign(Object.assign({},Of(t)),{outerRadius:null!==(e=t.r)&&void 0!==e?e:t.ry,x:parseFloat(t.cx),y:parseFloat(t.cy),startAngle:0,endAngle:2*Math.PI,scaleX:parseFloat(t.rx)/parseFloat(t.ry)||1,fill:Ef(t,"#000")})},text:(t,e)=>{var i,s;return Object.assign(Object.assign({},Of(t)),{text:e,textAlign:null!==(i=t.textAlign)&&void 0!==i?i:"left",textBaseLine:null!==(s=t.textAnchor)&&void 0!==s?s:"middle",anchor:[0,0],fill:Ef(t,"#000")})}},If=t=>{var i,s;if(!t||!t[0])return{};const{elements:r}=t[0].latestData;if(r&&r.length){r.forEach(((t,i)=>{var s;t[e.DEFAULT_DATA_INDEX]=i,t._uniqueId=`${t.id}-${i}`,t.data=void 0;const{graphicType:r,transform:n}=t,a={visible:"hidden"!==t.attributes.visibility&&"collapse"!==t.attributes.visibility};"text"===t.graphicType?e.merge(a,t._inheritStyle,null===(s=t.parent)||void 0===s?void 0:s._textGroupStyle,t.attributes):"group"!==t.graphicType&&e.merge(a,t._inheritStyle,t.attributes),Pf[r]?t._finalAttributes=Pf[r](a,t.value):t._finalAttributes=a,n&&(t._finalAttributes.postMatrix=Object.assign({},n))}));const t=r.filter((t=>"text"===t.tagName));for(let n=0;n<t.length;n++){const a=t[n]._uniqueId,o=r.filter((t=>{let e=!1,i=t.parent;for(;i;){if(i._uniqueId===a){e=!0;break}i=i.parent}return e}));if(o&&o.length){const r=null!==(s=null===(i=t[n]._textGroupStyle)||void 0===i?void 0:i.x)&&void 0!==s?s:0;let a=r;for(let t=0;t<o.length;t++){const i=o[t];if("group"===i.graphicType)a=r;else if(i.value&&void 0===i.parent._textGroupStyle.x){const s=o.slice(0,t).reverse().find((t=>"text"===t.graphicType&&t.value));if(s){a+=e.measureText(s.value,s._finalAttributes).width}i._finalAttributes.x=a}}}}}return r};class Rf extends e.GeoSeries{constructor(){super(...arguments),this.type=cf,this._idToMark=new Map}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.svg=this._spec.svg,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this.svg||null===(t=this._option)||void 0===t||t.onError("svg source is not specified !"),this._parsedSvgResult=null===(e=bf(this.svg))||void 0===e?void 0:e.latestData,this._parsedSvgResult||null===(i=this._option)||void 0===i||i.onError(`'${this.svg}' is not registered !`)}getDatumCenter(t){return[Number.NaN,Number.NaN]}getDatumName(t){return t.name||t._nameFromParent}getMarksWithoutRoot(){return this.getMarks().filter((t=>t.name&&!t.name.includes("seriesGroup")&&!t.name.includes("root")&&t!==this._pictogramMark))}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getTransformMatrix=this.getRootMatrix.bind(this),this._markAttributeContext.coordToPosition=this.coordToPosition.bind(this),this._markAttributeContext.dataToPosition=this.dataToPosition.bind(this)}_defaultHoverConfig(t){return{type:"element-highlight-by-graphic-name",trigger:t.trigger,triggerOff:"pointerout",blurState:e.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:e.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(t){const i="multiple"===t.mode,s=e.isValid(t.triggerOff)?t.triggerOff:i?["empty","self"]:["empty",t.trigger];return{type:"element-select-by-graphic-name",trigger:t.trigger,triggerOff:s,reverseState:e.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:e.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}initMark(){var t;if(this._pictogramMark=this._createMark(Rf.mark.pictogram,{groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0},{morph:e.shouldMarkDoMorph(this._spec,Rf.mark.pictogram.name)}),this._pictogramMark){this._pictogramMark.setData(this._mapViewData),this._pictogramMark.setUserId(Rf.mark.pictogram.name);for(const i of this._mapViewData.getDataView().latestData){const{graphicType:s,name:r,parent:n,id:a,_nameFromParent:o,_uniqueId:l}=i,h=this._createMark({type:s,name:null!=r?r:o},{groupKey:l,isSeriesMark:!1,skipBeforeLayouted:!0,parent:null!==(t=this._idToMark.get(null==n?void 0:n._uniqueId))&&void 0!==t?t:this._pictogramMark},{morph:e.shouldMarkDoMorph(this._spec,Rf.mark.pictogram.name)});h&&(h.setData(this._mapViewData),h.setUserId(l),this._idToMark.set(l,h),"group"!==h.type&&h.setMarkConfig({graphicName:h.name}),h.setTransform([{type:"filter",callback:t=>t._uniqueId===l}]))}this._initLabelMark()}}_initLabelMark(){if(!0!==this._spec.label.visible)return;const t=this._createMark(Rf.mark.label,{isSeriesMark:!1,parent:this._pictogramMark,groupKey:"_uniqueId",skipBeforeLayouted:!0});t&&(this._labelMark=t,this._labelMark.setData(this._mapViewData))}initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:t=>!!this._validElement(t),x:t=>{var e;return null===(e=this.dataToPosition(t,!0))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t,!0))||void 0===e?void 0:e.y},text:t=>t[this.nameField],textAlign:"center",textBaseline:"middle"},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}initMarkStyle(){const{root:t}=this._parsedSvgResult,i=this._getSvgViewportRect(),s=this._mapViewData.getDataView().latestData;t&&(this.setMarkStyle(this._pictogramMark,Pf.group(t.attributes),"normal",e.AttributeLevel.Built_In),this.setMarkStyle(this._pictogramMark,{postMatrix:()=>this._getFittedSvgRootMatrix()},"normal",e.AttributeLevel.Built_In),i&&this._pictogramMark.setMarkConfig({clip:!0,clipPath:[e.createRect(Object.assign(Object.assign({},i),{fill:!0}))]}));for(const t of s){const{_uniqueId:i,_finalAttributes:s}=t,r=this._idToMark.get(i),n=this._validElement(t);r&&(this.setMarkStyle(r,{keepStrokeScale:!0},"normal",e.AttributeLevel.Built_In),n?(this.initMarkStyleWithSpec(r,e.merge({},this._spec.pictogram,this._spec[r.name])),this.setMarkStyle(r,s,"normal",e.AttributeLevel.Series),r.setPostProcess("fill",((t,i)=>e.isValid(t)?t:this._spec.defaultFillColor))):(r.setMarkConfig({interactive:!1}),this.setMarkStyle(r,s,"normal",e.AttributeLevel.Built_In)))}this.initLabelMarkStyle()}_validElement(t){return t.name||t._nameFromParent}initTooltip(){this._tooltipHelper=new xf(this),this.getMarksWithoutRoot().forEach((t=>{t&&t.name&&this._tooltipHelper.activeTriggerSet.mark.add(t)}))}dataToPosition(t,i=!1){if(!t)return null;const s=t[this.nameField];if(!s)return null;const r=this.getMarksWithoutRoot().filter((t=>t.name===s));if(!r||0===r.length)return null;let n=new e.Bounds;i?r.forEach((t=>{n=n.union(t.getGraphics()[0].globalAABBBounds)})):r.forEach((t=>{n=n.union(t.getProduct().AABBBounds)}));const a={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2};if(i){const{x:t,y:e}=this.getLayoutStartPoint();a.x-=t,a.y-=e}return a}coordToPosition(t){if(!t)return null;const{x:e,y:i}=t,s=this.getRootMatrix();if(!s)return null;const r={};return s.getInverse().transformPoint({x:e,y:i},r),r}getRootMatrix(){var t;return null===(t=this.getPictogramRootGraphic())||void 0===t?void 0:t.transMatrix}getPictogramRootGraphic(){return this._pictogramMark.getProduct()}_getSvgRootMatrix(){var t,i;const s=null===(i=null===(t=this._parsedSvgResult)||void 0===t?void 0:t.root)||void 0===i?void 0:i.transform;return s?new e.Matrix(s.a,s.b,s.c,s.d,s.e,s.f):new e.Matrix}_getSvgViewportRect(){var t,e,i,s;const r=null===(t=this._parsedSvgResult)||void 0===t?void 0:t.viewBoxRect;if(r)return r;const{width:n,height:a}=null!==(e=this._parsedSvgResult)&&void 0!==e?e:{};return Number.isFinite(n)&&Number.isFinite(a)&&n>0&&a>0?{x:0,y:0,width:n,height:a}:null!==(s=null===(i=this._parsedSvgResult)||void 0===i?void 0:i[mf])&&void 0!==s?s:null}_getSvgRootBounds(t){const i=this._getSvgViewportRect();if(!i)return null;const s=(new e.Bounds).setValue(i.x,i.y,i.x+i.width,i.y+i.height);return s.transformWithMatrix(t),s}_appendMatrixScale(t,i,s){const r=new e.Matrix;return r.translate(s.x,s.y),r.scale(i,i),r.translate(-s.x,-s.y),r.multiply(t.a,t.b,t.c,t.d,t.e,t.f),r}_appendMatrixTranslate(t,i,s){const r=new e.Matrix;return r.translate(i,s),r.multiply(t.a,t.b,t.c,t.d,t.e,t.f),r}_getFittedSvgRootMatrix(){const t=this._getSvgRootMatrix(),e=this._getSvgRootBounds(t);if(!e)return t;const i=e.width(),s=e.height();if(!Number.isFinite(i)||!Number.isFinite(s)||i<=0||s<=0)return t;const{width:r,height:n}=this.getLayoutRect(),a=(e.x1+e.x2)/2,o=(e.y1+e.y2)/2,l=Math.min(r/i,n/s),h=this._appendMatrixScale(t,l,{x:a,y:o});return this._appendMatrixTranslate(h,r/2-a,n/2-o)}initData(){var t,i;super.initData();const s=gf.get(this.svg);s||null===(t=this._option)||void 0===t||t.onError("no valid svg found!");const r=new e.DataView(this._dataSet,{name:`pictogram_${this.id}_data`});e.registerDataSetInstanceTransform(this._dataSet,"pictogram",If),e.registerDataSetInstanceTransform(this._dataSet,"lookup",e.lookup),r.parse([s],{type:"dataview"}).transform({type:"pictogram"}).transform({type:"lookup",options:{from:()=>this.getViewData().latestData,key:"name",fields:this._nameField,set:(t,e)=>{e&&(t.data=e)}}}).transform({type:"lookup",options:{from:()=>this.getViewData().latestData,key:"_nameFromParent",fields:this._nameField,set:(t,e)=>{e&&(t.data=e)}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",r.reRunAllTransform),this._mapViewData=new e.CompilableData(this._option,r)}mapViewDataUpdate(){this._mapViewData.updateData()}onLayoutEnd(){var t;super.onLayoutEnd(),null===(t=this._mapViewData)||void 0===t||t.getDataView().reRunAllTransform()}updateSVGSize(){const t=this.getPictogramRootGraphic();t&&t.setAttributes({postMatrix:this._getFittedSvgRootMatrix()})}initEvent(){var t;super.initEvent(),null===(t=this._mapViewData.getDataView())||void 0===t||t.target.addListener("change",this.mapViewDataUpdate.bind(this))}handleZoom(t){const{scale:i,scaleCenter:s}=t;if(1===i)return;const r=this.getPictogramRootGraphic();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new e.Matrix}),r.scale(i,i,s))}handlePan(t){const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getPictogramRootGraphic();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new e.Matrix}),s.translate(i[0],i[1]))}getMarkData(t){var e;return null!==(e=t.data)&&void 0!==e?e:{}}getMeasureField(){return[this.valueField]}getDimensionField(){return[this.nameField]}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({data:{[t]:e}}),shapeType:i})))}release(){this._parsedSvgResult=null,this._idToMark.clear(),this._idToMark=null}}Rf.type=cf,Rf.mark=uf,Rf.transformerConstructor=Sf;const Df=()=>{e.Factory.registerSeries(Rf.type,Rf),e.Factory.registerImplement("registerSVG",yf),e.Factory.registerImplement("unregisterSVG",_f),e.Factory.registerInteractionTrigger(Tf.type,Tf),e.Factory.registerInteractionTrigger(kf.type,kf)};class Lf extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=pf,this.type=hf,this.seriesType=cf}}Lf.type=cf,Lf.seriesType=hf,Lf.transformerConstructor=pf;class Ff extends e.BaseChartSpecTransformer{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["urlField","nameField","valueField","imageSize","imageSizeRange","ratio","maskShape","imageMask","layoutConfig","image"])}}const Nf="imageCloud",Uf="imageCloud";var jf;!function(t){t.image="image",t.imageMask="imageMask"}(jf||(jf={}));const Vf=Object.assign(Object.assign({},e.baseSeriesMark),{image:{name:"image",type:"image"},imageMask:{name:"imageMask",type:"rect"}});class Gf extends e.ACustomAnimate{constructor(t,e,i,s,r){var n;super(t,e,i,s,r),this._rotations=null!==(n=null==r?void 0:r.rotation)&&void 0!==n?n:1}onBind(){this._scaleX=this.target.attribute.scaleX,e.isValidNumber(this._rotations)||(this.valid=!1)}onUpdate(t,e,i){var s;if(!1===this.valid)return;if(t)return void(i.scaleX=this._scaleX);const r=360*this._rotations*e*Math.PI/180,n=Math.abs(Math.cos(r))*(null!==(s=this._scaleX)&&void 0!==s?s:1);this.target.attribute.scaleX=n,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}function zf(t,i){switch(i){case"axialRotate":return[{custom:Gf,customParameters:{rotation:1},duration:e.DEFAULT_ANIMATION_CONFIG.appear.duration},{channel:{y:{from:(e,i)=>t.height()+i.getFinalAttribute().y},fillOpacity:{from:0,to:1}},easing:"sineInOut"}];case"growIn":return{channel:{scaleX:{from:0,to:1},scaleY:{from:0,to:1},x:{from:()=>t.center().x},y:{from:()=>t.center().y}},duration:e.DEFAULT_ANIMATION_CONFIG.appear.duration};case"scaleIn":return{type:"scaleIn",duration:e.DEFAULT_ANIMATION_CONFIG.appear.duration};default:return{type:"fadeIn",easing:"linear",duration:e.DEFAULT_ANIMATION_CONFIG.appear.duration}}}class Kf extends e.BaseSeriesTooltipHelper{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,r=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&r)return null!==(i=r[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"}}class Hf extends e.BaseSeries{constructor(){super(...arguments),this.type=Uf}setValueField(t){e.isValid(t)&&(this._valueField=t)}setAttrFromSpec(){super.setAttrFromSpec(),this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._urlField=this._spec.urlField}initMark(){var t;(null===(t=this._spec.imageMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(Vf.imageMask,{dataView:!1,skipBeforeLayouted:!0})),this._imageMark=this._createMark(Vf.image,{key:t=>`${t[e.DEFAULT_DATA_KEY]}-${t.frequency}`,isSeriesMark:!0,skipBeforeLayouted:!0})}initMarkStyle(){this._initImageMarkStyle(),this._initMaskMarkStyle()}_initImageMarkStyle(){var t,i;if(!this._imageMark)return;this._imageMark.setTransform([Object.assign({type:"imagecloud"},this._imageCloudTransformOption())]),this.setMarkStyle(this._imageMark,{x:t=>t.x,y:t=>t.y,width:t=>t.width,height:t=>t.height,visible:t=>t.visible,angle:t=>t.angle,clipConfig:t=>t.clipConfig,image:t=>t[this._urlField],scaleCenter:["50%","50%"]},"normal",e.AttributeLevel.Series);"masked"===(null===(t=this._spec.layoutConfig)||void 0===t?void 0:t.placement)&&(this.setMarkStyle(this._imageMark,{globalCompositeOperation:"source-atop"},"normal",e.AttributeLevel.Series),this.setMarkStyle(this._rootMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,globalCompositeOperation:"destination-in",clip:!0,drawMode:1},"normal",e.AttributeLevel.Series)),"stack"===(null===(i=this._spec.layoutConfig)||void 0===i?void 0:i.layoutMode)&&this.setMarkStyle(this._imageMark,{stroke:"white",lineWidth:2,shadowBlur:6,shadowColor:"grey"},"normal",e.AttributeLevel.Series)}isFillingImage(t){return t._frequency>1}_initMaskMarkStyle(){this._maskMark&&(this._maskMark.setMarkConfig({interactive:!1}),this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height},"normal",e.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Kf(this),this._imageMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._imageMark)}_imageCloudTransformOption(){var t;return{size:()=>{const{width:t,height:e}=this._region.getLayoutRect();return[t,e]},image:{field:this._urlField},weight:{field:this._valueField},imageConfig:{imageSize:this._spec.imageSize,imageSizeRange:this._spec.imageSizeRange,padding:null===(t=this._spec.image)||void 0===t?void 0:t.padding},ratio:this._spec.ratio,mask:this._spec.maskShape,maskConfig:this._spec.imageMask,layoutConfig:this._spec.layoutConfig,createCanvas:e.vglobal.createCanvas.bind(e.vglobal),createImage:e.createImage,onUpdateMaskCanvas:((t,e)=>{var i;t&&this._maskMark&&this._maskMark.getProduct().getChildren().forEach((e=>{e.setAttribute("background",t)})),e&&"masked"===(null===(i=this._spec.layoutConfig)||void 0===i?void 0:i.placement)&&this._rootMark.getProduct().setAttribute("background",e)}).bind(this),onLayoutFinished:()=>{var t,e;return null===(e=null===(t=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===t?void 0:t.afterWordcloudShapeDraw)||void 0===e?void 0:e.call(t,this._option.globalInstance)}}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.isFillingImage=this.isFillingImage.bind(this)}initAnimation(){[this._imageMark].forEach((t=>{var i,s;if(t){const r=null===(s=null===(i=this._spec)||void 0===i?void 0:i.animationAppear)||void 0===s?void 0:s.preset,n={center:()=>{const{width:t,height:e}=this._region.getLayoutRect();return{x:t/2,y:e/2}},height:()=>{const{height:t}=this._region.getLayoutRect();return t}};t.setAnimationConfig(e.animationConfig(e.Factory.getAnimationInKey("imageCloud")(n,r),e.userAnimationConfig("image",this._spec,this._markAttributeContext)))}}))}getDimensionField(){var t;return[null!==(t=this._nameField)&&void 0!==t?t:this._spec.urlField]}getMeasureField(){return[this._valueField]}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getActiveMarks(){return[this._imageMark]}getMarkData(t){var e;return null!==(e=null==t?void 0:t.datum)&&void 0!==e?e:t}getGroupFields(){return[]}dataToPosition(t){return null}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}valueToPosition(t,e){return null}getStackGroupFields(){return[]}getStackValueField(){return""}}Hf.type=Uf,Hf.mark=Vf;const Wf=()=>{e.registerImageMark(),e.Factory.registerAnimation("imageCloud",((t,e)=>({appear:zf(t,e),enter:zf(t,e),exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),e.Factory.registerSeries(Hf.type,Hf),e.Factory.registerGrammarTransform("imagecloud",{transform:e.imagecloudTransform})};class $f extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=$f.transformerConstructor,this.type=Nf,this.seriesType=Uf}}$f.type=Nf,$f.seriesType=Uf,$f.transformerConstructor=Ff;class Yf extends e.BaseChartSpecTransformer{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["timeField","eventField","seriesField","titleField","subTitleField","iconField","dot","title","subTitle","icon","line","arrow","labelPosition","sortDataByAxis"])}_setDefaultXAxisSpec(t){return{type:"band",orient:"bottom",label:{visible:!1},tick:{visible:!1},grid:{visible:!1},domainLine:{visible:!1},paddingInner:0,paddingOuter:0}}_setDefaultYAxisSpec(t){return{type:"band",inverse:!0,orient:"left",label:{visible:!1},tick:{visible:!1},grid:{visible:!1},domainLine:{visible:!1},paddingInner:0,paddingOuter:0}}_transformAxisSpec(t){t.axes||(t.axes=[]);const e={x:!1,y:!1};t.axes.forEach((i=>{const{orient:r}=i;let n=null;"top"!==r&&"bottom"!==r||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==r&&"right"!==r||(e.y=!0,n=this._setDefaultYAxisSpec(t)),n&&Object.keys(n).forEach((t=>{i[t]=s.isObject(i[t])?s.merge(n[t],i[t]):s.isNil(i[t])?n[t]:i[t]}))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t))}transformSpec(t){var e,i;super.transformSpec(t),this.transformSeriesSpec(t),this._transformAxisSpec(t);const s=null!==(e=t.direction)&&void 0!==e?e:"horizontal";null===(i=t.series)||void 0===i||i.forEach((t=>{"vertical"===s?(t.timeField&&!t.yField&&(t.yField=t.timeField),t.xField||(t.xField=t.seriesField||"__vchart_timeline_dummy__")):(t.timeField&&!t.xField&&(t.xField=t.timeField),t.yField||(t.yField=t.seriesField||"__vchart_timeline_dummy__"))}))}}const Xf="event",qf=Object.assign(Object.assign({},e.baseSeriesMark),{line:{name:"line",type:"line"},dot:{name:"dot",type:"symbol"},icon:{name:"icon",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},arrow:{name:"arrow",type:"path"}});class Zf extends e.CartesianSeries{constructor(){super(...arguments),this.type=Xf,this.transformerConstructor=e.BaseSeriesSpecTransformer,this.coordinate="cartesian"}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),this._timeField=this._spec.timeField,this._eventField=this._spec.eventField,this._subTitleField=this._spec.subTitleField,this._iconField=this._spec.iconField,this._labelPosition=this._spec.labelPosition}getDimensionField(){return this._timeField?[this._timeField]:[]}getMeasureField(){const t=[];return this._eventField&&t.push(this._eventField),this._subTitleField&&t.push(this._subTitleField),t}initMark(){this._axisLineMark=this._createMark(Zf.mark.line,{isSeriesMark:!0,groupKey:this._seriesField}),this._arrowMark=this._createMark(Zf.mark.arrow,{isSeriesMark:!0}),this._dotMark=this._createMark(Zf.mark.dot,{isSeriesMark:!0}),this._iconMark=this._createMark(Zf.mark.icon,{isSeriesMark:!0}),this._titleMark=this._createMark(Zf.mark.title),this._subTitleMark=this._createMark(Zf.mark.subTitle)}initTooltip(){super.initTooltip(),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark),this._titleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._titleMark),this._subTitleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._subTitleMark),this._iconMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._iconMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}initMarkStyle(){var t,i,r,n,a,o,l,h,c,d,u;this._axisLineMark&&this.setMarkStyle(this._axisLineMark,{points:this._getAxisPoints.bind(this),visible:this._isFirstDataInGroup.bind(this),stroke:"#c0c3c7",lineWidth:1},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series);const p=this._spec.dot,g="number"==typeof(null===(t=null==p?void 0:p.style)||void 0===t?void 0:t.size)?p.style.size:8,m=this._spec.title,f=null!==(i=null==m?void 0:m.style)&&void 0!==i?i:{},v=this._spec.subTitle,y=null!==(r=null==v?void 0:v.style)&&void 0!==r?r:{},_="number"==typeof f.fontSize?f.fontSize:14,b=g/2+(null!==(n=null==m?void 0:m.offset)&&void 0!==n?n:6);this._dotMark&&this.setMarkStyle(this._dotMark,{x:t=>this._getPoint(t).x,y:t=>this._getPoint(t).y,size:g,fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute()},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series),this._arrowMark&&this.setMarkStyle(this._arrowMark,{path:t=>this._getArrowPath(t),fill:null!==(h=null===(l=null==p?void 0:p.style)||void 0===l?void 0:l.fill)&&void 0!==h?h:this.getColorAttribute()},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series),this._titleMark&&this.setMarkStyle(this._titleMark,Object.assign(Object.assign({fontSize:14},f),{x:t=>this._getTitlePosition(t,b).x,y:t=>this._getTitlePosition(t,b).y,textAlign:t=>this._getLabelTextAlign(t),textBaseline:t=>this._getLabelTextBaseline(t,!0),text:t=>this._getDatumString(t,this._eventField)}),e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series),this._subTitleMark&&this.setMarkStyle(this._subTitleMark,Object.assign(Object.assign({},y),{x:t=>this._getSubTitlePosition(t,b,_).x,y:t=>this._getSubTitlePosition(t,b,_).y,textAlign:t=>this._getLabelTextAlign(t),textBaseline:t=>this._getLabelTextBaseline(t,!1),text:t=>this._getDatumString(t,this._subTitleField)}),e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series);const S=this._spec.icon,x="number"==typeof(null===(c=null==S?void 0:S.style)||void 0===c?void 0:c.size)?S.style.size:20,A=(s.isValid(null==S?void 0:S.offset)?S.offset+g/2:b)+x/2;this._iconMark&&this.setMarkStyle(this._iconMark,{x:t=>this._getIconPosition(t,A).x,y:t=>this._getIconPosition(t,A).y,size:x,fill:null!==(u=null===(d=null==S?void 0:S.style)||void 0===d?void 0:d.fill)&&void 0!==u?u:this.getColorAttribute(),shape:t=>this._getDatumString(t,this._iconField)||"circle"},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}_getLabelSide(t){const e=this._getViewDataList().indexOf(t),i=this._labelPosition;if("vertical"===this.direction)switch(i){case"left":default:return"primary";case"right":return"secondary";case"left-right":return e%2==0?"primary":"secondary";case"right-left":return e%2==0?"secondary":"primary"}else switch(i){case"top":default:return"primary";case"bottom":return"secondary";case"top-bottom":return e%2==0?"primary":"secondary";case"bottom-top":return e%2==0?"secondary":"primary"}}_getLabelTextAlign(t){if("vertical"===this.direction){return"primary"===this._getLabelSide(t)?"right":"left"}return"center"}_getLabelTextBaseline(t,e){if("vertical"===this.direction)return"middle";return"primary"===this._getLabelSide(t)?"bottom":"top"}_getTitlePosition(t,e){const i=this._getPoint(t),s=this._getLabelSide(t);return"vertical"===this.direction?{x:"primary"===s?i.x-e:i.x+e,y:i.y}:{x:i.x,y:"primary"===s?i.y-e:i.y+e}}_getSubTitlePosition(t,e,i){var s,r,n,a;const o=this._getPoint(t),l=this._getLabelSide(t),h=null!==(r=null===(s=this._spec.title)||void 0===s?void 0:s.subTitleGap)&&void 0!==r?r:4;if("vertical"===this.direction){const t=null!==(a=null===(n=this._spec.title)||void 0===n?void 0:n.style)&&void 0!==a?a:{},s="number"==typeof t.lineHeight?t.lineHeight:1.2*i;return{x:"primary"===l?o.x-e:o.x+e,y:o.y+s+h}}return{x:o.x,y:"primary"===l?o.y-(e+i+h):o.y+(e+i+h)}}_getIconPosition(t,e){const i=this._getPoint(t),s=this._getLabelSide(t);return"vertical"===this.direction?{x:"primary"===s?i.x+e:i.x-e,y:i.y}:{x:i.x,y:"primary"===s?i.y+e:i.y-e}}_getViewDataList(){var t,e;return null!==(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)&&void 0!==e?e:[]}_getPoint(t){if("vertical"===this.direction){return{x:this._getPositionFromAxis(t,this.getXAxisHelper(),this._seriesField),y:this._getPositionFromAxis(t,this.getYAxisHelper(),this._timeField)}}return{x:this._getPositionFromAxis(t,this.getXAxisHelper(),this._timeField),y:this._getPositionFromAxis(t,this.getYAxisHelper(),this._seriesField)}}_getPositionFromAxis(t,e,i){var s,r,n,a,o,l;if(!e)return this._getDefaultPosition(i);if(!i||!(i in t))return this._getDefaultPosition(i);const h=t[i];return"band"!==(null===(r=null===(s=e.getSpec)||void 0===s?void 0:s.call(e))||void 0===r?void 0:r.type)&&e.isContinuous?null!==(l=null===(o=e.valueToPosition)||void 0===o?void 0:o.call(e,h))&&void 0!==l?l:this._getDefaultPosition(i):null!==(a=null===(n=e.dataToPosition)||void 0===n?void 0:n.call(e,[h],{bandPosition:.5}))&&void 0!==a?a:this._getDefaultPosition(i)}onXAxisHelperUpdate(){var t;null===(t=super.onXAxisHelperUpdate)||void 0===t||t.call(this),this.onMarkPositionUpdate()}onYAxisHelperUpdate(){var t;null===(t=super.onYAxisHelperUpdate)||void 0===t||t.call(this),this.onMarkPositionUpdate()}_getDefaultPosition(t){const e=this._region.getLayoutRect();if(!this._seriesField||t===this._seriesField){return"vertical"!==this.direction?.5*e.height:.5*e.width}return 0}_getAxisPoints(t){const e=this._region.getLayoutRect();if("vertical"===this.direction){const i=this._getPositionFromAxis(t,this.getXAxisHelper(),this._seriesField);return[{x:i,y:0},{x:i,y:e.height}]}const i=this._getPositionFromAxis(t,this.getYAxisHelper(),this._seriesField);return[{x:0,y:i},{x:e.width,y:i}]}_isFirstDataInGroup(t){if(!this._seriesField){return 0===this._getViewDataList().indexOf(t)}const e=this._getViewDataList(),i=t[this._seriesField];return t===e.find((t=>this._seriesField&&t[this._seriesField]===i))}_getNextDatum(t){const e=this._getViewDataList(),i=e.indexOf(t);if(-1===i||i===e.length-1)return null;if(!this._seriesField)return e[i+1];const s=t[this._seriesField];for(let t=i+1;t<e.length;t++){const i=e[t];if(i[this._seriesField]===s)return i}return null}_getPreviousDatum(t){const e=this._getViewDataList(),i=e.indexOf(t);if(-1===i||0===i)return null;if(!this._seriesField)return e[i-1];const s=t[this._seriesField];for(let t=i-1;t>=0;t--){const i=e[t];if(i[this._seriesField]===s)return i}return null}_getArrowPath(t){var e,i;const s=this._getPoint(t),r=this._getNextDatum(t),n=this._getPreviousDatum(t),a=null!==(i=null===(e=this._spec.arrow)||void 0===e?void 0:e.thickness)&&void 0!==i?i:16,o=this._region.getLayoutRect();if("vertical"===this.direction){const t=this.getYAxisHelper().isInverse(),e=n?{x:s.x,y:(this._getPoint(n).y+s.y)/2}:{x:s.x,y:t?0:o.height},i=r?{x:s.x,y:(this._getPoint(r).y+s.y)/2}:{x:s.x,y:t?o.height:0},l=t?1:-1,h=a/3,c=a/2;return`M ${e.x-c} ${e.y} L ${e.x} ${e.y+l*h} L ${e.x+c} ${e.y} \n L ${i.x+c} ${i.y-l*h} \n L ${i.x} ${i.y}\n L ${i.x-c} ${i.y-l*h} Z`}const l=this.getXAxisHelper().isInverse(),h=n?{x:(this._getPoint(n).x+s.x)/2,y:s.y}:{x:l?o.width:0,y:s.y},c=r?{x:(this._getPoint(r).x+s.x)/2,y:s.y}:{x:l?0:o.width,y:s.y},d=l?-1:1,u=a/2,p=a/3;return`M ${h.x} ${h.y-u} L ${h.x+d*p} ${h.y} L ${h.x} ${h.y+u} \n L ${c.x-d*p} ${c.y+u} \n L ${c.x} ${c.y} \n L ${c.x-d*p} ${c.y-u} Z`}_getDatumString(t,e){if(!t||!e)return"";const i=t[e];return"string"==typeof i?i:null==i?"":String(i)}valueToPosition(t,e){if(t&&"object"==typeof t)return this.dataToPosition(t);const i={};return this._timeField&&(i[this._timeField]=t),this._eventField&&void 0!==e&&(i[this._eventField]=e),this._getPoint(i)}getActiveMarks(){return[this._axisLineMark,this._dotMark,this._iconMark,this._arrowMark,this._titleMark,this._subTitleMark].filter(Boolean)}}Zf.type=Xf,Zf.mark=qf,Zf.builtInTheme={event:{dot:{style:{size:8}},icon:{visible:!1,style:{size:20}},line:{visible:!0,style:{stroke:"#c0c3c7",lineWidth:1}},title:{visible:!0,offset:6,subTitleGap:4,style:{fontSize:14}},subTitle:{visible:!0,style:{fontSize:12}},arrow:{visible:!1,thickness:16}}},Zf.transformerConstructor=e.BaseSeriesSpecTransformer;const Jf=()=>{e.registerSymbolMark(),e.registerTextMark(),e.registerLineMark(),e.registerPathMark(),e.Factory.registerSeries(Zf.type,Zf)};class Qf extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=Yf,this.type="timeline",this.seriesType="event"}}Qf.type="timeline",Qf.seriesType="event",Qf.transformerConstructor=Yf;const tv="seriesBreak";function ev(t,e,i,s,r=!1){const n=[],{x:a,y:o}=t,{x:l,y:h}=e,c=r?Math.floor((h-o)/(2*i)):Math.floor((l-a)/(2*i)),d=Math.PI/180*s,u=i*Math.cos(d),p=i*Math.sin(d);n.push(`M ${a} ${o}`);for(let t=0;t<=c;t++){const e=r?a+(t%2==0?u:-u):a+t*i*2,s=r?o+t*i*2:t%2==0?o-p:o+p;n.push(`L ${e} ${s}`)}return n.push(`L ${r?a:l} ${r?h:o}`),n.join(" ")}class iv extends e.AbstractComponent{constructor(){super(...arguments),this.name=tv}render(){this.removeAllChild();const{data:t=[]}=this.attribute;if(e.isEmpty(t))return;const i=[],s=[];t.forEach((t=>{const{start:r,end:n}=t;((t,i)=>{const{start:s,end:r}=i,n=s.x===r.x,a=n?"x":"y",o=n?"y":"x";let l=!0;const h=1e-6;t.length&&t.forEach((t=>{if(e.isNumberClose(t.start[a],s[a])){const e=Math.min(s[o],r[o]),i=Math.max(s[o],r[o]),n=Math.min(t.start[o],t.end[o]),a=Math.max(t.start[o],t.end[o]);if(!(i<n-h||e>a+h))return t.start[o]=Math.min(n,e),t.end[o]=Math.max(a,i),void(l=!1)}})),l&&t.push(i)})(r.x===n.x?i:s,t)})),[...i,...s].forEach(((t,i)=>{var s;const{start:r,end:n,size:a=4,gap:o=5,style:l={}}=t,h=v(t,["start","end","size","gap","style"]),c=e.createGroup({}),d=r.x===n.x;let u,p,g,m;d?(u={x:r.x-o/2,y:r.y},p={x:n.x-o/2,y:n.y},g={x:r.x+o/2,y:r.y},m={x:n.x+o/2,y:n.y}):(u={x:r.x,y:r.y-o/2},p={x:n.x,y:n.y-o/2},g={x:r.x,y:r.y+o/2},m={x:n.x,y:n.y+o/2});const f=ev(u,p,a,d?75:15,d),y=ev(r,n,a,d?75:15,d),_=ev(g,m,a,d?75:15,d);c.add(e.createPath(Object.assign(Object.assign({path:f,stroke:"#000",lineWidth:1},l),{pickable:!1,zIndex:1}))),c.add(e.createPath(Object.assign(Object.assign({path:_,stroke:"#000",lineWidth:1},l),{pickable:!1,zIndex:1}))),c.add(e.createPath({path:y,stroke:"#fff",lineWidth:o,pickable:!1,zIndex:0})),c.name="series-break",c.data=h,e.isValid(h.axisId)&&(c.id=`${null!==(s=h.axisId)&&void 0!==s?s:""}_${i}`),this.add(c)}))}}function sv(t,e,i=1){return Math.abs(t-e)<i}function rv(t,i){return{type:"component",componentType:tv,interactive:!0,zIndex:500,style:{data:(s,r)=>{const n=[],a=r.vchart.getChart(),o="horizontal"===a.getAllSeries()[0].direction;return t.forEach(((t,s)=>{var r,l;const h=t.id,c=e.isValid(h)?a.getComponentByUserId(h):i&&e.isValid(i[s])?a.getComponentByIndex("axes",i[s]):null===(r=a.getComponentsByKey("axes").filter((e=>e.getSpec().breaks===t.breaks)))||void 0===r?void 0:r[0];if(!c)return;const d=null!=h?h:`${c.type}-${c.id}`,u=function(t){let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,r=i+t[0].getLayoutRect().height;for(let n=1;n<t.length;n++){const a=t[n],{x:o,y:l}=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();e=Math.min(e,o),s=Math.max(s,h+o),i=Math.min(i,l),r=Math.max(r,c+l)}return{x1:e,y1:i,x2:s,y2:r}}(c.getRegions());e.array(null===(l=c._break)||void 0===l?void 0:l.breaks).forEach((t=>{const{range:e,breakSymbol:i,gap:s=5}=t,r=c.valueToPosition(e[0]),l=c.valueToPosition(e[1]),h=(r+l)/2+(o?u.x1:u.y1);a.getAllSeries().forEach((t=>{if("bar"===t.type||"waterfall"===t.type){t.getMarkInName("bar").getGraphics().forEach((t=>{const a=t.AABBBounds;let c,p,g,m,f=!1;o?(f=a.x1<(r+l-s)/2&&a.x2>(r+l+s)/2,c=h,p=Math.max(a.y1+u.y1-2,u.y1),g=h,m=Math.min(a.y2+u.y1+2,u.y2)):(f=a.y1<(r+l-s)/2&&a.y2>(r+l+s)/2,c=Math.max(a.x1+u.x1-2,u.x1),p=h,g=Math.min(a.x2+u.x1+2,u.x2),m=h),f&&n.push({start:{x:c,y:p},end:{x:g,y:m},gap:s,style:null==i?void 0:i.style,axisId:d,data:e})}))}else if("line"===t.type){t.getMarkInName(t.type).getGraphics().forEach((t=>{av(t,"line").forEach((t=>{nv(o?{start:{x:(r+l)/2,y:0},end:{x:(r+l)/2,y:u.y2-u.y1}}:{start:{x:0,y:(r+l)/2},end:{x:u.x2-u.x1,y:(r+l)/2}},t).forEach((t=>{let r,a;o?(r={x:h,y:Math.max(t[1]+u.y1-10,u.y1)},a={x:h,y:Math.min(t[1]+u.y1+10,u.y2)}):(r={x:Math.max(t[0]+u.x1-10,u.x1),y:h},a={x:Math.min(t[0]+u.x1+10,u.x2),y:h}),n.push({start:r,end:a,gap:s,style:null==i?void 0:i.style,axisId:d,data:e})}))}))}))}else if("area"===t.type){t.getMarkInName("area").getGraphics().forEach((t=>{av(t,"area").forEach((t=>{const a=nv(o?{start:{x:(r+l)/2,y:0},end:{x:(r+l)/2,y:u.y2-u.y1}}:{start:{x:0,y:(r+l)/2},end:{x:u.x2-u.x1,y:(r+l)/2}},t);a.sort(((t,e)=>t[0]-e[0]));for(let r=0;r<a.length-1;r++){const l={x:a[r][0],y:a[r][1]},h={x:a[r+1][0],y:a[r+1][1]};if(ov(o?{x:l.x,y:(l.y+h.y)/2}:{x:(l.x+h.x)/2,y:l.y},t)){let t,r;o?(t={x:l.x+u.x1,y:Math.max(l.y+u.y1-0,u.y1)},r={x:h.x+u.x1,y:Math.min(h.y+u.y1+0,u.y2)}):(t={x:Math.max(l.x+u.x1-0,u.x1),y:l.y+u.y1},r={x:Math.min(h.x+u.x1+0,u.x2),y:h.y+u.y1}),n.push({start:t,end:r,gap:s,style:null==i?void 0:i.style,axisId:d,data:e})}}}))}))}}))}))})),n}}}}function nv(t,i){const s=[];for(let r=1;r<i.length;r++){const n=e.getIntersectPoint([t.start.x,t.start.y],[t.end.x,t.end.y],[i[r].x,i[r].y],[i[r-1].x,i[r-1].y]);n&&!s.find((t=>sv(e.PointService.distancePP({x:t[0],y:t[1]},{x:n[0],y:n[1]}),0)))&&s.push(n)}return s}function av(t,e){const{points:i,segments:s}=t.attribute,r=[];let n=[];const a=t=>{if(t&&t.length){let i=[];if(t.forEach((t=>{var s,a;if(!1===t.defined){if(r.push(n),"area"===e&&i.length){for(let t=i.length-1;t>=0;t--)n.push({x:i[t].x,y:i[t].y});n.push(n[0])}n=[],i=[]}else n.push({x:t.x,y:t.y}),"area"===e&&i.push({x:null!==(s=t.x1)&&void 0!==s?s:t.x,y:null!==(a=t.y1)&&void 0!==a?a:t.y})})),"area"===e&&i.length){for(let t=i.length-1;t>=0;t--)n.push({x:i[t].x,y:i[t].y});n.push(n[0])}r.push(n)}};return i&&i.length?a(i):s&&s.length&&s.forEach((t=>{a(t.points)})),r}function ov(t,e){const{x:i,y:s}=t;let r=!1;for(let t=0,n=e.length-1;t<e.length;n=t++){const{x:a,y:o}=e[t],{x:l,y:h}=e[n];o>s!=h>s&&i<(l-a)*(s-o)/(h-o)+a&&(r=!r)}return r}const lv="barLink";class hv extends e.AbstractComponent{constructor(){super(...arguments),this.name=lv}render(){const{data:t,linkStyle:i,areaStyle:s,styleMap:r,label:n,linkType:a="total"}=this.attribute;e.isEmpty(t)||(this.removeAllChild(),t.forEach(((t,o)=>{var l,h,c,d,u;const{linePoints:p,areaPoints:g,id:m=o,color:f,data:v}=t;if(g&&!1!==(null===(l=null==r?void 0:r[`area-${m}`])||void 0===l?void 0:l.visible)){const t=e.createArea(Object.assign(Object.assign({points:g,fillOpacity:.3,fill:f,zIndex:0},s),null==r?void 0:r[`area-${m}`]));t.name="bar-link-area",t.id=`area-${m}`,this.add(t)}if(p&&!1!==(null===(h=null==r?void 0:r[`line-${m}`])||void 0===h?void 0:h.visible)&&0!==(null===(c=null==i?void 0:i.lineStyle)||void 0===c?void 0:c.lineWidth)&&0!==(null===(d=null==r?void 0:r[`line-${m}`])||void 0===d?void 0:d.lineWidth)){const{startSymbol:t={},endSymbol:s={},lineStyle:n}=i||{},a=e.cloneDeep(t),o=e.cloneDeep(s);(null==r?void 0:r[`line-${m}`])&&r[`line-${m}`].stroke&&(a.style=Object.assign(Object.assign({},a.style),{color:r[`line-${m}`].stroke}),o.style=Object.assign(Object.assign({},o.style),{color:r[`line-${m}`].stroke})),a.symbolType||a.originSymbolType||(a.originSymbolType="solidArrow"),o.symbolType||o.originSymbolType||(o.originSymbolType="solidArrow");const l=new e.Segment({points:p,startSymbol:Object.assign({size:8},a),endSymbol:Object.assign({size:8},o),lineStyle:Object.assign(Object.assign({lineDash:[3,3],lineWidth:1,stroke:"#000"},n),null==r?void 0:r[`line-${m}`]),pickable:!0,childrenPickable:!1,zIndex:1});l.name="bar-link-line",l.id=`line-${m}`,this.add(l)}if((null==n?void 0:n.visible)&&!1!==(null===(u=null==r?void 0:r[`label-${m}`])||void 0===u?void 0:u.visible)){const{style:t,formatMethod:i}=n,[s,o]=v;let l=s[e.STACK_FIELD_END],h=o[e.STACK_FIELD_END];"value"===a&&(l=s[e.STACK_FIELD_END]-s[e.STACK_FIELD_START],h=o[e.STACK_FIELD_END]-o[e.STACK_FIELD_START]);const c=h-l,d=(h-l)/l*100,u=e.createText(Object.assign(Object.assign({x:.5*(p[0].x+p[1].x),y:.5*(p[0].y+p[1].y),text:i?i(c,d,v):`${c} ${d}`,fontSize:14,fill:"#000",stroke:"#fff",lineWidth:1,textAlign:"center",textBaseline:"middle",background:"#fff",zIndex:2},t),null==r?void 0:r[`label-${m}`]));u.name="bar-link-label",u.id=`label-${m}`,this.add(u)}})))}}function cv(t,i,s){const{isHorizontal:r,isXAxisInverse:n,isYAxisInverse:a,linkType:o,doFill:l,regionStartX:h,regionStartY:c}=s,d=t.AABBBounds,u=i.AABBBounds;let p,g;return r?(p=[{x:(d.x1+d.x2)/2+h,y:d.y1+c},{x:(u.x1+u.x2)/2+h,y:u.y2+c}],n?("total"===o&&(p=[{x:d.x1+h,y:d.y1+c},{x:u.x1+h,y:u.y2+c}]),l&&(g=[{x:d.x1+h,x1:d.x2+h,y:d.y1+c},{x:u.x1+h,x1:u.x2+h,y:u.y2+c}])):("total"===o&&(p=[{x:d.x2+h,y:d.y1+c},{x:u.x2+h,y:u.y2+c}]),l&&(g=[{x:d.x2+h,x1:d.x1+h,y:d.y1+c},{x:u.x2+h,x1:u.x1+h,y:u.y2+c}]))):(p=[{x:d.x2+h,y:(d.y1+d.y2)/2+c},{x:u.x1+h,y:(u.y1+u.y2)/2+c}],a?("total"===o&&(p=[{x:d.x2+h,y:d.y2+c},{x:u.x1+h,y:u.y2+c}]),l&&(g=[{x:d.x2+h,y:d.y2+c,y1:d.y1+c},{x:u.x1+h,y:u.y2+c,y1:u.y1+c}])):("total"===o&&(p=[{x:d.x2+h,y:d.y1+c},{x:u.x1+h,y:u.y1+c}]),l&&(g=[{x:d.x2+h,y:d.y1+c,y1:d.y2+c},{x:u.x1+h,y:u.y1+c,y1:u.y2+c}]))),{areaPoints:g,linePoints:p,data:[e.getDatumOfGraphic(t),e.getDatumOfGraphic(i)],color:t.attribute.fill}}function dv(t={},i){const{linkType:s="total",doFill:r}=t,n=v(t,["linkType","doFill"]);return{type:"component",componentType:lv,zIndex:500,interactive:!1,style:Object.assign(Object.assign({data:(t,i)=>{const{vchart:n}=i,a=n.getChart().getAllRegions(),o=[];return a.forEach((t=>{const i=t.getSeries().filter((t=>"bar"===t.type)),{x:n,y:a}=t.getLayoutStartPoint();if(i.length){const t=i[0].getGroupFields(),l=[];i.forEach((t=>{var e;(null===(e=t.getMarkInName("bar"))||void 0===e?void 0:e.getGraphics()).forEach((t=>{l.push(t)}))}));const h=function(t,i){const s={};for(let r=0;r<t.length;r++){const n=t[r],a=e.getDatumOfGraphic(n),o=i.map((t=>a[t])).join("-");s[o]||(s[o]=[]),s[o].push(n)}return s}(l,t);Object.values(h).forEach((t=>{t.sort(((t,i)=>e.getDatumOfGraphic(t)[e.STACK_FIELD_END]-e.getDatumOfGraphic(i)[e.STACK_FIELD_END]))}));const c=i[0],d="horizontal"===c.direction,u=c.getYAxisHelper().isInverse(),p=c.getXAxisHelper().isInverse(),g=Object.values(h);if(g.length)if(d){g[0][0].AABBBounds.y1<g[g.length-1][0].AABBBounds.y1&&g.reverse()}else{g[0][0].AABBBounds.x1>g[g.length-1][0].AABBBounds.x1&&g.reverse()}for(let t=0;t<g.length-1;t++){const e=g[t],i=g[t+1];if(e.forEach(((t,e)=>{var l;const h=cv(t,null!==(l=i[e])&&void 0!==l?l:i[i.length-1],{isHorizontal:d,isXAxisInverse:p,isYAxisInverse:u,doFill:r,linkType:s,regionStartX:n,regionStartY:a});o.push(h)})),e.length<i.length){const t=e[e.length-1];for(let l=e.length;l<i.length;l++){const e=cv(t,i[l],{isHorizontal:d,isXAxisInverse:p,isYAxisInverse:u,doFill:r,linkType:s,regionStartX:n,regionStartY:a});o.push(e)}}}}})),o},linkType:s},n),i)}}const uv="seriesLabel";function pv(t,e=10,i=10,s=.1){const r=t.length;if(!t.every(isFinite))return t;if(!(r>1))return t;const n=function(t,e,i){t=+t,e=+e;let s=arguments.length;i=s<2?(e=t,t=0,1):s<3?1:+i;let r=-1;s=0|Math.max(0,Math.ceil((e-t)/i));const n=new Array(s);for(;++r<s;)n[r]=t+r*i;return n}(t.length);for(let a=0;a<i;++a){n.sort(((e,i)=>{return s=t[e],r=t[i],null==s||null==r?NaN:s<r?-1:s>r?1:s>=r?0:NaN;var s,r}));let i=0;for(let s=1;s<r;++s){let r=t[n[s]]-t[n[s-1]];r<e&&(r=(e-r)/2,i=Math.max(i,r),t[n[s-1]]-=r,t[n[s]]+=r)}if(i<s)break}return t}function gv(t,e){return!(e.x1>t.x2||e.x2<t.x1||e.y1>t.y2||e.y2<t.y1)}function mv(t,e=10,i=10){const s=t.length;let r,n=0;do{r=!1;for(let i=0;i<s;++i)for(let n=i+1;n<s;++n){const s=t[i].AABBBounds,a=t[n].AABBBounds;if(gv(s,a)){const i=e-(a.x1-s.x2);i>0&&(t[n].attribute.x+=i,a.x1+=i,a.x2+=i,r=!0)}}n++}while(r&&n<i)}function fv(t,i){const{label:s,line:r}=i;return{type:"component",componentType:uv,interactive:!1,style:{position:t,layout:(t,e)=>{var i;return null!==(i=e.vchart.getChart().getAllSeries()[0].getSpec().direction)&&void 0!==i?i:"vertical"},data:(i,s)=>{var r;const n=s.vchart.getChart(),a=n.getAllSeries()[0],o="horizontal"===a.direction,l=o?a.getYAxisHelper():a.getXAxisHelper(),h=null===(r=l.getScale)||void 0===r?void 0:r.call(l,0),c=l.isInverse(),d=a.getDimensionField()[0],u=a.getSeriesField(),p=n.getAllSeries().map((t=>t.type)).filter(((t,e,i)=>i.indexOf(t)===e)),g=[];if(1===p.length&&["bar","area","line","waterfall"].includes(p[0])){("both-ends"===t?["start","end"]:[t]).forEach((t=>{const i="end"===t?e.last(h.domain()):h.domain()[0],s=a.getRegion(),{x:r,y:l}=s.getLayoutStartPoint();let m=0;n.getAllSeries().forEach((e=>{e.getMarkInName("waterfall"===p[0]?"bar":p[0]).getGraphics().forEach((s=>{var n;const a=s.context.data.find((t=>t[d]===i));if(a){const i=s.AABBBounds;let h,f,v,y;"bar"===p[0]||"waterfall"===p[0]?(h="end"===t?{x:o?(i.x1+i.x2)/2:c?i.x1:i.x2,y:o?c?i.y2:i.y1:(i.y1+i.y2)/2}:{x:o?(i.x1+i.x2)/2:c?i.x2:i.x1,y:o?c?i.y1:i.y2:(i.y1+i.y2)/2},f=s.attribute.fill):(h=e.dataToPosition(a),f=s.attribute.stroke||s.attribute.fill),"end"===t?(v=o?"center":c?"end":"start",y=o?c?"top":"bottom":"middle"):(v=o?"center":c?"start":"end",y=o?c?"bottom":"top":"middle");const _=null!==(n=a[u])&&void 0!==n?n:a[d];g.push({point:{x:h.x+r,y:h.y+l},label:_,color:f,textAlign:v,textBaseline:y,series:e,datum:a,id:`${t}-${m}`,position:t}),m++}}))}))}))}return g},line:r,label:Object.assign({space:12},s)}}}class vv extends e.AbstractComponent{constructor(){super(...arguments),this.name=uv}render(){var t,i,s,r;this.removeAllChild();const{data:n,layout:a,label:o,line:l={}}=this.attribute;if(e.isEmpty(n))return;const h=null!==(t=null==o?void 0:o.styleMap)&&void 0!==t?t:{},c={},d=n.filter((t=>{var e;return!1!==(null===(e=h[t.id])||void 0===e?void 0:e.visible)}));if("vertical"===a){const t=1.5*(null!==(s=null===(i=null==o?void 0:o.style)||void 0===i?void 0:i.fontSize)&&void 0!==s?s:12),r=(t,i,s)=>{var r,n,a,o,l,h,c,d;const{label:u,color:p,textAlign:g,textBaseline:m,id:f}=t,v=null!==(n=null===(r=s[f])||void 0===r?void 0:r.formatMethod)&&void 0!==n?n:null===(a=this.attribute.label)||void 0===a?void 0:a.formatMethod,y=e.createText(Object.assign(Object.assign(Object.assign(Object.assign({text:v?v(u,t.datum,{series:t.series}):u},null===(o=this.attribute.label)||void 0===o?void 0:o.style),i),{textAlign:g,textBaseline:m,fill:null!==(c=null===(h=null===(l=this.attribute.label)||void 0===l?void 0:l.style)||void 0===h?void 0:h.fill)&&void 0!==c?c:p}),null===(d=s[f])||void 0===d?void 0:d.style));return y.name="series-label-text",y.id=f,this.add(y),y};["start","end"].forEach((e=>{const i=d.filter((t=>t.position===e)),s=pv(i.map((t=>t.point.y)),t);i.forEach(((t,e)=>{var i;const n={x:t.point.x+(null!==(i=null==o?void 0:o.space)&&void 0!==i?i:8)*("start"===t.textAlign?1:-1),y:s[e]};r(t,n,h),c[t.id]=n}))}))}else{const t=[],i=[];d.forEach((s=>{var r,n,a,l,c;const{point:d,label:u,color:p,textAlign:g,textBaseline:m,id:f,position:v}=s,y={x:d.x,y:d.y},_=null!==(n=null===(r=h[f])||void 0===r?void 0:r.formatMethod)&&void 0!==n?n:null==o?void 0:o.formatMethod,b=e.createText(Object.assign(Object.assign(Object.assign(Object.assign({text:_?_(u,s.datum,{series:s.series}):u},null==o?void 0:o.style),y),{textAlign:g,textBaseline:m,fill:null!==(l=null===(a=null==o?void 0:o.style)||void 0===a?void 0:a.fill)&&void 0!==l?l:p}),null===(c=h[f])||void 0===c?void 0:c.style));b.id=f,b.name="series-label-text",this.add(b),"start"===v?t.push(b):"end"===v&&i.push(b)})),t.length&&mv(t,4,10),i.length&&mv(i,4,10);const s=null!==(r=null==o?void 0:o.space)&&void 0!==r?r:8;[...t,...i].forEach((t=>{const e="top"===t.attribute.textBaseline?1:-1;t.setAttribute("y",t.attribute.y+s*e),c[t.id]={x:t.attribute.x,y:t.attribute.y}}))}!1!==l.visible&&d.forEach((t=>{var i,s,r,n,o,d;const{point:u,color:p,id:g}=t,m={x:c[g].x+(null!==(r=null===(s=null===(i=h[g])||void 0===i?void 0:i.style)||void 0===s?void 0:s.dx)&&void 0!==r?r:0),y:c[g].y+(null!==(d=null===(o=null===(n=h[g])||void 0===n?void 0:n.style)||void 0===o?void 0:o.dy)&&void 0!==d?d:0)};if(!1!==l.autoVisible){if("vertical"===a&&u.y!==m.y||"horizontal"===a&&u.x!==m.x){const t=e.createLine(Object.assign({points:[u,m],lineWidth:1,stroke:p},l.style));t.name="series-label-line",this.add(t)}}else{const t=e.createLine(Object.assign({points:[u,m],lineWidth:1,stroke:p},l.style));t.name="series-label-line",this.add(t)}}))}}function yv(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function _v(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function bv(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:_v(t.rect),anchorCandidates:kv(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const r=i[t],n=r.bound;let a=s.some((t=>yv(t,n)));if(r.anchorCandidates)if(a&&(null===(e=r.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;t<r.anchorCandidates.length;t++){const e=r.anchorCandidates[t],i={x1:e.x,y1:e.y,x2:e.x+n.x2-n.x1,y2:e.y+n.y2-n.y1,anchor:e};if(!s.some((t=>yv(t,i)))){s.push(i),a=!1;break}}a&&s.push(r.bound)}else s.push(r.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function Sv(t,i,s){const r=t.map((t=>t.pointCoord)),{x1:n,x2:a,y1:o,y2:l}=e.getAABBFromPoints(r),h=s([(n+a)/2,(o+l)/2]);if(!h)return[];const c=t.map((t=>{const r=t.rect,n=Tv(i,t.pointCoord)?s(function(t,i,s,r=200){const n=5621/r;let a=i;for(let i=1;i<=n;i++){const i=e.destination(a,r,s);if(!Tv(t,i))return[i.x,i.y];a=[i.x,i.y]}return i}(i,[t.pointCoord.x,t.pointCoord.y],xv(Av(t.point,h)))):t.point;n&&(r.x=n.x,r.y=n.y);const a=xv(Av(t.point,h));let o;const l=[];return a>=-45&&a<45?(o="top",l.push("left","right")):a>=45&&a<135?o="right":a>=-135&&a<-45?(o="left",l.push("left")):(o="bottom",l.push("left","right")),t.anchors=l,t.offset=20,t.rect=Cv(t.rect,o,0),t}));return bv(c)}function xv(t){return t>180?t-360:t}function Av(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function Tv(t,i){for(let s=0;s<t.length;s++){if(e.isPointInPolygon(i,t[s]))return!0}return!1}function Cv(t,e,i=0){const s=Object.assign({},t);return"top"===e?(s.x-=t.width/2,s.y-=i+t.height/2):"bottom"===e?(s.x-=t.width/2,s.y+=i-t.height/2):"left"===e?(s.x-=i+t.width,s.y-=t.height/2):"right"===e&&(s.x+=i,s.y-=t.height/2),s}function kv(t,e,i,s=0){const r=[];return t.forEach((t=>{const{x:n,y:a}=Cv(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);r.push({x:n,y:a})})),r}const wv={visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:10}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:10}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"black"}}};class Mv extends e.BaseComponentSpecTransformer{_getDefaultSpecFromChart(){return wv}}class Ev extends e.BaseComponent{constructor(){super(...arguments),this.type="mapLabel",this.name=" mapLabel",this.specKey="mapLabel",this.transformerConstructor=Mv,this.layoutType="none",this.layoutZIndex=e.LayoutZIndex.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){return e.getSpecInfo(t,this.specKey,this.type,(t=>t.visible&&e.isValid(t.seriesId)))}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,r,n,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(r=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===r?void 0:r.longitudeField,this._latitudeField=null===(o=null===(a=(n=this._regions[0]).getSpec)||void 0===a?void 0:a.call(n))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const i=t.getViewData();if(i){const t=new e.DataView(this._option.dataSet,{name:`${this.name}_data`});t.parse([i],{type:"dataview"}),t.transform({type:"copyDataView",level:e.TransformLevel.copyDataView},!1),this._data=new e.CompilableData(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(()=>(this.handleZoom(),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("element-highlight:start",(t=>{const i=t.graphics[0];this._isRelativeSeries(i)&&this._updateDatum(e.getDatumOfGraphic(i))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this._updateDatum(null)}))):"click"===t&&(this.event.on("element-select:start",(t=>{const i=t.graphics[0];this._isRelativeSeries(i)&&this._updateDatum(e.getDatumOfGraphic(i))})),this.event.on("elementSelectReset",(t=>{this._activeDatum&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const i=[],s=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,i)=>{var s;const r=new e.MarkPoint({position:void 0,animation:!1});return r&&(r.name=`${this.name}_marker_${i}`,r.id=null!==(s=this._spec.id)&&void 0!==s?s:`${this.name}_marker_${this.id}`,r.setAttribute("zIndex",this.layoutZIndex)),r})));this._markerComponents.forEach(((t,e)=>{const{pairInfo:r,contentMarks:n}=this._evaluateMarker(this._data.getLatestData()[e],e);r&&i.push(r),n&&s.push(n)}));const r=this._layoutLabels(i);this._layoutMarkers(r,s),this._renderMarkers()}_evaluateMarker(t,i){var s,r,n,a,o,l,h,c,d,u,p,g,m,f;let v=0,y=0,_=0,b=0,S=0;const x=this._spec.position||"top",A=this._spec.offset,T=e.normalizeLayoutPaddingSpec(null===(s=this._spec.background)||void 0===s?void 0:s.padding),C=this._spec.space||0;y+=((null==T?void 0:T.left)||0)+((null==T?void 0:T.right)||0),_+=((null==T?void 0:T.top)||0)+((null==T?void 0:T.bottom)||0);const k={},w=this.dataToPosition(t),M=e.graphicCreator.group({});if(M.name=`${this.name}_marker_itemContainer_${i}`,k.container=M,null===(r=this._spec.background)||void 0===r?void 0:r.visible){const t=e.graphicCreator.rect(e.transformToGraphic(Object.assign({},this._spec.background.style)));t.setAttributes(w),k.labelBackground=t,M.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=e.graphicCreator.symbol(e.transformToGraphic(Object.assign({},this._spec.icon.style)));t.setAttributes(w),t.setAttribute("symbolType",null!==(o=null===(a=this._spec.icon.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:null===(l=this._spec.icon.style)||void 0===l?void 0:l.shape);const i=t.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,r=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;k.icon=t,M.appendChild(t),S=s,b+=r,v++}if(null===(d=this._spec.nameLabel)||void 0===d?void 0:d.visible){const i=e.graphicCreator.text(e.transformToGraphic(Object.assign({},this._spec.nameLabel.style)));i.setAttributes(w),i.setAttribute("text",t[this.nameField]);const s=i.AABBBounds,r=null!==(u=(null==s?void 0:s.y2)-(null==s?void 0:s.y1))&&void 0!==u?u:0,n=null!==(p=(null==s?void 0:s.x2)-(null==s?void 0:s.x1))&&void 0!==p?p:0;k.nameLabel=i,M.appendChild(i),S=Math.max(S,r),b+=n,v++}if((null===(g=this._spec.valueLabel)||void 0===g?void 0:g.visible)&&e.isValid(t[this.valueField])){const i=e.graphicCreator.text(e.transformToGraphic(Object.assign({},this._spec.valueLabel.style)));i.setAttributes(w),i.setAttribute("text",t[this.valueField]);const s=i.AABBBounds,r=null!==(m=(null==s?void 0:s.y2)-(null==s?void 0:s.y1))&&void 0!==m?m:0,n=null!==(f=(null==s?void 0:s.x2)-(null==s?void 0:s.x1))&&void 0!==f?f:0;k.valueLabel=i,M.appendChild(i),S=Math.max(S,r),b+=n,v++}const E=Object.values(k).find((t=>!!t&&"group"!==t.type)),B={x:null==E?void 0:E.getComputedAttribute("x"),y:null==E?void 0:E.getComputedAttribute("y")},O={x:B.x,y:B.y,width:0,height:0};O.width=y+b+(v-1)*C,O.height=_+S;const P={rect:O,point:B,index:i};if("outer"!==x){const t=["top","right","left","bottom"].filter((t=>t!==x));P.rect=Cv(O,x,A),P.anchors=t,P.offset=A}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:k}}_layoutMarkers(t,i){var s,r,n;for(let a=0;a<i.length;a++){if(!t[a]||!i[a])return;const{icon:o,nameLabel:l,valueLabel:h,labelBackground:c,container:d}=i[a],u=t[a],p=e.normalizeLayoutPaddingSpec(null===(s=this._spec.background)||void 0===s?void 0:s.padding),g=this._spec.space||0,m=u.height/2;let f=(null==p?void 0:p.left)||0;[o,l,h].forEach(((t,e)=>{var i,s;if(t){const r=t.AABBBounds;let n=0;"symbol"===t.type&&(n+=(null!==(i=r.x2-r.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:f+n,y:m}),f+=null!==(s=r.x2-r.x1)&&void 0!==s?s:0,2!==e&&(f+=g)}})),null==c||c.setAttributes({x:0,y:0,width:u.width,height:u.height}),null==d||d.setAttributes({dx:-u.width/2,dy:-u.height/2});const v=this._data.getLatestData()[a],y=this.dataToPosition(v),_=this.getRegions()[0].getLayoutStartPoint(),b=!(!(null===(r=this._spec.leader)||void 0===r?void 0:r.visible)||!(o||l||h));this._markerComponents[a].setAttributes({x:_.x,y:_.y,position:y,visible:this._activeDatum.includes(v),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>d,autoRotate:!1,offsetX:u.x+u.width/2-y.x,offsetY:u.y+u.height/2-y.y},itemLine:{visible:b,type:"type-po",lineStyle:e.transformToGraphic(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;t<this._markerComponents.length;t++)this.getContainer().add(this._markerComponents[t])}_layoutLabels(t){return"outer"===this._spec.position&&this._map?Sv(t,this._map,(t=>this._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):bv(t)}_isRelativeModel(t){var e,i,s;const r=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===r}_isRelativeSeries(t){var e;return(null===(e=t.context)||void 0===e?void 0:e.modelId)===this._series.id}_getNeedClearVRenderComponents(){return this._markerComponents}getVRenderComponents(){return this._markerComponents}}Ev.type="mapLabel",Ev.specKey="mapLabel",Ev.transformerConstructor=Mv;const Bv="regressionLine";class Ov extends e.AbstractComponent{constructor(){super(...arguments),this.name=Bv}render(){this.removeAllChild();const{data:t,line:i={},label:s,name:r="regression-line",confidenceInterval:n}=this.attribute;e.isEmpty(t)||t.forEach((t=>{const{color:a}=t;if(t.area&&!1!==(null==n?void 0:n.visible)){const i=e.createArea(Object.assign(Object.assign({points:t.area},e.isValid(a)?{fill:a,fillOpacity:.12}:null),null==n?void 0:n.style));i.name="scatter-regression-area",this.add(i)}if(t.line&&!1!==(null==i?void 0:i.visible)){const s=e.createLine(Object.assign(Object.assign({points:t.line,lineWidth:1},e.isValid(a)?{stroke:a}:null),null==i?void 0:i.style));s.name=`${r}-curve`,this.add(s)}const o=e.last(t.line);if(s&&!1!==s.visible&&s.text&&o){const t=e.createText(Object.assign(Object.assign(Object.assign({},o),{text:s.text,textAlign:"end",textBaseline:"middle"}),s.style));t.name=`${r}-label`,this.add(t)}}))}}const Pv=(t,i,s=(t=>t.x),r=(t=>t.y),n)=>{switch(t){case"logisitc":return e.regressionLogistic(i,s,r);case"lowess":return e.regressionLowess(i,s,r);case"polynomial":return e.regressionPolynomial(i,s,r,{degree:n});default:return e.regressionLinear(i,s,r)}};function Iv(t,i){const{color:s,line:r,confidenceInterval:n,label:a}=i;return{type:"component",componentType:Bv,interactive:!1,style:{data:(r,n)=>{const a=n.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.scatter)),o=[];return a&&a.length&&a.forEach((r=>{var n,a;const l=r.getRegion().getLayoutStartPoint(),h=r.getRegion().getLayoutRect(),c=e.clamper(l.y,l.y+h.height),d=r.getColorAttribute(),u=r.getSeriesKeys(),p=r.getViewData().latestData,g=null===(n=r.fieldX)||void 0===n?void 0:n[0],m=null===(a=r.fieldY)||void 0===a?void 0:a[0];g&&m&&p&&!(p.length<=2)&&u.forEach((e=>{var n;const a=p.filter((t=>t[null==d?void 0:d.field]===e));if(!a.length)return;const{evaluateGrid:u,confidenceInterval:f}=Pv(t,a,(t=>null==t?void 0:t[g]),(t=>null==t?void 0:t[m]),i.polynomialDegree),v=Math.max(3,Math.floor(a.length/4)),y=u(v),_=f(v);o.push({color:null!=s?s:null===(n=null==d?void 0:d.scale)||void 0===n?void 0:n.scale(e),line:y.map((e=>{const i={[g]:e.x,[m]:e.y};return{x:r.dataToPositionX(i)+l.x,y:c("logisitc"===t?l.y+h.height*(1-e.y):r.dataToPositionY(i)+l.y)}})),area:_.map((t=>{const e={[g]:t.x,[m]:t.lower};return{x:r.dataToPositionX(e)+l.x,y:c(r.dataToPositionY(e)+l.y),y1:c(r.dataToPositionY({[m]:t.upper})+l.y)}}))})}))})),o},line:r,confidenceInterval:n,label:a}}}function Rv(t){const{color:i,line:s,confidenceInterval:r,label:n}=t;return{type:"component",componentType:Bv,interactive:!1,zIndex:500,style:{data:(s,r)=>{const n=r.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.bar)),a=[];return n&&n.length&&n.forEach((s=>{var r,n,o;const l=s.getRegion().getLayoutStartPoint(),h=s.getRegion().getLayoutStartPoint(),c=s.getRegion().getLayoutRect(),d=e.clamper(h.y,h.y+c.height),u=s.getViewData().latestData,p=null===(r=s.fieldX)||void 0===r?void 0:r[0],g=null===(n=s.fieldY)||void 0===n?void 0:n[0],m="horizontal"===s.direction,f=s.getRawDataStatisticsByField(p).values;if(m||!p||!g||!u||u.length<=2||f.length<=2)return;const{evaluateGrid:v,confidenceInterval:y}=e.regressionPolynomial(u,(t=>f.indexOf(null==t?void 0:t[p])),(t=>null==t?void 0:t[g]),{degree:t.degree}),_=f.length,b=v(_),S=y(_),x=s.getXAxisHelper().getBandwidth(0)/2;a.push({color:null!=i?i:null===(o=s.getOption().globalScale.getScale("color"))||void 0===o?void 0:o.scale(s.getSeriesKeys()[0]),line:b.map((t=>{const e={[p]:f[t.x],[g]:t.y};return{x:s.dataToPositionX(e)+l.x+x,y:d(s.dataToPositionY(e)+l.y)}})),area:S.map((t=>{const e={[p]:f[t.x],[g]:t.lower};return{x:s.dataToPositionX(e)+l.x+x,y:d(s.dataToPositionY(e)+l.y),y1:d(s.dataToPositionY({[g]:t.upper})+l.y)}}))})})),a},line:s,confidenceInterval:r,label:n}}}const Dv=(t,i,s)=>{switch(t){case"kde":return e.kde(i,s);case"ecdf":return e.ecdf(i)}};function Lv(t,i){const{line:s,label:r,color:n}=i;return{type:"component",componentType:Bv,interactive:!1,zIndex:500,style:{data:(i,s)=>{const r=s.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.bar)),a=[];return r&&r.length&&r.forEach((i=>{var s,r,o,l,h,c,d,u;const p=i.getRegion().getLayoutStartPoint(),g=i._rawData,m=null==g?void 0:g.rawData,f=null===(r=null===(s=g.transformsArr)||void 0===s?void 0:s.find((t=>"bin"===t.type)))||void 0===r?void 0:r.options,v=null===(o=i.fieldX)||void 0===o?void 0:o[0],y=i.getYAxisHelper().getScale(0),_=i.getViewData().latestData;if(!(m&&m.length&&(null==f?void 0:f.field)&&y&&_&&_.length))return;const b=m.map((t=>t[f.field])),S=Dv(t,b,"kde"===t?{bandwidth:_[0][null!==(h=null===(l=f.outputNames)||void 0===l?void 0:l.x1)&&void 0!==h?h:"x1"]-_[0][null!==(d=null===(c=f.outputNames)||void 0===c?void 0:c.x0)&&void 0!==d?d:"x0"]}:null),x=Math.max(3,Math.floor(b.length/4)),A=S.evaluateGrid(x),T=y.range(),C=T[0],k=e.last(T),w="kde"===t?t=>y.scale(t*m.length*S.bandwidth):t=>C+(k-C)*t;a.push({color:null!=n?n:null===(u=i.getOption().globalScale.getScale("color"))||void 0===u?void 0:u.scale(i.getSeriesKeys()[0]),line:A.map((t=>{const e={[v]:t.x};return{x:i.dataToPositionX(e)+p.x,y:w(t.y)+p.y}}))})})),a},line:s,label:r}}}const Fv="ExtensionMarkSyncStatePlugin";class Nv extends e.BasePlugin{constructor(){super(Fv),this.type=Fv}onAfterInitChart(t,i){var s;if(!this._detectSyncState(i))return;const r=t.globalInstance.getChart();if(!r)return;const n=r.getEvent();if(this._subscribedEvent===n)return;null===(s=this._unsubscribeAfterRender)||void 0===s||s.call(this);const a=()=>this._syncStates();n.on(e.ChartEvent.afterRender,a),this._subscribedEvent=n,this._unsubscribeAfterRender=()=>{n.off(e.ChartEvent.afterRender,a),this._subscribedEvent=void 0}}release(){var t;null===(t=this._unsubscribeAfterRender)||void 0===t||t.call(this),super.release()}_detectSyncState(t){const e=null==t?void 0:t.series;return!!(null==e?void 0:e.some((t=>this._hasExtensionMarkWithSyncState(t.extensionMark))))||this._hasExtensionMarkWithSyncState(null==t?void 0:t.extensionMark)}_hasExtensionMarkWithSyncState(t){return!!(null==t?void 0:t.some((t=>"group"!==t.type&&t.syncState)))}_syncStates(){var t;const e=null===(t=this.service)||void 0===t?void 0:t.globalInstance.getChart();e&&e.getAllSeries().forEach((t=>{var e,i;const s=null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.extensionMark)||void 0===i?void 0:i.filter((t=>"group"!==t.type&&t.syncState));(null==s?void 0:s.length)&&this._syncSeriesStates(t,s)}))}_syncSeriesStates(t,i){const s=new Map;if(t.getActiveMarks().forEach((t=>{t.getGraphics().forEach((t=>{var i;const r=null===(i=t.context)||void 0===i?void 0:i.key;e.isValid(r)&&s.set(String(r),t)}))})),0===s.size)return;const r=`${t.type}_${t.id}_extensionMark`;i.forEach(((i,n)=>{const a=e.isValid(i.name)?`${i.name}`:`${r}_${n}`,o=t.getMarkInName(a);o&&o.getGraphics().forEach((t=>{var i;const r=null===(i=t.context)||void 0===i?void 0:i.key;if(!e.isValid(r))return;const n=s.get(String(r));if(!n)return;const a=n.currentStates;(null==a?void 0:a.length)?t.useStates(a):t.clearStates()}))}))}}Nv.pluginType="chart",Nv.type=Fv;t.BAR_LINK=lv,t.Bar3dChart=Rp,t.Bar3dChartSpecTransformer=K,t.Bar3dSeries=Bp,t.Bar3dSeriesSpecTransformer=ka,t.BarLinkComponent=hv,t.CandlestickChart=zm,t.CandlestickChartSpecTransformer=Om,t.CandlestickSeries=Vm,t.CombinationCandlestickChart=Wm,t.CombinationCandlestickChart_TYPE=Bm,t.ConversionFunnelChart=B,t.ConversionFunnelSeries=O,t.DEFAULT_STROKE_COLOR="#000",t.DefaultBandWidth=6,t.ExtensionMarkSyncStatePlugin=Nv,t.Funnel3dChart=zp,t.Funnel3dSeries=Vp,t.Funnel3dSeriesSpecTransformer=Lp,t.Histogram3dChart=Kp,t.ImageCloudChart=$f,t.MapLabelComponent=Ev,t.PictogramChart=Lf,t.PictogramChartSpecTransformer=pf,t.PictogramSeries=Rf,t.Pie3dChart=Em,t.Pie3dChartSpecTransformer=pg,t.Pie3dSeries=wm,t.Pie3dSeriesSpecTransformer=km,t.REGRESSION_LINE=Bv,t.RangeColumn3dChart=lf,t.RangeColumn3dChartSpecTransformer=of,t.RangeColumn3dSeries=rf,t.RangeColumn3dSeriesSpecTransformer=af,t.RankingBar=l,t.RankingList=f,t.RegressionLine=Ov,t.SERIES_BREAK=tv,t.SVG_VIEWPORT_RECT_KEY=mf,t.SequenceScatterKDE=U,t.SequenceScatterLink=R,t.SequenceScatterPixel=z,t.SeriesBreakComponent=iv,t.SeriesLabelComponent=vv,t.TimelineChart=Qf,t.WordCloud3dChart=Jm,t.WordCloud3dChartSpecTransformer=Zm,t.WordCloud3dSeries=Ym,t.appendBarLinkConfig=function(t,i){t.customMark=e.array(t.customMark).filter((t=>t.componentType!==lv)),t.customMark.push(dv(i))},t.appendBarRegressionLineConfig=function(t,i){var s;if(!i){const r=Array.isArray(t.series)?t.series:t.series?[t.series]:[];i=null!==(s=e.get(t,Bv))&&void 0!==s?s:e.get(r.find((t=>t.type===e.SeriesTypeEnum.bar)),Bv)}e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const i=v(e,["visible"]);t.customMark.push(Rv(i))}}))},t.appendHistogramRegressionLineConfig=function(t,i){var s;if(!i){const r=Array.isArray(t.series)?t.series:t.series?[t.series]:[];i=null!==(s=e.get(t,Bv))&&void 0!==s?s:e.get(r.find((t=>t.type===e.SeriesTypeEnum.bar)),Bv)}e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const{type:i}=e,s=v(e,["type"]);t.customMark.push(Lv(i,s))}}))},t.appendScatterRegressionLineConfig=function(t,i){var s;if(!i){const r=Array.isArray(t.series)?t.series:t.series?[t.series]:[];i=null!==(s=e.get(t,Bv))&&void 0!==s?s:e.get(r.find((t=>t.type===e.SeriesTypeEnum.scatter)),Bv)}e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const{type:i}=e,s=v(e,["type"]);t.customMark.push(Iv(i,s))}}))},t.appendSeriesBreakConfig=t=>{var i;if(null===(i=t.axes)||void 0===i?void 0:i.length){const i=t.axes.filter((t=>t.breaks&&t.breaks.length&&!1!==t.visible));if(i.length)return t.customMark=e.array(t.customMark).filter((t=>t.componentType!==tv)),t.customMark.push(rv(i,i.map((e=>t.axes.indexOf(e))))),!0}return!1},t.appendSeriesLabelConfig=function(t,i){var s,r,n;if(t.customMark=e.array(t.customMark).filter((t=>t.componentType!==uv)),i||(i=null!==(n=null!==(s=e.get(t,uv))&&void 0!==s?s:e.get(null===(r=t.series)||void 0===r?void 0:r[0],uv))&&void 0!==n?n:{}),i.visible){const{position:e="end"}=i,s=v(i,["position"]);t.customMark.push(fv(e,s))}},t.clearSVGSource=function(){gf.clear(),ff=null},t.getBarLinkConfig=dv,t.getBarRegressionLineConfig=Rv,t.getHistogramRegressionLineConfig=Lv,t.getSVGSource=bf,t.getScatterRegressionLineConfig=Iv,t.getSeriesBreakConfig=rv,t.getSeriesLabelConfig=fv,t.register3DPlugin=Ta,t.registerAxis3dPlugin=()=>{Ta(),Ip(),(()=>{e.registerCartesianBandAxis();const t=e.Factory.getComponentInKey(e.CartesianBandAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},e.CartesianBandAxis.builtInTheme.axisX),tf)}),e.mixin(t,ef)})(),(()=>{e.registerCartesianLinearAxis();const t=e.Factory.getComponentInKey(e.CartesianLinearAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},e.CartesianLinearAxis.builtInTheme.axisX),tf)}),e.mixin(t,ef)})(),(()=>{e.registerCartesianTimeAxis();const t=e.Factory.getComponentInKey(e.CartesianTimeAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},t.builtInTheme.axisX),tf)}),e.mixin(t,ef)})(),(()=>{e.registerCartesianLogAxis();const t=e.Factory.getComponentInKey(e.CartesianSymlogAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},t.builtInTheme.axisX),tf)}),e.mixin(t,ef)})(),(()=>{e.registerCartesianLogAxis();const t=e.Factory.getComponentInKey(e.CartesianLogAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},e.CartesianLogAxis.builtInTheme.axisX),tf)}),e.mixin(t,ef)})()},t.registerBar3dChart=()=>{Ta(),Ip(),Op(),e.Factory.registerChart(Rp.type,Rp)},t.registerBar3dSeries=Op,t.registerBarLink=()=>{e.Factory.registerGraphicComponent(lv,(t=>new hv(t)))},t.registerCandlestickChart=()=>{e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),Gm(),e.Factory.registerChart(zm.type,zm)},t.registerCandlestickSeries=Gm,t.registerCombinationCandlestickChart=()=>{Gm(),e.Factory.registerChart(Wm.type,Wm)},t.registerConversionFunnelChart=t=>{e.registerMarkFilterTransform();const i=(null==t?void 0:t.VChart)||e.VChart;i&&(i.useChart([B]),i.useSeries([O]))},t.registerEventSeries=Jf,t.registerExtensionMarkSyncStatePlugin=()=>{e.registerChartPlugin(Nv)},t.registerFunnel3dChart=()=>{e.registerMarkTooltipProcessor(),Ta(),Ip(),Gp(),e.Factory.registerChart(zp.type,zp)},t.registerFunnel3dSeries=Gp,t.registerHistogram3dChart=()=>{e.registerGroupTooltipProcessor(),e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),Ta(),Ip(),Op(),e.Factory.registerChart(Kp.type,Kp)},t.registerImageCloudChart=()=>{Wf(),e.Factory.registerChart($f.type,$f)},t.registerMapLabel=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useComponent([Ev])},t.registerPictogramChart=()=>{e.registerMarkTooltipProcessor(),Df(),e.Factory.registerChart(Lf.type,Lf)},t.registerPictogramSeries=Df,t.registerPie3dChart=()=>{bp(),Sa.registerTooltipProcessor("mark",wg),Ta(),Ip(),Mm(),Sa.registerChart(Em.type,Em)},t.registerPie3dSeries=Mm,t.registerRangeColumn3dChart=()=>{e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),Ta(),Ip(),nf(),e.Factory.registerChart(lf.type,lf)},t.registerRangeColumn3dSeries=nf,t.registerRankingBarChart=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([l])},t.registerRankingList=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([f,e.BarChart])},t.registerRegressionLine=()=>{e.Factory.registerGraphicComponent(Bv,(t=>new Ov(t)))},t.registerSVGSource=yf,t.registerSequenceScatterKDE=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([U,e.ScatterChart])},t.registerSequenceScatterLink=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([R,e.ScatterChart])},t.registerSequenceScatterPixel=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([z,e.ScatterChart])},t.registerSeriesBreak=()=>{e.Factory.registerGraphicComponent("seriesBreak",(t=>new iv(t)))},t.registerSeriesLabel=()=>{e.Factory.registerGraphicComponent("seriesLabel",(t=>new vv(t)))},t.registerTimelineChart=()=>{e.registerMarkTooltipProcessor(),Jf(),e.Factory.registerChart(Qf.type,Qf)},t.registerWordCloud3dChart=Qm,t.registerWordCloud3dSeries=Xm,t.registerWordCloudShape3dChart=()=>{Ta(),qm(),Qm()},t.registerWordCloudShape3dSeries=qm,t.svgSourceMap=gf,t.transformCandlestickSeriesSpec=Km,t.unregisterSVGSource=_f}));
|
|
16
|
+
function v(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]])}return i}const y={cornerRadius:4,stroke:"black",strokeOpacity:1,lineWidth:1,closePath:!1,pickable:!1},_={symbolType:"triangle",size:8,scaleX:.7,fill:"black"},b={fill:"#606773",fontSize:12},S={fill:"#eff1f9"};class x extends e.FunnelChartSpecTransformer{transformSpec(t){const{conversionArrow:e,extensionMark:i=[],funnelBackground:s}=t;if(e&&e.arrows&&e.arrows.length){const t=function(t){const{arrows:e}=t,i=v(t,["arrows"]),s=e.filter((t=>"left"===t.position)),r=e.filter((t=>"right"===t.position)),n=A(r,i),a=A(s,i),o=[];n&&(n.name="arrowRight",o.push(n));a&&(a.name="arrowLeft",o.push(a));return o}(e);t&&t.length&&i.push(...t)}if(s&&s.visible){const t=function(t){const{style:e={}}=t,i=v(t,["style"]);return Object.assign(Object.assign({type:"rect"},i),{dataIndex:0,zIndex:0,style:Object.assign(Object.assign(Object.assign({},S),e),{x:0,y:(t,e)=>e.getPoints(t)[0].y,width:(t,e)=>{const i=e.getRegion(),{width:s}=i.getLayoutRect();return s},height:(t,e)=>{const i=e.getPoints(t),s=i[0];return i[3].y-s.y}})})}(s);t&&i.push(t)}t.extensionMark=i,super.transformSpec(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.conversionArrow=t.conversionArrow,e.funnelBackground=t.funnelBackground,e}}function A(t,i){if(0===(null==t?void 0:t.length))return null;const{line:s,symbol:r,text:n,margin:a}=i,o=[],l={type:"group",zIndex:e.LayoutZIndex.Mark+1,children:[]},h=function(t={},e){const{style:i={}}=t,s=v(t,["style"]),r=(t,e)=>{var i,s;const{from:r,to:n}=t,{vchart:a}=e,o=null===(s=null===(i=null==a?void 0:a.getChart())||void 0===i?void 0:i.getSeriesData())||void 0===s?void 0:s.latestData;return!(n>o.length-1||r>o.length-1)};return Object.assign(Object.assign({type:"polygon",interactive:!1},s),{dataKey:t=>`${t.id}`,style:Object.assign(Object.assign(Object.assign({},y),i),{renderable:r,points:(t,i)=>{if(!r(t,i))return[];let s=t.layout.points;return s=T(t,i,e),s}})})}(s,a);h&&o.push(h);const c=function(t={},e){const{style:i={}}=t,s=v(t,["style"]);return Object.assign(Object.assign({type:"symbol",interactive:!1,dataKey:t=>`${t.id}`},s),{style:Object.assign(Object.assign(Object.assign({},_),i),{x:(t,i)=>{var s,r;let n=t.layout.points;return n=T(t,i,e),null!==(r=null===(s=n[(null==n?void 0:n.length)-1])||void 0===s?void 0:s.x)&&void 0!==r?r:NaN},y:(t,i)=>{var s,r;let n=t.layout.points;return n=T(t,i,e),null!==(r=null===(s=n[(null==n?void 0:n.length)-1])||void 0===s?void 0:s.y)&&void 0!==r?r:NaN},angle:t=>"left"===t.position?90:-90})})}(r,a);c&&o.push(c);const d=function(t={},i){const{style:s={},formatMethod:r,textMargin:n=4}=t,a=v(t,["style","formatMethod","textMargin"]);return Object.assign(Object.assign({type:"text",dataKey:t=>`${t.id}`,interactive:!1,animation:!1},a),{style:Object.assign(Object.assign(Object.assign({},b),{text:(t,i)=>{var s,n,a,o,l,h,c;const{text:d}=t;let u=d;if(e.isFunction(r)){const{vchart:e}=i,{from:p,to:g}=t,{field:m}=t.context,f=null!==(a=null===(n=null===(s=null==e?void 0:e.getChart())||void 0===s?void 0:s.getSeriesData())||void 0===n?void 0:n.latestData)&&void 0!==a?a:[],v=null!==(c=null===(h=null===(l=null===(o=null==e?void 0:e.getChart())||void 0===o?void 0:o.getAllSeries()[0])||void 0===l?void 0:l.getViewData())||void 0===h?void 0:h.latestData)&&void 0!==c?c:[],y=v.find((t=>t[m]===f[p][m])),_=v.find((t=>t[m]===f[g][m]));u=r(d,{arrow:t,from:y,to:_})}return u},x:(t,e)=>{var s,r;let a=t.layout.points;return a=T(t,e,i),null!==(r=(null===(s=a[1])||void 0===s?void 0:s.x)+("left"===t.position?-n:n))&&void 0!==r?r:NaN},y:(t,e)=>{var s,r,n;let a=t.layout.points;return a=T(t,e,i),null!==(n=((null===(s=a[1])||void 0===s?void 0:s.y)+(null===(r=a[2])||void 0===r?void 0:r.y))/2)&&void 0!==n?n:NaN},textAlign:t=>"left"===t.position?"right":"left",textBaseline:"middle"}),s)})}(n,a);return d&&o.push(d),l.children=o,l}function T(t,e,i){var s,r,n,a,o;const{vchart:l}=e,{from:h,to:c}=t,{field:d}=t.context,u=null===(r=null===(s=null==l?void 0:l.getChart())||void 0===s?void 0:s.getSeriesData())||void 0===r?void 0:r.latestData,p=null===(o=null===(a=null===(n=null==l?void 0:l.getChart())||void 0===n?void 0:n.getAllSeries()[0])||void 0===a?void 0:a.getViewData())||void 0===o?void 0:o.latestData;let g=[];if(u&&u.length){const s=p.find((t=>t[d]===u[h][d])),r=p.find((t=>t[d]===u[c][d])),n=p[0];if(s&&r&&n){g=function(t,e,i,s,r=12){const{layout:n,distance:a,position:o}=t,{level:l,fromIndex:h,toIndex:c,fromTotal:d,toTotal:u}=n,p="right"===o,g=p?e[1]:e[0],m=p?e[2]:e[3],f=Math.abs(g.y-m.y),v=p?i[1]:i[0],y=p?i[2]:i[3],_=Math.abs(v.y-y.y),b=p?s[1]:s[0],S=f/(d+1),x=_/(u+1),A=g.y+S*(h+1),T=v.y+x*(c+1),C=p?-1:1,k=[{x:g.x-r*C,y:A},{x:b.x-(r+(l+1)*a)*C,y:A},{x:b.x-(r+(l+1)*a)*C,y:T},{x:v.x-r*C,y:T}];return k}(t,e.getPoints(s),e.getPoints(r),e.getPoints(n),i),t.layout.points=g}}return g}function C(t,e){const{from:i,to:s}=t,{from:r,to:n}=e;return s>r&&n>i}function k(t,e){const{from:i,to:s}=t,{from:r,to:n}=e;return i===r&&s===n}const w=(t,i)=>{var s,r,n;if(!t||!(null===(s=t.arrows)||void 0===s?void 0:s.length))return[];const{arrows:a}=t,o=function(t,i){return t.filter((t=>e.isValidNumber(t.from*t.to))).map(((t,e)=>{const{from:s,to:r,position:n="right"}=t;return Object.assign(Object.assign({},t),{position:n,distance:t.distance||40,from:Math.min(s,r),to:Math.max(s,r),span:Math.abs(s-r),isLayout:!1,context:{field:i},layout:{level:0},id:`${s}-${r}-${n}-${e}`})}))}(a,i.categoryField),l=o.filter((t=>"left"===t.position)),h=o.filter((t=>"right"===t.position));return[...null!==(r=M(l))&&void 0!==r?r:[],...null!==(n=M(h))&&void 0!==n?n:[]]};function M(t){if(0===(null==t?void 0:t.length))return null;const i=new Map;return t.forEach((t=>{const s=i.get(t.from);if(e.isValid(s)){const e=s.fromArrows.find((e=>k(e,t)));e?t.layout.duplicateNode=e:s.degree+=1,s.fromArrows.push(t)}else i.set(t.from,{fromArrows:[t],toArrows:[],totalArrows:[],degree:1});const r=i.get(t.to);if(e.isValid(r)){const e=r.toArrows.find((e=>k(e,t)));e?t.layout.duplicateNode=e:r.degree+=1,r.toArrows.push(t)}else i.set(t.to,{toArrows:[t],fromArrows:[],totalArrows:[],degree:1})})),i.forEach((t=>{t.fromArrows.sort(((t,e)=>e.span-t.span)),t.toArrows.sort(((t,e)=>t.span-e.span)),t.totalArrows=[...t.toArrows,...t.fromArrows]})),t.sort(((t,e)=>t.span-e.span)).forEach((s=>{var r;const n=t.filter((t=>t.layout.isLayout)),a=e.maxInArray(n,((t,e)=>t.layout.level-e.layout.level));let o=null!==(r=null==a?void 0:a.layout.level)&&void 0!==r?r:0;for(;o>=0;){if(n.some((t=>t.layout.level===o&&C(t,s)))){o+=1;break}--o}s.layout.level=Math.max(0,o),s.layout.fromTotal=i.get(s.from).degree,s.layout.toTotal=i.get(s.to).degree;const l=s.layout.duplicateNode;l?(s.layout.fromIndex=l.layout.fromIndex,s.layout.toIndex=l.layout.toIndex):(s.layout.fromIndex=E(s,i.get(s.from).totalArrows),s.layout.toIndex=E(s,i.get(s.to).totalArrows)),s.layout.isLayout=!0})),t}function E(t,e){let i=0,s=0;for(let r=0;r<e.length;r++){const n=e[r];if(n===t){i=r-s;break}n.layout.duplicateNode&&s++}return i}class B extends e.FunnelChart{constructor(){super(...arguments),this.type="conversionFunnel",this.transformerConstructor=x}}B.type="conversionFunnel",B.transformerConstructor=x;class P extends e.FunnelSeries{initData(){var t;super.initData();const{conversionArrow:i}=this._spec;i&&(null===(t=i.arrows)||void 0===t?void 0:t.length)&&(this._arrowData=new e.DataView(this._dataSet,{name:`${e.PREFIX}_series_${this.id}_arrowData`}),this._dataSet.getTransform("conversionArrow")||this._dataSet.registerTransform("conversionArrow",w),this._arrowData.parse(i).transform({type:"conversionArrow",options:{categoryField:this._spec.categoryField}}))}afterCompile(){var t;null===(t=super.afterCompile)||void 0===t||t.call(this);const e=this.getMarkInName("arrowRight");e&&e.getMarks().forEach((t=>{t.setDataView(this._arrowData),t.compileData(),t.setTransform([{type:"filter",callback:t=>"right"===t.position}])}));const i=this.getMarkInName("arrowLeft");i&&i.getMarks().forEach((t=>{t.setDataView(this._arrowData),t.compileData(),t.setTransform([{type:"filter",callback:t=>"left"===t.position}])}))}}const O="dataKey";class I extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,s,r,n;super.transformSpec(t);const a=function(t){const e=[];return Object.keys(t.data).forEach((i=>{const s=t.data[i].nodes;e.push({data:[{id:"nodes",values:s.map(((t,e)=>Object.assign(Object.assign({},t),{[O]:e})))},{id:"endpoints",values:[]},{id:"iter",values:[{iter:i}]},{id:"background",values:[{iter:i,x:t.scope[0],y:t.scope[1]},{iter:i,x:t.scope[0],y:t.scope[3]},{iter:i,x:t.scope[2],y:t.scope[3]},{iter:i,x:t.scope[2],y:t.scope[1]},{iter:i,x:t.scope[0],y:t.scope[1]}]}]})})),e}(t),o="neighborhood"!==t.taskType;t.type="common",t.dataKey=O,t.data=a[0].data,t.series=[{id:"background-series",type:"area",dataId:"background",interactive:!1,persent:!0,xField:"x",yField:"y",point:{visible:!1},line:{visible:!1},area:{visible:!0,interactive:!1,style:{background:e=>"neighborhood"===t.taskType?"":`https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/sequence-scatter-bgimg-2/${e.iter}.png`,fill:"transparent",fillOpacity:.5}},hover:{enable:!1},select:{enable:!1}},{id:"line-series",type:"line",dataId:"endpoints",xField:"x",yField:"y",seriesField:"edgeId",animation:!0,point:{visible:!1},line:{visible:!0,style:{stroke:t=>t.color,lineDash:t=>"same_type"===t.type?[0,0]:[3,2],lineWidth:.8,strokeOpacity:.6}}},{id:"scatter-series",type:"scatter",dataId:"nodes",xField:t.xField,yField:t.yField,seriesField:"label",point:{state:{hover:{scaleX:1.5,scaleY:1.5,fillOpacity:1},hover_reverse:{scaleX:1,scaleY:1,fillOpacity:.3}},style:{size:()=>"neighborhood"===t.taskType?6:4,fill:e=>{var i;return null!==(i=t.labelColor[e.label])&&void 0!==i?i:"gray"},fillOpacity:t=>t.confidence}},label:{visible:!0,style:{visible:()=>"neighborhood"===t.taskType,type:"text",fontFamily:"Console",fontStyle:"italic",fontSize:12,fill:"black",fillOpacity:.6,text:t=>t.id}}}],t.player&&(t.player=Object.assign(Object.assign({},t.player),{specs:a}),t.animationAppear={duration:null!==(i=null===(e=t.player)||void 0===e?void 0:e.duration)&&void 0!==i?i:2e3,easing:"linear"},t.animationUpdate={duration:null!==(r=null===(s=t.player)||void 0===s?void 0:s.duration)&&void 0!==r?r:2e3,easing:"linear"}),t.axes=[{orient:"left",type:"linear",inverse:!0,min:t.scope[1],max:t.scope[3]},{orient:"bottom",type:"linear",min:t.scope[0],max:t.scope[2]}],t.customMark=[{type:"text",dataId:"iter",style:Object.assign({x:50,y:()=>10,textBaseline:"top",textAlign:"left",fontSize:100,fontWeight:"bolder",fill:"black",fillOpacity:.2},null===(n=t.infoLabel)||void 0===n?void 0:n.style)}],t.legends=[{seriesId:"scatter-series",visible:!0,orient:"right",position:"middle",data:t=>t.map((t=>(t.shape.outerBorder={stroke:t.shape.fill,distance:2,lineWidth:1},t))),title:{visible:!0,align:"left",textStyle:{text:"Classes",fontFamily:"Console",fontSize:18,fontWeight:"bold"}},item:{visible:!0,width:"8%",value:{alignRight:!0,style:{fill:"#000",fillOpacity:1,fontSize:12},state:{unselected:{fill:"#d8d8d8"}}}}}],t.tooltip={visible:o,seriesId:"scatter-series",lockAfterClick:!1,activeType:"mark",trigger:"hover",mark:{title:{visible:!0,value:"Info"},content:[{key:"Label",value:t=>t.label,shapeType:"circle",shapeSize:8},{key:"Prediction",value:t=>t.prediction,shapeType:"circle",shapeSize:8,shapeFill:e=>{var i;return null!==(i=t.labelColor[e.prediction])&&void 0!==i?i:"gray"}},{key:"Confidence",value:t=>t.confidence.toFixed(2),shapeType:"square",shapeSize:8,shapeFill:t=>t.label===t.prediction?"green":"red"}]},style:{panel:{padding:{top:10,bottom:15,left:10,right:10},backgroundColor:"#fff",border:{color:"#eee",width:1,radius:10}},titleLabel:{fontSize:20,fontFamily:"Times New Roman",fill:"brown",fontWeight:"bold",textAlign:"center",lineHeight:24},keyLabel:{fontSize:16,fontFamily:"Times New Roman",fill:"black",textAlign:"center",lineHeight:15,spacing:10},valueLabel:{fontSize:14,fill:"black",textAlign:"center",lineHeight:15,spacing:10}}},t.dataZoom=[{visible:!1,orient:"left",filterMode:"axis",showDetail:!1,roamZoom:{enable:!0,focus:!0,rate:3},roamDrag:{enable:!0,reverse:!0,rate:1}},{visible:!1,orient:"bottom",filterMode:"axis",showDetail:!1,roamZoom:{enable:!0,focus:!0,rate:3},roamDrag:{enable:!0,reverse:!0,rate:1}}],super.transformSpec(t)}}class R extends e.BaseChart{constructor(){super(...arguments),this.type="sequenceScatterLink",this.transformerConstructor=I}init(){this.isValid()&&super.init()}isValid(){var t,e,i,s;const{xField:r,yField:n,data:a}=this._spec;return r&&n?!!a||(null===(s=(i=this._option).onError)||void 0===s||s.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}R.type="sequenceScatterLink",R.view="singleDefault",R.transformerConstructor=I;const D=.2;function L(t){const e=Math.sqrt((2*Math.PI)**2);return Math.exp(-(t**2)/2)/e}const F="dataKey";class N extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,s,r,n,a;super.transformSpec(t);const o=function(t){const e=[];return Object.keys(t.data).forEach((i=>{const s=t.data[i].map(((t,e)=>Object.assign(Object.assign({},t),{[F]:e}))),r=function(t,e=100,i){const s=t.reduce(((t,e)=>{const i=e.label;return t[i]=t[i]||[],t[i].push(e),t}),{}),r=[];return Object.entries(s).forEach((([t,s])=>{const n=i||function(t){return t.length**(-1/6)}(s),a=s.map((t=>t.x)),o=s.map((t=>t.y)),l=Math.min(...a),h=Math.max(...a),c=Math.min(...o),d=Math.max(...o),u=l-(h-l)*D,p=c-(d-c)*D;for(let i=0;i<e;i++)for(let a=0;a<e;a++){const e=u+.1*i,o=p+.1*a;let l=0;for(const t of s)l+=L(Math.sqrt((e-t.x)**2+(o-t.y)**2)/n);l/=s.length*n*n,r.push({x:e,y:o,kde:l,label:t})}})),r}(s,150);e.push({data:[{id:"nodes",values:s},{id:"iter",values:[{iter:i}]},{id:"kde",values:r}]})})),e}(t);t.type="common",t.dataKey=F,t.data=o[0].data,t.scales=[{id:"colorScale",type:"ordinal",specified:{0:"rgb(150, 10, 100)",1:"rgb(31, 119, 180)",2:"rgb(255, 127, 14)",3:"rgb(44, 160, 44)",4:"rgb(214, 39, 40)",5:"rgb(148, 103, 189)",6:"rgb(140, 86, 75)",7:"rgb(227, 119, 194)",8:"rgb(127, 127, 127)",9:"rgb(188, 189, 34)",10:"rgb(23, 190, 207)"}},{id:"brighterColorScale",type:"ordinal",specified:{0:"rgb(150, 10, 150)",1:"rgb(31, 119, 230)",2:"rgb(255, 127, 64)",3:"rgb(44, 160, 94)",4:"rgb(214, 39, 90)",5:"rgb(148, 103, 239)",6:"rgb(140, 86, 125)",7:"rgb(227, 119, 244)",8:"rgb(127, 127, 177)",9:"rgb(188, 189, 84)",10:"rgb(23, 190, 255)"}},...null!==(e=t.scales)&&void 0!==e?e:[]],t.series=[{type:"scatter",dataIndex:0,xField:t.xField,yField:t.yField,seriesField:t.seriesField,size:5,point:{zIndex:1e3,style:{fill:{scale:"colorScale",field:t.seriesField}}}}];t.customMark=[{type:"text",dataIndex:1,style:Object.assign({text:t=>t.iter,x:10,y:()=>10,textBaseline:"top",textAlign:"left",fontSize:25,fontWeight:"bolder",fill:"black",fillOpacity:.2},null===(i=t.infoLabel)||void 0===i?void 0:i.style)},{type:"symbol",dataIndex:2,style:{symbolType:"rect",x:(t,e)=>54+(0,e.chart.getAllSeries()[0]._markAttributeContext.valueToX)([t.x]),y:(t,e)=>(0,e.chart.getAllSeries()[0]._markAttributeContext.valueToY)([t.y])+26,size:5,fill:{scale:"brighterColorScale",field:"label"},fillOpacity:t=>10*t.kde}}],t.tooltip={visible:!0,fields:["x","y","label"]},t.player&&(t.player=Object.assign(Object.assign({},t.player),{specs:o}),t.animationAppear={duration:null!==(r=null===(s=t.player)||void 0===s?void 0:s.duration)&&void 0!==r?r:2e3,easing:"linear"},t.animationUpdate={duration:null!==(a=null===(n=t.player)||void 0===n?void 0:n.duration)&&void 0!==a?a:2e3,easing:"linear"}),t.axes=[{orient:"left",type:"linear",nice:!0},{orient:"bottom",type:"linear",nice:!0,label:{visible:!0}}],super.transformSpec(t)}}class U extends e.BaseChart{constructor(){super(...arguments),this.type="sequenceScatterKDE",this.transformerConstructor=N}init(){this.isValid()&&super.init()}isValid(){var t,e,i,s;const{xField:r,yField:n,data:a}=this._spec;return r&&n?!!a||(null===(s=(i=this._option).onError)||void 0===s||s.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}U.type="sequenceScatterKDE",U.view="singleDefault",U.transformerConstructor=N;const j="dataKey";function V(t){const e=[];return Object.keys(t.data).forEach((i=>{let s=null;if(t.backgroundColors&&t.backgroundColors[i]){const e=function(t,e){var i;if("undefined"==typeof document)throw new Error("Canvas rendering requires browser environment with document object");const s=document.createElement("canvas");s.width=e.width,s.height=e.height;const r=s.getContext("2d");if(!r)throw new Error("Failed to get 2D rendering context from canvas");const n=r.createImageData(e.width,e.height);for(let e=0;e<300;e++)for(let s=0;s<300;s++){const r=(null===(i=t[e])||void 0===i?void 0:i[s])||[0,0,0],a=4*(300*e+s);n.data[a]=Math.round(255*r[0]),n.data[a+1]=Math.round(255*r[1]),n.data[a+2]=Math.round(255*r[2]),n.data[a+3]=255}return r.putImageData(n,0,0),s.toDataURL("image/png")}(t.backgroundColors[i],t);s={imageData:e}}e.push({data:[{id:"nodes",values:t.data[i].map(((t,e)=>Object.assign(Object.assign({},t),{[j]:e})))},{id:"inter",values:[{inter:i}]},{id:"background",values:s?[s]:[]}]})})),e}class G extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,s,r,n;super.transformSpec(t);const a=V(t);t.type="common",t.dataKey=j,t.data=a[0].data,t.width=300,t.height=300,t.autoFit=!1,t.series=[{type:"scatter",xField:t.xField,yField:t.yField}],t.player&&(t.player=Object.assign(Object.assign({},t.player),{specs:a}),t.animationAppear={duration:null!==(i=null===(e=t.player)||void 0===e?void 0:e.duration)&&void 0!==i?i:2e3,easing:"linear"},t.animationUpdate={duration:null!==(r=null===(s=t.player)||void 0===s?void 0:s.duration)&&void 0!==r?r:2e3,easing:"linear"}),t.axes=[{orient:"left",type:"linear"},{orient:"bottom",label:{visible:!0},type:"linear"}],t.customMark=[{type:"image",dataIndex:2,style:{x:0,y:0,width:300,height:300,image:t=>t.imageData,zIndex:-1}},{type:"text",dataIndex:1,style:Object.assign({text:t=>t.inter,x:50,y:()=>10,textBaseline:"top",textAlign:"left",fontSize:100,fontWeight:"bolder",fill:"black",fillOpacity:.2},null===(n=t.infoLabel)||void 0===n?void 0:n.style)}],t.tooltip={visible:!1},super.transformSpec(t)}}class z extends e.BaseChart{constructor(){super(...arguments),this.type="sequenceScatterPixel",this.transformerConstructor=G}init(){this.isValid()&&super.init()}isValid(){var t,e,i,s;const{xField:r,yField:n,data:a}=this._spec;return r&&n?!!a||(null===(s=(i=this._option).onError)||void 0===s||s.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}z.type="sequenceScatterPixel",z.view="singleDefault",z.transformerConstructor=G;class K extends e.BarChartSpecTransformer{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.barWidth=t.barWidth,e.barMaxWidth=t.barMaxWidth,e.barMinWidth=t.barMinWidth,e.barGapInGroup=t.barGapInGroup,e}}var H,W,$,Y,X,q;!function(t){t.bar3d="bar3d",t.histogram3d="histogram3d",t.rangeColumn3d="rangeColumn3d",t.pie3d="pie3d",t.wordCloud3d="wordCloud3d",t.funnel3d="funnel3d"}(H||(H={})),function(t){t.rect3d="rect3d",t.arc3d="arc3d",t.pyramid3d="pyramid3d"}(W||(W={})),function(t){t.bar3d="bar3d",t.rangeColumn3d="rangeColumn3d",t.pie3d="pie3d",t.wordCloud3d="wordCloud3d",t.funnel3d="funnel3d"}($||($={})),function(t){t.bar3d="bar3d",t.funnel3d="funnel3d",t.transform3d="transform3d",t.pie3d="pie3d"}(Y||(Y={})),function(t){t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical"}(X||(X={})),function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(q||(q={}));class Z{static Get(t,e=q.Color1,i=[0,0,0,1]){if(e===q.Color1){const e=Z.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const r=s.Color.parseColorString(t);if(r){const e=[r.r/255,r.g/255,r.b/255,r.opacity];Z.store1[t]=e,Z.store255[t]=[r.r,r.g,r.b,r.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const r=Z.store255[t];if(r)return i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i;const n=s.Color.parseColorString(t);return n&&(Z.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Z.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===q.Color1){if(Z.store1[t])return;Z.store1[t]=i,Z.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Z.store255[t])return;Z.store255[t]=i,Z.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function J(t,e=!1){return Array.isArray(t)&&s.isNumber(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Q(t,e,i,r,n){return Array.isArray(t)&&!s.isNumber(t[0])||Array.isArray(e)&&!s.isNumber(e[0])?new Array(4).fill(0).map(((n,a)=>{var o,l;return tt(s.isArray(t)?null!==(o=t[a])&&void 0!==o?o:t[0]:t,s.isArray(e)?null!==(l=e[a])&&void 0!==l?l:e[0]:e,i,r)})):tt(t,e,i,r,n)}function tt(t,e,i,s,r){if(!t||!e)return t&&J(t)||e&&J(e)||!1;let n,a,o=!1,l=!1;if(Array.isArray(t)?n=t:"string"==typeof t?n=Z.Get(t,q.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Z.Get(e,q.Color255):l=!0,o!==l){const n=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},n),{stops:n.stops.map((t=>Object.assign(Object.assign({},t),{color:J(a)})))});return o?Q(n,l,i,s,r):Q(l,n,i,s,r)}if(o){if(t.gradient===e.gradient){const s=t,r=e,n=s.stops,a=r.stops;if(n.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,r=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:rt(s[e].color,r[e].color,i),offset:s[e].offset+(r[e].offset-s[e].offset)*i})))}}(s,r,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,r=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:rt(s[e].color,r[e].color,i),offset:s[e].offset+(r[e].offset-s[e].offset)*i})))}}(s,r,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,r=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:rt(s[e].color,r[e].color,i),offset:s[e].offset+(r[e].offset-s[e].offset)*i})))}}(s,r,i)}return!1}return r&&r(n,a),J(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(n,a,i),s)}function et(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Z.store255={},Z.store1={};const it=[0,0,0,0],st=[0,0,0,0];function rt(t,e,i){return Z.Get(t,q.Color255,it),Z.Get(e,q.Color255,st),`rgba(${Math.round(it[0]+(st[0]-it[0])*i)},${Math.round(it[1]+(st[1]-it[1])*i)},${Math.round(it[2]+(st[2]-it[2])*i)},${it[3]+(st[3]-it[3])*i})`}const nt=Symbol.for("@visactor/vrender-core/factory-state");class at{static GenAutoIncrementId(){return at.auto_increment_id++}}at.auto_increment_id=0;class ot{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const r=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(r>i)){s++;break}}this.taps[s]=t}}class lt extends ot{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}class ht{}const ct=Symbol.for("@visactor/vrender-core/application-state");const dt=function(){const t=globalThis;return t[ct]||(t[ct]={application:new ht}),t[ct]}().application;class ut{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),r=this._resolveOnce(i),n=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(n,e);if(a.has(s))return;const o=i=>{const n=this._eventListenerTransformer(i);"function"==typeof e?e(n):e.handleEvent&&e.handleEvent(n),r&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,r;if(!e)return;const n=this._resolveCapture(i),a=null===(r=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===r?void 0:r.get(n);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,n),this._deleteListenerRecord(t,e,n))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const r=s.get(e);r&&(r.delete(i),0===r.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}const pt=Symbol.for("VWindow");function gt(t){const e=dt.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class mt extends ut{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t=dt.global,e=gt){super(),this.handlerFactory=e,this.hooks={onChange:new lt(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=at.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,r,n){this._handler.setViewBoxTransform(t,e,i,s,r,n)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&s.isNumberClose(this.width,t.width())&&s.isNumberClose(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class ft{get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get x(){return this.canvas.x}get y(){return this.canvas.y}get canvasX(){return this.canvas.x}get canvasY(){return this.canvas.y}get viewX(){return this.viewport.x}get viewY(){return this.viewport.y}constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=ft.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer={x:0,y:0},this.page={x:0,y:0},this.canvas={x:0,y:0},this.viewport={x:0,y:0},this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}composedPath(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.composedDetailPath(),this.path}composedDetailPath(){return this.pickParams&&this.pickParams.graphic?(this.detailPath=this.path.slice(),this._composedDetailPath(this.pickParams)):this.detailPath=this.path.slice(),this.detailPath}_composedDetailPath(t){if(t&&t.graphic){const e=t.graphic;if(e.stage){const i=e.stage.eventSystem.manager.propagationPath(e);this.detailPath.push(i),this._composedDetailPath(t.params)}}}preventDefault(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault()}catch(t){this.nativeEvent.preventDefault&&s.isFunction(this.nativeEvent.preventDefault)&&this.nativeEvent.preventDefault()}this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.stopPropagation()}catch(t){this.nativeEvent.stopPropagation&&s.isFunction(this.nativeEvent.stopPropagation)&&this.nativeEvent.stopPropagation()}this.propagationStopped=!0}initEvent(){}initUIEvent(){}clone(){throw new Error("Method not implemented.")}}class vt extends ft{constructor(t,e){super(),this.type=t,this.detail=e}}const yt={dispatchEvent(t){var e;if(!(t instanceof ft))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.detailPath&&(t.detailPath=[]),t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new vt(t,e))}};var _t=function(t,e,i,s){return new(i||(i=Promise))((function(r,n){function a(t){try{l(s.next(t))}catch(t){n(t)}}function o(t){try{l(s.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class bt extends s.EventEmitter{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=at.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return _t(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&s.Logger.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t<e;t++){if(!i)return null;t>0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i<t;i++){if(!e._next)return null;e=e._next}return e}at(t){return this.getChildAt(t)}containNode(t){if(!this._idMap)return!1;if(this._idMap.has(t._uid))return!0;let e=this._firstChild;for(;e;){if(e.containNode(t))return!0;e=e._next}return!1}getRootNode(){let t=this.parent;for(;null==t?void 0:t.parent;)t=t.parent;return t||this}hasChildNodes(){return null!==this._firstChild}addChild(t){return this.appendChild(t)}add(t){return this.appendChild(t)}getChildren(){const t=[];let e=this._firstChild;for(;e;)t.push(e),e=e._next;return t}isChildOf(t){return!!this.parent&&this.parent._uid===t._uid}isParentOf(t){return t.isChildOf(this)}isDescendantsOf(t){let e=this.parent;if(!e)return!1;do{if(e._uid===t._uid)return!0;e=e.parent}while(null!==e);return!1}isAncestorsOf(t){return t.isDescendantsOf(this)}getAncestor(t){throw new Error("暂不支持")}setAllDescendantsProps(t,e){let i=this._firstChild;for(;i;)i[t]=e,i.setAllDescendantsProps(t,e),i=i._next}setCount(t){this._count+=t;let e=this.parent;if(e)do{e._count+=t,e=e.parent}while(null!==e)}clone(){throw new Error("暂不支持")}cloneTo(t){throw new Error("暂不支持")}getParent(){return this.parent}del(t){return this.removeChild(t)}addEventListener(t,e,i){const r=s.isBoolean(i,!0)&&i||s.isObject(i)&&i.capture,n=s.isObject(i)&&i.once,a=s.isFunction(e)?void 0:e;return t=r?`${t}capture`:t,e=s.isFunction(e)?e:e.handleEvent,n?super.once(t,e,a):super.on(t,e,a),this}on(t,e,i){return this.addEventListener(t,e,i)}removeEventListener(t,e,i){const r=s.isBoolean(i,!0)&&i||s.isObject(i)&&i.capture,n=s.isFunction(e)?void 0:e;t=r?`${t}capture`:t,e=s.isFunction(e)?e:e.handleEvent;const a=s.isObject(i)&&i.once;return super.off(t,e,n,a),this}off(t,e,i){return this.removeEventListener(t,e,i)}once(t,e,i){return s.isObject(i)?(i.once=!0,this.addEventListener(t,e,i)):this.addEventListener(t,e,{once:!0})}removeAllEventListeners(){return super.removeAllListeners(),this}removeAllListeners(){return this.removeAllEventListeners()}dispatchEvent(t,...e){return super.emit(t.type,t,...e),!t.defaultPrevented}emit(t,e){return this.dispatchEvent(t,e)}release(){this.removeAllListeners()}}const St=s.tau-1e-8;class xt{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,r,n,a){if(Math.abs(n-r)>St)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let o,l,h,c,d=1/0,u=-1/0,p=1/0,g=-1/0;function m(t){h=i*Math.cos(t),c=i*Math.sin(t),h<d&&(d=h),h>u&&(u=h),c<p&&(p=c),c>g&&(g=c)}if(m(r),m(n),n!==r)if((r%=s.tau)<0&&(r+=s.tau),(n%=s.tau)<0&&(n+=s.tau),n<r&&(a=!a,o=r,r=n,n=o),a)for(n-=s.tau,o=r-r%s.halfPi,l=0;l<4&&o>n;++l,o-=s.halfPi)m(o);else for(o=r-r%s.halfPi+s.halfPi,l=0;l<4&&o<n;++l,o+=s.halfPi)m(o);this.bounds.add(t+d,e+p),this.bounds.add(t+u,e+g)}arcTo(t,e,i,s,r){this.bounds.add(t,e)}bezierCurveTo(t,e,i,s,r,n){this.bounds.add(t,e),this.bounds.add(i,s),this.bounds.add(r,n)}closePath(){}ellipse(){throw new Error("不支持ellipse")}lineTo(t,e){this.bounds.add(t,e)}moveTo(t,e){this.bounds.add(t,e)}quadraticCurveTo(t,e,i,s){this.bounds.add(t,e),this.bounds.add(i,s)}rect(t,e,i,s){this.bounds.add(t,e),this.bounds.add(t+i,e+s)}clear(){this.bounds.clear()}release(...t){}}class At{constructor(){this._curves=[],this.bounds=new s.AABBBounds}get curves(){return this._curves}getCurveLengths(){return this._curves.map((t=>t.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Tt=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Ct={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},kt={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let wt,Mt,Et,Bt,Pt,Ot;var It,Rt,Dt,Lt,Ft,Nt;function Ut(t){const e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],l=t[7],h=l*n,c=-o*a,d=o*n,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(r),f=Math.sin(r),v=.5*(r-s),y=Math.sin(.5*v),_=8/3*y*y/Math.sin(v),b=e+p-_*g,S=i+g+_*p,x=e+m,A=i+f,T=x+_*f,C=A-_*m;return[h*b+c*S,d*b+u*S,h*T+c*C,d*T+u*C,h*x+c*A,d*x+u*A]}function jt(t,e,i,r){const n=function(t,e,i,r,n,a,o,l,h){const c=s.degreeToRadian(o),d=Math.sin(c),u=Math.cos(c),p=u*(l-t)*.5+d*(h-e)*.5,g=u*(h-e)*.5-d*(l-t)*.5;let m=p*p/((i=Math.abs(i))*i)+g*g/((r=Math.abs(r))*r);m>1&&(m=Math.sqrt(m),i*=m,r*=m);const f=u/i,v=d/i,y=-d/r,_=u/r,b=f*l+v*h,S=y*l+_*h,x=f*t+v*e,A=y*t+_*e;let T=1/((x-b)*(x-b)+(A-S)*(A-S))-.25;T<0&&(T=0);let C=Math.sqrt(T);a===n&&(C=-C);const k=.5*(b+x)-C*(A-S),w=.5*(S+A)+C*(x-b),M=Math.atan2(S-w,b-k);let E=Math.atan2(A-w,x-k)-M;E<0&&1===a?E+=s.tau:E>0&&0===a&&(E-=s.tau);const B=Math.ceil(Math.abs(E/(s.halfPi+.001))),P=[];for(let t=0;t<B;++t){const e=M+t*E/B,s=M+(t+1)*E/B;P[t]=[k,w,e,s,i,r,d,u]}return P}(r[5],r[6],r[0],r[1],r[3],r[4],r[2],e,i);for(let e=0;e<n.length;++e){const i=Ut(n[e]);t.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5])}}!function(t){t[t.NONE=0]="NONE",t[t.UPDATE_BOUNDS=1]="UPDATE_BOUNDS",t[t.UPDATE_SHAPE=2]="UPDATE_SHAPE",t[t.CLEAR_SHAPE=253]="CLEAR_SHAPE",t[t.UPDATE_SHAPE_AND_BOUNDS=3]="UPDATE_SHAPE_AND_BOUNDS",t[t.INIT=179]="INIT",t[t.CLEAR_BOUNDS=254]="CLEAR_BOUNDS",t[t.UPDATE_GLOBAL_MATRIX=32]="UPDATE_GLOBAL_MATRIX",t[t.CLEAR_GLOBAL_MATRIX=223]="CLEAR_GLOBAL_MATRIX",t[t.UPDATE_LOCAL_MATRIX=16]="UPDATE_LOCAL_MATRIX",t[t.CLEAR_LOCAL_MATRIX=239]="CLEAR_LOCAL_MATRIX",t[t.UPDATE_GLOBAL_LOCAL_MATRIX=48]="UPDATE_GLOBAL_LOCAL_MATRIX",t[t.UPDATE_PAINT=64]="UPDATE_PAINT",t[t.CLEAR_PAINT=191]="CLEAR_PAINT",t[t.UPDATE_LAYOUT=128]="UPDATE_LAYOUT",t[t.CLEAR_LAYOUT=127]="CLEAR_LAYOUT"}(It||(It={})),function(t){t[t.GLOBAL=1]="GLOBAL",t[t.LOCAL=16]="LOCAL",t[t.GLOBAL_ACCURATE=3]="GLOBAL_ACCURATE",t[t.LOCAL_ACCURATE=48]="LOCAL_ACCURATE"}(Rt||(Rt={})),function(t){t[t.INIT=0]="INIT",t[t.DEFAULT=1]="DEFAULT",t[t.STATE=2]="STATE",t[t.ANIMATE_BIND=10]="ANIMATE_BIND",t[t.ANIMATE_PLAY=11]="ANIMATE_PLAY",t[t.ANIMATE_START=12]="ANIMATE_START",t[t.ANIMATE_UPDATE=13]="ANIMATE_UPDATE",t[t.ANIMATE_END=14]="ANIMATE_END",t[t.TRANSLATE=20]="TRANSLATE",t[t.TRANSLATE_TO=21]="TRANSLATE_TO",t[t.SCALE=22]="SCALE",t[t.SCALE_TO=23]="SCALE_TO",t[t.ROTATE=24]="ROTATE",t[t.ROTATE_TO=25]="ROTATE_TO"}(Dt||(Dt={})),function(t){t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(Lt||(Lt={})),function(t){t[t.CubicBezierCurve=0]="CubicBezierCurve",t[t.QuadraticBezierCurve=1]="QuadraticBezierCurve",t[t.ArcCurve=2]="ArcCurve",t[t.LineCurve=3]="LineCurve",t[t.EllipseCurve=4]="EllipseCurve",t[t.MoveCurve=5]="MoveCurve"}(Ft||(Ft={})),function(t){t[t.beforeFillStroke=0]="beforeFillStroke",t[t.afterFillStroke=1]="afterFillStroke"}(Nt||(Nt={}));const Vt=[(t,e,i,s,r,n,a)=>e.arc(t[1]*r+i,t[2]*n+s,t[3]*(r+n)/2,t[4],t[5],t[6],a),(t,e,i,s,r,n,a)=>e.arcTo(t[1]*r+i,t[2]*n+s,t[3]*r+i,t[4]*n+s,t[5]*(r+n)/2,a),(t,e,i,s,r,n,a)=>e.bezierCurveTo(t[1]*r+i,t[2]*n+s,t[3]*r+i,t[4]*n+s,t[5]*r+i,t[6]*n+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,r,n)=>e.ellipse(t[1]*r+i,t[2]*n+s,t[3]*r,t[4]*n,t[5],t[6],t[7],t[8]),(t,e,i,s,r,n,a)=>e.lineTo(t[1]*r+i,t[2]*n+s,a),(t,e,i,s,r,n,a)=>e.moveTo(t[1]*r+i,t[2]*n+s,a),(t,e,i,s,r,n,a)=>e.quadraticCurveTo(t[1]*r+i,t[2]*n+s,t[3]*r+i,t[4]*n+s,a),(t,e,i,s,r,n,a)=>e.rect(t[1]*r+i,t[2]*n+s,t[3]*r,t[4]*n,a)];function Gt(t,e,i=0,s=0,r=1,n=1,a){for(let o=0;o<t.length;o++){const l=t[o];Vt[l[0]](l,e,i,s,r,n,a)}}class zt{getLength(t){return null!=t?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function Kt(t,e){let i=0;const r=t.length;for(let n=0;n<r;n++){const a=t[n],o=e[n],l=t[(n+1)%r],h=e[(n+1)%r];i+=s.PointService.distanceNN(a,o,l,h)}return i/2}function Ht(t,e,i,s,r){const n=1-r;return n*n*n*t+3*e*r*n*n+3*i*r*r*n+s*r*r*r}function Wt(t,e,i,r,n){const a=Ht(t.x,e.x,i.x,r.x,n),o=Ht(t.y,e.y,i.y,r.y,n);return new s.Point(a,o)}function $t(t,e,i,s){const r=1-s;return r*r*t+2*r*s*e+s*s*i}function Yt(t,e,i,r){const n=$t(t.x,e.x,i.x,r),a=$t(t.y,e.y,i.y,r);return new s.Point(n,a)}class Xt extends zt{constructor(t,e,i,s){super(),this.type=Ft.CubicBezierCurve,this.p0=t,this.p1=e,this.p2=i,this.p3=s}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y+this.p3.x+this.p3.y)}getPointAt(t){if(!1!==this.defined)return Wt(this.p0,this.p1,this.p2,this.p3,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,s=this.p3,Kt([t.x,e.x,i.x,s.x],[t.y,e.y,i.y,s.y])):60;var t,e,i,s}calcProjLength(t){return t===Lt.ROW?s.abs(this.p0.x-this.p3.x):t===Lt.COLUMN?s.abs(this.p0.y-this.p3.y):0}getAngleAt(t){const e=s.max(t-.01,0),i=s.min(t+.01,1),r=this.getPointAt(e),n=this.getPointAt(i);return s.atan2(n.y-r.y,n.x-r.x)}draw(t,e,i,r,n,a){if(t.moveTo(this.p0.x*r+e,this.p0.y*n+i),a>=1)t.bezierCurveTo(this.p1.x*r+e,this.p1.y*n+i,this.p2.x*r+e,this.p2.y*n+i,this.p3.x*r+e,this.p3.y*n+i);else if(a>0){const[o]=function(t,e){const{p0:i,p1:r,p2:n,p3:a}=t,o=Wt(i,r,n,a,e),l=s.PointService.pointAtPP(i,r,e),h=s.PointService.pointAtPP(r,n,e),c=s.PointService.pointAtPP(n,a,e),d=s.PointService.pointAtPP(l,h,e),u=s.PointService.pointAtPP(h,c,e);return[new Xt(i,l,d,o),new Xt(o,u,c,a)]}(this,a);t.bezierCurveTo(o.p1.x*r+e,o.p1.y*n+i,o.p2.x*r+e,o.p2.y*n+i,o.p3.x*r+e,o.p3.y*n+i)}}includeX(t){const e=s.min(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=s.max(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=s.min(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(s.max(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}class qt extends zt{constructor(t,e){super(),this.type=Ft.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return s.PointService.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=s.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?s.PointService.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Lt.ROW?s.abs(this.p0.x-this.p1.x):t===Lt.COLUMN?s.abs(this.p0.y-this.p1.y):0}draw(t,e,i,s,r,n){if(t.moveTo(this.p0.x*s+e,this.p0.y*r+i),n>=1)t.lineTo(this.p1.x*s+e,this.p1.y*r+i);else if(n>0){const a=this.getPointAt(n);t.lineTo(a.x*s+e,a.y*r+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class Zt{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,r,n,a,o,l){const h=new Xt(new s.Point(this._lastX,this._lastY),new s.Point(t,e),new s.Point(i,r),new s.Point(n,a));h.originP1=this._lastOriginP,h.originP2=l,h.defined=o,this.curves.push(h),this._lastX=n,this._lastY=a,this._lastOriginP=l}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const r=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(r),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,r,n){const a=new qt(new s.Point(this._lastX,this._lastY),new s.Point(t,e));return a.originP1=r,a.originP2=n,a.defined=i,a}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Lt.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],r=null!==(e=i.p3)&&void 0!==e?e:i.p1;return s.abs(t.p0.y-r.y)}if(t===Lt.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],r=null!==(i=e.p3)&&void 0!==i?i:e.p1;return s.abs(t.p0.x-r.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Jt extends Zt{bezierCurveTo(t,e,i,s,r,n,a,o){return super.bezierCurveTo(e,t,s,i,n,r,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Qt(t,e,i=1){let s=!1;for(let i=0,r=e.length;i<=r;i++)i>=r===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function te(t,e,i){const r=null!=e?e:s.abs(i[i.length-1].x-i[0].x)>s.abs(i[i.length-1].y-i[0].y)?Lt.ROW:Lt.COLUMN;return"monotoneY"===t?new Jt(t,r):new Zt(t,r)}class ee{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function ie(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const r=te("linear",i,t);return function(t,e){Qt(t,e,1)}(new ee(r,s),t),r}function se(t,e,i,s,r){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class re{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&se(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:se(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function ne(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return ie(t,e);const r=te("basis",i,t);return function(t,e){Qt(t,e,2)}(new re(r,s),t),r}function ae(t){return t<0?-1:1}function oe(t,e,i){const s=t._x1-t._x0,r=e-t._x1,n=(t._y1-t._y0)/(s||Number(r<0&&-0)),a=(i-t._y1)/(r||Number(s<0&&-0)),o=(n*r+a*s)/(s+r);return(ae(n)+ae(a))*Math.min(Math.abs(n),Math.abs(a),.5*Math.abs(o))||0}function le(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function he(t,e,i,s,r){const n=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-n)/3;t.context.bezierCurveTo(n+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class ce{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:he(this,this._t0,le(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,he(this,le(this,e=oe(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:he(this,this._t0,e=oe(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class de extends ce{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function ue(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return ie(t,e);const r=te("monotoneX",i,t);return function(t,e){Qt(t,e,2)}(new ce(r,s),t),r}function pe(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return ie(t,e);const r=te("monotoneY",i,t);return function(t,e){Qt(t,e,2)}(new de(r,s),t),r}let ge=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0<this._t&&this._t<1&&2===this._point&&this.context.lineTo(this._x,this._y,!1!==this._lastDefined,this.lastPoint),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class me extends ge{lineEnd(){this.context.closePath()}}function fe(t,e,i={}){const{direction:r,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const a=new Zt("step",null!=r?r:s.abs(t[t.length-1].x-t[0].x)>s.abs(t[t.length-1].y-t[0].y)?Lt.ROW:Lt.COLUMN);return ve(new ge(a,e,n),t),a}function ve(t,e){return Qt(t,e,1)}class ye extends ee{lineEnd(){this.context.closePath()}}function _e(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const r=te("linear",i,t);return function(t,e){Qt(t,e,1)}(new ye(r,s),t),r}function be(t,e,i,r,n){let a=t._x1,o=t._y1,l=t._x2,h=t._y2;if(t._l01_a>s.epsilon){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);a=(a*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,o=(o*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>s.epsilon){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,r=3*t._l23_a*(t._l23_a+t._l12_a);l=(l*s+t._x1*t._l23_2a-e*t._l12_2a)/r,h=(h*s+t._y1*t._l23_2a-i*t._l12_2a)/r}t.context.bezierCurveTo(a,o,l,h,t._x2,t._y2,r,t.lastPoint1)}function Se(t,e){return function(i,s,r={}){const{direction:n,startPoint:a}=r;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return ie(i,r);const o=te(t,n,i);return Qt(new e(o,s,a),i,2),o}}const xe=Se("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:be(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Ae=Se("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:be(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Te extends zt{constructor(t,e,i){super(),this.type=Ft.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Yt(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,Kt([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Lt.ROW?s.abs(this.p0.x-this.p2.x):t===Lt.COLUMN?s.abs(this.p0.y-this.p2.y):0}getAngleAt(t){const e=s.max(t-.01,0),i=s.min(t+.01,1),r=this.getPointAt(e),n=this.getPointAt(i);return s.atan2(n.y-r.y,n.x-r.x)}draw(t,e,i,r,n,a){if(t.moveTo(this.p0.x*r+e,this.p0.y*n+i),a>=1)t.quadraticCurveTo(this.p1.x*r+e,this.p1.y*n+i,this.p2.x*r+e,this.p2.y*n+i);else if(a>0){const[o]=function(t,e){const{p0:i,p1:r,p2:n}=t,a=Yt(i,r,n,e),o=s.PointService.pointAtPP(i,r,e),l=s.PointService.pointAtPP(r,n,e);return[new Te(i,o,a),new Te(a,l,n)]}(this,a);t.quadraticCurveTo(o.p1.x*r+e,o.p1.y*n+i,o.p2.x*r+e,o.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Ce{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new qt(new s.Point(this._lastX,this._lastY),new s.Point(t,e))}quadraticCurveTo(t,e,i,r){const n=new Te(new s.Point(this._lastX,this._lastY),new s.Point(t,e),new s.Point(i,r));this.path.addCurve(n),this._lastX=i,this._lastY=r}bezierCurveTo(t,e,i,r,n,a){const o=new Xt(new s.Point(this._lastX,this._lastY),new s.Point(t,e),new s.Point(i,r),new s.Point(n,a));this.path.addCurve(o),this._lastX=n,this._lastY=a}arcTo(t,e,i,s,r){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,r,n,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,r,n){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function ke(t,e,i){var r,n;switch(e){case"linear":default:return ie(t,i);case"basis":return ne(t,i);case"monotoneX":return ue(t,i);case"monotoneY":return pe(t,i);case"step":return fe(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:r,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const a=new Zt("step",null!=r?r:s.abs(t[t.length-1].x-t[0].x)>s.abs(t[t.length-1].y-t[0].y)?Lt.ROW:Lt.COLUMN);return ve(new me(a,e,n),t),a}(t,.5,i);case"stepBefore":return fe(t,0,i);case"stepAfter":return fe(t,1,i);case"catmullRom":return xe(t,null!==(r=null==i?void 0:i.curveTension)&&void 0!==r?r:.5,i);case"catmullRomClosed":return Ae(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return _e(t,i)}}class we extends At{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new xt(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([kt.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([kt.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([kt.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,r,n){return this.commandList.push([kt.C,t,e,i,s,r,n]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,r,n),this}arcTo(t,e,i,s,r){return this.commandList.push([kt.AT,t,e,i,s,r]),this._ctx&&this._ctx.arcTo(t,e,i,s,r),this}ellipse(t,e,i,s,r,n,a,o){return this.commandList.push([kt.E,t,e,i,s,r,n,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,r,n,a,o),this}rect(t,e,i,s){return this.commandList.push([kt.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,r,n){return this.commandList.push([kt.A,t,e,i,s,r,n]),this._ctx&&this._ctx.arc(t,e,i,s,r,n),this}closePath(){return this.commandList.push([kt.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Ce(this);Gt(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[kt.M]=t=>`M${t[1]} ${t[2]}`,t[kt.L]=t=>`L${t[1]} ${t[2]}`,t[kt.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[kt.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[kt.A]=t=>{const e=[],i=t[1],s=t[2],r=t[3];((t,e,i,s,r,n,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e<u;e++){const i=h+p*e,l=h+p*(e+1),c=4/3*Math.tan(Math.abs(p)/4),d=Math.cos(i),u=Math.sin(i),g=Math.cos(l),m=Math.sin(l),f=d*n+s,v=u*a+r,y=g*n+s,_=m*a+r,b=o?-1:1,S=n*c*b,x=a*c*b;t.push(f-S*u,v+x*d,y+S*m,_-x*g,y,_)}})(e,t[4],t[5],i,s,r,r,t[6]);let n="";for(let t=0;t<e.length;t+=6)n+=`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`;return n},t[kt.R]=t=>`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[kt.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,r){this.clear();const n=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const r=[];for(let t=0,n=e.length;t<n;t++)if(wt=e[t],Mt=wt.slice(1),Et=wt[0],i=[Et],s=Mt.match(Tt),null!==s){for(let t=0,e=s.length;t<e;t++)Bt=s[t],Pt=parseFloat(Bt),Number.isNaN(Pt)||i.push(Pt);if(Ot=Ct[Et],i.length-1>Ot){let t,e=Et;for(let s=1,n=i.length;s<n;s+=Ot){t=[e];for(let e=s,r=s+Ot;e<r;e++)t.push(i[e]);r.push(t),"m"===e?e="l":"M"===e&&(e="L")}}else r.push(i)}else r.push(i);return r}(t);return this._runCommandStrList(n,e,i,s,r),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const r=ke(e,i);"x"===s?this.direction=Lt.ROW:"y"===s?this.direction=Lt.COLUMN:"auto"===s&&(this.direction=r.direction),this._curves=r.curves}fromCustomPath2D(t,e,i,s,r){return this.clear(),this._runCommandList(t.commandList,e,i,s,r),this._updateBounds(),this}transform(t,e,i,s){const r=this.commandList;if(!this.transformCbList){const t=[];t[kt.M]=this.moveToTransform,t[kt.L]=this.lineToTransform,t[kt.Q]=this.quadraticCurveToTransform,t[kt.C]=this.bezierCurveToTransform,t[kt.AT]=this.arcToTransform,t[kt.E]=this.ellipseTransform,t[kt.R]=this.rectTransform,t[kt.A]=this.arcTransform,t[kt.Z]=this.closePathTransform,this.transformCbList=t}r.forEach((r=>{this.transformCbList[r[0]](r,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i}lineToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i}quadraticCurveToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s+e,t[4]=t[4]*r+i}bezierCurveToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s+e,t[4]=t[4]*r+i,t[5]=t[5]*s+e,t[6]=t[6]*r+i}arcToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s+e,t[4]=t[4]*r+i,t[5]=t[5]*(s+r)/2}ellipseTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s,t[4]=t[4]*r}rectTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s,t[4]=t[4]*r}arcTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*(s+r)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,r=1){let n,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m<f;++m){switch(n=t[m],1===s&&1===r||(n=Ee(n,s,r)),n[0]){case"l":d+=n[1],u+=n[2],this.lineTo(d+e,u+i);break;case"L":d=n[1],u=n[2],this.lineTo(d+e,u+i);break;case"h":d+=n[1],this.lineTo(d+e,u+i);break;case"H":d=n[1],this.lineTo(d+e,u+i);break;case"v":u+=n[1],this.lineTo(d+e,u+i);break;case"V":u=n[1],this.lineTo(d+e,u+i);break;case"m":d+=n[1],u+=n[2],this.moveTo(d+e,u+i);break;case"M":d=n[1],u=n[2],this.moveTo(d+e,u+i);break;case"c":a=d+n[5],o=u+n[6],p=d+n[3],g=u+n[4],this.bezierCurveTo(d+n[1]+e,u+n[2]+i,p+e,g+i,a+e,o+i),d=a,u=o;break;case"C":d=n[5],u=n[6],p=n[3],g=n[4],this.bezierCurveTo(n[1]+e,n[2]+i,p+e,g+i,d+e,u+i);break;case"s":a=d+n[3],o=u+n[4],null===c[0].match(/[CcSs]/)?(p=d,g=u):(p=2*d-p,g=2*u-g),l=d+n[1],h=u+n[2],this.bezierCurveTo(p+e,g+i,l+e,h+i,a+e,o+i),p=l,g=h,d=a,u=o;break;case"S":a=n[3],o=n[4],null===c[0].match(/[CcSs]/)?(p=d,g=u):(p=2*d-p,g=2*u-g),l=n[1],h=n[2],this.bezierCurveTo(p+e,g+i,l+e,h+i,a+e,o+i),p=l,g=h,d=a,u=o;break;case"q":a=d+n[3],o=u+n[4],p=d+n[1],g=u+n[2],this.quadraticCurveTo(p+e,g+i,a+e,o+i),d=a,u=o;break;case"Q":a=n[3],o=n[4],this.quadraticCurveTo(n[1]+e,n[2]+i,a+e,o+i),d=a,u=o,p=n[1],g=n[2];break;case"t":a=d+n[1],o=u+n[2],null===c[0].match(/[QqTt]/)?(p=d,g=u):"t"===c[0]?(p=2*d-l,g=2*u-h):"q"===c[0]&&(p=2*d-p,g=2*u-g),l=p,h=g,this.quadraticCurveTo(p+e,g+i,a+e,o+i),d=a,u=o,p=d+n[1],g=u+n[2];break;case"T":a=n[1],o=n[2],p=2*d-p,g=2*u-g,this.quadraticCurveTo(p+e,g+i,a+e,o+i),d=a,u=o;break;case"a":jt(this,d+e,u+i,[n[1],n[2],n[3],n[4],n[5],n[6]+d+e,n[7]+u+i]),d+=n[6],u+=n[7];break;case"A":jt(this,d+e,u+i,[n[1],n[2],n[3],n[4],n[5],n[6]+e,n[7]+i]),d=n[6],u=n[7];break;case"z":case"Z":this.closePath()}c=n}}_runCommandList(t,e=0,i=0,s=1,r=1){if(0!==e||0!==i||1!==s||1!==r)for(let n=0,a=t.length;n<a;++n){const a=t[n].slice();switch(a[0]){case kt.L:this.lineToTransform(a,e,i,s,r);break;case kt.M:this.moveToTransform(a,e,i,s,r);break;case kt.C:this.bezierCurveToTransform(a,e,i,s,r);break;case kt.Q:this.quadraticCurveToTransform(a,e,i,s,r);break;case kt.A:this.arcToTransform(a,e,i,s,r);break;case kt.E:this.ellipseTransform(a,e,i,s,r);break;case kt.R:this.rectTransform(a,e,i,s,r);break;case kt.AT:this.arcToTransform(a,e,i,s,r);break;case kt.Z:this.closePath()}}else this.commandList=t.map((t=>t.slice()))}_updateBounds(){this.bounds.clear(),Gt(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Lt.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return s.abs(t.p0.y-e.p1.y)}if(this.direction===Lt.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return s.abs(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e<this.curves.length;e++){const i=this.curves[e];if(i.includeX(t))return i.getYAt(t)}return 1/0}getAttrAt(t){if(!this._curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s<this._curves.length;s++){e=this._curves[s];const r=e.getLength(this.direction);if(i+r>=t)break;i+=r}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,r){this.tryBuildCurves();const n=this.getLength()*r;let a=0;for(let r=0;r<this._curves.length;r++){const o=this._curves[r],l=o.getLength(this.direction);if(!(a+l<=n)){const r=1-(a+l-n)/l;o.draw(t,i,s,e,e,r);break}o.draw(t,i,s,e,e,1),a+=l}}}const Me=["l",0,0,0,0,0,0,0];function Ee(t,e,i){const s=Me[0]=t[0];if("a"===s||"A"===s)Me[1]=e*t[1],Me[2]=i*t[2],Me[3]=t[3],Me[4]=t[4],Me[5]=t[5],Me[6]=e*t[6],Me[7]=i*t[7];else if("h"===s||"H"===s)Me[1]=e*t[1];else if("v"===s||"V"===s)Me[1]=i*t[1];else for(let s=1,r=t.length;s<r;++s)Me[s]=(s%2==1?e:i)*t[s];return Me}var Be,Pe,Oe,Ie;!function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Be||(Be={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Pe||(Pe={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Oe||(Oe={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Ie||(Ie={}));const Re={x:0,y:0,z:0,dx:0,dy:0,dz:0,scrollX:0,scrollY:0,scaleX:1,scaleY:1,scaleZ:1,angle:0,alpha:0,beta:0,scaleCenter:[0,0],anchor:[0,0],anchor3d:[0,0],postMatrix:new s.Matrix},De={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},Le=Object.assign({outerBorder:Object.assign(Object.assign({},De),{distance:0}),innerBorder:Object.assign(Object.assign({},De),{distance:0})},De),Fe={text:"",maxLineWidth:1/0,maxWidth:1/0,textAlign:"left",textBaseline:"alphabetic",fontSize:16,fontFamily:"PingFang SC,Microsoft Yahei,system-ui,'-apple-system',segoe ui,\n Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",fontWeight:"",ellipsis:"…",fontVariant:"",fontStyle:"",lineHeight:void 0,underline:0,lineThrough:0,scaleIn3d:!1,direction:"horizontal",wordBreak:"break-all",ignoreBuf:!1,verticalMode:0,wrap:!1,whiteSpace:"no-wrap",heightLimit:1/0,lineClamp:1/0,suffixPosition:"end",underlineDash:[],underlineOffset:0,disableAutoClipedPoptip:void 0,measureMode:Be.fontBounding,keepCenterInLine:!1},Ne=Object.assign(Object.assign(Object.assign(Object.assign({forceBoundsWidth:void 0,forceBoundsHeight:void 0,opacity:1,background:null,autoAnimateTexture:!1,textureRatio:1,textureOptions:null,backgroundOpacity:1,backgroundCornerRadius:0,texture:null,textureColor:"black",textureSize:10,texturePadding:2,backgroundMode:"no-repeat",backgroundFit:!0,backgroundKeepAspectRatio:!1,backgroundClip:!0,backgroundScale:1,backgroundOffsetX:0,backgroundOffsetY:0,backgroundPosition:"top-left",blur:0,filter:"",cursor:null,html:null,react:null,vue:null},{fillOpacity:1,fill:!1,shadowBlur:0,shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0}),Le),{alignSelf:"auto"}),{pickStrokeBuffer:0}),Ue={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},je=Object.assign(Object.assign(Object.assign({strokeSeg:null,renderable:!0,pickable:!0,shadowGraphic:void 0,childrenPickable:!0,fillPickable:!0,strokePickable:!0,visible:!0,zIndex:0,layout:null,boundsPadding:0,fillStrokeOrder:0,renderStyle:"default",pickMode:"accurate",customPickShape:null,boundsMode:"accurate",keepDirIn3d:!0,shadowRootIdx:1,globalZIndex:1,globalCompositeOperation:"",overflow:"hidden",shadowPickMode:"graphic",keepStrokeScale:!1,clipConfig:null,roughStyle:null},{_debug_bounds:!1}),Ne),Re),Ve=Object.assign(Object.assign({},je),{startAngle:0,endAngle:s.pi2,innerRadius:0,outerRadius:1,innerPadding:0,outerPadding:0,cornerRadius:0,padRadius:0,padAngle:0,clipRange:1,cap:!1,forceShowCap:!1}),Ge=Object.assign(Object.assign(Object.assign({},je),Ue),{points:[],segments:[],curveType:"linear",clipRange:1,closePath:!1,curveTension:1}),ze=Object.assign(Object.assign({},je),{radius:1,startAngle:0,endAngle:s.pi2}),Ke=Object.assign(Object.assign({},je),{width:0,height:0,cornerRadius:0,path:[],clip:!1,visibleAll:!0,display:"relative",flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-start",alignItems:"flex-start",alignContent:"flex-start",baseOpacity:1,cornerType:"round"}),He=Object.assign(Object.assign({},je),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),We=Object.assign(Object.assign(Object.assign({},je),Ue),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default",closePath:!1,curveTension:1}),$e=Object.assign(Object.assign({},je),{path:new we,fillStrokeOrder:1,clipRange:1,customPath:()=>{s.Logger.getInstance().warn("空函数")}}),Ye=Object.assign(Object.assign({},je),{points:[],cornerRadius:0,closePath:!0}),Xe=Object.assign(Object.assign({},je),{width:100,height:100,spikes:5,thickness:.5}),qe=Object.assign(Object.assign({},je),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},je),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const Ze=Object.assign(Object.assign({},je),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),Je=Object.assign(Object.assign(Object.assign({},je),Fe),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Qe=Object.assign(Object.assign(Object.assign({},je),Fe),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ti=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},je),{fill:!0,cornerRadius:0,cornerType:"round"}),ei=Object.assign(Object.assign({},ti),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});class ii{static GetImage(t,e){var i;const s=ii.cache.get(t);s?"fail"===s.loadState?dt.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):ii.loadImage(t,e)}static GetSvg(t,e){var i;let s=ii.cache.get(t);s?"fail"===s.loadState?dt.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},ii.cache.set(t,s),s.dataPromise=dt.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,r)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=ii.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},ii.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=dt.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=dt.global.loadBlob(t):"json"===e&&(i.dataPromise=dt.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!ii.isLoading&&ii.toLoadAueue.length){ii.isLoading=!0;const t=ii.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,r={type:"image",loadState:"init"};if(ii.cache.set(i,r),r.dataPromise=dt.global.loadImage(i),r.dataPromise){r.waitingMark=s;const t=r.dataPromise.then((t=>{var e;r.loadState=(null==t?void 0:t.data)?"success":"fail",r.data=null==t?void 0:t.data,null===(e=r.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(r.loadState="success",r.data=t.data,e.imageLoadSuccess(i,t.data)):(r.loadState="fail",e.imageLoadFail(i))})),r.waitingMark&&(r.waitingMark=[])}));e.push(t)}else r.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{ii.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),ii.loading()})).catch((t=>{console.error(t),ii.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),ii.loading()}))}}),0)}static loadImage(t,e){const i=si(t,ii.toLoadAueue);if(-1!==i)return ii.toLoadAueue[i].marks.push(e),void ii.loading();ii.toLoadAueue.push({url:t,marks:[e]}),ii.loading()}static improveImageLoading(t){const e=si(t,ii.toLoadAueue);if(-1!==e){const t=ii.toLoadAueue.splice(e,1);ii.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function si(t,e){for(let i=0;i<e.length;i++)if(e[i].url===t)return i;return-1}var ri;ii.cache=new Map,ii.isLoading=!1,ii.toLoadAueue=[],ii.onLoadSuccessCb=[],function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(ri||(ri={}));const ni=[0,0,0,0],ai=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],oi=[1,2,3,0,1,2,3,0];function li(t,e,i,r){for(;t>=s.pi2;)t-=s.pi2;for(;t<0;)t+=s.pi2;for(;t>e;)e+=s.pi2;ai[0].x=i,ai[1].y=i,ai[2].x=-i,ai[3].y=-i;const n=Math.ceil(t/s.halfPi)%4,a=Math.ceil(e/s.halfPi)%4;if(r.add(s.cos(t)*i,s.sin(t)*i),r.add(s.cos(e)*i,s.sin(e)*i),n!==a||e-t>s.pi){let t=!1;for(let e=0;e<oi.length;e++)if(t||n!==oi[e]){if(t&&a===oi[e])break;if(t){const t=ai[oi[e]];r.add(t.x,t.y)}}else{t=!0;const e=ai[n];r.add(e.x,e.y)}}}function hi(t,e,i){const{x:r,y:n}=s.pointAt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=s.pointAt(t.x1,t.y1,e.x1,e.y1,i),l=new s.Point(r,n,a,o);return l.defined=e.defined,l}function ci(t,e,i){if(!t||!e)return[];Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]);let r=[];if(t.length>e.length){r=e.map((t=>{const e=new s.Point(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s<e.length;s++)r[s]=hi(t[s],e[s],i)}else{r=e.map((t=>{const e=new s.Point(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s<t.length;s++)r[s]=hi(t[s],e[s],i)}return r}class di{bounds(t,e){if(s.isNumber(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return s.isNumber(t)?t:Math.min(t[0],t[1])}}function ui(t,e,i,r,n){return n?t.arc(i,r,e,0,s.tau,!1,n):t.arc(i,r,e,0,s.tau),!1}var pi=new class extends di{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,r){return ui(t,this.parseSize(e)/2,i,s,r)}drawOffset(t,e,i,s,r,n){return ui(t,this.parseSize(e)/2+r,i,s,n)}drawToSvgPath(t,e,i,s){const r=this.parseSize(t)/2;return`M ${e-r}, ${i} a ${r},${r} 0 1,0 ${2*r},0 a ${r},${r} 0 1,0 -${2*r},0`}};var gi=new class extends di{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,r){return function(t,e,i,s,r){return t.moveTo(-3*e+i,-e+s,r),t.lineTo(-e+i,-e+s,r),t.lineTo(-e+i,-3*e+s,r),t.lineTo(e+i,-3*e+s,r),t.lineTo(e+i,-e+s,r),t.lineTo(3*e+i,-e+s,r),t.lineTo(3*e+i,e+s,r),t.lineTo(e+i,e+s,r),t.lineTo(e+i,3*e+s,r),t.lineTo(-e+i,3*e+s,r),t.lineTo(-e+i,e+s,r),t.lineTo(-3*e+i,e+s,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,r)}drawOffset(t,e,i,s,r,n){return function(t,e,i,s,r,n){return t.moveTo(-3*e+i-r,-e+s-r,n),t.lineTo(-e+i-r,-e+s-r,n),t.lineTo(-e+i-r,-3*e+s-r,n),t.lineTo(e+i+r,-3*e+s-r,n),t.lineTo(e+i+r,-e+s-r,n),t.lineTo(3*e+i+r,-e+s-r,n),t.lineTo(3*e+i+r,e+s+r,n),t.lineTo(e+i+r,e+s+r,n),t.lineTo(e+i+r,3*e+s+r,n),t.lineTo(-e+i-r,3*e+s+r,n),t.lineTo(-e+i-r,e+s+r,n),t.lineTo(-3*e+i-r,e+s+r,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,r,n)}};function mi(t,e,i,s,r){return t.moveTo(i,s-e,r),t.lineTo(e+i,s,r),t.lineTo(i,s+e,r),t.lineTo(i-e,s,r),t.closePath(),!0}var fi=new class extends di{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,r){return mi(t,this.parseSize(e)/2,i,s,r)}drawFitDir(t,e,i,s,r){return mi(t,this.parseSize(e)/2,i,s,r)}drawOffset(t,e,i,s,r,n){return mi(t,this.parseSize(e)/2+r,i,s,n)}};function vi(t,e,i,s){const r=2*e;return t.rect(i-e,s-e,r,r),!1}var yi=new class extends di{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return vi(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return vi(t,this.parseSize(e)/2+r,i,s)}};function _i(t,e,i,s,r=0){return t.moveTo(i+e+2*r,e+s+r),t.lineTo(i-e-2*r,e+s+r),t.lineTo(i,s-e-2*r),t.closePath(),!0}class bi extends di{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return _i(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return _i(t,this.parseSize(e)/2,i,s,r)}}var Si=new bi;var xi=new class extends bi{constructor(){super(...arguments),this.type="triangle"}};const Ai=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Ti=Math.sin(s.tau/10)*Ai,Ci=-Math.cos(s.tau/10)*Ai;function ki(t,e,i,r){const n=Ti*e,a=Ci*e;t.moveTo(i,-e+r),t.lineTo(n+i,a+r);for(let o=1;o<5;++o){const l=s.tau*o/5,h=Math.cos(l),c=Math.sin(l);t.lineTo(c*e+i,-h*e+r),t.lineTo(h*n-c*a+i,c*n+h*a+r)}return t.closePath(),!0}var wi=new class extends di{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return ki(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return ki(t,this.parseSize(e)/2+r,i,s)}};const Mi=s.sqrt(3);function Ei(t,e,i,s){const r=e,n=r/Mi,a=n/5,o=e;return t.moveTo(0+i,-r+s),t.lineTo(n/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-n/2+i,s),t.closePath(),!0}var Bi=new class extends di{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Ei(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Ei(t,this.parseSize(e)/2+r,i,s)}};function Pi(t,e,i,s){const r=2*e;return t.moveTo(i,-e+s),t.lineTo(r/3/2+i,e+s),t.lineTo(-r/3/2+i,e+s),t.closePath(),!0}var Oi=new class extends di{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Pi(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Pi(t,this.parseSize(e)/2+r,i,s)}};function Ii(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Ri=new class extends di{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Ii(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Ii(t,this.parseSize(e)/2+r,i,s)}};const Di=-.5,Li=s.sqrt(3)/2,Fi=1/s.sqrt(12);function Ni(t,e,i,s){const r=e/2,n=e*Fi,a=r,o=e*Fi+e,l=-a,h=o;return t.moveTo(r+i,n+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Di*r-Li*n+i,Li*r+Di*n+s),t.lineTo(Di*a-Li*o+i,Li*a+Di*o+s),t.lineTo(Di*l-Li*h+i,Li*l+Di*h+s),t.lineTo(Di*r+Li*n+i,Di*n-Li*r+s),t.lineTo(Di*a+Li*o+i,Di*o-Li*a+s),t.lineTo(Di*l+Li*h+i,Di*h-Li*l+s),t.closePath(),!1}var Ui=new class extends di{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Ni(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Ni(t,this.parseSize(e)/2+r,i,s)}};function ji(t,e,i,s,r){return t.moveTo(-e+i-2*r,s),t.lineTo(e+i+r,e+s+2*r),t.lineTo(e+i+r,s-e-2*r),t.closePath(),!0}var Vi=new class extends di{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return ji(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,r){return ji(t,this.parseSize(e)/2,i,s,r)}};function Gi(t,e,i,s,r=0){return t.moveTo(i-e-r,e+s+2*r),t.lineTo(e+i+2*r,s),t.lineTo(i-e-r,s-e-2*r),t.closePath(),!0}var zi=new class extends di{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return Gi(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Gi(t,this.parseSize(e)/2,i,s,r)}};function Ki(t,e,i,s,r=0){return t.moveTo(i-e-2*r,s-e-r),t.lineTo(i+e+2*r,s-e-r),t.lineTo(i,s+e+2*r),t.closePath(),!0}var Hi=new class extends di{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return Ki(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Ki(t,this.parseSize(e)/2,i,s,r)}};const Wi=s.sqrt(3);function $i(t,e,i,s){const r=e*Wi;return t.moveTo(i,s+-r/3*2),t.lineTo(e+i,s+r),t.lineTo(i-e,s+r),t.closePath(),!0}var Yi=new class extends di{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return $i(t,this.parseSize(e)/2/Wi,i,s)}drawOffset(t,e,i,s,r){return $i(t,this.parseSize(e)/2/Wi+r,i,s)}};function Xi(t,e,i,s){const r=2*e;return t.moveTo(e+i,s-r),t.lineTo(i-e,s),t.lineTo(e+i,r+s),!0}var qi=new class extends di{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return Xi(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,r){return Xi(t,this.parseSize(e)/4+r,i,s)}};function Zi(t,e,i,s){const r=2*e;return t.moveTo(i-e,s-r),t.lineTo(i+e,s),t.lineTo(i-e,r+s),!0}var Ji=new class extends di{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return Zi(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,r){return Zi(t,this.parseSize(e)/4+r,i,s)}};function Qi(t,e,i,s){const r=2*e;return t.moveTo(i-r,s+e),t.lineTo(i,s-e),t.lineTo(i+r,s+e),!0}var ts=new class extends di{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return Qi(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,r){return Qi(t,this.parseSize(e)/4+r,i,s)}};function es(t,e,i,s){const r=2*e;return t.moveTo(i-r,s-e),t.lineTo(i,s+e),t.lineTo(i+r,s-e),!0}var is=new class extends di{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return es(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,r){return es(t,this.parseSize(e)/4+r,i,s)}};function ss(t,e,i,s,r){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var rs=new class extends di{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,r){return ss(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r,n){return ss(t,this.parseSize(e)/2+r,i,s)}drawToSvgPath(t,e,i,s){const r=this.parseSize(t)/2;return`M ${e}, ${i-r} L ${e},${i+r}`}};function ns(t,e,i,s,r){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var as=new class extends di{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,r){return ns(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r,n){return ns(t,this.parseSize(e)/2+r,i,s)}drawToSvgPath(t,e,i,s){const r=this.parseSize(t)/2;return`M ${e-r}, ${i} L ${e+r},${i}`}};function os(t,e,i,s,r){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var ls=new class extends di{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,r){return os(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r,n){return os(t,this.parseSize(e)/2+r,i,s)}drawToSvgPath(t,e,i,s){const r=this.parseSize(t)/2;return`M ${e-r}, ${i-r} L ${e+r},${i+r} M ${e+r}, ${i-r} L ${e-r},${i+r}`}};function hs(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function cs(t,e,i,s){const r=e,n=e/2;return t.rect(i-r/2,s-n/2,r,n),!1}var ds=new class extends di{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,r){return s.isNumber(e)?cs(t,e,i,r):hs(t,e,i,r)}drawWithClipRange(t,e,i,r,n,a,o){s.isNumber(e)&&(e=[e,e/2]);const l=2*(e[0]+e[1])*n,h=[{x:i+e[0]/2,y:r-e[1]/2},{x:i+e[0]/2,y:r+e[1]/2},{x:i-e[0]/2,y:r+e[1]/2},{x:i-e[0]/2,y:r-e[1]/2}];let c=0,d=h[3];t.moveTo(d.x,d.y);for(let e=0;e<h.length;e++){const i=h[e],s=Math.sqrt((i.x-d.x)*(i.x-d.x)+(i.y-d.y)*(i.y-d.y));if(c+s>l){const e=(i.x-d.x)*(l-c)/s,r=(i.y-d.y)*(l-c)/s;t.lineTo(d.x+e,d.y+r);break}t.lineTo(i.x,i.y),d=i,c+=s}return!1}drawOffset(t,e,i,r,n){return s.isNumber(e)?cs(t,e+2*n,i,r):hs(t,[e[0]+2*n,e[1]+2*n],i,r)}};const us=new s.AABBBounds;class ps{constructor(t,e,i=!1){this.pathStr="",this.type=t,s.isArray(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,r,n,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{t.beginPath(),Gt(r.path.commandList,t,i,s,e,e),a&&a(r.path,r.attribute)})),!1):(Gt(this.path.commandList,t,i,s,e+r,e+r),!1)}draw(t,e,i,s,r,n){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,r,n)}parseSize(t){return s.isNumber(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,r,n,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{n.path.drawWithClipRange(t,e,i,s,r),a&&a(n.path,n.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,r),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{us.x1=i.bounds.x1*t,us.y1=i.bounds.y1*t,us.x2=i.bounds.x2*t,us.y2=i.bounds.y2*t,e.union(us)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const gs={};[pi,gi,fi,yi,Yi,xi,wi,Bi,Oi,Ri,Ui,Vi,zi,Si,Hi,qi,Ji,ts,is,ds,rs,as,ls].forEach((t=>{gs[t.type]=t}));const ms={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"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",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class fs{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function vs(t,e,i,s){const r=t.indexOf(e,i);if(-1===r)throw new Error(s);return r+e.length-1}function ys(t,e,i,s=">"){const r=function(t,e,i=">"){let s,r="";for(let n=e;n<t.length;n++){let e=t[n];if(s)e===s&&(s="");else if('"'===e||"'"===e)s=e;else if(e===i[0]){if(!i[1])return{data:r,index:n};if(t[n+1]===i[1])return{data:r,index:n}}else"\t"===e&&(e=" ");r+=e}}(t,e+1,s);if(!r)return;let n=r.data;const a=r.index,o=n.search(/\s/);let l=n,h=!0;-1!==o&&(l=n.substr(0,o).replace(/\s\s*$/,""),n=n.substr(o+1));const c=l;if(i){const t=l.indexOf(":");-1!==t&&(l=l.substr(t+1),h=l!==r.data.substr(t+1))}return{tagName:l,tagExp:n,closeIndex:a,attrExpPresent:h,rawTagName:c}}const _s=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class bs{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const r=function(t,e){const i=[];let s=e.exec(t);for(;s;){const r=[];r.startIndex=e.lastIndex-s[0].length;const n=s.length;for(let t=0;t<n;t++)r.push(s[t]);i.push(r),s=e.exec(t)}return i}(t,_s),n=r.length;for(let t=0;t<n;t++){const e=r[t][1],i=r[t][4];e&&(s[e]=void 0===i||(isNaN(i)?i:Number(i)))}return s}parseXml(t){t=t.replace(/\r\n?/g,"\n");const e=new fs("!xml");let i=e,s="",r="";for(let n=0;n<t.length;n++)if("<"===t[n])if("/"===t[n+1]){const e=vs(t,">",n,"Closing Tag is not closed."),a=r.lastIndexOf(".");r=r.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",n=e}else if("?"===t[n+1])n=ys(t,n,!1,"?>").closeIndex+1;else if("!--"===t.substr(n+1,3))n=vs(t,"--\x3e",n+4,"Comment is not closed.");else{const a=ys(t,n,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(r+=r?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),r=r.substr(0,r.length-1),l=o):l=l.substr(0,l.length-1);const t=new fs(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,r,o)),this.addChild(i,t,r),r=r.substr(0,r.lastIndexOf("."))}else{const t=new fs(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,r,o)),this.addChild(i,t,r),i=t}s="",n=c}else s+=t[n];return e.child}}function Ss(t,e){return xs(t)}function xs(t,e){const i={};for(let e=0;e<t.length;e++){const r=t[e],n=As(r);if(void 0!==n&&r[n]){const t=xs(r[n]);s=t,Object.keys(s).length,r[":@"]&&Ts(t,r[":@"]),void 0!==i[n]&&i.hasOwnProperty(n)?(Array.isArray(i[n])||(i[n]=[i[n]]),i[n].push(t)):i[n]=t}}var s;return i}function As(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function Ts(t,e,i){if(e){const i=Object.keys(e),s=i.length;for(let r=0;r<s;r++){const s=i[r];t[s]=e[s]}}}class Cs{constructor(t){this.options=Object.assign({},Cs.defaultOptions,t)}valid(t){return t.startsWith("<")}parse(t){if(!this.valid)return!1;return Ss(new bs(this.options).parseXml(t),this.options)}}function ks(t,e,i,s=0){return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}Cs.defaultOptions={};let ws=0;function Ms(){return ws++}var Es;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(Es||(Es={}));const Bs=new Map;["…","(",")","—","【","】","「","」","《","》"].forEach((t=>Bs.set(t,!0)));const Ps=new Map;[""].forEach((t=>Ps.set(t,!0)));const Os=Ms(),Is=Ms();Ms(),Ms(),Ms();const Rs=Ms();Ms(),Ms(),Ms();const Ds=Ms(),Ls=Ms(),Fs=Ms(),Ns=Ms();Ms(),Ms();const Us=Ms();Ms();const js=Symbol.for("GraphicService"),Vs=Symbol.for("GraphicCreator"),Gs={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},zs=Object.keys(Gs),Ks={duration:200,easing:"cubicOut"};function Hs(t){return function(){var t,e;const i=null===(t=dt.global)||void 0===t?void 0:t.env,s=i?null===(e=dt.canvasFactory)||void 0===e?void 0:e.call(dt,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const Ws=1e-4,$s=Math.sqrt(3),Ys=1/3;function Xs(t){return t>-lr&&t<lr}function qs(t){return t>lr||t<-lr}const Zs=[0,0],Js=[0,0],Qs=[0,0];function tr(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function er(t,e,i,s){const r=1-s;return r*(r*t+2*s*e)+s*s*i}function ir(t,e,i,s,r){const n=1-r;return n*n*(n*t+3*r*e)+r*r*(r*s+3*n*i)}function sr(t){return(t%=s.pi2)<0&&(t+=s.pi2),t}function rr(t,e,i,s,r,n,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>n+h||l<e-h&&l<s-h&&l<n-h||o>t+h&&o>i+h&&o>r+h||o<t-h&&o<i-h&&o<r-h)&&function(t,e,i,s,r,n,a,o,l){let h=0,c=.005,d=1/0;Zs[0]=a,Zs[1]=o;for(let a=0;a<1;a+=.05){Js[0]=er(t,i,r,a),Js[1]=er(e,s,n,a);const o=tr(Zs,Js);o<d&&(h=a,d=o)}d=1/0;for(let a=0;a<32&&!(c<Ws);a++){const a=h-c,o=h+c;Js[0]=er(t,i,r,a),Js[1]=er(e,s,n,a);const l=tr(Js,Zs);if(a>=0&&l<d)h=a,d=l;else{Qs[0]=er(t,i,r,o),Qs[1]=er(e,s,n,o);const a=tr(Qs,Zs);o<=1&&a<d?(h=o,d=a):c*=.5}}return l&&(l[0]=er(t,i,r,h),l[1]=er(e,s,n,h)),Math.sqrt(d)}(t,e,i,s,r,n,o,l,null)<=h/2}function nr(t,e,i,s,r,n,a,o,l,h,c){if(0===l)return!1;const d=l;return!(c>e+d&&c>s+d&&c>n+d&&c>o+d||c<e-d&&c<s-d&&c<n-d&&c<o-d||h>t+d&&h>i+d&&h>r+d&&h>a+d||h<t-d&&h<i-d&&h<r-d&&h<a-d)&&function(t,e,i,s,r,n,a,o,l,h,c){let d,u,p,g,m=0,f=.005,v=1/0;Zs[0]=l,Zs[1]=h;for(let l=0;l<1;l+=.05)Js[0]=ir(t,i,r,a,l),Js[1]=ir(e,s,n,o,l),p=tr(Zs,Js),p<v&&(m=l,v=p);v=1/0;for(let l=0;l<32&&!(f<Ws);l++)d=m-f,u=m+f,Js[0]=ir(t,i,r,a,d),Js[1]=ir(e,s,n,o,d),p=tr(Js,Zs),d>=0&&p<v?(m=d,v=p):(Qs[0]=ir(t,i,r,a,u),Qs[1]=ir(e,s,n,o,u),g=tr(Qs,Zs),u<=1&&g<v?(m=u,v=g):f*=.5);return c&&(c[0]=ir(t,i,r,a,m),c[1]=ir(e,s,n,o,m)),Math.sqrt(v)}(t,e,i,s,r,n,a,o,h,c,null)<=d/2}function ar(t,e,i,r,n,a,o,l,h){if(0===o)return!1;const c=o;l-=t,h-=e;const d=Math.sqrt(l*l+h*h);if(d-c>i||d+c<i)return!1;if(Math.abs(r-n)%s.pi2<1e-4)return!0;if(a){const t=r;r=sr(n),n=sr(t)}else r=sr(r),n=sr(n);r>n&&(n+=s.pi2);let u=Math.atan2(h,l);return u<0&&(u+=s.pi2),u>=r&&u<=n||u+s.pi2>=r&&u+s.pi2<=n}function or(t,e,i,s,r,n,a){if(0===r)return!1;const o=r,l=r/2;let h=0,c=t;if(a>e+l&&a>s+l||a<e-l&&a<s-l||n>t+l&&n>i+l||n<t-l&&n<i-l)return!1;if(t===i)return Math.abs(n-t)<=o/2;h=(e-s)/(t-i),c=(t*s-i*e)/(t-i);const d=h*n-a+c;return d*d/(h*h+1)<=o/2*o/2}const lr=1e-4;function hr(t,e,i,s,r){const n=6*i-12*e+6*t,a=9*e+3*s-3*t-9*i,o=3*e-3*t;let l=0;if(Xs(a)){if(qs(n)){const t=-o/n;t>=0&&t<=1&&(r[l++]=t)}}else{const t=n*n-4*a*o;if(Xs(t))r[0]=-n/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-n+e)/(2*a),s=(-n-e)/(2*a);i>=0&&i<=1&&(r[l++]=i),s>=0&&s<=1&&(r[l++]=s)}}return l}const cr=[-1,-1,-1],dr=[-1,-1];function ur(){const t=dr[0];dr[0]=dr[1],dr[1]=t}function pr(t,e,i,s,r,n,a,o,l,h){if(h>e&&h>s&&h>n&&h>o||h<e&&h<s&&h<n&&h<o)return 0;const c=function(t,e,i,s,r,n){const a=s+3*(e-i)-t,o=3*(i-2*e+t),l=3*(e-t),h=t-r,c=o*o-3*a*l,d=o*l-9*a*h,u=l*l-3*o*h;let p=0;if(Xs(c)&&Xs(d))if(Xs(o))n[0]=0;else{const t=-l/o;t>=0&&t<=1&&(n[p++]=t)}else{const t=d*d-4*c*u;if(Xs(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(n[p++]=e),i>=0&&i<=1&&(n[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Ys):Math.pow(i,Ys),s=s<0?-Math.pow(-s,Ys):Math.pow(s,Ys);const r=(-o-(i+s))/(3*a);r>=0&&r<=1&&(n[p++]=r)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),r=(-o-2*i*s)/(3*a),l=(-o+i*(s+$s*Math.sin(e)))/(3*a),h=(-o+i*(s-$s*Math.sin(e)))/(3*a);r>=0&&r<=1&&(n[p++]=r),l>=0&&l<=1&&(n[p++]=l),h>=0&&h<=1&&(n[p++]=h)}}return p}(e,s,n,o,h,cr);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h<c;h++){const c=cr[h],m=0===c||1===c?.5:1;ir(t,i,r,a,c)<l||(u<0&&(u=hr(e,s,n,o,dr),dr[1]<dr[0]&&u>1&&ur(),p=ir(e,s,n,o,dr[0]),u>1&&(g=ir(e,s,n,o,dr[1]))),2===u?c<dr[0]?d+=p<e?m:-m:c<dr[1]?d+=g<p?m:-m:d+=o<g?m:-m:c<dr[0]?d+=p<e?m:-m:d+=o<p?m:-m)}return d}function gr(t,e,i,s,r,n,a,o){if(o>e&&o>s&&o>n||o<e&&o<s&&o<n)return 0;const l=function(t,e,i,s,r){const n=t-2*e+i,a=2*(e-t),o=t-s;let l=0;if(Xs(n)){if(qs(a)){const t=-o/a;t>=0&&t<=1&&(r[l++]=t)}}else{const t=a*a-4*n*o;if(Xs(t)){const t=-a/(2*n);t>=0&&t<=1&&(r[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*n),s=(-a-e)/(2*n);i>=0&&i<=1&&(r[l++]=i),s>=0&&s<=1&&(r[l++]=s)}}return l}(e,s,n,o,cr);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,n);if(h>=0&&h<=1){let o=0;const c=er(e,s,n,h);for(let s=0;s<l;s++){const l=0===cr[s]||1===cr[s]?.5:1;er(t,i,r,cr[s])<a||(cr[s]<h?o+=c<e?l:-l:o+=n<c?l:-l)}return o}const c=0===cr[0]||1===cr[0]?.5:1;return er(t,i,r,cr[0])<a?0:n<e?c:-c}function mr(t,e,i,r,n,a,o,l){if((l-=e)>i||l<-i)return 0;const h=Math.sqrt(i*i-l*l);cr[0]=-h,cr[1]=h;const c=Math.abs(r-n);if(c<1e-4)return 0;if(c>=s.pi2-1e-4){r=0,n=s.pi2;const e=a?1:-1;return o>=cr[0]+t&&o<=cr[1]+t?e:0}if(r>n){const t=r;r=n,n=t}r<0&&(r+=s.pi2,n+=s.pi2);let d=0;for(let e=0;e<2;e++){const i=cr[e];if(i+t>o){let t=Math.atan2(l,i),e=a?1:-1;t<0&&(t=s.pi2+t),(t>=r&&t<=n||t+s.pi2>=r&&t+s.pi2<=n)&&(t>s.pi/2&&t<1.5*s.pi&&(e=-e),d+=e)}}return d}function fr(t){return Math.round(t/s.pi*1e8)/1e8%2*s.pi}function vr(t,e){let i=fr(t[0]);i<0&&(i+=s.pi2);const r=i-t[0];let n=t[1];n+=r,!e&&n-i>=s.pi2?n=i+s.pi2:e&&i-n>=s.pi2?n=i-s.pi2:!e&&i>n?n=i+(s.pi2-fr(i-n)):e&&i<n&&(n=i-(s.pi2-fr(n-i))),t[0]=i,t[1]=n}const yr=[0,0];function _r(t,e,i,r,n){const a=t,o=t.length;let l,h,c=0,d=0,u=0,p=0,g=0;for(let t=0;t<o;t++){const o=a[t],m=0===t;o[0]===kt.M&&t>1&&(i||(c+=s.isPointInLine(d,u,p,g,r,n))),m&&(d=o[1],u=o[2],p=d,g=u);const f=o[0],v=o[1],y=o[2],_=o[3],b=o[4],S=o[5],x=o[6];let A=b,T=S;yr[0]=A,yr[1]=T,vr(yr,Boolean(o[6])),A=yr[0],T=yr[1];const C=A,k=T-A,w=!!(1-(o[6]?0:1)),M=(r-v)*_/_+v;switch(f){case kt.M:p=v,g=y,d=p,u=g;break;case kt.L:if(i){if(or(d,u,v,y,e,r,n))return!0}else c+=s.isPointInLine(d,u,v,y,r,n)||0;d=v,u=y;break;case kt.C:if(i){if(nr(d,u,v,y,_,b,S,x,e,r,n))return!0}else c+=pr(d,u,v,y,_,b,S,x,r,n)||0;d=S,u=x;break;case kt.Q:if(i){if(rr(d,u,v,y,_,b,e,r,n))return!0}else c+=gr(d,u,v,y,_,b,r,n)||0;d=_,u=b;break;case kt.A:if(l=Math.cos(C)*_+v,h=Math.sin(C)*_+y,m?(p=l,g=h):c+=s.isPointInLine(d,u,l,h,r,n),i){if(ar(v,y,_,C,C+k,w,e,M,n))return!0}else c+=mr(v,y,_,C,C+k,w,M,n);d=Math.cos(C+k)*_+v,u=Math.sin(C+k)*_+y;break;case kt.R:if(p=d=v,g=u=y,l=p+_,h=g+b,i){if(or(p,g,l,g,e,r,n)||or(l,g,l,h,e,r,n)||or(l,h,p,h,e,r,n)||or(p,h,p,g,e,r,n))return!0}else c+=s.isPointInLine(l,g,l,h,r,n),c+=s.isPointInLine(p,h,p,g,r,n);break;case kt.Z:if(i){if(or(d,u,p,g,e,r,n))return!0}else c+=s.isPointInLine(d,u,p,g,r,n);d=p,u=g}}return i||(m=u,f=g,Math.abs(m-f)<lr)||(c+=s.isPointInLine(d,u,p,g,r,n)||0),0!==c;var m,f}const br=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return r("linear",t.linearGradient,n)||r("radial",t.radialGradient,o)||r("conic",t.conicGradient,a)}function r(e,s,r){return function(s,n){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const n=r();return n&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:n,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function n(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,r=l();return r&&(i=[],i.push(r),s=e,v(t.comma)&&(r=l(),r?i.push(r):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const r=[];if(s)for(r.push(s);v(t.comma);)s=e(),s?r.push(s):i("One extra comma");return r}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&y(i[0].length);const s=t.exec(e);return s&&y(s[0].length),s}function y(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class Sr{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Sr.IsGradientStr(t))try{const e=br(t)[0];if(e){if("linear"===e.type)return Sr.ParseLinear(e);if("radial"===e.type)return Sr.ParseRadial(e);if("conic"===e.type)return Sr.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t<e.length-1;t++)if(e[t].offset<0){const i=t-1;let s=t+1;for(;s<e.length&&e[s].offset<0;)s++;const r=e[i].offset,n=e[s].offset,a=s-i;for(let t=1;t<a;t++)e[i+t].offset=r+(n-r)*t/a;t=s-1}return e}return t.map(((e,i)=>{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,r=s.pi/2,n=parseFloat(e.value)/180*s.pi-r;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+s.pi2,stops:Sr.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:Sr.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,r=s.pi/2;let n="angular"===e.type?parseFloat(e.value)/180*s.pi:0;for(;n<0;)n+=s.pi2;for(;n>=s.pi2;)n-=s.pi2;let a=0,o=0,l=0,h=0;return n<r?(a=0,o=1,l=Math.sin(n),h=o-Math.cos(n)):n<s.pi?(a=0,o=0,l=Math.cos(n-r),h=Math.sin(n-r)):n<s.pi+r?(a=1,o=0,l=a-Math.sin(n-s.pi),h=Math.cos(n-s.pi)):(a=1,l=a-Math.cos(n-r-s.pi),h-=Math.sin(n-r-s.pi)),{gradient:"linear",x0:a,y0:o,x1:l,y1:h,stops:Sr.processColorStops(i)}}}function xr(t,e,i,r=0,n=0){var a,o,l,h;if(!e||!0===e)return"black";let c,d;if(s.isArray(e))for(let t=0;t<e.length&&(d=e[t],!d);t++);else d=e;if(d=Sr.Parse(d),"string"==typeof d)return d;if(i.AABBBounds&&(!i.attribute||0!==i.attribute.scaleX||0!==i.attribute.scaleY)){const e=i.AABBBounds;let s=e.x2-e.x1,u=e.y2-e.y1,p=e.x1-r,g=e.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1,angle:r=0}=i.attribute;s/=t,u/=e,p/=t,g/=e,(r||1!==t||1!==e)&&(p=null!==(a=i.x1WithoutTransform)&&void 0!==a?a:0,g=null!==(o=i.y1WithoutTransform)&&void 0!==o?o:0,s=null!==(l=i.widthWithoutTransform)&&void 0!==l?l:s,u=null!==(h=i.heightWithoutTransform)&&void 0!==h?h:u)}"linear"===d.gradient?c=function(t,e,i,s,r,n){var a,o,l,h;const c=t.createLinearGradient(i+(null!==(a=e.x0)&&void 0!==a?a:0)*r,s+(null!==(o=e.y0)&&void 0!==o?o:0)*n,i+(null!==(l=e.x1)&&void 0!==l?l:1)*r,s+(null!==(h=e.y1)&&void 0!==h?h:0)*n);return e.stops.forEach((t=>{c.addColorStop(t.offset,t.color)})),c}(t,d,p,g,s,u):"conical"===d.gradient?c=function(t,e,i,s,r,n){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*r,s+(null!==(o=e.y)&&void 0!==o?o:0)*n,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(r+i,n+s,void 0):l}(t,d,p,g,s,u):"radial"===d.gradient&&(c=function(t,e,i,s,r,n){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*r,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*n,Math.max(r,n)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*r,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*n,Math.max(r,n)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,d,p,g,s,u))}return c||"orange"}function Ar(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Tr(t,e,i){const s=i[0],r=i[1],n=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*r+e[8]*n+e[12],t[13]=e[1]*s+e[5]*r+e[9]*n+e[13],t[14]=e[2]*s+e[6]*r+e[10]*n+e[14],t[15]=e[3]*s+e[7]*r+e[11]*n+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*r+g*n+e[12],t[13]=o*s+d*r+m*n+e[13],t[14]=l*s+u*r+f*n+e[14],t[15]=h*s+p*r+v*n+e[15]),t}function Cr(t,e,i){const s=e[0],r=e[1],n=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],S=i[2],x=i[3];return t[0]=_*s+b*o+S*d+x*m,t[1]=_*r+b*l+S*u+x*f,t[2]=_*n+b*h+S*p+x*v,t[3]=_*a+b*c+S*g+x*y,_=i[4],b=i[5],S=i[6],x=i[7],t[4]=_*s+b*o+S*d+x*m,t[5]=_*r+b*l+S*u+x*f,t[6]=_*n+b*h+S*p+x*v,t[7]=_*a+b*c+S*g+x*y,_=i[8],b=i[9],S=i[10],x=i[11],t[8]=_*s+b*o+S*d+x*m,t[9]=_*r+b*l+S*u+x*f,t[10]=_*n+b*h+S*p+x*v,t[11]=_*a+b*c+S*g+x*y,_=i[12],b=i[13],S=i[14],x=i[15],t[12]=_*s+b*o+S*d+x*m,t[13]=_*r+b*l+S*u+x*f,t[14]=_*n+b*h+S*p+x*v,t[15]=_*a+b*c+S*g+x*y,t}function kr(t,e,i){const s=e[0],r=e[1],n=e[2];let a=i[3]*s+i[7]*r+i[11]*n+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*r+i[8]*n+i[12])/a,t[1]=(i[1]*s+i[5]*r+i[9]*n+i[13])/a,t[2]=(i[2]*s+i[6]*r+i[10]*n+i[14])/a,t}class wr{constructor(){this.pools=[]}static identity(t){return Ar(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return wr.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i<e.length;i++)e[i]=t[i];return e}free(t){t&&this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const Mr=new class{constructor(){this.pools=[]}allocate(t,e,i,r,n,a){if(!this.pools.length)return new s.Matrix(t,e,i,r,n,a);const o=this.pools.pop();return o.a=t,o.b=e,o.c=i,o.d=r,o.e=n,o.f=a,o}allocateByObj(t){if(!this.pools.length)return new s.Matrix(t.a,t.b,t.c,t.d,t.e,t.f);const e=this.pools.pop();return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.e=t.e,e.f=t.f,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}},Er=new wr,Br=new s.Matrix(1,0,0,1,0,0),Pr={x:0,y:0};class Or{get nativeContext(){return this.path}constructor(t,e){this.matrix=new s.Matrix(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new s.Matrix(1,0,0,1,0,0),this.path=new we,this._clearMatrix=new s.Matrix(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Mr.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new s.Matrix(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(Mr.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Mr.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,r=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),r&&this.setTransformForCurrent()}setTransform(t,e,i,s,r,n,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*r,o*n),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,r,n,a=!0){this.matrix.multiply(t,e,i,s,r,n),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,r,n){this.path.arc(t,e,i,s,r,n)}arcTo(t,e,i,s,r){this.path.arcTo(t,e,i,s,r)}bezierCurveTo(t,e,i,s,r,n){this.path.bezierCurveTo(t,e,i,s,r,n)}closePath(){this.path.closePath()}ellipse(t,e,i,s,r,n,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,r,n){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Pr),function(t,e,i){return _r(t,0,!1,e,i)}(this.path.commandList,Pr.x,Pr.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Pr);const i=function(t,e,i){let s=e;const{a:r,b:n,c:a,d:o}=t.currentMatrix,l=Math.sign(r)*Math.sqrt(r*r+n*n),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}(this,this.lineWidth,this.dpr);return function(t,e,i,s){return _r(t,e,!0,i,s)}(this.path.commandList,i,Pr.x,Pr.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,r){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,r){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(Br,t,e)}setClearMatrix(t,e,i,s,r,n){this._clearMatrix.setValue(t,e,i,s,r,n)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Mr.free(t))),this.stack.length=0}}const Ir=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Rr(t){return null==t?void 0:t}class Dr{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const r=null!==(i=t.priority)&&void 0!==i?i:0,n=null!==(s=e.priority)&&void 0!==s?s:0;return r!==n?r-n:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const r=new Map;return e.forEach((([,t])=>{var e,i,n,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),r.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Rr(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(n=t.exclude)&&void 0!==n?n:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(r,"exclude"),this.expandRelationClosure(r,"suppress"),r}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Ir.has(t)))){const r=e;return{name:null!==(i=r.name)&&void 0!==i?i:t,priority:null!==(s=r.priority)&&void 0!==s?s:0,patch:Rr(r.patch),resolver:r.resolver,declaredAffectedKeys:r.declaredAffectedKeys,exclude:r.exclude,suppress:r.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const r=new Set,n=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||r.has(t)||(r.add(t),e.add(t),n(t,e),e.delete(t))}))};n(s,new Set([s])),t[e]=r}))}}function Lr(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Fr(t){if(!Lr(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Fr(t[i])})),e}function Nr(t,e){var i;const s=null!==(i=Fr(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],r=s[t];Lr(r)&&Lr(i)?s[t]=Nr(r,i):s[t]=Fr(i)})),s}class Ur{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),r=s.active,n=r.filter((t=>!s.suppressedSet.has(t))),a=r.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,r)||!this.sameArray(this._effectiveStates,n)||!this.sameArray(this._suppressed,a);return this._activeStates=r,this._effectiveStates=n,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(n),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],r=this.compiledDefinitions.get(s);r&&(r.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s<t&&(t-=1))})),r.suppress.forEach((t=>{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const r=this.compiledDefinitions.get(t);if(r&&(r.patch&&this.mergeInto(i,r.patch),r.hasResolver)){const n=s?this.resolverPatchCache.get(t):null===(e=r.resolver)||void 0===e?void 0:e.call(r,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});n&&(s||this.resolverPatchCache.set(t,n),this.mergeInto(i,n))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Fr(e[i])})):Object.keys(e).forEach((i=>{var s;const r=e[i],n=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];Lr(n)&&Lr(r)?t[i]=Nr(n,r):!Lr(n)&&Lr(a)&&Lr(r)?t[i]=Nr(a,r):t[i]=Fr(r)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}}var jr;!function(t){t[t.NONE=0]="NONE",t[t.PAINT=1]="PAINT",t[t.SHAPE=2]="SHAPE",t[t.BOUNDS=4]="BOUNDS",t[t.TRANSFORM=8]="TRANSFORM",t[t.LAYOUT=16]="LAYOUT",t[t.PICK=32]="PICK"}(jr||(jr={}));const Vr={fill:jr.PAINT,opacity:jr.PAINT,fillOpacity:jr.PAINT,strokeOpacity:jr.PAINT,lineDash:jr.PAINT,lineDashOffset:jr.PAINT,lineCap:jr.PAINT,lineJoin:jr.PAINT,miterLimit:jr.PAINT,shadowColor:jr.PAINT,x:jr.TRANSFORM|jr.BOUNDS,y:jr.TRANSFORM|jr.BOUNDS,scaleX:jr.TRANSFORM|jr.BOUNDS,scaleY:jr.TRANSFORM|jr.BOUNDS,angle:jr.TRANSFORM|jr.BOUNDS,anchor:jr.TRANSFORM|jr.BOUNDS,anchor3d:jr.TRANSFORM|jr.BOUNDS,postMatrix:jr.TRANSFORM|jr.BOUNDS,layout:jr.LAYOUT,zIndex:jr.PAINT,visible:jr.PAINT|jr.PICK,lineWidth:jr.SHAPE|jr.BOUNDS|jr.PICK,width:jr.SHAPE|jr.BOUNDS,height:jr.SHAPE|jr.BOUNDS},Gr={stroke:(t,e)=>(null!=t&&!1!==t)!=(null!=e&&!1!==e)?jr.PAINT|jr.BOUNDS|jr.PICK:jr.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?jr.PAINT|jr.BOUNDS:jr.PAINT}};class zr{analyzeTransition(t,e,i={}){var s,r;const n={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return n;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(r=i.animateConfig)||void 0===r?void 0:r.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])n.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;n.animateAttrs[e]=l(e)}else n.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return n}applyTransition(t,e,i,s={}){var r,n,a;if(i){const i=null!==(r=s.animateConfig)&&void 0!==r?r:Ks;null===(n=t.applyAnimationState)||void 0===n||n.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:Dt.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:Dt.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:Dt.STATE}),e}applyClearTransition(t,e,i,s={}){var r;const n=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(r=s.shouldSkipDefaultAttribute)&&void 0!==r?r:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,n,i,s)}}const Kr=new Dr;function Hr(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,Wr(t),!0)}function Wr(t,e=t.revision+1){var i;const s=(r=t.parentScope,n=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},r?r.effectiveSourceDefinitions:a,n));var r,n,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=Kr.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function $r(t){if(t)return t.parentScope&&$r(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&Wr(t),t}function Yr(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function Xr(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}const qr=new s.AABBBounds,Zr=new s.Matrix,Jr=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Qr=["x","y"],tn=["scaleX","scaleY"],en=["angle"],sn=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),rn=new s.Point,nn=[],an=jr.PAINT|jr.SHAPE|jr.BOUNDS|jr.TRANSFORM|jr.LAYOUT;function on(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function ln(t){if(!on(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=on(s)?ln(s):s})),i}function hn(t,e){return t===e||!!(on(t)||on(e)||Array.isArray(t)||Array.isArray(e))&&s.isEqual(t,e)}function cn(t,e){var i;const s=null!==(i=ln(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],r=s[t];on(r)&&on(i)?s[t]=cn(r,i):s[t]=ln(i)})),s}const dn={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class un extends bt{static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const s=e[i];Object.defineProperty(this.prototype,s,Object.getOwnPropertyDescriptor(t,s))}}get AABBBounds(){return this.tryUpdateAABBBounds()}get OBBBounds(){return this.tryUpdateOBBBounds()}get globalAABBBounds(){return this.tryUpdateGlobalAABBBounds()}get transMatrix(){return this.tryUpdateLocalTransMatrix(!0)}get globalTransMatrix(){return this.tryUpdateGlobalTransMatrix(!0)}get baseAttributes(){var t;return null!==(t=this._baseAttributes)&&void 0!==t?t:this.attribute}set baseAttributes(t){t!==this.attribute?this._baseAttributes=t:this._baseAttributes=void 0}constructor(t={}){var e;super(),this._AABBBounds=new s.AABBBounds,this._updateTag=It.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background&&this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0),t.texture&&mn(t.texture)&&this.loadImage(t.texture,!1),t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}get normalAttrs(){return this.baseAttributes}set normalAttrs(t){}getBaseAttributesStorage(){var t;return null!==(t=this._baseAttributes)&&void 0!==t?t:this.attribute}getGraphicService(){var t,e;return null!==(e=null===(t=this.stage)||void 0===t?void 0:t.graphicService)&&void 0!==e?e:dt.graphicService}getAttributes(){return this.attribute}getStateTransitionOrchestrator(){return this.stateTransitionOrchestrator||(this.stateTransitionOrchestrator=new zr),this.stateTransitionOrchestrator}resolveBoundSharedStateScope(){var t;let e=this.parent;for(;e;){if(e.sharedStateScope)return e.sharedStateScope;e=e.parent}return null===(t=this.stage)||void 0===t?void 0:t.rootSharedStateScope}syncSharedStateScopeBindingFromTree(t=!0){var e;const i=this.resolveBoundSharedStateScope();return this.boundSharedStateScope===i?(this.syncSharedStateActiveRegistrations(),!1):(this.boundSharedStateScope=i,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.syncSharedStateActiveRegistrations(),t&&(null===(e=this.currentStates)||void 0===e?void 0:e.length)&&this.markSharedStateDirty(),!0)}syncSharedStateScopeBindingOnTreeChange(t=!0){var e,i;return!!((null===(e=this.currentStates)||void 0===e?void 0:e.length)||this.boundSharedStateScope||(null===(i=this.registeredActiveScopes)||void 0===i?void 0:i.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingFromTree(t)}syncSharedStateActiveRegistrations(){var t;const e=this.registeredActiveScopes;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.boundSharedStateScope)return(null==e?void 0:e.size)&&(e.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,Xr(this.stage,this),Yr(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&$r(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Dt.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&($r(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new Dr).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),r=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,n=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...r],this.resolvedStatePatch=n,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=ln(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],r=e[t];"deep"===this.stateMergeMode&&on(r)&&on(s)?e[t]=cn(r,s):e[t]=ln(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),r=s;return Object.keys(e).forEach((e=>{const n=Object.prototype.hasOwnProperty.call(t,e);if(n&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,r)||(i[e]=void 0===t?t:ln(t))};if(n)a(this.getStateTransitionDefaultAttribute(e,r));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,r):t)}else a(this.getStateTransitionDefaultAttribute(e,r))})),i}syncObjectToSnapshot(t,e,i){const s=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((r=>{if(!0===(null==i?void 0:i[r]))return;const n=Object.prototype.hasOwnProperty.call(e,r),a=t[r];if(!n)return void(Object.prototype.hasOwnProperty.call(t,r)&&(s.set(r,{prev:a,next:void 0}),delete t[r]));const o=e[r];hn(a,o)||(s.set(r,{prev:a,next:o}),t[r]=ln(o))})),s}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,s){var r;let n="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const r=Gr[t];return r?r(e,i):null!==(s=Vr[t])&&void 0!==s?s:jr.PAINT}(e,i,s):null!==(r=Vr[e])&&void 0!==r?r:jr.PAINT;return n&jr.PICK&&(n|=jr.BOUNDS),n===jr.PAINT&&this.needUpdateTag(e)&&(n=jr.SHAPE|jr.BOUNDS),t|n}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&an)!==an?(t&jr.SHAPE?this.addUpdateShapeAndBoundsTag():t&jr.BOUNDS&&this.addUpdateBoundTag(),t&jr.PAINT&&this.addUpdatePaintTag(),t&jr.TRANSFORM&&this.addUpdatePositionTag(),t&jr.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=jr.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,r;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(r=this.stateEngine)||void 0===r||r.invalidateResolverCache(),this.recomputeCurrentStatePatch());const n=this._syncAttribute();this.submitUpdateByDelta(n,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!on(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=on(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,r=this.getBaseAttributesStorage();let n=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(n=!0,r[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));n&&(this.attribute=r,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const s=e[i];this.getBaseAttributesStorage()[s]=t[s]}}_commitAnimationStaticAttributes(t,e){if(!t)return;const i=t,s=this.getBaseAttributesStorage(),r=this.attribute,n=new Map;let a=!1;for(const t in i){if(!Object.prototype.hasOwnProperty.call(i,t))continue;a=!0;const e=r[t],o=i[t];s[t]=o,r[t]=o,hn(e,o)||n.set(t,{prev:e,next:o})}a&&(this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!0,this.submitUpdateByDelta(n),this.onAttributeUpdate(e))}applyAnimationTransientAttributes(t,e=!1,i){const s=t;let r,n=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r||(this.detachAttributeFromBaseAttributes(),r=this.attribute),r[t]=s[t],!n&&this.needUpdateTag(t)&&(n=!0));r&&(this.attributeMayContainTransientAttrs=!0,this.valid=this.isValid(),this.submitTouchedUpdate(n),this.onAttributeUpdate(i))}applyTransientAttributes(t,e=!1,i){this.detachAttributeFromBaseAttributes();const s=new Map,r=Object.keys(t);for(let e=0;e<r.length;e++){const i=r[e],n=this.attribute[i],a=t[i];hn(n,a)||(s.set(i,{prev:n,next:a}),this.attribute[i]=a)}s.size&&(this.attributeMayContainTransientAttrs=!0),this.valid=this.isValid(),this.submitUpdateByDelta(s,e),this.onAttributeUpdate(i)}_restoreAttributeFromStaticTruth(t,e){this._syncFinalAttributeFromStaticTruth(e);const i=this._syncAttribute(e);this.submitUpdateByDelta(i),this.onAttributeUpdate(t)}collectStatePatchDeltaKeys(t,e){const i=t?Object.keys(t):[];if(!e)return i;for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(null!=t?t:{},s)&&i.push(s);return i}getStaticTruthValueForStateKey(t,e){var i;const s=null!==(i=this.baseAttributes)&&void 0!==i?i:{},r=e;if(r&&Object.prototype.hasOwnProperty.call(r,t)){const e=r[t],i=s[t];return"deep"===this.stateMergeMode&&on(i)&&on(e)?{hasValue:!0,value:cn(i,e)}:{hasValue:!0,value:e}}return Object.prototype.hasOwnProperty.call(s,t)?{hasValue:!0,value:s[t]}:{hasValue:!1,value:void 0}}syncStatePatchDeltaToTarget(t,e,i,s=!1){let r=jr.NONE;for(let n=0;n<e.length;n++){const a=e[n],o=t[a],l=this.getStaticTruthValueForStateKey(a,i);if(!l.hasValue){Object.prototype.hasOwnProperty.call(t,a)&&(delete t[a],s&&(r=this.mergeAttributeDeltaCategory(r,a,o,void 0)));continue}if(hn(o,l.value))continue;const h=ln(l.value);t[a]=h,s&&(r=this.mergeAttributeDeltaCategory(r,a,o,h))}return r}restoreAttributeFromStatePatchDelta(t,e,i){this.detachAttributeFromBaseAttributes();const s=this.collectStatePatchDeltaKeys(t,e),r=this.finalAttribute;r&&this.syncStatePatchDeltaToTarget(r,s,e,!1);const n=this.syncStatePatchDeltaToTarget(this.attribute,s,e,!0);this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitUpdateByCategory(n),this.onAttributeUpdate(i)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t,e=!1){var i,s;const{dx:r=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;rn.x=r+(null!==(i=t.scrollX)&&void 0!==i?i:0),rn.y=n+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else rn.x=r,rn.y=n;return rn}onAnimateBind(t){this.detachAttributeFromBaseAttributes(),this._emitCustomEvent("animate-bind",t)}visitTrackedAnimates(t){const e=this.forEachTrackedAnimate;"function"!=typeof e?this.animates&&this.animates.forEach(t):e.call(this,t)}hasAnyTrackedAnimate(){var t;const e=this.hasTrackedAnimate;if("function"==typeof e)return e.call(this);const i=this.getTrackedAnimates;return"function"==typeof i?i.call(this).size>0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&It.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new s.OBBBounds),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=gs[t];if(e)return e;if(e=gn.userSymbolMap[t],e)return e;if(!0===((i=t=ms[t]||t).startsWith("<svg")||i.startsWith("<?xml"))){const e=new Cs,{svg:i}=e.parse(t);if(!i)return null;const r=s.isArray(i.path)?i.path:[i.path];qr.clear();const n=[];r.forEach((t=>{const e=(new we).fromString(t.d),i={};zs.forEach((e=>{t[e]&&(i[Gs[e]]=t[e])})),n.push({path:e,attribute:i}),qr.union(e.bounds)}));const a=qr.width(),o=qr.height(),l=1/s.max(a,o);n.forEach((t=>t.path.transform(0,0,l,l)));const h=new ps(t,n,!0);return gn.userSymbolMap[t]=h,h}var i;const r=(new we).fromString(t),n=r.bounds.width(),a=r.bounds.height(),o=1/s.max(n,a);r.transform(0,0,o,o);const l=new ps(t,r);return gn.userSymbolMap[t]=l,l}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const r=this.attribute,n=this.updateAABBBounds(r,i,this._AABBBounds,t),{boundsPadding:a=i.boundsPadding}=r,o=(l=a)?s.isArray(l)?0===l.length?0:1===l.length?l[0]:2===l.length?(ni[0]=l[0],ni[2]=l[0],ni[1]=l[1],ni[3]=l[1],ni):l:l:0;var l;return o&&n.expand(o),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new xt(t);return Gt(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new s.Matrix),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&It.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&It.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&It.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&It.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&It.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&It.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=It.CLEAR_SHAPE}containsPoint(t,e,i,r){if(!r)return!1;if(i===Rt.GLOBAL){const i=new s.Point(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return r.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const r=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,r,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(r)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===Dt.STATE||null!=i&&i>=Dt.ANIMATE_BIND&&i<=Dt.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,r=this.setFinalAttributes;s&&"function"==typeof r&&r.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var r,n;const a=this.context,o=null!==(r=null==a?void 0:a.diffAttrs)&&void 0!==r?r:t,l=null==i?void 0:i.type;if(!e.length||!o||l===Dt.STATE||null!=l&&l>=Dt.ANIMATE_BIND&&l<=Dt.ANIMATE_END)return;const h=this.transientFromAttrsBeforePreventAnimateDiffAttrs===o;let c=h&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;h||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let d=!1;for(let i=0;i<e.length;i++){const r=e[i];if(!Object.prototype.hasOwnProperty.call(o,r))continue;const n=this.attribute[r],a=t[r];s.isEqual(n,a)||(null!=c||(c={}),c[r]=ln(n),d=!0)}d&&(this.transientFromAttrsBeforePreventAnimate=c,this.transientFromAttrsBeforePreventAnimateDiffAttrs=o)}consumeTransientFromAttrsBeforePreventAnimate(t){const e=this.transientFromAttrsBeforePreventAnimate,i=this.transientFromAttrsBeforePreventAnimateDiffAttrs;if(!e||!i)return null;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&(!Object.prototype.hasOwnProperty.call(i,e)||!s.isEqual(i[e],t[e])))return null;let r=null,n=!1;for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)?(null!=r||(r={}),r[i]=e[i]):n=!0);if(n){const i={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=e[s]);this.transientFromAttrsBeforePreventAnimate=i}else this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null;return r}setAttributes(t,e=!1,i){t&&((t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),t.texture&&mn(t.texture)&&this.loadImage(t.texture,!1),t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i))}_setAttributes(t,e=!1,i){this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,e,i):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(e,i))}setAttribute(t,e,i,s){const r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(r)this._setAttributes(r,i,s);else if(this.canCommitBaseAttributesByTouchedKeys())this.commitBaseAttributeBySingleKey(t,e,!!i,s);else{const r={[t]:e};this.applyBaseAttributes(r),this.commitBaseAttributeMutation(!!i,s)}"background"===t?this.loadImage(e,!0):"texture"===t&&mn(e)?this.loadImage(e,!1):"shadowGraphic"===t&&this.setShadowGraphic(e)}needUpdateTags(t,e=Jr){for(let i=0;i<e.length;i++){const s=e[i];if(-1!==t.indexOf(s))return!0}return!1}needUpdateTag(t,e=Jr){for(let i=0;i<e.length;i++)if(t===e[i])return!0;return!1}initAttributes(t){const e={type:Dt.INIT};t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,e)||t,this.attribute=t,this._baseAttributes=void 0,this.resolvedStatePatch=void 0,this.attributeMayContainTransientAttrs=!1,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0),t.texture&&mn(t.texture)&&this.loadImage(t.texture,!1),t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._updateTag=It.INIT,this.valid=this.isValid(),this.onAttributeUpdate(e)}translate(t,e){var i,s;if(0===t&&0===e)return this;const r={type:Dt.TRANSLATE},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Qr,r);n&&(t=n.x,e=n.y,delete n.x,delete n.y);const a=this.baseAttributes,o=a.postMatrix,l=n||{};if(o){const i=o.clone();dt.transformUtil.fromMatrix(i,i).translate(t,e),l.postMatrix=i}else l.x=(null!==(i=a.x)&&void 0!==i?i:Re.x)+t,l.y=(null!==(s=a.y)&&void 0!==s?s:Re.y)+e;return this.commitInternalBaseAttributes(l,r),this}translateTo(t,e){const i=this.baseAttributes;if(i.x===t&&i.y===e)return this;const s={type:Dt.TRANSLATE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Qr,s);return r?(this.commitInternalBaseAttributes(r,s),this):(this.commitInternalBaseAttributes({x:t,y:e},s),this)}scale(t,e,i){var r,n;if(1===t&&1===e)return this;const a={type:Dt.SCALE},o=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e,scaleCenter:i},this.attribute,tn,a);o&&(t=o.scaleX,e=o.scaleY,delete o.scaleX,delete o.scaleY);const l=this.baseAttributes,h=o||{};if(i){let{postMatrix:r}=this.baseAttributes;r=r?r.clone():new s.Matrix,dt.transformUtil.fromMatrix(r,r).scale(t,e,i),h.postMatrix=r}else h.scaleX=(null!==(r=l.scaleX)&&void 0!==r?r:Re.scaleX)*t,h.scaleY=(null!==(n=l.scaleY)&&void 0!==n?n:Re.scaleY)*e;return this.commitInternalBaseAttributes(h,a),this}scaleTo(t,e){const i=this.baseAttributes;if(i.scaleX===t&&i.scaleY===e)return this;const s={type:Dt.SCALE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e},this.attribute,tn,s);return r?(this.commitInternalBaseAttributes(r,s),this):(this.commitInternalBaseAttributes({scaleX:t,scaleY:e},s),this)}rotate(t,e){var i;if(0===t)return this;const r={type:Dt.ROTATE},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({angle:t,rotateCenter:e},this.attribute,en,r);n&&delete n.angle;const a=this.baseAttributes,o=n||{};if(e){let{postMatrix:i}=this.baseAttributes;i=i?i.clone():new s.Matrix,dt.transformUtil.fromMatrix(i,i).rotate(t,e),o.postMatrix=i}else o.angle=(null!==(i=a.angle)&&void 0!==i?i:Re.angle)+t;return this.commitInternalBaseAttributes(o,r),this}rotateTo(t){if(this.baseAttributes.angle===t)return this;const e={type:Dt.ROTATE_TO},i=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,en,e);return i?(this.commitInternalBaseAttributes(i,e),this):(this.commitInternalBaseAttributes({angle:t},e),this)}skewTo(t,e){return this}onAttributeUpdate(t){t&&t.skipUpdateCallback||(this.getGraphicService().onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds(),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds(),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!s.isNil(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}getStateResolveBaseAttrs(){var t;return null!==(t=this.baseAttributes)&&void 0!==t?t:this.attribute}syncStateResolveContext(t=this.getStateResolveBaseAttrs()){var e;return null===(e=this.stateEngine)||void 0===e||e.setResolveContext(this,t),t}ensureStateEngine(t=this.getStateResolveBaseAttrs()){const{compiledDefinitions:e}=this.resolveEffectiveCompiledDefinitions();return this.compiledStateDefinitions=e,e?this.stateEngine&&this.stateEngineCompiledDefinitions===e&&this.stateEngineStateSort===this.stateSort&&this.stateEngineMergeMode===this.stateMergeMode||(this.stateEngine=new Ur({compiledDefinitions:e,stateSort:this.stateSort,mergeMode:this.stateMergeMode}),this.stateEngineCompiledDefinitions=e,this.stateEngineStateSort=this.stateSort,this.stateEngineMergeMode=this.stateMergeMode):(this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0),this.syncStateResolveContext(t),this.stateEngine&&this.currentStates&&!this.sameStateNames(this.stateEngine.activeStates,this.currentStates)&&this.stateEngine.applyStates(this.currentStates),this.stateEngine}toGraphicStateTransition(t){return{changed:t.changed,states:[...t.activeStates],effectiveStates:[...t.effectiveStates]}}sortLocalStates(t){return this.stateSort?[...t].sort(this.stateSort):[...t]}resolveLocalUseStatesTransition(t){var e;if(!t.length)return this.resolveLocalClearStatesTransition();const i=null!==(e=this.currentStates)&&void 0!==e?e:nn,s=i.length!==t.length||t.some(((t,e)=>i[e]!==t)),r=this.sortLocalStates(t);return{changed:s,states:s?r:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const r=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(r)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),r=this.ensureStateEngine(s);e&&(null==r||r.invalidateResolverCache());const n=r?this.toGraphicStateTransition(r.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:n,effectiveStates:null!==(i=n.effectiveStates)&&void 0!==i?i:n.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},r=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of r){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!hn(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const r=null!==(s=this.currentStates)&&void 0!==s?s:nn,n=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(n,l);h&&!this.beforeStateUpdate(l,r,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Dt.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:Dt.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:Ks}applyStateAttrs(t,e,i,s,r,n){const a=i?this.resolveStateAnimateConfig(r):void 0,o=a?{animateConfig:a,extraAnimateAttrs:n,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:n,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const r=null!==(e=this.currentStates)&&void 0!==e?e:nn,n=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===r.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?ln(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,r,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Dt.STATE}):this.restoreAttributeFromStatePatchDelta(n,void 0,{type:Dt.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,r;const{hasAnimation:n,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:nn,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(r=this.registeredActiveScopes)||void 0===r?void 0:r.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,n,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,n)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(n)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:nn,r=this.resolvedStatePatch,{transition:n,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!n.changed&&this.sameStateNames(s,n.states)||this.beforeStateUpdate(o,s,n.states,e,!1)&&(this.currentStates=n.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,n.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Dt.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:Dt.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Dt.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!==s[t])return!1;return!0}addUpdateBoundTag(){this._updateTag|=It.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdatePaintTag(){this._updateTag|=It.UPDATE_PAINT}addUpdateShapeTag(){this._updateTag|=It.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=It.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addBroadUpdateTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=It.UPDATE_SHAPE_AND_BOUNDS|It.UPDATE_PAINT|It.UPDATE_GLOBAL_LOCAL_MATRIX|It.UPDATE_LAYOUT,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&It.UPDATE_SHAPE_AND_BOUNDS)===It.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=It.CLEAR_BOUNDS}clearUpdatePaintTag(){this._updateTag&=It.CLEAR_PAINT}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=It.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=It.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=It.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=It.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=It.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=It.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&It.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],r=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=r();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=r();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Re.x,y:e=Re.y,scaleX:i=Re.scaleX,scaleY:r=Re.scaleY,angle:n=Re.angle,scaleCenter:a,anchor:o,postMatrix:l}=this.attribute;let h=[0,0];const c={};if(o&&n&&(h=this.getAnchor(o,c)),!a||1===i&&1===r)s.normalTransform(this._transMatrix,this._transMatrix.reset(),t,e,i,r,n,o&&h);else{const s=this._transMatrix;s.reset(),s.translate(h[0],h[1]),s.rotate(n),s.translate(-h[0],-h[1]),s.translate(t,e),h=this.getAnchor(a,c,!0),dt.transformUtil.fromMatrix(s,s).scale(i,r,{x:h[0],y:h[1]})}const d=this.getOffsetXY(Re);if(this._transMatrix.e+=d.x,this._transMatrix.f+=d.y,l){const t=Zr.setValue(l.a,l.b,l.c,l.d,l.e,l.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){var i,s,r,n,a,o,l,h,c,d;const u=null!==(r=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==r?r:dt.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(n=this.currentStates)||void 0===n?void 0:n.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:Dt.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:Dt.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=dt.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return s.isString(t,!0)?this.pathProxy=(new we).fromString(t):this.pathProxy=new we,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("<svg")||s.isValidUrl(t)||t.includes("/")||s.isBase64(t)):!!(t.fill||t.stroke||"string"==typeof t.gradient&&Array.isArray(t.stops))}(t)))return void(this.backgroundImg=!1);if(!t)return;const i=t;this.resources||(this.resources=new Map);const r={data:"init",state:null};this.resources.set(i,r),"string"==typeof t?(r.state="loading",t.startsWith("<svg")?(ii.GetSvg(t,this),this.backgroundImg=this.backgroundImg||e):(s.isValidUrl(t)||t.includes("/")||s.isBase64(t))&&(ii.GetImage(t,this),this.backgroundImg=this.backgroundImg||e)):s.isObject(t)?(r.state="success",r.data=t,this.backgroundImg=this.backgroundImg||e):r.state="fail"}setShadowGraphic(t){t?this.attachShadow().add(t):this.detachShadow()}imageLoadSuccess(t,e,i){if(!this.resources)return;const s=this.resources.get(t);s&&(s.state="success",s.data=e,i&&i(),this.addUpdateBoundTag(),this.stage&&this.stage.renderNextFrame())}imageLoadFail(t,e){if(!this.resources)return;const i=this.resources.get(t);i&&(i.state="fail",e&&e())}_stopAnimates(){if(!this.mayHaveTrackedAnimates())return;const t=[];this.visitTrackedAnimates((e=>{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const r=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:dt.graphicService;null===(s=null==r?void 0:r.onRelease)||void 0===s||s.call(r,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const r=new vt(t,e);r.bubbles=!1;const n=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return n?(r.manager=n,this.dispatchEvent(r)):bt.prototype.dispatchEvent.call(this,r)}return!0}beforeStateUpdate(t,e,i,s,r){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:Dt.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!r})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:Dt.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||dt.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Or(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}un.userSymbolMap={};const pn=Symbol.for("@visactor/vrender-core/graphic-class");const gn=function(){var t;const e=globalThis;return null!==(t=e[pn])&&void 0!==t||(e[pn]={Graphic:un}),e[pn]}().Graphic;function mn(t){return!!t&&("string"==typeof t?!sn.has(t)&&(t.startsWith("<svg")||s.isValidUrl(t)||t.includes("/")||s.isBase64(t)):s.isObject(t))}gn.mixin(yt);const fn={arc:Ve,area:Ge,circle:ze,line:We,path:$e,symbol:Ze,text:Je,rect:qe,polygon:Ye,star:Xe,richtext:Qe,richtextIcon:ei,image:ti,group:Ke,glyph:He},vn=Object.keys(fn);function yn(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const _n={arc:Object.assign({},fn.arc),area:Object.assign({},fn.area),circle:Object.assign({},fn.circle),line:Object.assign({},fn.line),path:Object.assign({},fn.path),symbol:Object.assign({},fn.symbol),text:Object.assign({},fn.text),rect:Object.assign({},fn.rect),polygon:Object.assign({},fn.polygon),star:Object.assign({},fn.star),richtext:Object.assign({},fn.richtext),richtextIcon:Object.assign({},fn.richtextIcon),image:Object.assign({},fn.image),group:Object.assign({},fn.group),glyph:Object.assign({},fn.glyph)};class bn{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},vn.forEach((t=>{this._defaultTheme[t]=Object.create(_n[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const r=this.getParentWithTheme(t);if(r){const t=r.theme;(t.dirty||i)&&t.applyTheme(r,e,!0)}this.userTheme?this.doCombine(r&&r.theme.combinedTheme):(r?this.combinedTheme=r.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,s.Logger.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;vn.forEach((s=>{const r=Object.create(_n[s]);t&&t[s]&&yn(r,t[s]),i[s]&&yn(r,i[s]),e[s]&&yn(r,e[s]),this.combinedTheme[s]=r})),e.common&&vn.forEach((t=>{yn(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Sn=new bn;function xn(t,e){return t.glyphHost?xn(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Sn.getTheme()}return null}(t)||t.attachedThemeGraphic&&xn(t.attachedThemeGraphic)||Sn.getTheme()}var An;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(An||(An={}));class Tn extends gn{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Rs,this._childUpdateTag=It.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;var i,s;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(Hr(this.sharedStateScope,t),i=this.sharedStateScope,s=this.stage,i.subtreeActiveDescendants.size&&(i.subtreeActiveDescendants.forEach((t=>{var e;t.sharedStateDirty=!0,Xr(null!==(e=null!=s?s:t.stage)&&void 0!==e?e:i.ownerStage,t)})),Yr(null!=s?s:i.ownerStage))),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new bn),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new bn)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Rt.GLOBAL){const i=new s.Point(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&It.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Re.x,y:e=Re.y,dx:i=Re.dx,dy:s=Re.dy,scaleX:r=Re.scaleX,scaleY:n=Re.scaleY,angle:a=Re.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==r||1!==n||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return xn(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:r,height:n,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=n&&i.set(0,0,Math.max(0,r),Math.max(0,n)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return dt.graphicService.updateTempAABBBounds(i),dt.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=It.CLEAR_BOUNDS,this._childUpdateTag&=It.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=It.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&It.UPDATE_BOUNDS||(this._childUpdateTag|=It.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,r,n,a,o;const l=null!==(r=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==r?r:dt.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(n=this.currentStates)||void 0===n?void 0:n.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&It.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=dt.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new Tn(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Tn.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&Hr(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return Wr({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}}function Cn(t){return new Tn(t)}Tn.NOWORK_ANIMATE_ATTR=dn;var kn=function(t,e,i,s){return new(i||(i=Promise))((function(r,n){function a(t){try{l(s.next(t))}catch(t){n(t)}}function o(t){try{l(s.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function wn(t,e,i){const s={},r=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],r.push(i))}),i),r.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:r}}function Mn(t,e,i,s=!1){return kn(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function En(t,e,i,s=!1){let r=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return r=!0,!0;return!1}),s);let n=null,a=!1;if(r){const{childMap:r,zIdxArray:o}=wn(t,i,s);let l=!1;for(let t=0;t<o.length&&!l;t++){const i=r[o[t]];for(let t=0;t<i.length;t++){if(a){l=!0,n=i[t];break}i[t]._uid!==e||(a=!0)}}}else t.forEachChildren((t=>a?(n=t,!0):(t._uid===e&&(a=!0),!1)),s);return n}const Bn=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new s.AABBBounds)}allocate(t,e,i,r){if(!this.pools.length)return(new s.AABBBounds).setValue(t,e,i,r);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=r,n}allocateByObj(t){if(!this.pools.length)return new s.AABBBounds(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const Pn=new class{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Hs(Object.assign({nativeCanvas:dt.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Hs(Object.assign({nativeCanvas:dt.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class On{constructor(){this.time=Nt.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,r,n,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:y=l.backgroundFit,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:S=l.backgroundOffsetX,backgroundOffsetY:x=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:T=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const r=t.resources.get(Rn(g));if(!r||"success"!==r.state||!r.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=xn(t.parent).group,{scrollX:s=i.scrollX,scrollY:r=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,r)}A&&e.clip();const n=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,r.data,n,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:S,backgroundOffsetY:x,backgroundPosition:T}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){jn(t,e,i,s)}}new On;const In=new Set(["top","center","bottom"]);function Rn(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Dn({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Ln={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Fn(t,e,i,s,r){if("number"==typeof t&&Number.isFinite(t))return t;const n=`${null!=t?t:""}`.trim().toLowerCase();if(!n||n===i)return 0;if(n===s)return e/2;if(n===r)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(n))return e*parseFloat(n)/100;const a=Number(n);return Number.isFinite(a)?a:0}function Nn(t,e,i){const[s,r]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:In.has(t)?["center",t]:[t,"center"]}let r,n;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):n=e:r=e}return null==r&&a.length&&(r=a.shift()),null==n&&a.length&&(n=a.shift()),[null!=r?r:"left",null!=n?n:"top"]}(t);return{x:Fn(s,e,"left","center","right"),y:Fn(r,i,"top","center","bottom")}}function Un(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function jn(t,e,i,s){var r,n;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),m=function(t){if(!t)return null;const e=Un(t.naturalWidth,t.videoWidth,t.width),i=Un(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}(e),{backgroundRepeatMode:f,backgroundSizing:v}=function({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Ln[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:Dn({backgroundFit:e,backgroundKeepAspectRatio:i})}}({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===f){let s=null!==(r=null==m?void 0:m.width)&&void 0!==r?r:p,a=null!==(n=null==m?void 0:m.height)&&void 0!==n?n:g;if("cover"!==v&&"contain"!==v||!m)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/m.width,g/m.height):Math.min(p/m.width,g/m.height);s=m.width*t,a=m.height*t}s*=h,a*=h;const{x:o,y:l}=Nn(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==f&&m){const i=m.width,s=m.height;"repeat-x"===f?(y=i*(g/s),_=g):"repeat-y"===f&&(_=s*(p/i),y=p);const r=t.dpr,n=Pn.allocate({width:y,height:_,dpr:r}),a=n.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=n.nativeCanvas),Pn.free(n)}const b=t.dpr,S=t.createPattern(e,f);S.setTransform&&S.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=S,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class Vn{constructor(t){this.subRenderContribitions=t,this.time=Nt.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,r,n,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,r,n,a,o,l,h,c,d,u)}))}}const Gn=new class{constructor(){this.time=Nt.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,r,n,a,o,l,h,c,d,u){var p,g;const{clipConfig:m}=t.attribute;if(!m)return;const f=t.getClipPath();if(!f)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===f.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const zn=new class{constructor(){this.time=Nt.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,r,n,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}},Kn={getContributions:()=>[]};class Hn{constructor(t=[],e=Kn,i={}){var r,n,a,o,l,h;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var r;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):function(t,e,i,s=!1,r=!1){let n=!1;if(r)n=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:r=e}=t.attribute;if(0===s)i=r;else if(i!==r)return n=!0,!0;return!1}),s)}if(n){const{childMap:n,zIdxArray:a}=wn(t,e,s);let o=!1;for(let t=0;t<a.length&&!o;t++){const e=n[a[t]];r&&e.sort(((t,e)=>{var i,r;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(r=t.attribute.z)&&void 0!==r?r:0))}));for(let t=0;t<e.length;t++)if(i(e[t],t)){o=!0;break}}}else t.forEachChildren(i,s)}(e,je.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(r=i.context)||void 0===r?void 0:r.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new s.Bounds,this.backupDirtyBounds=new s.Bounds,this.global=null!==(r=i.global)&&void 0!==r?r:dt.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:dt.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(o=null===(a=this.rendererRegistry)||void 0===a?void 0:a.getAll())&&void 0!==o?o:this.contributions,this.drawItemInterceptorContributions=null!==(h=null!==(l=i.drawItemInterceptorContributions)&&void 0!==l?l:this.drawItemInterceptorContributions)&&void 0!==h?h:Kn,s.isArray(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:r,stage:n,viewBox:a,transMatrix:o}=e;if(!r)return;const l=this.dirtyBounds.setValue(0,0,a.width(),a.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=s.getRectIntersect(l,n.dirtyBounds,!1);l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}const h=r.dpr%1;(h||.5!==h)&&(l.x1=Math.floor(l.x1*r.dpr)/r.dpr,l.y1=Math.floor(l.y1*r.dpr)/r.dpr,l.x2=Math.ceil(l.x2*r.dpr)/r.dpr,l.y2=Math.ceil(l.y2*r.dpr)/r.dpr),this.backupDirtyBounds.copy(l),r.reset(!1),r.save(),r.setClearMatrix(o.a,o.b,o.c,o.d,o.e,o.f),r.clearMatrix(!1),r.translate(a.x1,a.y1,!0),r.beginPath(),r.rect(l.x1,l.y1,l.width(),l.height()),r.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,r,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:je.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:je.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Mr.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),r.restore(),r.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=En(e,i,je.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,r){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!s.isRectIntersect(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,a=i;if(this.useDirtyBounds){n=Bn.allocateByObj(this.dirtyBounds);const e=t.transMatrix;a=Mr.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(a.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:r,nextM:a},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Bn.free(n),Mr.free(a))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:r}=i;let n=r.get(t._uid);n||(n={layer:this.layerService.createLayer(s),zIndex:r.size,group:t},r.set(t._uid,n));const a=n.layer.getNativeHandler().getContext(),o=n.drawContribution||function(){const t=dt.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:n.layer,context:a,startAtId:t._uid,break:!1})),n.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=r.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:r.size},r.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s<this.InterceptorContributions.length;s++){const r=this.InterceptorContributions[s];if(r.beforeDrawItem&&r.beforeDrawItem(t,this.currentRenderService,e,this,i))return}const r=this.getRenderContribution(t);if(!r)return;let n,a=!1;if(e.isGroupScroll){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;a=!0,this.scrollMatrix||(this.scrollMatrix=Mr.allocate(1,0,0,1,0,0)),this.scrollMatrix.translate(-e,-i)}if(a&&(n=this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix)),this.useDirtyBounds&&!t.isContainer&&"empty"!==t.attribute.boundsMode&&!s.isRectIntersect(t.AABBBounds,null!=n?n:this.dirtyBounds,!1)){if(a&&t.parent){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;this.scrollMatrix&&this.scrollMatrix.translate(e,i)}return}const o=null!=e.startAtId&&t._uid!==e.startAtId;if(t._uid===e.startAtId&&(e.startAtId=null),i&&(i.skipDraw=o),o?t.isContainer&&r.draw(t,this.currentRenderService,e,i):r.draw(t,this.currentRenderService,e,i),a&&t.parent){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;this.scrollMatrix&&this.scrollMatrix.translate(e,i)}if(this.InterceptorContributions.length)for(let i=0;i<this.InterceptorContributions.length;i++){const s=this.InterceptorContributions[i];if(s.afterDrawItem&&s.afterDrawItem(t,this.currentRenderService,e,this))return}}selectRenderByType(t){return s.Logger.getInstance().warn("未知错误,不应该走到这里"),null}selectRenderByNumberType(t,e){let i;if(e.attribute.renderStyle){const s=this.styleRenderMap.get(e.attribute.renderStyle);i=s&&s.get(t)}return i||this.currentRenderMap.get(t)||this.defaultRenderMap.get(t)}clearScreen(t,e,i){var s,r,n,a,o,l,h,c,d,u,p;const{clear:g,viewBox:m}=i,f=m.width(),v=m.height();if(g){e.clearRect(0,0,f,v),(null===(s=t.drawParams)||void 0===s?void 0:s.stage)&&t.drawParams.stage.hooks.afterClearRect.call(t.drawParams);const i=null===(r=t.drawParams)||void 0===r?void 0:r.stage;if(i&&(e.globalAlpha=(null!==(n=i.attribute.opacity)&&void 0!==n?n:1)*(null!==(a=i.attribute.backgroundOpacity)&&void 0!==a?a:1)),i&&i.backgroundImg&&i.resources){const t=i.resources.get(Rn(g));if(t&&"success"===t.state&&t.data){const s=Bn.allocate(0,0,0+f,0+v);jn(e,t.data,s,{backgroundMode:null!==(o=i.attribute.backgroundMode)&&void 0!==o?o:je.backgroundMode,backgroundFit:null!==(l=i.attribute.backgroundFit)&&void 0!==l?l:je.backgroundFit,backgroundKeepAspectRatio:null!==(h=i.attribute.backgroundKeepAspectRatio)&&void 0!==h?h:je.backgroundKeepAspectRatio,backgroundScale:null!==(c=i.attribute.backgroundScale)&&void 0!==c?c:je.backgroundScale,backgroundOffsetX:null!==(d=i.attribute.backgroundOffsetX)&&void 0!==d?d:je.backgroundOffsetX,backgroundOffsetY:null!==(u=i.attribute.backgroundOffsetY)&&void 0!==u?u:je.backgroundOffsetY,backgroundPosition:null!==(p=i.attribute.backgroundPosition)&&void 0!==p?p:je.backgroundPosition}),Bn.free(s)}}else e.fillStyle=xr(e,g,{AABBBounds:{x1:0,y1:0,x2:0+f,y2:0+v}},0,0),e.fillRect(0,0,f,v)}}afterDraw(t,e){}}class Wn{constructor(t=new Hn){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class $n{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}const Yn={getContributions:()=>[]};class Xn{constructor(t=Yn,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new $n}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}let qn;function Zn(t){const e=dt.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}class Jn{static GenerateLayerId(){return`${Jn.idprefix}_${Jn.prefix_count++}`}constructor(t=dt.global,e=new ha,i=Zn){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const r=this.getLayerHandler(s),n=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Jn.GenerateLayerId(),layerHandler:r})}),a=this.layerMap.get(t)||[];return a.push(n),this.layerMap.set(t,a),this.staticLayerCountInEnv--,n}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}}Jn.idprefix="visactor_layer",Jn.prefix_count=0;class Qn{constructor(){this.registry=new Map}create(t,e){const i=this.registry.get(t);if(!i)throw new Error(`GraphicFactory has no creator registered for type "${t}"`);return new i(e)}register(t,e){if(!t)throw new Error("GraphicFactory requires a non-empty graphic type");this.registry.set(t,e)}}class ta{constructor(){this.store=new Map}registerStore(t,e){this.store.set(t,e),this[t]=e}RegisterGraphicCreator(t,e){ra(t,e)}CreateGraphic(t,e){return this.store.has(t)?na(t,e):null}}const ea=Symbol.for("@visactor/vrender-core/graphic-registry");const ia=function(){const t=globalThis;return t[ea]||(t[ea]={graphicCreator:new ta,graphicFactory:new Qn}),t[ea]}(),sa=ia.graphicCreator;function ra(t,e){if(!t)throw new Error("Graphic registration requires a non-empty graphic type");sa.registerStore(t,e),ia.graphicFactory.register(t,function(t){return class{constructor(e){try{return new t(e)}catch(i){return t(e)}}}}(e))}function na(t,e){return ia.graphicFactory.create(t,e)}function aa(t,e,i){var s;const{x:r=i.x,y:n=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,y=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=f[1];y[2]=null!==(s=f[2])&&void 0!==s?s:0}if(Ar(t),Tr(t,t,[r+o,n+l,a+h]),Tr(t,t,[y[0],y[1],y[2]]),function(t,e,i){const s=Math.sin(i),r=Math.cos(i),n=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=n*r+h*s,t[5]=a*r+c*s,t[6]=o*r+d*s,t[7]=l*r+u*s,t[8]=h*r-n*s,t[9]=c*r-a*s,t[10]=d*r-o*s,t[11]=u*r-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),r=Math.cos(i),n=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=n*r-h*s,t[1]=a*r-c*s,t[2]=o*r-d*s,t[3]=l*r-u*s,t[8]=n*s+h*r,t[9]=a*s+c*r,t[10]=o*s+d*r,t[11]=l*s+u*r}(t,t,p),Tr(t,t,[-y[0],-y[1],y[2]]),function(t,e,i){const s=i[0],r=i[1],n=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=Er.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}Tr(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),r=Math.cos(i),n=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=n*r+h*s,t[1]=a*r+c*s,t[2]=o*r+d*s,t[3]=l*r+u*s,t[4]=h*r-n*s,t[5]=c*r-a*s,t[6]=d*r-o*s,t[7]=u*r-l*s}(i,i,m),Tr(i,i,[-s[0],-s[1],0]),Cr(t,t,i)}}class oa{constructor(t=sa){this.creator=t,this.hooks={onAttributeUpdate:new lt(["graphic"]),onSetStage:new lt(["graphic","stage"]),onRemove:new lt(["graphic"]),onRelease:new lt(["graphic"]),onAddIncremental:new lt(["graphic","group","stage"]),onClearIncremental:new lt(["graphic","group","stage"]),beforeUpdateAABBBounds:new lt(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new lt(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new lt(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new s.AABBBounds,this.tempAABBBounds2=new s.AABBBounds,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,r){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,r)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updateHTMLTextAABBBounds(t,e,i,r){const{textAlign:n,textBaseline:a}=t;if(null!=t.forceBoundsHeight){const e=s.isNumber(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),r=function(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}(a,e,e);i.set(i.x1,r,i.x2,r+e)}if(null!=t.forceBoundsWidth){const e=s.isNumber(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),r=function(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}(n,e);i.set(r,i.y1,r+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,r,n){if(!e.empty()){const{scaleX:s=i.scaleX,scaleY:n=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){ks(d,(l+h)/Math.abs(s+n),r,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:r=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;ks(d,o/Math.abs(s+n)*2,!1,c+1),d.translate(r,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let a=!0;const o=n.transMatrix;n&&n.isContainer&&(a=!(1===o.a&&0===o.b&&0===o.c&&1===o.d&&0===o.e&&0===o.f)),a&&s.transformBoundsWithMatrix(e,e,o)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:r=e.visible}=t;return!(!s.valid||!r)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}class la extends Tn{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var r;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(r=s.zIndex)&&void 0!==r?r:0}),this.layer=this,this.subLayers=new Map,this.theme=new bn,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{dt.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{dt.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}class ha{constructor(t=la){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let ca=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};ca._pluginClasses=function(){const t=globalThis;return t[nt]||(t[nt]={pluginClasses:{}}),t[nt]}().pluginClasses;class da{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Z.Get(e,q.Color1),this.ambient=i;const r=s.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/r,t[1]/r,t[2]/r]}computeColor(t,e){const i=this.formatedDir,r=s.min(s.max((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=s.isString(e)?Z.Get(e,q.Color1):e;const a=this.colorRgb;return`rgb(${a[0]*n[0]*r}, ${a[1]*n[1]*r}, ${a[2]*n[2]*r})`}}const ua=()=>{ca.registerPlugin("DirectionalLight",da)};class pa{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=Er.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Er.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,r){let n,a,o,l,h,c,d,u,p,g;const m=e[0],f=e[1],v=e[2],y=r[0],_=r[1],b=r[2],S=i[0],x=i[1],A=i[2];Math.abs(m-S)<s.epsilon&&Math.abs(f-x)<s.epsilon&&Math.abs(v-A)<s.epsilon?Ar(t):(d=m-S,u=f-x,p=v-A,g=1/Math.hypot(d,u,p),d*=g,u*=g,p*=g,n=_*p-b*u,a=b*d-y*p,o=y*u-_*d,g=Math.hypot(n,a,o),g?(g=1/g,n*=g,a*=g,o*=g):(n=0,a=0,o=0),l=u*o-p*a,h=p*n-d*o,c=d*a-u*n,g=Math.hypot(l,h,c),g?(g=1/g,l*=g,h*=g,c*=g):(l=0,h=0,c=0),t[0]=n,t[1]=l,t[2]=d,t[3]=0,t[4]=a,t[5]=h,t[6]=u,t[7]=0,t[8]=o,t[9]=c,t[10]=p,t[11]=0,t[12]=-(n*m+a*f+o*v),t[13]=-(l*m+h*f+c*v),t[14]=-(d*m+u*f+p*v),t[15]=1)}(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Er.allocate()),this._vp=Cr(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Er.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Er.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return function(t,e,i,s,r,n,a){const o=1/(e-i),l=1/(s-r),h=1/(n-a);t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+i)*o,t[13]=(r+s)*l,t[14]=(a+n)*h,t[15]=1}(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=Er.allocate()),this._vp=Cr(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return kr(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:r}=this._params.viewParams;kr(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const n=this.getProjectionScale(i);return{x:t*n+r[0],y:e*n+r[1]}}}const ga=()=>{ca.registerPlugin("OrthoCamera",pa)};class ma{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=at.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const r=t.page.x-this.pageX,n=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=r/100,o=n/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}let fa=0;function va(){return fa>=9999999&&(fa=0),fa++}class ya{constructor(t){this.id=va(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}var _a;const ba=Symbol.for("@visactor/vchart/factory-registry@2.1.3"),Sa=globalThis,xa=null!==(_a=Sa[ba])&&void 0!==_a?_a:Sa[ba]={charts:{},series:{},components:{},graphicComponents:{},marks:{},regions:{},animations:{},implements:{},chartPlugin:{},vChartPlugin:{},componentPlugin:{},transforms:{fields:i.fields,filter:i.filter,fold:i.fold},dataParser:{csv:i.csvParser,dsv:i.dsvParser,tsv:i.tsvParser},layout:{},grammarTransforms:{},stageEventPlugins:{},interactionTriggers:{},composedEventMap:{},tooltipProcessors:{},runtimePluginInstallers:{},formatter:void 0};class Aa{static registerChart(t,e){Aa._charts[t]=e}static registerSeries(t,e){Aa._series[t]=e}static registerComponent(t,e,i,s){Aa._components[t]={cmp:e,alwaysCheck:i,createOrder:null!=s?s:0}}static registerGraphicComponent(t,e){Aa._graphicComponents[t]=e}static createGraphicComponent(t,e,i){const s=Aa._graphicComponents[t];return s?s(e,i):null}static registerMark(t,e){Aa._marks[t]=e}static registerRegion(t,e){Aa._regions[t]=e}static registerTransform(t,e){Aa.transforms[t]=e}static registerGrammarTransform(t,e){Aa._grammarTransforms[t]=e}static getGrammarTransform(t){return Aa._grammarTransforms[t]}static registerLayout(t,e){Aa._layout[t]=e}static registerAnimation(t,e){Aa._animations[t]=e}static registerImplement(t,e){Aa._implements[t]=e}static registerChartPlugin(t,e){Aa._chartPlugin[t]=e}static registerVChartPlugin(t,e){Aa._vChartPlugin[t]=e}static registerComponentPlugin(t,e){Aa._componentPlugin[t]=e}static createChart(t,e,i){return Aa._charts[t]?new Aa._charts[t](e,i):null}static getChart(t){return Aa._charts[t]}static createChartSpecTransformer(t,e){if(!Aa._charts[t])return null;const i=Aa._charts[t];return new i.transformerConstructor(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){return Aa._regions[t]?new Aa._regions[t](e,i):null}static createRegionSpecTransformer(t,e){return Aa._regions[t]?new Aa._regions[t].transformerConstructor(e):null}static createSeries(t,e,i){return Aa._series[t]?new Aa._series[t](e,i):null}static createSeriesSpecTransformer(t,e){return Aa._series[t]?new Aa._series[t].transformerConstructor(e):null}static createMark(t,e,i){if(!Aa._marks[t])return null;const s=new Aa._marks[t](e,i);return"group"===s.type&&s.setMarkConfig({interactive:!1}),s}static getComponents(){return Object.values(Aa._components)}static getComponentInKey(t){return Aa._components[t].cmp}static getLayout(){return Object.values(Aa._layout)}static getLayoutInKey(t){return Aa._layout[t]}static getSeries(){return Object.values(Aa._series)}static getSeriesInType(t){return Aa._series[t]}static getRegionInType(t){return Aa._regions[t]}static getAnimationInKey(t){return Aa._animations[t]}static getImplementInKey(t){return Aa._implements[t]}static getSeriesMarkMap(t){return Aa._series[t]?Aa._series[t].mark:{}}static getSeriesBuiltInTheme(t){for(const e in Aa._series){const i=Aa._series[e];if(i&&i.builtInTheme&&i.builtInTheme[t])return i.builtInTheme[t]}return null}static getComponentBuiltInTheme(t){for(const e in Aa._components){const i=Aa._components[e];if(i&&i.cmp&&i.cmp.builtInTheme&&i.cmp.builtInTheme[t])return i.cmp.builtInTheme[t]}return null}static getChartPlugins(){return Object.values(Aa._chartPlugin)}static getVChartPlugins(){return Object.values(Aa._vChartPlugin)}static getComponentPlugins(){return Object.values(Aa._componentPlugin)}static getComponentPluginInType(t){return Aa._componentPlugin[t]}static registerFormatter(t){this._formatter=t,xa.formatter=t}static getFormatter(){var t;return null!==(t=xa.formatter)&&void 0!==t?t:this._formatter}static createInteractionTrigger(t,e){const i=Aa._interactionTriggers[t];return i?new i(e):null}static hasInteractionTrigger(t){return!!Aa._interactionTriggers[t]}static getComposedEvent(t){return Aa._composedEventMap[t]}}Aa._charts=xa.charts,Aa._series=xa.series,Aa._components=xa.components,Aa._graphicComponents=xa.graphicComponents,Aa._marks=xa.marks,Aa._regions=xa.regions,Aa._animations=xa.animations,Aa._implements=xa.implements,Aa._chartPlugin=xa.chartPlugin,Aa._vChartPlugin=xa.vChartPlugin,Aa._componentPlugin=xa.componentPlugin,Aa.transforms=xa.transforms,Aa.dataParser=xa.dataParser,Aa._layout=xa.layout,Aa._grammarTransforms=xa.grammarTransforms,Aa._stageEventPlugins=xa.stageEventPlugins,Aa.registerStageEventPlugin=(t,e)=>{Aa._stageEventPlugins[t]=e},Aa.getStageEventPlugin=t=>Aa._stageEventPlugins[t],Aa._interactionTriggers=xa.interactionTriggers,Aa.registerInteractionTrigger=(t,e)=>{Aa._interactionTriggers[t]=e},Aa._composedEventMap=xa.composedEventMap,Aa.registerComposedEvent=(t,e)=>{Aa._composedEventMap[t]=e},Aa._tooltipProcessors=xa.tooltipProcessors,Aa.registerTooltipProcessor=(t,e)=>{Aa._tooltipProcessors[t]=e},Aa.createTooltipProcessor=(t,e)=>{const i=Aa._tooltipProcessors[t];return i?new i(e):null},Aa._runtimePluginInstallers=xa.runtimePluginInstallers,Aa.registerRuntimePluginInstaller=(t,e)=>{Aa._runtimePluginInstallers[t]=e},Aa.getRuntimePluginInstaller=t=>Aa._runtimePluginInstallers[t];const Ta=t=>t.zField||t.series&&t.series.some((t=>t.zField));class Ca extends ya{constructor(){super(Ca.type),this.type="VChart3dPlugin"}onInit(t,e){var i,s;if(this._is3d=!!(s=e)&&((t=>"bar3d"===t||"funnel3d"===t||"histogram3d"===t||"pie3d"===t||"rangeColumn3d"===t||"wordCloud3d"===t)(s.type)||Ta(s),!0),this._is3d){const{globalInstance:e}=t;e.getCompiler().getStage().set3dOptions(Object.assign({},null===(i=e._option)||void 0===i?void 0:i.options3d))}}onBeforeInitChart(t,e,i){this._is3d&&Ta(e)&&(e.layout={type:"layout3d"})}}Ca.pluginType="chart",Ca.type="VChart3dPlugin";const ka=()=>{var t;t=Ca,Aa.registerChartPlugin(t.type,t),ua(),ga(),ca.registerPlugin("ViewTransform3dPlugin",ma)},wa={label:{name:"label",type:"text"},bar3d:{name:"bar3d",type:"rect3d"}};class Ma extends e.BarSeriesSpecTransformer{_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar3d")}}const Ea=(t,e,i)=>{const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+(r+a)/2)}return i},Ba=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...Jr];class Pa extends gn{constructor(t){super(t),this.type="arc",this.numberType=Os}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:r=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:a=t.innerRadius}=this.attribute;if(n+=r,a-=i,0===e||"0%"===e)return 0;const o=Math.abs(n-a),l=t=>Math.min(s.isNumber(t,!0)?t:o*parseFloat(t)/100,o/2);if(s.isArray(e)){const t=e.map((t=>l(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return l(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:r=t.cap,clipRange:n=t.clipRange}=this.attribute,a=i-e>=0?1:-1;let o=i-e;if(o*=Math.max(0,Math.min(n,1)),e=s.clampAngleByRadian(e),i=e+o,r&&s.abs(o)>s.epsilon&&s.abs(o)<s.pi2-s.epsilon){let n=1,o=1;r.length&&(n=Number(r[0]),o=Number(r[1]));let{outerRadius:l=t.outerRadius,innerRadius:h=t.innerRadius}=this.attribute;const{outerPadding:c=t.outerPadding,innerPadding:d=t.innerPadding}=this.attribute;l+=c,h-=d;const u=Math.abs(l-h)/2,p=u/l;if(u>s.epsilon&&l>s.epsilon)return{startAngle:e-a*p*n,endAngle:i+a*p*o,sc:a*p*n,ec:a*p*o}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:r=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:a=i.padAngle}=this.attribute;let{outerRadius:o=i.outerRadius,innerRadius:l=i.innerRadius}=this.attribute;o+=n,l-=r;const{padRadius:h=s.sqrt(o*o+l*l)}=this.attribute,c=s.abs(e-t);let d=t,u=e,p=t,g=e;const m=a/2;let f=c,v=c;if(m>s.epsilon&&h>s.epsilon){const i=e>t?1:-1;let r=s.asin(Number(h)/l*s.sin(m)),n=s.asin(Number(h)/o*s.sin(m));return(f-=2*r)>s.epsilon?(r*=i,p+=r,g-=r):(f=0,p=g=(t+e)/2),(v-=2*n)>s.epsilon?(n*=i,d+=n,u-=n):(v=0,d=u=(t+e)/2),{outerStartAngle:d,outerEndAngle:u,innerStartAngle:p,innerEndAngle:g,innerDeltaAngle:f,outerDeltaAngle:v}}return{outerStartAngle:d,outerEndAngle:u,innerStartAngle:p,innerEndAngle:g,innerDeltaAngle:f,outerDeltaAngle:v}}getGraphicTheme(){return xn(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:r,tb2:n}=dt.graphicService.updateTempAABBBounds(i);Ea(t,e,r),i.union(r),r.setValue(n.x1,n.y1,n.x2,n.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return dt.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:n=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=n,r-=a,s<r&&(s=r),i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i){let{outerRadius:r=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:o=e.innerPadding}=t;if(r+=a,n-=o,r<n){const t=r;r=n,n=t}let{endAngle:l=e.endAngle,startAngle:h=e.startAngle}=t;if(h>l){const t=h;h=l,l=t}return r<=s.epsilon?i.set(0,0,0,0):Math.abs(l-h)>s.pi2-s.epsilon?i.set(-r,-r,r,r):(li(h,l,r,i),li(h,l,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Ba)}needUpdateTag(t){return super.needUpdateTag(t,Ba)}toCustomPath(){var t,e,i,r;let n=super.toCustomPath();if(n)return n;const a=this.attribute,{startAngle:o,endAngle:l}=this.getParsedAngle();let h=(null!==(t=a.innerRadius)&&void 0!==t?t:0)-(null!==(e=a.innerPadding)&&void 0!==e?e:0),c=(null!==(i=a.outerRadius)&&void 0!==i?i:0)-(null!==(r=a.outerPadding)&&void 0!==r?r:0);const d=s.abs(l-o),u=l>o;if(c<h){const t=c;c=h,h=t}if(n=new we,c<=s.epsilon)n.moveTo(0,0);else if(d>=s.pi2-s.epsilon)n.moveTo(0+c*s.cos(o),0+c*s.sin(o)),n.arc(0,0,c,o,l,!u),h>s.epsilon&&(n.moveTo(0+h*s.cos(l),0+h*s.sin(l)),n.arc(0,0,h,l,o,u));else{const t=c*s.cos(o),e=c*s.sin(o),i=h*s.cos(l),r=h*s.sin(l);n.moveTo(0+t,0+e),n.arc(0,0,c,o,l,!u),n.lineTo(0+i,0+r),n.arc(0,0,h,l,o,u),n.closePath()}return n}clone(){return new Pa(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Pa.NOWORK_ANIMATE_ATTR}}Pa.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},dn);const Oa=["points","cornerRadius",...Jr];class Ia extends gn{constructor(t){super(t),this.type="polygon",this.numberType=Ds}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return xn(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),dt.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return dt.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,r){"points"===t&&(r.points=ci(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Oa)}needUpdateTag(t){return super.needUpdateTag(t,Oa)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new we,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new Ia(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ia.NOWORK_ANIMATE_ATTR}}Ia.NOWORK_ANIMATE_ATTR=dn;const Ra=["width","x1","y1","height","cornerRadius",...Jr];class Da extends gn{constructor(t){super(t),this.type="rect",this.numberType=Fs}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return xn(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:r,y1:n,x:a,y:o}=t;e=null!=e?e:r-a,s=null!=s?s:n-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:r}=dt.graphicService.updateTempAABBBounds(i);return Ea(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,dt.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Ra)}needUpdateTag(t){return super.needUpdateTag(t,Ra)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,r=t=>null!=s[t],n=t=>null==s[t];switch(t){case"width":return n("width")&&r("x")&&r("x1");case"height":return n("height")&&r("y")&&r("y1");case"x1":return n("x1")&&r("x")&&r("width");case"y1":return n("y1")&&r("y")&&r("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,r=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},n=r("x"),a=r("y"),o=r("x1"),l=r("y1"),h=r("width"),c=r("height");switch(t){case"width":if(null==h&&null!=n&&null!=o)return o-n;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=n&&null!=h)return n+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:r,width:n,height:a}=(t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=s.isNil(t.width)?t.x1-t.x:t.width,i=s.isNil(t.height)?t.y1-t.y:t.height,r=0,n=0;return e<0?(r=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:r,y:n,width:e,height:i}})(e);return t=new we,t.moveTo(i,r),t.rect(i,r,n,a),t}clone(){return new Da(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Da.NOWORK_ANIMATE_ATTR}}Da.NOWORK_ANIMATE_ATTR=dn;const La=Symbol.for("EnvContribution"),Fa=Symbol.for("VGlobal"),Na=/\w|\(|\)|-/,Ua=/[.?!,;:/,。?!、;:]/;function ja(t,e,i=!1){let s=e;for(;Na.test(t[s-1])&&Na.test(t[s])||Ua.test(t[s]);)if(s--,s<=0)return i?Va(t,e):e;return s}function Va(t,e){let i=e;for(;Na.test(t[i+1])&&Na.test(t[i])||Ua.test(t[i]);)if(i++,i>=t.length)return i;return i+1}class Ga extends Tn{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function za(t){return new Ga(t)}const Ka=["symbolType","size",...Jr];let Ha=class t extends gn{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Us}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const r=this.getParsedPath();if(!r)return null;r.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return s.isArray(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return xn(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:r,tb2:n}=dt.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:n=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;ks(i,a+(r+o)/2,!0,n)}})(t,e,r),i.union(r),r.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return dt.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:r=e.size}=t;if(s.isArray(r))i.set(-r[0]/2,-r[1]/2,r[0]/2,r[1]/2);else{const t=r/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,r=this.getParsedPath();return r?(r.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Ka)}needUpdateTag(t){return super.needUpdateTag(t,Ka)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=s.isArray(e)?e:[e,e];return t.path?(new we).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new we).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};Ha.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},dn);let Wa=0;class $a{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=dt.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Wa,t),this.tryRunAnimationFrameNextFrame(),Wa}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}var Ya,Xa=function(t,e,i,s){return new(i||(i=Promise))((function(r,n){function a(t){try{l(s.next(t))}catch(t){n(t)}}function o(t){try{l(s.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class qa extends ut{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=at.GenAutoIncrementId(),this.hooks={onSetEnv:new lt(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new $a);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new $a),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Xa(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}class Za{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=dt.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Pn.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const r=this.global.measureTextMethod;this.global.measureTextMethod=i;const n={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Fe.fontSize};return this.global.measureTextMethod=r,n}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new s.TextMeasure(Object.assign({defaultFontParams:{fontFamily:Fe.fontFamily,fontSize:Fe.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+s.TextMeasure.ALPHABET_CHAR_SET+s.TextMeasure.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,r;if(!e.defaultLayer)return null;const n=null!==(r=null===(s=dt.windowFactory)||void 0===s?void 0:s.call(dt))&&void 0!==r?r:new mt(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;n.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(n,[t],{transMatrix:n.getViewBoxTransform(),viewBox:n.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=n.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Ya||(Ya={}));const Ja=new s.Matrix;class Qa{constructor(){this.matrix=new s.Matrix}init(t){return this.mode=Ya.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Ya.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Ja.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:r}=i;this.outTargetMatrix.translate(s,r),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-r)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Ja.a,Ja.b,Ja.c,Ja.d,Ja.e,Ja.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Ja.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Ja.a,Ja.b,Ja.c,Ja.d,Ja.e,Ja.f),this}scale(t,e,i){return this.mode===Ya.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Ya.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Ja.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Ja.a,Ja.b,Ja.c,Ja.d,Ja.e,Ja.f),this}translate(t,e){return this.mode===Ya.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Ya.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}const to=Symbol.for("TransformUtil"),eo=Symbol.for("GraphicUtil"),io=Symbol.for("LayerService"),so=Symbol.for("StaticLayerHandlerContribution"),ro=Symbol.for("@visactor/vrender-core/contribution-store-state");const no=Symbol("ContributionProvider");class ao{constructor(t,e){this.serviceIdentifier=t,this.container=e,ho.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function oo(t,e){return new ao(t,e)}function lo(t,e){t(no).toDynamicValue((({container:t})=>oo(e,t))).inSingletonScope().whenTargetNamed(e)}class ho{static getStore(t){var e;return null===(e=this.store.get(t))||void 0===e?void 0:e.values().next().value}static setStore(t,e){let i=this.store.get(t);i||(i=new Set,this.store.set(t,i)),i.add(e)}static refreshAllContributions(){this.store.forEach((t=>{t.forEach((t=>{t.refresh()}))}))}}ho.store=function(){const t=globalThis;return t[ro]||(t[ro]={store:new Map}),t[ro]}().store;class co{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=Je.fontSize}){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}}measureTextWidth(t,e,i){return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e)).width:this.estimate(t,e).width}measureTextBoundsWidth(t,e,i){return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e)).width:this.estimate(t,e).width}measureTextBoundsLeftRight(t,e,i){return this.context?{left:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).actualBoundingBoxLeft,right:i.actualBoundingBoxRight}:this.measureTextBoundLeftRightEstimate(e)}measureTextPixelHeight(t,e,i){var s;return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(i.actualBoundingBoxAscent-i.actualBoundingBoxDescent)):null!==(s=e.fontSize)&&void 0!==s?s:Fe.fontSize}measureTextPixelADscent(t,e,i){return this.context?{ascent:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent}:this.measureTextBoundADscentEstimate(e)}measureTextBoundHieght(t,e,i){var s;return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(i.fontBoundingBoxAscent-i.fontBoundingBoxDescent)):null!==(s=e.fontSize)&&void 0!==s?s:Fe.fontSize}measureTextBoundADscent(t,e,i){return this.context?{ascent:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).fontBoundingBoxAscent,descent:i.fontBoundingBoxDescent}:this.measureTextBoundADscentEstimate(e)}measureTextBoundADscentEstimate(t){var e;const i=null!==(e=t.fontSize)&&void 0!==e?e:Fe.fontSize;return{ascent:.79*i,descent:.21*i}}measureTextBoundLeftRightEstimate(t){var e;const i=null!==(e=t.fontSize)&&void 0!==e?e:Fe.fontSize,{textAlign:s}=t;return"center"===s?{left:i/2,right:i/2}:"right"===s||"end"===s?{left:i,right:0}:{left:0,right:i}}measureTextPixelADscentAndWidth(t,e,i){if(!this.context)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(e)),{width:this.estimate(t,e).width});const s=this._measureTextWithoutAlignBaseline(t,e,!0);if(i===Be.actualBounding)return{ascent:s.actualBoundingBoxAscent,descent:s.actualBoundingBoxDescent,width:s.width};if(i===Be.estimate)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(e)),{width:s.width});if(i===Be.fontBounding){let t=s.fontBoundingBoxAscent,e=s.fontBoundingBoxDescent;if(s.actualBoundingBoxDescent&&e<s.actualBoundingBoxDescent){const i=s.actualBoundingBoxDescent-e;e+=i,t-=i}else if(s.actualBoundingBoxAscent&&t<s.actualBoundingBoxAscent){const i=s.actualBoundingBoxAscent-t;t+=i,e-=i}return{ascent:t,descent:e,width:s.width}}return{ascent:s.actualBoundingBoxAscent,descent:s.actualBoundingBoxDescent,width:s.width}}measureText(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t)):this.estimate(t,e)}clipTextVertical(t,e,i,s){if(0===t.length)return{verticalList:t,width:0};const{fontSize:r=12}=e;t.forEach((t=>{t.width=0===t.direction?r:this.measureTextWidth(t.text,e)}));const n=[];let a=0,o=0;for(;o<t.length&&a+t[o].width<i;o++)a+=t[o].width,n.push(t[o]);if(t[o]&&t[o].text.length>1){const r=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&r.str!==t[o].text){let i="",s=0;for(let e=0;e<o;e++){const r=t[e];i+=r.text,s+=r.text.length}i+=t[o].text;let n=ja(i,s+r.str.length);n-=s,n!==r.str.length-1&&(r.str=r.str.substring(0,n),r.width=this.measureTextWidth(r.str,e))}n.push(Object.assign(Object.assign({},t[o]),{text:r.str,width:r.width})),a+=r.width}return{verticalList:n,width:a}}clipText(t,e,i,s,r){if(0===t.length)return{str:"",width:0};let n=this.measureTextWidth(t,e);if(n<=i)return{str:t,width:n};if(n=this.measureTextWidth(t[0],e),n>i)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=ja(t,a.str.length,r);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,r,n,a){let o;if("start"===n)o=this._clipTextStart(t,e,i,s,r),a&&(o.result=a+o.str);else if("middle"===n){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,r),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,r,n){if(r===n){s.Logger.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${r}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const a=Math.floor((r+n)/2),o=t.substring(0,a+1),l=this.measureTextWidth(o,e);let h;if(l>i){if(o.length<=1)return{str:"",width:0};const s=t.substring(0,a);return h=this.measureTextWidth(s,e),h<=i?{str:s,width:h}:this._clipTextEnd(t,e,i,r,a)}if(l<i){if(a>=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,a+2);return h=this.measureTextWidth(s,e),h>=i?{str:o,width:l}:this._clipTextEnd(t,e,i,a,n)}return{str:o,width:l}}_clipTextStart(t,e,i,s,r){const n=Math.ceil((s+r)/2),a=t.substring(n-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(n,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,n,t.length)}if(o<i){if(n<=0)return{str:t,width:this.measureTextWidth(t,e)};const r=t.substring(n-2,t.length);return l=this.measureTextWidth(r,e),l>=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,n)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,r,n,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:r,width:n+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:r,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,r,n){if(""===s)return this.clipTextVertical(t,e,i,r);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,r);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===n){const n=this.revertVerticalList(t);l=this.clipTextVertical(n,e,i,r);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===n){const n=this.clipTextVertical(t,e,i/2,r),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,r);n.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>n.verticalList.push(t))),l={verticalList:n.verticalList,width:n.width+h.width}}else l=this.clipTextVertical(t,e,i,r),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,r,n,a=!1){if(""===s)return this.clipText(t,e,i,r);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,n,s);if(r&&h.str!==t){const i=ja(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}}const uo=Symbol.for("TextMeasureContribution");class po extends co{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}const go=Symbol.for("RenderService");const mo=Symbol.for("PickerService"),fo=Symbol.for("GlobalPickerService"),vo=Symbol.for("PickItemInterceptor"),yo=Symbol.for("PickServiceInterceptor"),_o=(t,e,i,r)=>{let n,a=!1,o=!1;if(e.forEachChildren((t=>(a=t.numberType===Is,!a))),e.forEachChildren((t=>(o=!!t.findFace,!o))),a){const t=e.getChildren(),l=[...t];l.sort(((t,e)=>{var i,r,n,a;let o=(null!==(r=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==r?r:0)/2,l=(null!==(a=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==a?a:0)/2;for(;o<0;)o+=s.pi2;for(;l<0;)l+=s.pi2;return l-o})),l.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),l.forEach((t=>{e.appendChild(t)})),r.hack_pieFace="outside",n=i(a,o),n&&n.graphic||(r.hack_pieFace="inside",n=i(a,o)),n&&n.graphic||(r.hack_pieFace="top",n=i(a,o)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(o){const s=e.getChildren(),r=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));r.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),r.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),r.forEach((t=>{e.add(t.g)})),n=i(a,o),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(a,o);return n},bo=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class So extends Da{constructor(t){super(t),this.type="rect3d",this.numberType=Ns}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:r,x:n,y:a,length:o=s.min(e.width,e.height)}=this.attribute;let{width:l,height:h}=this.attribute;l=null!=l?l:i-n,h=null!=h?h:r-a;for(let e=0;e<bo.length;e++){const i=bo[e];t.vertices.push([i[0]*l,i[1]*h,i[2]*o])}return t.polygons.push({polygon:[0,1,5,4],normal:[0,-1,0]}),t.polygons.push({polygon:[2,3,7,6],normal:[0,1,0]}),t.polygons.push({polygon:[4,7,3,0],normal:[-1,0,0]}),t.polygons.push({polygon:[1,2,6,5],normal:[1,0,0]}),t.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),t.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),t.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],t}getNoWorkAnimateAttr(){return So.NOWORK_ANIMATE_ATTR}}function xo(t){return new So(t)}So.NOWORK_ANIMATE_ATTR=dn;class Ao extends Pa{constructor(t){super(t),this.type="arc3d",this.numberType=Is}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:n=0}=t,a=r+n;return i.setValue(-a,-a,a,a),dt.graphicService.updateTempAABBBounds(i),dt.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return Ao.NOWORK_ANIMATE_ATTR}}function To(t){return new Ao(t)}Ao.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},dn);class Co extends Ia{constructor(t){super(t),this.type="pyramid3d",this.numberType=Ls}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),dt.graphicService.updateTempAABBBounds(i),dt.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],r=e.x-s.x;return 0===r?0:(e.y-s.y)/r})),i=t.map((t=>({p:t,d:0})));let r=!1,n=0;for(let t=0;t<e.length-1;t++){for(let a=t+1;a<e.length;a++){if(e[t]===e[a]){r=!0;const e=s.PointService.distancePP(i[t].p,i[t+1].p);i[t].d=e,i[t+1].d=e,n=s.max(n,e);const o=s.PointService.distancePP(i[a].p,i[a+1].p);i[a].d=o,i[a+1].d=o,n=s.max(n,o)}if(r)break}if(r)break}for(let e=t.length-1;e>=0;e--){const s=t[e];i.unshift({p:s,d:0})}for(let e=0;e<t.length;e++){const s=(n-i[e+t.length].d)/2;i[e].d+=s,i[e+t.length].d+=s}const a={polygons:[],vertices:[],edges:[]};return i.forEach((t=>{a.vertices.push([t.p.x,t.p.y,t.d])})),a.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),a.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),a.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),a.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),a.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),a.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),a.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],a}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return Co.NOWORK_ANIMATE_ATTR}}function ko(t){return new Co(t)}Co.NOWORK_ANIMATE_ATTR=dn;class wo{constructor(){this.order=1}afterPickItem(t,e,i,s,r){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class Mo{constructor(){this.order=1}afterPickItem(t,e,i,s,r){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,r):null}beforePickItem(t,e,i,s,r){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,r):null}_pickItem(t,e,i,r,n){var a;if(!t.shadowRoot)return null;const{parentMatrix:o}=n||{};if(!o)return null;const l=e.pickContext;l.highPerformanceSave();const h=null===(a=xn(t))||void 0===a?void 0:a[t.type],{shadowPickMode:c=(null==h?void 0:h.shadowPickMode)}=t.attribute,d=t.shadowRoot,u=Mr.allocateByObj(o),p=new s.Point(u.a*i.x+u.c*i.y+u.e,u.b*i.x+u.d*i.y+u.f),g=e.pickGroup(d,p,u,r);return l.highPerformanceRestore(),!g.graphic&&g.group&&"full"===c&&(g.graphic=g.group),g}}class Eo{constructor(){this.order=1}beforePickItem(t,e,i,r,n){const a=t.baseGraphic;if(a&&a.parent){const t=new s.Point(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const o=a.parent.globalTransMatrix;o.transformPoint(t,t);const l=a.isContainer?e.pickGroup(a,t.clone(),o,r):e.pickItem(a,t.clone(),o,r);return n.highPerformanceRestore(),l}return null}}class Bo{constructor(){this.order=1}beforePickItem(t,e,i,s,r){if(!t.in3dMode||s.in3dInterceptor)return null;const n=e.pickContext,a=t.stage;if(!n||!a)return null;if(s.in3dInterceptor=!0,n.save(),this.initCanvasCtx(n),n.camera=a.camera,t.isContainer){const a=_o(n,t,(()=>e.pickGroup(t,i,r.parentMatrix,s)),s);return n.camera=null,s.in3dInterceptor=!1,n.restore(),a}return n.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}const Po=Symbol.for("AutoEnablePlugins"),Oo=Symbol.for("PluginService");function Io({bind:t}){t(Oo).to(Xn),function(t,e){t(no).toDynamicValue((({container:t})=>oo(e,t))).whenTargetNamed(e)}(t,Po)}class Ro{constructor(){this.type="static",this.offscreen=!1,this.global=dt.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,r=Hs({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});r.applyPosition(),this.canvas=r,this.context=r.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const r=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:r},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}}function Do(t){(function({bind:t}){lo(t,La)})({bind:t.bind}),function({bind:t}){t(uo).to(po).inSingletonScope(),lo(t,uo)}({bind:t.bind}),function({bind:t}){t(Ro).toSelf(),t(so).toService(Ro)}({bind:t.bind})}const Lo=s.pi/2;function Fo(t,e){return!(!t&&!e)}function No(t,e){let i;return i=s.isArray(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Uo(t,e,i){return i&&t*e>0}function jo(t,e,i,s,r){return r&&t*e>0&&0!==i&&0!==s}function Vo(t,e){return t*e>0}function Go(t,e,i,s,r){return r?t*e>0:t*e>0&&0!==i&&0!==s}const zo=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class Ko{constructor(){this.time=Nt.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,r){const n=(t-2*e)/2,a=s.dpr,o=Pn.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),r(n,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Pn.free(o),h}createCirclePattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,s.pi2),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const r=t/2,n=r;s.fillStyle=i,s.moveTo(r,n-e),s.lineTo(e+r,n),s.lineTo(r,n+e),s.lineTo(r-e,n),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const r=e,n=r;s.fillStyle=i,s.fillRect(r,n,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,r)=>{const n=e;r.fillStyle=i,r.fillRect(n,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,r)=>{const n=e;r.fillStyle=i,r.fillRect(0,n,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const r=t/2,n=-r;s.moveTo(r,n),s.lineTo(r+t,n+t),s.moveTo(-r,-n),s.lineTo(-r+t,-n+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const r=t/2,n=r;s.moveTo(t+r,n),s.lineTo(r,n+t),s.moveTo(t-r,-n),s.lineTo(-r,-n+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const r=e,n=r;s.fillStyle=i,s.fillRect(r,n,t,t),s.fillRect(r+t,n+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,r,n,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,r,n,a,o,l){var h,c,d,u,p,g;const{textureRatio:m=n.textureRatio,textureOptions:f=null}=e.attribute;let v=null;const y=null!==(h=null==f?void 0:f.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&f&&f.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=f,u=e.AABBBounds;s=u.x1,r=u.y1;const p=i;let g;if(d){g=Pn.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,r=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,r,n),p.clip();const v=u.width(),y=u.height(),_=l,b=o,S=h.columns?h.columns:Math.ceil(v/b),x=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,T=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=new Ha({}));const C=h.columns?v/h.columns:b,k=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,k-T],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t<x;t++)for(let n=0;n<S;n++){const o=s+b/2+n*b,l=r+b/2+t*b;null===(c=f.beforeDynamicTexture)||void 0===c||c.call(f,i,t,n,x,S,m,e,u.width(),u.height()),i.beginPath(),!1===w.draw(i,Math.min(C-A,k-T),o,l,0)&&i.closePath(),i.fillStyle=a,f.dynamicTexture(i,t,n,x,S,m,e,u.width(),u.height())}d&&(p.globalAlpha=1,p.drawImage(g.nativeCanvas,0,0,g.nativeCanvas.width,g.nativeCanvas.height,u.x1,u.y1,u.width()*p.dpr,u.height()*p.dpr)),p.restore()}else if(v){if(v.setTransform){const t=!!(null==f?void 0:f.alignToGraphic),e=null!==(d=null==f?void 0:f.alignOffsetX)&&void 0!==d?d:0,n=null!==(u=null==f?void 0:f.alignOffsetY)&&void 0!==u?u:0;let a=0,o=0;if(t){const t=i.currentMatrix;a=(null!==(p=null==t?void 0:t.e)&&void 0!==p?p:0)+s+e,o=(null!==(g=null==t?void 0:t.f)&&void 0!==g?g:0)+r+n}else(e||n)&&(a=e,o=n);v.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,a,o]))}i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,r,n),i.fillStyle=v,i.fill(),i.highPerformanceRestore()}else if("wave"===t){i.save(),i.setCommonStyle(e,e.attribute,s,r,n),i.clip();const t=e.AABBBounds;(function(t,e,i,s,r,n,a){const{fill:o="orange",percent:l=.6,frequency:h=4,opacity:c,phi:d=0}=r;let{amplitude:u=10}=r;u*=function(t){return t<=.5?4*t-1:-4*t+3}(e);const p=s*(1-l),g=i,m=Math.max(Math.round(g/70),2);t.beginPath(),t.moveTo(0+n,s+a),t.lineTo(0+n,p+a);const f=g/h*e,v=g/Math.PI/(2*h);for(let e=0;e<g;e+=m){const i=u*Math.sin((e+f+d)/v+d);t.lineTo(e+n,p+i+a)}t.lineTo(g+n,s+a),t.closePath(),t.fillStyle=o,isFinite(c)&&(t.globalAlpha=c),t.fill()})(i,m,t.width(),t.height(),Object.assign(Object.assign({},f||{}),{fill:a}),s+t.x1-s,r+t.y1-r),i.restore()}}getPatternCacheKey(t,e,i,s,r,n){return"string"!=typeof t?i>0||n>0?null:t:"wave"===t?null:zo.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${r}`:`resource:${t}|padding:${i}|radius:${n}|dpr:${r}`}createResourcePattern(t,e,i,s,r){var n;const a=null===(n=e.resources)||void 0===n?void 0:n.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||r>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const n=t+2*s,a=e+2*s,l=Pn.allocate({width:n,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,n,a),r>0){const i=Math.max(0,Math.min(r,Math.min(t,e)/2)),n=s,a=s,o=n+t,l=a+e;h.beginPath(),h.moveTo(n+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(n+i,l),h.quadraticCurveTo(n,l,n,l-i),h.lineTo(n,a+i),h.quadraticCurveTo(n,a,n+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),Pn.free(l),c}Pn.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}new Ko;const Ho=new class extends On{constructor(){super(...arguments),this.time=Nt.beforeFillStroke}drawShape(t,e,i,s,r,n,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:m=l.backgroundMode,backgroundFit:f=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:S=l.backgroundClip,backgroundPosition:x=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(Rn(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,S&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:m,backgroundFit:f,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:x}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};class Wo{constructor(t){this.groupRenderContribitions=t,this.numberType=Rs}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Ho)}drawShape(t,e,i,r,n,a,o,l,h){const{clip:c,fill:d,stroke:u,background:p}=t.attribute;if(!(c||d||u||p))return;h=null!=h?h:xn(t,null==a?void 0:a.theme).group;const{opacity:g=h.opacity,width:m=h.width,height:f=h.height,fillOpacity:v=h.fillOpacity,strokeOpacity:y=h.strokeOpacity,cornerRadius:_=h.cornerRadius,path:b=h.path,lineWidth:S=h.lineWidth,visible:x=h.visible,fillStrokeOrder:A=h.fillStrokeOrder,cornerType:T=h.cornerType,x:C=h.x,y:k=h.y}=t.attribute,w=jo(g,v,m,f,d),M=Go(g,y,m,f),E=Fo(d,p),B=No(u,S);if(!t.valid||!x)return;if(!c){if(!E&&!B)return;if(!(w||M||o||l||p))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,a)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||s.isArray(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,r,m,f)):(e.beginPath(),function(t,e,i,r,n,a,o=!0,l){let h;if(Array.isArray(o)&&(l=o,o=!0),r<0&&(e+=r,r=-r),n<0&&(i+=n,n=-n),s.isNumber(a,!0))h=[a=s.abs(a),a,a,a];else if(Array.isArray(a)){const t=a;let e,i;switch(t.length){case 0:h=[0,0,0,0];break;case 1:e=s.abs(t[0]),h=[e,e,e,e];break;case 2:case 3:e=s.abs(t[0]),i=s.abs(t[1]),h=[e,i,e,i];break;default:h=t,h[0]=s.abs(h[0]),h[1]=s.abs(h[1]),h[2]=s.abs(h[2]),h[3]=s.abs(h[3])}}else h=[0,0,0,0];if(r<0||h[0]+h[1]+h[2]+h[3]<1e-12)return t.rect(e,i,r,n);const[c,d,u,p]=[[e,i],[e+r,i],[e+r,i+n],[e,i+n]],g=Math.min(r/2,n/2),m=[Math.min(g,h[0]),Math.min(g,h[1]),Math.min(g,h[2]),Math.min(g,h[3])],f=[c[0]+m[0],c[1]],v=[c[0],c[1]+m[0]],y=[d[0]-m[1],d[1]],_=[d[0],d[1]+m[1]],b=[u[0]-m[2],u[1]],S=[u[0],u[1]-m[2]],x=[p[0]+m[3],p[1]],A=[p[0],p[1]-m[3]];if(t.moveTo(f[0],f[1]),o){if(l&&l[0]?l[0](f[0],f[1],y[0],y[1]):t.lineTo(y[0],y[1]),!s.arrayEqual(y,_)){l&&l[0]&&t.moveTo(y[0],y[1]);const e=y[0],i=y[1]+m[1];t.arc(e,i,m[1],-Lo,0,!1)}if(l&&l[1]?l[1](_[0],_[1],S[0],S[1]):t.lineTo(S[0],S[1]),!s.arrayEqual(b,S)){const e=S[0]-m[2],i=S[1];l&&l[1]&&t.moveTo(S[0],S[1]),t.arc(e,i,m[2],0,Lo,!1)}if(l&&l[2]?l[2](b[0],b[1],x[0],x[1]):t.lineTo(x[0],x[1]),!s.arrayEqual(x,A)){const e=x[0],i=x[1]-m[3];l&&l[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,m[3],Lo,s.pi,!1)}if(l&&l[3]?l[3](A[0],A[1],v[0],v[1]):t.lineTo(v[0],v[1]),!s.arrayEqual(f,v)){const e=f[0],i=f[1]+m[0];l&&l[3]&&t.moveTo(v[0],v[1]),t.arc(e,i,m[0],s.pi,s.pi+Lo,!1)}}else l&&l[0]?l[0](f[0],f[1],y[0],y[1]):t.lineTo(y[0],y[1]),l&&l[1]?l[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),l&&l[2]?l[2](b[0],b[1],x[0],x[1]):t.lineTo(x[0],x[1]),l&&l[2]?l[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);!l&&t.closePath()}(e,i,r,m,f,_,"bevel"!==T));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Ho));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this._groupRenderContribitions.forEach((s=>{s.time===Nt.beforeFillStroke&&s.drawShape(t,e,i,r,E,B,w,M,h,n,o,l,P)})),c&&e.clip();const O=()=>{P.doFill&&(o?o(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,C-i,k-r,h),e.fill()))},I=()=>{P.doStroke&&(l?l(e,t.attribute,h):M&&(e.setStrokeStyle(t,t.attribute,C-i,k-r,h),e.stroke()))};A?(I(),O()):(O(),I()),this._groupRenderContribitions.forEach((s=>{s.time===Nt.afterFillStroke&&s.drawShape(t,e,i,r,E,B,w,M,h,n,o,l)}))}draw(t,e,i,s){var r,n;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:r}=t.attribute,n=a.canvas,o=dt.global.createCanvas({width:n.width,height:n.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,n.width,n.height),l.beginPath(),l.rect(e,i,s,r),l.clip(),l.drawImage(n.nativeCanvas,0,0,n.width,n.height,0,0,n.displayWidth,n.displayHeight),l.restore()),a.nativeContext=l,n.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=xn(t,null==s?void 0:s.theme).group,i=Er.allocate(),r=Er.allocate();aa(r,t,e),Cr(i,p||i,r),a.modelMatrix=i,Er.free(r),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:m}=t.attribute;let f;if((g||m)&&a.translate(g,m),s&&s.renderInGroup&&(f=s.renderInGroup(null===(r=s.renderInGroupParams)||void 0===r?void 0:r.skipSort,t,i,null===(n=s.renderInGroupParams)||void 0===n?void 0:n.nextM)),a.modelMatrix!==p&&Er.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:r}=t.attribute,n=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&n.rect(e,i,s,r),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=n.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}f&&f.then?f.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var $o,Yo=function(t,e,i,s){return new(i||(i=Promise))((function(r,n){function a(t){try{l(s.next(t))}catch(t){n(t)}}function o(t){try{l(s.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}($o||($o={}));class Xo extends Hn{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=$o.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new lt([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return Yo(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:r}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(r.x1,r.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:je.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:je.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return Yo(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return Yo(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Yo(this,void 0,void 0,(function*(){if(2!==t.count)yield Mn(t,je.zIndex,((i,s)=>{if(this.status===$o.STOP)return!0;if(i.isContainer)return!1;if(s<this.currentIdx)return!1;const r=this.currFrameStartAt+t.incremental;return s<r&&(this.currentIdx=s+1,this.renderItem(i,e)),s===r-1&&(this.currFrameStartAt=this.currentIdx,this.waitToNextFrame())})),i(!1);else{const s=t.getChildAt(0);if(s.incremental&&s.attribute.segments)for(s.incrementalAt||(s.incrementalAt=0);s.incrementalAt<s.attribute.segments.length;)e.multiGraphicOptions={startAtIdx:s.incrementalAt,length:s.incremental},this.renderItem(s,e),s.incrementalAt+=s.incremental,yield this.waitToNextFrame();else this.renderItem(s,e);i(!1)}}))})})),this.hooks.completeDraw.call()}))}waitToNextFrame(){return Yo(this,void 0,void 0,(function*(){return new Promise((t=>{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return Yo(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return Yo(this,void 0,void 0,(function*(){this.rendering&&(this.status=$o.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=$o.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return Yo(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Yo(this,void 0,void 0,(function*(){yield Mn(t,je.zIndex,(t=>Yo(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const qo=Symbol.for("IncrementalDrawContribution"),Zo=Symbol.for("Arc3dRender"),Jo=Symbol.for("GraphicRender"),Qo=Symbol.for("GroupRender"),tl=Symbol.for("Rect3DRender"),el=Symbol.for("Pyramid3dRender"),il=Symbol.for("DrawContribution"),sl=Symbol.for("DrawItemInterceptor"),rl=new s.AABBBounds,nl=new s.AABBBounds;class al{constructor(){this.order=1}afterDrawItem(t,e,i,s,r){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,r),!1}beforeDrawItem(t,e,i,s,r){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,r),!1}drawItem(t,e,i,s,r){if(!t.shadowRoot)return!1;const{context:n}=i;if(n.highPerformanceSave(),n.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){rl.copy(s.dirtyBounds),nl.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,Mr.allocate(1,0,0,1,0,0)),n.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(rl),s.backupDirtyBounds.copy(nl)),!0}}class ol{constructor(){this.order=1}afterDrawItem(t,e,i,s,r){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,r),!1}drawItem(t,e,i,s,r){if(!t.attribute._debug_bounds)return!1;const{context:n}=i;n.highPerformanceSave(),t.parent&&n.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&n.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(n,t),n.strokeRect(a.x1,a.y1,a.width(),a.height()),n.highPerformanceRestore(),!0}}class ll{constructor(){this.order=1,this.interceptors=[new al,new cl,new hl,new ol]}afterDrawItem(t,e,i,s,r){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let n=0;n<this.interceptors.length;n++)if(this.interceptors[n].afterDrawItem&&this.interceptors[n].afterDrawItem(t,e,i,s,r))return!0;return!1}beforeDrawItem(t,e,i,s,r){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let n=0;n<this.interceptors.length;n++)if(this.interceptors[n].beforeDrawItem&&this.interceptors[n].beforeDrawItem(t,e,i,s,r))return!0;return!1}}class hl{constructor(){this.order=1}beforeDrawItem(t,e,i,s,r){return!this.processing&&(t.baseGraphic?this.beforeDrawInteractive(t,e,i,s,r):this.beforeSetInteractive(t,e,i,s,r))}beforeSetInteractive(t,e,i,s,r){let n=t.interactiveGraphic;if(t.attribute.globalZIndex){n||(n=t.clone(),t.interactiveGraphic=n,n.baseGraphic=t),n.setAttributes({globalZIndex:0,zIndex:t.attribute.globalZIndex},!1,{skipUpdateCallback:!0}),i.stage.tryInitInteractiveLayer();const e=i.stage.getLayer("_builtin_interactive");return e&&this.getShadowRoot(e).add(n),!0}if(n){i.stage.tryInitInteractiveLayer();const e=i.stage.getLayer("_builtin_interactive");e&&this.getShadowRoot(e).removeChild(n),t.interactiveGraphic=null,n.baseGraphic=null}return!1}beforeDrawInteractive(t,e,i,s,r){const n=t.baseGraphic;let a=!!n.stage,o=n.parent;for(;a&&o&&o.stage!==o;)a=!!o.stage,o=o.parent;if(!a){const e=i.stage.getLayer("_builtin_interactive");return e&&this.getShadowRoot(e).removeChild(t),!0}if(n){this.processing=!0;const{context:t}=i;return t.highPerformanceSave(),t.setTransformFromMatrix(n.parent.globalTransMatrix,!0),n.isContainer?s.renderGroup(n,i,n.parent.globalTransMatrix):s.renderItem(n,i),t.highPerformanceRestore(),this.processing=!1,!0}return!1}getShadowRoot(t){var e;let i=t.getElementById("_interactive_group");return i||(i=na("group",{}),i.id="_interactive_group",t.add(i)),null!==(e=i.shadowRoot)&&void 0!==e?e:i.attachShadow()}}class cl{constructor(){this.order=1}beforeDrawItem(t,e,i,s,r){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:n,stage:a}=e.drawParams;n.save(),this.initCanvasCtx(n),n.camera=a.camera;const o=n.currentMatrix;o.a/=n.dpr,o.b/=n.dpr,o.c/=n.dpr,o.d/=n.dpr,o.e/=n.dpr,o.f/=n.dpr;const l=Er.allocate();var h,c;c=o,(h=l)[0]=c.a,h[1]=c.b,h[2]=0,h[3]=0,h[4]=c.c,h[5]=c.d,h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[10]=1,h[11]=0,h[12]=c.e,h[13]=c.f,h[14]=0,h[15]=1;const d=n.modelMatrix;if(d){if(l){const t=Er.allocate();n.modelMatrix=Cr(t,d,l)}}else n.modelMatrix=l;return n.setTransform(1,0,0,1,0,0,!0),t.isContainer?_o(n,t,((e,r)=>s.renderGroup(t,i,t.parent.globalTransMatrix,!e&&r)),i):s.renderItem(t,i),n.camera=null,n.restore(),n.modelMatrix!==d&&Er.free(n.modelMatrix),n.modelMatrix=d,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const dl=Symbol.for("GroupRenderContribution"),ul=Symbol.for("InteractiveSubRenderContribution");function pl(t){!function({bind:t}){t(On).toSelf().inSingletonScope(),t(Ko).toSelf().inSingletonScope(),t(il).to(Hn),t(qo).to(Xo),t(Qo).toDynamicValue((({container:t})=>new Wo(oo(dl,t)))).inSingletonScope(),t(Jo).toService(Qo),lo(t,dl),lo(t,ul),t(Vn).toDynamicValue((({container:t})=>new Vn(oo(ul,t)))).inSingletonScope(),lo(t,Jo),t(ll).toSelf().inSingletonScope(),t(sl).toService(ll),lo(t,sl)}({bind:t.bind})}class gl{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class ml{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new gl(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}const fl=Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");const vl=function(){const t=globalThis;return t[fl]||(t[fl]={legacyBindingContext:new ml,preloaded:!1}),t[fl]}(),yl=vl.legacyBindingContext;function _l(){vl.preloaded||(vl.preloaded=!0,function({bind:t}){t(Fa).toDynamicValue((({container:t})=>new qa(oo(La,t)))).inSingletonScope(),t(pt).to(mt),t(eo).toDynamicValue((({container:t})=>new Za(oo(uo,t)))).inSingletonScope(),t(to).to(Qa).inSingletonScope(),t(io).to(Jn).inSingletonScope()}({bind:yl.bind}),function({bind:t}){t(js).to(oa),t(Vs).toConstantValue(sa)}({bind:yl.bind}),function({bind:t}){t(go).to(Wn)}({bind:yl.bind}),function({bind:t,isBound:e}){e(mo)||(t(fo).toSelf(),t(mo).toService(fo)),t(Bo).toSelf().inSingletonScope(),t(vo).toService(Bo),t(Mo).toSelf().inSingletonScope(),t(vo).toService(Mo),t(Eo).toSelf().inSingletonScope(),t(vo).toService(Eo),lo(t,vo),t(wo).toSelf().inSingletonScope(),t(yo).toService(wo),lo(t,yo)}({bind:yl.bind,isBound:yl.isBound}),Io({bind:yl.bind}),Do(yl),pl(yl))}function bl(){return yl}const Sl=function(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}((()=>function(t){_l();const[e]=yl.getAll(t);return e}(Fa)));dt.global=Sl;class xl{constructor(){this.transitions=new Map,this.registerDefaultTransitions()}static getInstance(){return xl.instance||(xl.instance=new xl),xl.instance}registerDefaultTransitions(){this.registerTransition("appear","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,r,n,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(r=this.transitions.get(t))||void 0===r?void 0:r.get("*"),o?o(i,t):(o=null===(n=this.transitions.get("*"))||void 0===n?void 0:n.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function Al(t){if(!t||!s.isFunction(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}function Tl(t,e,i,s){const r=function(t,e,i,s){var r;const n=t,a=null===(r=n.context)||void 0===r?void 0:r.finalAttrs,o=n.getFinalAttribute();let l=null;for(let t=0;t<e.length;t++){const r=e[t];i&&!i.validAttr(r)||(a&&Object.prototype.hasOwnProperty.call(a,r)?(null!=l||(l={}),l[r]=a[r]):o&&Object.prototype.hasOwnProperty.call(o,r)?(null!=l||(l={}),l[r]=o[r]):s&&Object.prototype.hasOwnProperty.call(s,r)&&(null!=l||(l={}),l[r]=s[r]))}return l}(t,e,i,s);if(!r)return!1;t.setFinalAttributes(r);const n=t._commitAnimationStaticAttributes;return"function"==typeof n?n.call(t,r,{type:Dt.ANIMATE_END}):t.setAttributes(r,!1,{type:Dt.ANIMATE_END}),!0}xl.getInstance();class Cl{static registerBuiltInAnimate(t,e){Cl.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._activeConfigList=null,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e<this._animates.length;e++){const i=this._animates[e];if(i.status===Ie.END)continue;const s=i.getEndProps();if(s)for(const e in s)Object.prototype.hasOwnProperty.call(s,e)&&t.indexOf(e)<0&&t.push(e)}return t}hasActiveAttrs(){for(let t=0;t<this._animates.length;t++){const e=this._animates[t];if(e.status===Ie.END)continue;const i=e.getEndProps();if(i)for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t))return!0}return!1}preventAttrs(t){if(!(null==t?void 0:t.length))return this.hasActiveAttrs();for(let e=0;e<this._animates.length;e++){const i=this._animates[e];i.status!==Ie.END&&i.preventAttrs(t)}return this.hasActiveAttrs()}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var r,n;const a=this.resolveValue(t.totalTime,i,void 0),o=this.resolveValue(t.startTime,i,0),l=Object.assign({},t);l.oneByOneDelay=0,l.startTime=o,l.totalTime=a;const h=this.resolveValue(t.oneByOne,i,!1);if(e){const t=l.timeSlices;s.isArray(t)||(l.timeSlices=[t]);let e=0;l.timeSlices=l.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),r=this.resolveValue(t.delayAfter,i,0),n=this.resolveValue(t.duration,i,300);return e+=s+n+r,Object.assign(Object.assign({},t),{delay:s,delayAfter:r,duration:n})}));let r=0;h&&(r="number"==typeof h?h:h?e:0),l.oneByOneDelay=r;let n=1;if(a){const t=e+r*(this._target.count-2);n=a?a/t:1}l.timeSlices=l.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:Cl.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],r=Al(s);return Object.assign(Object.assign({},t),{custom:s,customType:r})}))})})),l.oneByOneDelay=r*n,l.startTime=o*n}else{const e=this.resolveValue(t.delay,i,0),c=this.resolveValue(t.delayAfter,i,0),d=this.resolveValue(t.duration,i,300);let u=0;h&&(u="number"==typeof h?h:h?e+c+d:0),l.oneByOneDelay=u,l.custom=null!==(r=t.custom)&&void 0!==r?r:Cl.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const p=Al(l.custom);l.customType=p;const g=e+c+d+u*(this._target.count-2),m=s.isValidNumber(a)?a/g:1;l.delay=e*m,l.delayAfter=c*m,l.duration=d*m,l.oneByOneDelay=u*m,l.startTime=o}return l}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,r,n,a;return t.sort(null===(r=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],null===(a=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,r)=>{const n=this.parseParams(t,e,i),a=this.executeTimelineItem(n,i,s,r);a&&this._trackAnimation(a)}:(i,s,r)=>{const n=this.parseParams(t,e,i),a=this.executeTypeConfigItem(n,i,s,r);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,r){var n,a,o,l,h,c,d,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:m,easing:f="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:S=0,loop:x,bounce:A,priority:T=0,options:C,custom:k,customType:w,controlOptions:M}=t,E=e.animate();E.priority=T;const B=s.isFunction(v)?v(null===(a=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===a?void 0:a[0],e,{}):v,P=null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],O=null===(h=e.context)||void 0===h?void 0:h.indexKey;P&&O&&(i=null!==(c=P[O])&&void 0!==c?c:i),E.startAt(b);const I=i*S+B;I>0&&E.wait(I);let R=null,D=t.to,L=t.from;const F=this.shouldCommitAttrOutChannel(p);D||(R||(R=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=R.props),L||(R||(R=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=R.from),R.attrOutChannel&&e.setAttributes(R.attrOutChannel),this._handleRunAnimate(E,k,w,L,D,_,f,m,M,C,p,e),this.commitAnimatedUpdateDiffAttrsOnEnd(E,e,p,D);let N=0;S&&(N=S*(r-i-1));const U=s.isFunction(y)?y(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):y;return U>0&&(N+=U),N>0&&E.wait(N),x&&x>0&&E.loop(x),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,r,n,a,o,l,h,c,d,u){var p,g,m,f,v,y,_,b;if(e&&i){i=Al(e);let d=this.resolveValue(l,u);"function"==typeof d&&(d=d(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),d=Object.assign({width:(null===(m=u.stage)||void 0===m?void 0:m.width)||0,height:(null===(f=u.stage)||void 0===f?void 0:f.height)||0,group:this._target.parent},d);const S=s.isFunction(c)?c.call(null,null!==(y=d&&(null===(v=d.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,d):c;d.options=S,d.controlOptions=h,1===i?this.createCustomAnimation(t,e,r,n,a,o,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,a,o,d)}else"to"===d?t.to(n,a,o):"from"===d&&t.from(n,a,o)}executeTimelineItem(t,e,i,s){var r,n,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,m=null===(n=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===n?void 0:n[0],f=null===(a=e.context)||void 0===a?void 0:a.indexKey;m&&f&&(i=null!==(o=m[f])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,r){var n,a,o,l;const{effects:h,duration:c=300,delay:d=0,delayAfter:u=0}=t,p=s.isFunction(d)?d(null===(a=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===a?void 0:a[0],i,{}):d,g=s.isFunction(u)?u(null===(l=null===(o=i.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(h)?h:[h]).forEach((t=>{var s;const{type:n="fromTo",channel:a,customParameters:o,easing:l="linear",options:h}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(n);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const m=null!==(s=t.custom)&&void 0!==s?s:Cl.builtInAnimateMap[n],f=t.custom?t.customType:Al(m);this._handleRunAnimate(e,m,f,p,u,c,l,o,r,h,n,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,r,n){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,r,a,o)=>{e(r,i,s,a,o,t.target,n)},t.to(i,s,r)}shouldCommitAttrOutChannel(t){return"update"!==t}commitAnimatedUpdateDiffAttrsOnEnd(t,e,i,s){if("update"===i||!s||!this.isUpdateDiffContext(e))return;const r=this.collectAnimatedUpdateDiffAttrKeys(e,s);(null==r?void 0:r.length)&&t.onEnd((()=>{Tl(e,r,t,s)}))}isUpdateDiffContext(t){const e=t.context;return"update"===(null==e?void 0:e.diffState)||"update"===(null==e?void 0:e.animationState)}collectAnimatedUpdateDiffAttrKeys(t,e){var i;const s=null===(i=t.context)||void 0===i?void 0:i.diffAttrs;if(!s)return null;let r=null;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(s,t)&&void 0!==s[t]&&(null!=r||(r=[]),r.push(t));return r}createCustomAnimation(t,e,i,s,r,n,a){const o=new e(i,s,r,n,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var r;const n={};let a=null;if(!t)return{from:a,props:n,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(r=e.context)||void 0===r?void 0:r.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,r,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?n[i]=h.to(null===(r=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],e,{}):n[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(n.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:n,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,r;return void 0===t?i:"function"==typeof t&&e?t(null===(r=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let r=null;for(let e=0;e<i.length;e++)r=this.collectAnimatedDiffKeys(i[e],t,s,r);return r}collectAnimatedDiffKeys(t,e,i,s){if("timeSlices"in t){const r=Array.isArray(t.timeSlices)?t.timeSlices:[t.timeSlices];for(let t=0;t<r.length;t++){const n=Array.isArray(r[t].effects)?r[t].effects:[r[t].effects];for(let t=0;t<n.length;t++)s=this.collectAnimatedDiffKeysFromEffect(n[t],e,i,s)}return s}return this.collectAnimatedDiffKeysFromEffect(t,e,i,s)}collectAnimatedDiffKeysFromEffect(t,e,i,s){var r;if("update"===(null!==(r=t.type)&&void 0!==r?r:"fromTo")){const r=this.resolveValue(t.options,e,void 0),n=null==r?void 0:r.excludeChannels;for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&void 0!==i[t]&&!this.includesChannel(n,t)&&(null!=s||(s={}),s[t]=!0);return s}return s=this.collectExplicitAnimatedKeys(t.to,i,s),s=this.collectExplicitAnimatedKeys(t.from,i,s),this.collectChannelAnimatedKeys(t.channel,i,s)}collectExplicitAnimatedKeys(t,e,i){if(!t)return i;for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&Object.prototype.hasOwnProperty.call(e,s)&&void 0!==e[s]&&(null!=i||(i={}),i[s]=!0);return i}collectChannelAnimatedKeys(t,e,i){if(!t)return i;if(Array.isArray(t)){for(let s=0;s<t.length;s++){const r=t[s];Object.prototype.hasOwnProperty.call(e,r)&&void 0!==e[r]&&(null!=i||(i={}),i[r]=!0)}return i}for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&Object.prototype.hasOwnProperty.call(e,s)&&void 0!==e[s]){const e=t[s];void 0===e.to&&void 0===e.from||(null!=i||(i={}),i[s]=!0)}return i}includesChannel(t,e){if(!(null==t?void 0:t.length))return!1;for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1}syncFinalAttrsFromContext(t){var e;const i=null===(e=t.context)||void 0===e?void 0:e.finalAttrs;i&&t.setFinalAttributes(i)}executeItem(t,e,i=0,s=1){if(Array.isArray(t)){const r=this._activeConfigList;this._activeConfigList=t;try{return t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=r}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const r="timeSlices"in t;let n=null;const a=this.parseParams(t,r);return n=r?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),n&&this._trackAnimation(n),n}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Ie.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}Cl.builtInAnimateMap={};const kl="appear",wl="disappear",Ml="update",El="highlight",Bl="unhighlight";class Pl{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class Ol{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1}takeOverUpdateAttrs(t,e,i){if(t.state!==Ml||!e.length)return;const s=t.executor.getActiveAttrKeys();if(s.length)for(let r=0;r<e.length;r++){const n=e[r];n.state!==Ml||n===t||this.hasStateInfo(i,n)||n.executor.preventAttrs(s)||(n.executor.stop(null,!1),i.push(n))}}applyState(t,e,i){var r;const n=xl.getInstance(),a=null!==(r=this.stateList)&&void 0!==r?r:[],o=[],l=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const r={allowTransition:!0,stopOriginalTransition:!0};a.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);r.allowTransition=r.allowTransition&&i.allowTransition})),r.allowTransition&&(l.push({state:t,animationConfig:s.isArray(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new Cl(this.graphic)}),a.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&o.push(e)})))})):t.forEach(((t,i)=>{l.push({state:t,animationConfig:s.isArray(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new Cl(this.graphic)})})),o.forEach((t=>{t.executor.stop(null,!1)})),l.length){l[0].executor.execute(l[0].animationConfig),this.takeOverUpdateAttrs(l[0],a,o);for(let t=0;t<l.length;t++){const e=l[t+1],s=l[t];s.executor.onEnd((()=>{var r;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(r=this.stateList)&&void 0!==r?r:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===l.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!o.includes(t))):this.stateList=[],this.stateList.push(...l)}applyAppearState(t,e){this.applyState([kl],[{name:kl,animation:t}],e)}applyDisappearState(t,e){this.applyState([wl],[{name:wl,animation:t}],e)}applyUpdateState(t,e){this.applyState([Ml],[{name:Ml,animation:t}],e)}applyHighlightState(t,e){this.applyState([El],[{name:El,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([Bl],[{name:Bl,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class Il{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new Ol(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new Pl(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class Rl{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-Rl.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Rl.bounceIn(2*t):.5*Rl.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const r=e/s.pi2*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-r)*s.pi2/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const r=e/s.pi2*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-r)*s.pi2/e)+1}}static getElasticInOut(t,e){return function(i){const r=e/s.pi2*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-r)*s.pi2/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-r)*s.pi2/e)*.5+1}}static registerFunc(t,e){Rl[t]=e}}function Dl(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const r=s*t/i;return r>0?r:1+r}Rl.quadIn=Rl.getPowIn(2),Rl.quadOut=Rl.getPowOut(2),Rl.quadInOut=Rl.getPowInOut(2),Rl.cubicIn=Rl.getPowIn(3),Rl.cubicOut=Rl.getPowOut(3),Rl.cubicInOut=Rl.getPowInOut(3),Rl.quartIn=Rl.getPowIn(4),Rl.quartOut=Rl.getPowOut(4),Rl.quartInOut=Rl.getPowInOut(4),Rl.quintIn=Rl.getPowIn(5),Rl.quintOut=Rl.getPowOut(5),Rl.quintInOut=Rl.getPowInOut(5),Rl.backIn=Rl.getBackIn(1.7),Rl.backOut=Rl.getBackOut(1.7),Rl.backInOut=Rl.getBackInOut(1.7),Rl.elasticIn=Rl.getElasticIn(1,.3),Rl.elasticOut=Rl.getElasticOut(1,.3),Rl.elasticInOut=Rl.getElasticInOut(1,.3*1.5),Rl.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),Rl.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},Rl.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)Rl[`flicker${t}`]=e=>Dl(e,t);for(let t=2;t<10;t++)Rl[`aIn${t}`]=e=>t*e*e+(1-t)*e;function Ll(t,e,i){return t+(e-t)*i}const Fl=new class{constructor(){this.opacity=(t,e,i,s,r,n)=>{n.attribute.opacity=Ll(e,i,s)},this.baseOpacity=(t,e,i,s,r,n)=>{n.attribute.baseOpacity=Ll(e,i,s)},this.fillOpacity=(t,e,i,s,r,n)=>{n.attribute.fillOpacity=Ll(e,i,s)},this.strokeOpacity=(t,e,i,s,r,n)=>{n.attribute.strokeOpacity=Ll(e,i,s)},this.zIndex=(t,e,i,s,r,n)=>{n.attribute.zIndex=Ll(e,i,s)},this.backgroundOpacity=(t,e,i,s,r,n)=>{n.attribute.backgroundOpacity=Ll(e,i,s)},this.shadowOffsetX=(t,e,i,s,r,n)=>{n.attribute.shadowOffsetX=Ll(e,i,s)},this.shadowOffsetY=(t,e,i,s,r,n)=>{n.attribute.shadowOffsetY=Ll(e,i,s)},this.shadowBlur=(t,e,i,s,r,n)=>{n.attribute.shadowBlur=Ll(e,i,s)},this.fill=(t,e,i,s,r,n)=>{n.attribute.fill=Q(e,i,s,!1)},this.fillPure=(t,e,i,s,r,n)=>{n.attribute.fill=r.fromParsedProps.fill?et(r.fromParsedProps.fill,r.toParsedProps.fill,s):r.toParsedProps.fill},this.stroke=(t,e,i,s,r,n)=>{n.attribute.stroke=Q(e,i,s,!1)},this.strokePure=(t,e,i,s,r,n)=>{n.attribute.stroke=r.fromParsedProps.stroke?et(r.fromParsedProps.stroke,r.toParsedProps.stroke,s):r.toParsedProps.stroke},this.width=(t,e,i,s,r,n)=>{n.attribute.width=Ll(e,i,s),n.addUpdateBoundTag()},this.height=(t,e,i,s,r,n)=>{n.attribute.height=Ll(e,i,s),n.addUpdateBoundTag()},this.x=(t,e,i,s,r,n)=>{n.attribute.x=Ll(e,i,s),n.addUpdateBoundTag(),n.addUpdatePositionTag()},this.y=(t,e,i,s,r,n)=>{n.attribute.y=Ll(e,i,s),n.addUpdateBoundTag(),n.addUpdatePositionTag()},this.dx=(t,e,i,s,r,n)=>{n.attribute.dx=Ll(e,i,s),n.addUpdateBoundTag(),n.addUpdatePositionTag()},this.dy=(t,e,i,s,r,n)=>{n.attribute.dy=Ll(e,i,s),n.addUpdateBoundTag(),n.addUpdatePositionTag()},this.angle=(t,e,i,s,r,n)=>{n.attribute.angle=Ll(e,i,s),n.addUpdateBoundTag(),n.addUpdatePositionTag()},this.scaleX=(t,e,i,s,r,n)=>{n.attribute.scaleX=Ll(e,i,s),n.addUpdateBoundTag(),n.addUpdatePositionTag()},this.scaleY=(t,e,i,s,r,n)=>{n.attribute.scaleY=Ll(e,i,s),n.addUpdateBoundTag(),n.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,r,n)=>{n.attribute.lineWidth=Ll(e,i,s),n.addUpdateBoundTag()},this.startAngle=(t,e,i,s,r,n)=>{n.attribute.startAngle=Ll(e,i,s),n.addUpdateBoundTag()},this.endAngle=(t,e,i,s,r,n)=>{n.attribute.endAngle=Ll(e,i,s),n.addUpdateBoundTag()},this.radius=(t,e,i,s,r,n)=>{n.attribute.radius=Ll(e,i,s),n.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,r,n)=>{n.attribute.outerRadius=Ll(e,i,s),n.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,r,n)=>{n.attribute.innerRadius=Ll(e,i,s),n.addUpdateBoundTag()},this.size=(t,e,i,s,r,n)=>{n.attribute.size=Ll(e,i,s),n.addUpdateBoundTag()},this.points=(t,e,i,s,r,n)=>{n.attribute.points=ci(e,i,s),n.addUpdateBoundTag()}}};function Nl(t,e,i,s,r,n){if(Number.isFinite(i)&&Number.isFinite(e))return n.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const r=[];let a=!0;for(let t=0;t<i.length;t++){const n=e[t],o=n+(i[t]-n)*s;if(!Number.isFinite(o)){a=!1;break}r.push(o)}return a&&(n.attribute[t]=r),!0}return!1}const Ul={type:Dt.ANIMATE_UPDATE},jl={type:Dt.ANIMATE_BIND},Vl={type:Dt.ANIMATE_START};function Gl(t){const e=t;return e.attribute||(e.attribute={}),e.attribute===e.baseAttributes&&e.detachAttributeFromBaseAttributes(),e.attributeMayContainTransientAttrs=!0,e.attribute}function zl(t){t.onAttributeUpdate(Ul)}function Kl(t,e){if(!e)return;const i=Gl(t);for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(i[t]=e[t]);zl(t)}function Hl(t,e,i,s,r){const n=Gl(t);for(let t=0;t<e.length;t++){const a=e[t];n[a]=i[a]+(s[a]-i[a])*r}zl(t)}function Wl(t,e,i=Dt.ANIMATE_UPDATE){if(!e)return;const s=function(t){switch(t){case Dt.ANIMATE_UPDATE:return Ul;case Dt.ANIMATE_BIND:return jl;case Dt.ANIMATE_START:return Vl;default:return{type:t}}}(i);t.applyAnimationTransientAttributes(e,!1,s)}function $l(t,e){Wl(t,e,Dt.ANIMATE_BIND)}function Yl(){}function Xl(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1}class ql{constructor(t,e,i,s){var r;this._startTime=0,this._hasFirstRun=!1,this._syncAttributeUpdate=()=>{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:Dt.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(r=Rl[s])&&void 0!==r?r:Rl.linear:Rl.linear,"wait"===t&&(this.onUpdate=Yl),this.id=at.GenAutoIncrementId(),this.syncAttributeUpdate=Yl}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],r=this.props[e];if(s.isString(i)&&s.isString(r)){const s=Z.Get(i,q.Color255),n=Z.Get(r,q.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=s,this.toParsedProps[e]=n,t.push(Fl["fill"===e?"fillPure":"strokePure"])}else Fl[e]?t.push(Fl[e]):t.push(Nl)}else Fl[e]?t.push(Fl[e]):t.push(Nl)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,r=this.propKeys;if(s&&r)for(let n=0;n<s.length;n++){const a=r[n],o=t[a],l=e[a];s[n](a,o,l,i,this,this.target)}}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let r=null;for(let t=0;t<i.length;t++){const e=i[t];null!=s[e]&&(null!=r?r:r=[]).push(e)}r&&e.preventAttrs(r)}))}removeKeysFromRecord(t,e){if(!t)return t;let i=!1;for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&Xl(e,s)){i=!0;break}if(!i)return t;const s={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&!Xl(e,i)&&(s[i]=t[i]);return s}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;if((null==t?void 0:t.length)&&(this.props=this.removeKeysFromRecord(this.props,t),this.fromProps=this.removeKeysFromRecord(this.fromProps,t),this.fromParsedProps=this.removeKeysFromRecord(this.fromParsedProps,t),this.toParsedProps=this.removeKeysFromRecord(this.toParsedProps,t),null===(e=this.propKeys)||void 0===e?void 0:e.length)){const e=this.interpolateUpdateFunctions;let i=0;for(let s=0;s<this.propKeys.length;s++){const r=this.propKeys[s];Xl(t,r)||(i!==s&&(this.propKeys[i]=r,e&&(e[i]=e[s])),i++)}this.propKeys.length=i,e&&(e.length=i)}}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class Zl extends ql{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();Wl(this.target,t,Dt.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class Jl extends s.EventEmitter{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=at.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Ie.END?this.removeAnimate(t,!0):t.status!==Ie.RUNNING&&t.status!==Ie.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const Ql=new Jl;Ql.isGlobal=!0;class th extends ql{constructor(t,e,i,s,r){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=r,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class eh extends th{constructor(t,e,i,s,r){super(t,e,i,s,r),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Ie.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class ih extends th{constructor(t,e,i,s,r){super(t,e,i,s,r),this.from=null!=t?t:{}}applyTransientFromAttributes(){Wl(this.target,this.from,Dt.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function sh(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1}function rh(t,e){if(!t)return t;let i=!1;for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&sh(e,s)){i=!0;break}if(!i)return t;const s={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&!sh(e,i)&&(s[i]=t[i]);return s}function nh(t,e){var i;const s=null==t?void 0:t.getTrackedAnimates;if("function"==typeof s){const e=s.call(t);if(e&&e.size<=1)return}const r=null==t?void 0:t.forEachTrackedAnimate;if("function"!=typeof r)return;let n;const a=null===(i=e.getEndProps)||void 0===i?void 0:i.call(e);return r.call(t,(t=>{var i;if(t===e||t.status===Ie.END)return;const s=null===(i=t.getEndProps)||void 0===i?void 0:i.call(t);if(s)for(const t in s)!Object.prototype.hasOwnProperty.call(s,t)||a&&Object.prototype.hasOwnProperty.call(a,t)||((null!=n?n:n=Object.create(null))[t]=!0)})),n}class ah{constructor(t=at.GenAutoIncrementId(),e=Ql,i){this.id=t,this.status=Ie.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){this.target=t;const e=this.target;return e.detachAttributeFromBaseAttributes(),e.trackAnimate(this),this.onRemove((()=>{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(nh(e,this)),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new ql(Oe.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new Zl(Oe.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new ih(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Ie.RUNNING&&(this.status=Ie.PAUSED)}resume(){this.status===Ie.PAUSED&&(this.status=Ie.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;e<t.length;e++)this._preventAttrs.add(t[e]);this._startProps=rh(this._startProps,t),this._endProps=rh(this._endProps,t);let e=this._firstStep;for(;e;)e.deleteSelfAttrs(t),e=e.next}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,r,n){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Ie.END&&this.onEnd(),this.status=Ie.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Ie.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Ie.END)return void console.warn("aaa 动画已经结束,不能推进");const r=this.currentTime+t;if(r<this._startTime)return void(this.currentTime=r);if(r>=this._startTime+this._totalDuration){null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Ie.END;const t=this.target;return t.restoreStaticAttribute(nh(t,this)),void(this.__skipRestoreStaticAttributeOnRemove=!0)}this.status=Ie.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=r;let n=r-this._startTime,a=!1,o=!1;if(this._loopCount>0){n=(r-this._startTime)%this._duration;const t=Math.floor((r-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(n=this._duration-n)}a&&!o&&Wl(this.target,this._startProps,Dt.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(n>=e&&n<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(n-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const oh=new $a;class lh{constructor(){this.released=!1}tick(t,e){oh.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class hh extends s.EventEmitter{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const r=s-this.lastFrameTime,n=this.checkSkip(r);return n||(this._handlerTick(r),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!n},this._handlerTick=t=>{this.status===Pe.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Pe.INITIAL,dt.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),dt.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new lh;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Pe.INITIAL&&(this.status=Pe.PAUSE,!0)}resume(){return this.status!==Pe.INITIAL&&(this.status=Pe.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Pe.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Pe.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Pe.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Pe.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Pe.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Pe.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,dt.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t<this.interval+2*(Math.random()-.5)*this._jitter}}class ch{visitTrackedAnimates(t){this.forEachTrackedAnimate(t)}getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const r=new ah(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:Ql,null==t?void 0:t.slience);if(r.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&r.onStart(e),null!=i&&r.onEnd(i),null!=s&&r.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),r}createTimeline(){return new Jl}createTicker(t){return new hh(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new Cl(this))}applyFinalAttributeToAttribute(){const t=this.getFinalAttribute();t&&this.setAttributesAndPreventAnimate(t,!1,{type:Dt.ANIMATE_BIND})}restoreStaticAttribute(t){this._restoreAttributeFromStaticTruth({type:Dt.ANIMATE_END},t)}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.visitTrackedAnimates((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function dh(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const uh={x:0,y:0,z:0,lastModelMatrix:null};class ph{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(Gn),e(zn),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Nt.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Nt.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,r,n,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,r,n,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,r,n,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,r,n,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,r,n,a,o){if(!t.pathProxy)return!1;const l=xn(t,null==n?void 0:n.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,y=Uo(d,u,h),_=Vo(d,g),b=Fo(h),S=No(c,p);if(!m)return!0;if(!b&&!S)return!0;if(!(y||_||a||o))return!0;e.beginPath();return Gt(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,S,y,_,l,r,a,o),S&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,S,y,_,l,r,a,o),!0}valid(t,e,i,s){const{fill:r=e.fill,background:n,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Uo(o,l,r),p=Vo(o,c),g=Fo(r,n),m=No(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||n)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i,s=!1){const{x:r=e.x,y:n=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;uh.x=r,uh.y=n,uh.z=a,uh.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Er.allocate(),r=Er.allocate();aa(r,t,e),Cr(s,d||s,r),uh.x=0,uh.y=0,uh.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Er.free(r)}if(g&&!d){const s=t.getOffsetXY(e);uh.x+=s.x,uh.y+=s.y,uh.z=a,i.setTransformForCurrent()}else if(p)uh.x=0,uh.y=0,uh.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);uh.x+=s.x,uh.y+=s.y,this.transformWithoutTranslate(i,uh.x,uh.y,uh.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),uh.x=0,uh.y=0,uh.z=0;return uh}transformUseContext2d(t,e,i,s){const r=s.camera;if(this.camera=r,r){const e=t.AABBBounds,r=e.x2-e.x1,n=e.y2-e.y1,a=s.project(0,0,i),o=s.project(r,0,i),l=s.project(r,n,i),h={x:0,y:0},c={x:r,y:0},d={x:r,y:n};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,y,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,r,n,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(r,n,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,r,n){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,r)||(this.drawShape(t,a,h,c,s,r,null,null,n),this.z=0,a.modelMatrix!==u&&Er.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class gh extends ph{constructor(){super(...arguments),this.numberType=Is}drawShape(t,e,i,r,n,a,o,l){var h;const c=xn(t,null==a?void 0:a.theme).arc,{fill:d=c.fill}=t.attribute,u=this.valid(t,c,o,l);if(!u)return;const{fVisible:p,sVisible:g,doFill:m,doStroke:f}=u,v=null!==(h=this.z)&&void 0!==h?h:0,{outerPadding:y=c.outerPadding,innerPadding:_=c.innerPadding,height:b=10}=t.attribute;let{outerRadius:S=c.outerRadius,innerRadius:x=c.innerRadius}=t.attribute;S+=y,x-=_;const A=Z.Get(d,q.Color255),{light:T}=n.stage||{},C=n.hack_pieFace,k={top:v,bottom:v+b},w={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===C||"top"===C?(e.beginPath(),function(t,e,i,r,n,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=s.abs(h-l),d=h>l;let u=!1;if(a<o){const t=a;a=o,o=t}if(a<=s.epsilon)e.moveTo(i,r,n);else if(c>=s.pi2-s.epsilon)e.moveTo(i+a*s.cos(l),r+a*s.sin(l),n),e.arc(i,r,a,l,h,!d,n),o>s.epsilon&&(e.moveTo(i+o*s.cos(h),r+o*s.sin(h),n),e.arc(i,r,o,h,l,d,n));else{const{outerDeltaAngle:c,innerDeltaAngle:p,outerStartAngle:g,outerEndAngle:m,innerEndAngle:f,innerStartAngle:v}=t.getParsePadAngle(l,h),y=a*s.cos(g),_=a*s.sin(g),b=o*s.cos(f),S=o*s.sin(f);c<.001?u=!0:(e.moveTo(i+y,r+_,n),e.arc(i,r,a,g,m,!d,n)),!(o>s.epsilon)||p<.001?(e.lineTo(i+b,r+S,n),u=!0):(e.lineTo(i+b,r+S,n),e.arc(i,r,o,f,v,d,n))}e.closePath()}(t,e,i,r,k[C],S,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,c),m&&(o?o(e,t.attribute,c):p&&(e.setCommonStyle(t,t.attribute,i,r,c),e.fillStyle=T?T.computeColor(w[C],A):d,e.fill())),f&&(l?l(e,t.attribute,c):g&&(e.setStrokeStyle(t,t.attribute,i,r,c),e.stroke()))):"outside"!==C&&"inside"!==C||("inside"===C&&(e.save(),e.beginPath(),e.arc(i,r,x,0,s.pi2,!0,k.top),e.clip()),e.beginPath(),function(t,e,i,r,n,a,o,l){const{startAngle:h,endAngle:c}=t.getParsedAngle(),d=s.abs(c-h),u=c>h;let p=!1;if(o<=s.epsilon)e.moveTo(i,r,n);else if(d>=s.pi2-s.epsilon)e.moveTo(i+o*s.cos(h),r+o*s.sin(h),n),e.arc(i,r,o,h,c,!u,n),e.lineTo(i+o*s.cos(c),r+o*s.sin(c),a),e.arc(i,r,o,c,h,u,a);else{const{innerouterDeltaAngle:t,innerouterStartAngle:d,innerouterEndAngle:g}=l(h,c),m=o*s.cos(d),f=o*s.sin(d),v=o*s.cos(g),y=o*s.sin(g);t<.001?p=!0:(e.moveTo(i+m,r+f,n),e.arc(i,r,o,d,g,!u,n),e.lineTo(i+v,r+y,a),e.arc(i,r,o,g,d,u,a))}e.closePath()}(t,e,i,r,k.top,k.bottom,"outside"===C?S:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:r,outerStartAngle:n,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===C?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:n}:{innerouterDeltaAngle:r,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,c),m&&(o?o(e,t.attribute,c):p&&(e.setCommonStyle(t,t.attribute,i,r,c),e.fillStyle=T?T.computeColor(w[C],A):d,e.fill())),f&&(l?l(e,t.attribute,c):g&&(e.setStrokeStyle(t,t.attribute,i,r,c),e.stroke())),"inside"===C&&e.restore())}draw(t,e,i,s){const r=xn(t,null==s?void 0:s.theme).arc;this._draw(t,r,!1,i,s)}}const mh=new WeakSet;const fh=function({bind:t}){dh(mh,t)||(t(gh).toDynamicValue((()=>new gh)).inSingletonScope(),t(Zo).toService(gh),t(Jo).toService(Zo))};class vh extends ph{stroke(t,e,i,s,r){const n=s.vertices;s.edges.forEach((s=>{const a=n[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=n[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};r.beginPath(),r.moveTo(o.x,o.y,o.z),r.lineTo(h.x,h.y,h.z),r.stroke()}))}fill(t,e,i,s,r,n,a,o,l,h,c){const d=Z.Get(n,q.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(r&&!r[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],n=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+n+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:r,normal:p}=s.polygon,g=u[r[0]],m=u[r[1]],f=u[r[2]],v=u[r[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+m[0],y:e+m[1],z:i+m[2]},b={x:t+f[0],y:e+f[1],z:i+f[2]},S={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(S.x,S.y,S.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):n,a.fill())}))}}class yh extends vh{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=Ls}drawShape(t,e,i,s,r,n,a,o){var l;const h=xn(t,null==n?void 0:n.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=r.stage||{},m=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let r=c;"string"!=typeof r&&(r="black"),this.fill(i,s,p,m,u,r,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,m,e))}draw(t,e,i){const s=xn(t).polygon;this._draw(t,s,!1,i)}}const _h=new WeakSet;const bh=function({bind:t}){dh(_h,t)||(t(yh).toDynamicValue((()=>new yh)).inSingletonScope(),t(el).toService(yh),t(Jo).toService(el))};class Sh extends vh{constructor(){super(...arguments),this.type="rect3d",this.numberType=Ns}drawShape(t,e,i,s,r,n,a,o){var l,h;const c=xn(t,null==n?void 0:n.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:m,y:f,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:S=c.visible,drawStrokeWhenZeroWH:x=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:T}=t.attribute;A=(null!=A?A:p-m)||0,T=(null!=T?T:g-f)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,k=jo(v,y,A,T,d),w=Go(v,b,A,T,x),M=Fo(d),E=No(u,_);if(!t.valid||!S)return;if(!M&&!E)return;if(!(k||w||a||o))return;const{light:B}=r.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let r=d;"string"!=typeof r&&(r="black"),this.fill(i,s,C,P,null,r,e,B,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=xn(t).rect;this._draw(t,s,!1,i)}}const xh=new WeakSet;const Ah=function({bind:t}){dh(xh,t)||(t(Sh).toDynamicValue((()=>new Sh)).inSingletonScope(),t(tl).toService(Sh),t(Jo).toService(tl))};function Th(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}const Ch=Symbol.for("CanvasArc3dPicker"),kh=Symbol.for("CanvasRect3dPicker"),wh=Symbol.for("CanvasPyramid3dPicker"),Mh=Symbol.for("CanvasPickerContribution");class Eh extends r.BaseRender{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const a=this.transform(t,n,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,i,null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u))),this.canvasRenderer.z=0,s.modelMatrix!==c&&r.mat4Allocate.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}class Bh extends Eh{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=r.ARC3D_NUMBER_TYPE,this.themeType="arc"}}let Ph=!1;function Oh(){if(Oh.__loaded)return;Oh.__loaded=!0;const t=bl();ra("arc3d",To),ua(),ga(),fh({bind:t.bind}),function(t){var e;Ph||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Zo))&&(Ph=!0,t.bind(Ch).toDynamicValue((()=>new Bh(Th(t,Zo)))).inSingletonScope(),t.bind(Mh).toService(Ch))}(t)}Oh.__loaded=!1;const Ih=Oh;class Rh extends Eh{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=r.PYRAMID3D_NUMBER_TYPE,this.themeType="polygon"}}let Dh=!1;function Lh(){if(Lh.__loaded)return;Lh.__loaded=!0;const t=bl();ra("pyramid3d",ko),ua(),ga(),bh({bind:t.bind}),function(t){var e;Dh||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,el))&&(Dh=!0,t.bind(wh).toDynamicValue((()=>new Rh(Th(t,el)))).inSingletonScope(),t.bind(Mh).toService(wh))}(t)}Lh.__loaded=!1;const Fh=Lh;class Nh extends Eh{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=r.RECT3D_NUMBER_TYPE,this.themeType="rect"}}let Uh=!1;function jh(){if(jh.__loaded)return;jh.__loaded=!0;const t=bl();ra("rect3d",xo),Ah({bind:t.bind}),function(t){var e;Uh||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,tl))&&(Uh=!0,t.bind(kh).toDynamicValue((()=>new Nh(Th(t,tl)))).inSingletonScope(),t.bind(Mh).toService(kh))}(t)}jh.__loaded=!1;const Vh=jh;function Gh(){Gh.__loaded||(Gh.__loaded=!0,ra("shadowRoot",za))}Gh.__loaded=!1;const zh=Gh,Kh=t=>(Ih(),na("arc3d",t)),Hh=t=>(Fh(),na("pyramid3d",t)),Wh=t=>(Vh(),na("rect3d",t));class $h extends th{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),r=null!==(t=this.target.attribute)&&void 0!==t?t:{},n={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;n[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:r[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=n,this.propKeys=this.keys,this.from=a,this.to=n,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$l(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Kl(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Yh extends th{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var r;e[s]=0,i[s]=null!==(r=t[s])&&void 0!==r?r:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Wl(this.target,i,Dt.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Kl(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Xh extends $h{constructor(t,e,i,s,r){super(t,e,i,s,r),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class qh extends Yh{constructor(t,e,i,s,r){super(t,e,i,s,r),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const Zh=(t,e,i)=>{var r;return!1!==(null!==(r=null==e?void 0:e.overall)&&void 0!==r&&r)?((t,e,i)=>{const r=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=s.isNumber(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==r?void 0:r.startAngle,endAngle:null==r?void 0:r.endAngle}}}const n=s.isNumber(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==r?void 0:r.startAngle,endAngle:null==r?void 0:r.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class Jh extends th{constructor(t,e,i,s,r){super(t,e,i,s,r)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){Kl(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){Kl(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class Qh extends Jh{onBind(){var t,e,i;super.onBind();const{from:s,to:r}=Zh(this.target,this.params.options,this.params),n=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=r,this.propKeys=Object.keys(r).filter((t=>null!=r[t])),this.from=n,this.to=r,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$l(this.target,n),this.determineUpdateFunction()}}class tc extends Jh{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,r=this.params.options,this.params,!1!==(null!==(n=null==r?void 0:r.overall)&&void 0!==n&&n)?((t,e,i)=>{const r=t.attribute;if(e&&"anticlockwise"===e.orient){const t=s.isNumber(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:r.startAngle,endAngle:r.endAngle},to:{startAngle:t,endAngle:t}}}const n=s.isNumber(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:r.startAngle,endAngle:r.endAngle},to:{startAngle:n,endAngle:n}}})(i,r):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,r));var i,r,n;const a=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=a?a:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class ec extends th{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t,e,i;super.onBind();const{from:r,to:n}=((t,e,i)=>{const r=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=r.x,e=r.x1,i=r.width;return{from:s.isValid(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=r.y,e=r.y1,i=r.height;return{from:s.isValid(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=r.x,e=r.x1,i=r.width,n=r.y,a=r.y1,o=r.height,l={};return s.isValid(i)?(l.x=t+i/2,l.width=0,l.x1=void 0):(l.x=(t+e)/2,l.x1=(t+e)/2,l.width=void 0),s.isValid(o)?(l.y=n+o/2,l.height=0,l.y1=void 0):(l.y=(n+a)/2,l.y1=(n+a)/2,l.height=void 0),{from:l,to:{x:t,y:n,x1:e,y1:a,width:i,height:o}}}}})(this.target,this.params.options,this.params),a=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:r;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=a,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$l(this.target,a)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Kl(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class ic extends th{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const r=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=r.x,e=r.x1,i=r.width;return{to:s.isValid(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=r.y,e=r.y1,i=r.height;return{to:s.isValid(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=r.x,e=r.y,i=r.x1,n=r.y1,a=r.width,o=r.height,l={};return s.isValid(a)?(l.x=t+a/2,l.width=0,l.x1=void 0):(l.x=(t+i)/2,l.x1=(t+i)/2,l.width=void 0),s.isValid(o)?(l.y=e+o/2,l.height=0,l.y1=void 0):(l.y=(e+n)/2,l.y1=(e+n)/2,l.height=void 0),{to:l}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Kl(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const sc=(t,e,i)=>{var r;return!1!==(null!==(r=null==e?void 0:e.overall)&&void 0!==r&&r)?function(t,e,i){var r,n,a;const o=t.getFinalAttribute(),l=o.y,h=o.y1,c=o.height;let d;return e&&"negative"===e.orient?s.isNumber(e.overall)?d=e.overall:i.group?(d=null!==(a=null!==(r=i.groupHeight)&&void 0!==r?r:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==a?a:i.group.getBounds().height(),i.groupHeight=d):d=i.height:d=s.isNumber(null==e?void 0:e.overall)?e.overall:0,{from:{y:d,y1:s.isNil(h)?void 0:d,height:s.isNil(c)?void 0:0},to:{y:l,y1:h,height:c}}}(t,e,i):function(t,e,i){const r=t.getFinalAttribute(),n=r.y,a=r.y1,o=r.height;if(e&&"negative"===e.orient){const t=s.isValid(o)?Math.max(n,n+o):Math.max(n,a);return{from:{y:t,y1:s.isNil(a)?void 0:t,height:s.isNil(o)?void 0:0},to:{y:n,y1:a,height:o}}}const l=s.isValid(o)?Math.min(n,n+o):Math.min(n,a);return{from:{y:l,y1:s.isNil(a)?void 0:l,height:s.isNil(o)?void 0:0},to:{y:n,y1:a,height:o}}}(t,e)};class rc extends th{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t,e,i;super.onBind();const{from:s,to:r}=sc(this.target,this.params.options,this.params),n=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=r,this.propKeys=Object.keys(r).filter((t=>null!=r[t])),this.from=n,this.to=r,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$l(this.target,n)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){Hl(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class nc extends th{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,r=this.params.options,n=this.params,!1!==(null!==(a=null==r?void 0:r.overall)&&void 0!==a&&a)?function(t,e,i){var r,n,a;const o=t.getFinalAttribute(),l=o.y1,h=o.height;let c;return e&&"negative"===e.orient?s.isNumber(e.overall)?c=e.overall:i.group?(c=null!==(a=null!==(r=i.groupHeight)&&void 0!==r?r:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==a?a:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=s.isNumber(null==e?void 0:e.overall)?e.overall:0,{to:{y:c,y1:s.isNil(l)?void 0:c,height:s.isNil(h)?void 0:0}}}(i,r,n):function(t,e,i){const r=t.getFinalAttribute(),n=r.y,a=r.y1,o=r.height;if(e&&"negative"===e.orient){const t=s.isValid(o)?Math.max(n,n+o):Math.max(n,a);return{to:{y:t,y1:s.isNil(a)?void 0:t,height:s.isNil(o)?void 0:0}}}const l=s.isValid(o)?Math.min(n,n+o):Math.min(n,a);return{to:{y:l,y1:s.isNil(a)?void 0:l,height:s.isNil(o)?void 0:0}}}(i,r));var i,r,n,a;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){Hl(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const ac=(t,e,i)=>{const r=t.getFinalAttribute().points,n={x:0,y:0};return r.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=r.length,n.y/=r.length,e&&e.center&&(s.isValidNumber(e.center.x)&&(n.x=e.center.x),s.isValidNumber(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),r.map((t=>Object.assign({},t,n)))};class oc extends th{constructor(t,e,i,s,r){super(t,e,i,s,r)}onUpdate(t,e,i){var s,n;const a=null===(s=this.from)||void 0===s?void 0:s.points,o=null===(n=this.to)||void 0===n?void 0:n.points;a&&o&&(Kl(this.target,{points:a.map(((t,i)=>r.pointInterpolation(a[i],o[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class lc extends oc{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:r}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:ac(t,e)}});this.props=r,this.propKeys=Object.keys(r).filter((t=>null!=r[t])),this.from=s||i,this.to=r}else this.valid=!1;var t,e}}const hc=(t,e,i)=>{var r;return!1!==(null!==(r=null==e?void 0:e.overall)&&void 0!==r&&r)?((t,e,i)=>{const r=t.getFinalAttribute(),n=s.isNumber(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==r?void 0:r.innerRadius,outerRadius:null==r?void 0:r.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class cc extends th{constructor(t,e,i,s,r){super(t,e,i,s,r)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Kl(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class dc extends cc{onBind(){var t,e,i;super.onBind();const{from:s,to:r}=hc(this.target,this.params.options,this.params),n=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=r,this.propKeys=Object.keys(r).filter((t=>null!=r[t])),this.from=n,this.to=r,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$l(this.target,n)}}class uc extends cc{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(r=null==i?void 0:i.overall)&&void 0!==r&&r)?((t,e,i)=>{const r=t.getFinalAttribute(),n=s.isNumber(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==r?void 0:r.innerRadius,outerRadius:null==r?void 0:r.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,r;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const pc=(t,e,i)=>{var r;return!1!==(null!==(r=null==e?void 0:e.overall)&&void 0!==r&&r)?function(t,e,i){var r;const n=t.getFinalAttribute(),a=n.x,o=n.x1,l=n.width;let h;return e&&"negative"===e.orient?s.isNumber(e.overall)?h=e.overall:i.group?(h=null!==(r=i.groupWidth)&&void 0!==r?r:i.group.getBounds().width(),i.groupWidth=h):h=i.width:h=s.isNumber(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:h,x1:s.isNil(o)?void 0:h,width:s.isNil(l)?void 0:0},to:{x:a,x1:o,width:l}}}(t,e,i):function(t,e,i){const r=t.getFinalAttribute(),n=r.x,a=r.x1,o=r.width;if(e&&"negative"===e.orient){const t=s.isValid(o)?Math.max(n,n+o):Math.max(n,a);return{from:{x:t,x1:s.isNil(a)?void 0:t,width:s.isNil(o)?void 0:0},to:{x:n,x1:a,width:o}}}const l=s.isValid(o)?Math.min(n,n+o):Math.min(n,a);return{from:{x:l,x1:s.isNil(a)?void 0:l,width:s.isNil(o)?void 0:0},to:{x:n,x1:a,width:o}}}(t,e)};class gc extends th{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t,e,i;super.onBind();const{from:s,to:r}=pc(this.target,this.params.options,this.params),n=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=r,this.propKeys=Object.keys(r).filter((t=>null!=r[t])),this.from=n,this.to=r,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$l(this.target,n)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){Hl(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class mc extends th{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,r=this.params.options,n=this.params,!1!==(null!==(a=null==r?void 0:r.overall)&&void 0!==a&&a)?function(t,e,i){var r;const n=t.getFinalAttribute(),a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?s.isNumber(e.overall)?l=e.overall:i.group?(l=null!==(r=i.groupWidth)&&void 0!==r?r:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=s.isNumber(null==e?void 0:e.overall)?e.overall:0,{to:{x:l,x1:s.isNil(a)?void 0:l,width:s.isNil(o)?void 0:0}}}(i,r,n):function(t,e,i){const r=t.getFinalAttribute(),n=r.x,a=r.x1,o=r.width;if(e&&"negative"===e.orient){const t=s.isValid(o)?Math.max(n,n+o):Math.max(n,a);return{to:{x:t,x1:s.isNil(a)?void 0:t,width:s.isNil(o)?void 0:0}}}const l=s.isValid(o)?Math.min(n,n+o):Math.min(n,a);return{to:{x:l,x1:s.isNil(a)?void 0:l,width:s.isNil(o)?void 0:0}}}(i,r));var i,r,n,a;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){Hl(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class fc extends th{constructor(t,e,i,s,r){super(t,e,i,s,r)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Kl(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class vc extends fc{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var r,n,a,o;const{offset:l=0,orient:h,direction:c,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,m=0;"negative"===h&&(g=null!==(r=p.width)&&void 0!==r?r:t.stage.viewWidth,m=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=l,m+=l;const f=s.isFunction(d)?d.call(null,null===(o=null===(a=t.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],t,i):d,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:f&&s.isValidNumber(f.x)?f.x:g,b=u.includes("y")?y:f&&s.isValidNumber(f.y)?f.y:m;switch(c){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$l(this.target,e)}}class yc extends fc{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var r,n,a,o;const{offset:l=0,orient:h,direction:c,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(r=u.width())&&void 0!==r?r:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,m=("negative"===h?p:0)+l,f=("negative"===h?g:0)+l,v=s.isFunction(d)?d.call(null,null===(o=null===(a=t.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],t,i):d,y=v&&s.isValidNumber(v.x)?v.x:m,_=v&&s.isValidNumber(v.y)?v.y:f;switch(c){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class _c extends th{constructor(t,e,i,s,r){super(t,e,i,s,r)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Kl(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class bc extends _c{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const r=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=s.isNumberClose(r/(2*Math.PI),0)?Math.round(r/(2*Math.PI))*Math.PI*2:s.isValidNumber(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(r/(2*Math.PI))*Math.PI*2:Math.floor(r/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:r}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$l(this.target,e)}}class Sc extends _c{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const r=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=s.isNumberClose(r/(2*Math.PI),0)?Math.round(r/(2*Math.PI))*Math.PI*2:s.isValidNumber(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(r/(2*Math.PI))*Math.PI*2:Math.floor(r/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class xc extends th{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t,e,i,s,r,n,a,o,l,h,c,d,u,p,g,m,f,v,y,_,b,S,x;let A,T;super.onBind();const C=this.target.getFinalAttribute(),k=null!==(t=this.target.attribute)&&void 0!==t?t:{},w=null===(e=this.params)||void 0===e?void 0:e.options,M=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==w?void 0:w.direction,E=null!==(l=null!==(a=null!==(n=null===(r=this.params)||void 0===r?void 0:r.fromScaleX)&&void 0!==n?n:null==w?void 0:w.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==w?void 0:w.fromScale,B=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==w?void 0:w.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==w?void 0:w.fromScale;switch(M){case"x":A={scaleX:null!==(g=null!=E?E:k.scaleX)&&void 0!==g?g:0},T={scaleX:null!==(m=null==C?void 0:C.scaleX)&&void 0!==m?m:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(f=null!=B?B:k.scaleY)&&void 0!==f?f:0},T={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=E?E:k.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=B?B:k.scaleY)&&void 0!==_?_:0},T={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(S=null==C?void 0:C.scaleY)&&void 0!==S?S:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=T,this.from=A,this.to=T,!1!==(null===(x=this.params.controlOptions)||void 0===x?void 0:x.immediatelyApply)&&$l(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),Kl(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class Ac extends th{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t,e,i,s,r;let n,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":n={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":n={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:n={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(r=null==o?void 0:o.scaleY)&&void 0!==r?r:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=n,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Kl(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class Tc extends th{constructor(t,e,i,s,r){super(t,e,i,s,r)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const Cc={x:!0,y:!0,x1:!0,y1:!0,width:!0,height:!0};function kc(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1}class wc extends th{constructor(t,e,i,s,r){super(t,e,i,s,r),this.updateFromAttrs=null,this.clipPathSyncKeys=null,this.clipPathSyncParent=null,this.clipPathSyncChildIndex=-1,this.clipPathSyncDisabled=!1}onBind(){var t;super.onBind();const e=null!==(t=this.target.context)&&void 0!==t?t:{};let{diffAttrs:i={}}=e;const{options:s}=this.params;i=function(t,e){if(!(null==e?void 0:e.length))return t;const i={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&!kc(e,s)&&(i[s]=t[s]);return i}(i,null==s?void 0:s.excludeChannels),this.props=i,this.updateFromAttrs=this.target.consumeTransientFromAttrsBeforePreventAnimate(i),this.clipPathSyncKeys=Object.keys(i).filter((t=>Cc[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&Tl(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,r=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(r)||!r.length)return;const n=this.getClipPathSyncChildIndex(s);if(n<0||n>=r.length)return;const a=r[n];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(Kl(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,r=this.getTargetFinalAttrs(),n=t.getFinalAttribute(),a=null!==(e=null!=n?n:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&r&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=r[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var r;const n=null===(r=i.attribute)||void 0===r?void 0:r[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==n&&!this.isSameClipPathValue(t.attribute[e],n)&&(s[e]=n)})),Object.keys(s).length?s:null}}class Mc extends eh{constructor(t,e,i,s,r){super(t,e,i,s,r),this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}afterStageRender(t,e){var i,s;return null===(s=null===(i=this.params)||void 0===i?void 0:i.callBack)||void 0===s?void 0:s.call(i,t,e,this.currentAnimationRatio,this.animationTime)}}var Ec,Bc;!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(Ec||(Ec={})),function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(Bc||(Bc={}));const Pc=(t,e)=>(s.isFunction(Ic.warnHandler)&&Ic.warnHandler.call(null,t,e),e?s.Logger.getInstance().warn(`[VChart warn]: ${t}`,e):s.Logger.getInstance().warn(`[VChart warn]: ${t}`)),Oc=(t,e,i)=>{if(!Ic.silent){if(!s.isFunction(Ic.errorHandler))throw new Error(t);Ic.errorHandler.call(null,t,e)}},Ic={silent:!1,warnHandler:!1,errorHandler:!1},Rc=function(){!function(){if(null==qn)try{const t=document.createElement("canvas"),e=t.getContext("2d");qn=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),qn&&(qn=!!document.createElement)}catch(t){qn=!1}}();const t=dt.global&&dt.global.env;return t?"browser"===t:qn}();function Dc(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}function Lc(t){return null!=t&&""!==t&&(!!s.isNumber(t)||+t==+t)}function Fc(t){return!(!t||0===t.length)&&!s.isNil(t[0])&&!s.isNil(t[0].dataId)&&s.isArray(t[0].fields)}function Nc(t){return function(e){let i;return i=s.isArray(t)?t.reduce(((t,e)=>null==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var Uc;!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(Uc||(Uc={}));const jc={};function Vc(t){switch(t){case Uc.Linear:case Uc.Log:case Uc.Pow:case Uc.Sqrt:case Uc.Symlog:case Uc.Time:return!0;default:return!1}}function Gc(t){return!!jc[t]}function zc(t){switch(t){case Uc.Ordinal:case Uc.Point:case Uc.Band:return!0;default:return!1}}function Kc(t){return t}function Hc(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function Wc(t,e,i){const s=t[0],r=t[1],n=e[0],a=e[1];let o,l;return r<s?(o=Hc(r,s),l=i(a,n)):(o=Hc(s,r),l=i(n,a)),t=>l(o(t))}function $c(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Yc(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Xc(t,e,i){const r=Math.min(t.length,e.length)-1,n=new Array(r),a=new Array(r);let o=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<r;)n[o]=Hc(t[o],t[o+1]),a[o]=i(e[o],e[o+1]);return function(e){const i=s.bisect(t,e,1,r)-1;return a[i](n[i](e))}}Object.values(Uc).forEach((t=>{jc[t]=!0}));const qc=(t,e=!1)=>{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let r;return r=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,r*Math.pow(10,i)};class Zc{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:s.isValid(this._rangeFactorStart)&&s.isValid(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=Yc(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):s.isValid(this._rangeFactorStart)&&s.isValid(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return s.isNil(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!s.isNil(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return s.isNil(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!s.isNil(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:r}=this._fishEyeOptions,n=this.range(),a=n[0],o=n[n.length-1],l=Math.min(a,o),h=Math.max(a,o),c=s.clamp(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,l,h),d=s.isNil(r)?(h-l)*i:r;let u=Math.exp(e);u=u/(u-1)*d;const p=e/d;this._fishEyeTransform=t=>{const e=Math.abs(t-c);if(e>=d)return t;if(e<=1e-6)return c;const i=u*(1-Math.exp(-e*p))/e*.75+.25;return c+(t-c)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Jc=Symbol("implicit");class Qc extends Zc{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=Uc.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Jc}clone(){const t=(new Qc).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return s.isValid(this._rangeFactorStart)&&s.isValid(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==Jc)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const r=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(r):r}invert(t){let e=0;for(;e<this._ordinalRange.length&&this._ordinalRange[e]!==t;)e++;return this._domain[(e-1)%this._domain.length]}domain(t){if(!t)return this._domain.slice();this._domain=[],this._index=new Map;for(const e of t){const t=`${e}`;this._index.has(t)||this._index.set(t,this._domain.push(e))}return this}range(t){if(!t)return this._ordinalRange.slice();const e=Array.from(t);return this._ordinalRange=e,this}index(t){var e;return this._index&&null!==(e=this._index.get(`${t}`))&&void 0!==e?e:-1}}function td(t,e,i,s){const r=[];let n=t;for(;n<=e;)r.push(n),n+=i;return s&&r.reverse(),r}function ed(t,e,i,r){let n,a;if(e=Math.floor(+e),t=Math.floor(+t),!(i=Math.floor(+i)))return[];if(t===e)return[t];if(n=e<t){const i=t;t=e,e=i}let o=s.clamper(1,e-t+1)(i);if(a=Math.floor((e-t+1)/o),!r)for(;Math.ceil((e-t+1)/a)>i&&o>1;)o-=1,a=Math.floor((e-t)/o);return td(t,e,a,n)}class id extends Qc{constructor(t){super(),this.type=Uc.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),r=super.domain().length,n=i[1]<i[0];let a=i[Number(n)-0];const o=i[1-Number(n)],l=$c(r,this._paddingInner,this._paddingOuter);return this._step=(o-a)/Math.max(1,l||1),this._round&&(this._step=Math.floor(this._step)),a+=(o-a-this._step*(r-this._paddingInner))*this._align,this.isBandwidthFixed()||(this._bandwidth=this._step*(1-this._paddingInner)),this._round&&(a=Math.round(a),this.isBandwidthFixed()||(this._bandwidth=Math.round(this._bandwidth))),this._bandRangeState={reverse:n,start:n?s.clamp(a+this._step*(r-1),i[1],i[0]):s.clamp(a,i[0],i[1]),min:n?i[1]:i[0],max:o,count:r},this.generateFishEyeTransform(),this}scale(t){if(!this._bandRangeState)return;const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let r=this._index.get(e);if(!r){if(this._unknown!==Jc)return this._unknown;r=this._domain.push(t),this._index.set(e,r)}const{count:n,start:a,reverse:o,min:l,max:h}=this._bandRangeState,c=a+(r-1)%n*(o?-1:1)*this._step;return s.clamp(this._fishEyeTransform?this._fishEyeTransform(c):c,l,h)}_calculateWholeRange(t,e){if(this._wholeRange)return this._wholeRange;if((this._minBandwidth||this._maxBandwidth)&&!this._isBandwidthFixedByUser()){let e;if(s.isValid(this._rangeFactorStart)&&s.isValid(this._rangeFactorEnd)&&2===t.length){const i=Yc(t,[this._rangeFactorStart,this._rangeFactorEnd]);e=Math.abs(i[1]-i[0])}else e=Math.abs(t[1]-t[0]);const i=function(t,e,i,s,r){const n=$c(t,i,s);let a=e/Math.max(1,n||1);r&&(a=Math.floor(a));let o=a*(1-i);return r&&(o=Math.round(o)),o}(super.domain().length,e,this._paddingInner,this._paddingOuter,this._round);i<this._minBandwidth?(this._bandwidth=this._minBandwidth,this._isFixed=!0):i>this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const o=(i=super.domain().length,r=this._bandwidth,n=this._paddingInner,a=this._paddingOuter,1===n&&(n=0),$c(i,n,a)*(r/(1-n))*Math.sign(t[1]-t[0])),l=Math.min((t[1]-t[0])/o,1);if(s.isValid(this._rangeFactorStart)&&s.isValid(this._rangeFactorEnd)){const i=this._rangeFactorStart+l<=1,s=this._rangeFactorEnd-l>=0;if("rangeFactorStart"===e&&i?this._rangeFactorEnd=this._rangeFactorStart+l:"rangeFactorEnd"===e&&s?this._rangeFactorStart=this._rangeFactorEnd-l:t[0]<=t[1]?i?this._rangeFactorEnd=this._rangeFactorStart+l:s?this._rangeFactorStart=this._rangeFactorEnd-l:(this._rangeFactorStart=0,this._rangeFactorEnd=l):s?this._rangeFactorStart=this._rangeFactorEnd-l:i?this._rangeFactorEnd=this._rangeFactorStart+l:(this._rangeFactorStart=1-l,this._rangeFactorEnd=1),o>0){const e=t[0]-o*this._rangeFactorStart,i=e+o;this._wholeRange=[e,i]}else{const e=t[1]+o*(1-this._rangeFactorEnd),i=e-o;this._wholeRange=[i,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=l,this._wholeRange=[t[0],t[0]+o];return this._wholeRange}var i,r,n,a;return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(s.isValid(this._rangeFactorStart)&&s.isValid(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[s.toNumber(t[0]),s.toNumber(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[s.toNumber(t[0]),s.toNumber(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:ed(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return ed(0,e.length-1,t,!0).filter((t=>t<e.length)).map((t=>e[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let r;if(e=Math.floor(+e),t=Math.floor(+t),i=s.clamper(1,e-t+1)(Math.floor(+i)),r=e<t){const i=t;t=e,e=i}return td(t,e,i,r)}(0,e.length-1,t).map((t=>e[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,r=this.bandwidth()/2,n=this._domain.length,a=this.range(),o=a[0]>a[a.length-1];for(e=0;e<n;e++){const a=this.scale(this._domain[e])+r;if(0===e&&(!o&&!s.isGreater(t,a+i)||o&&!s.isLess(t,a-i)))break;if(e===n-1)break;if(!s.isLess(t,a-i)&&!s.isGreater(t,a+i))break}return e>=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return s.isNil(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return s.isNil(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&s.isNumber(this._userBandwidth)}clone(){var t,e,i;return new id(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:sd}=s.ColorUtil;function rd(t,e){const i=typeof e;let r;if(s.isNil(e)||"boolean"===i)return()=>e;if("number"===i)return s.interpolateNumber(t,e);if("string"===i){if(r=s.ColorUtil.Color.parseColorString(e)){const e=sd(s.ColorUtil.Color.parseColorString(t),r);return t=>e(t).formatRgb()}return s.interpolateNumber(Number(t),Number(e))}return e instanceof s.ColorUtil.RGB?sd(t,e):e instanceof s.ColorUtil.Color?sd(t.color,e.color):e instanceof Date?s.interpolateDate(t,e):s.interpolateNumber(Number(t),Number(e))}class nd extends Zc{constructor(t=Kc,e=Kc){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Kc,this._piecewise=Wc,this._interpolate=rd}calculateVisibleDomain(t){var e;return s.isValid(this._rangeFactorStart)&&s.isValid(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),s.interpolateNumber)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const r=Array.from(t,s.toNumber);return this._domain=r,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=s.interpolateNumberRound,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,r=i.length,n=this._range.length;let a=Math.min(r,n);if(r&&r<n&&this._forceAlign){const t=n-r+1,e=i[r-1],s=r>=2?(e-i[r-2])/t:0;for(let n=1;n<=t;n++)i[r-2+n]=e-s*(t-n);a=n}return this._autoClamp&&(this._clamp=s.clamper(i[0],i[a-1])),this._piecewise=a>2?Xc:Wc,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:Kc),this.rescale(i)):this._clamp!==Kc}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return s.isNil(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return s.isNil(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const ad=Math.sqrt(50),od=Math.sqrt(10),ld=Math.sqrt(2),hd=[1,2,5,10],cd=(t,e,i)=>{let r=1,n=t;const a=Math.floor((e-1)/2),o=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&o<1?r=gd(o).step:(i||o>1)&&(n=Math.floor(t)-a*r),r>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*r)),s.range(0,e).map((t=>n+t*r))):t>0?ud(0,-(e-1)/r,r):ud((e-1)/r,0,r)},dd=s.memoize(((t,e,i,s)=>{let r,n,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((r=e<t)&&(n=t,t=e,e=n),o=md(t,e,i).step,!isFinite(o))return[];if(o>0){let i=Math.round(t/o),s=Math.round(e/o);for(i*o<t&&++i,s*o>e&&--s,a=new Array(n=s-i+1);++l<n;)a[l]=(i+l)*o}else if(o<0&&(null==s?void 0:s.noDecimals)){o=1;const i=Math.ceil(t),s=Math.floor(e);if(!(i<=s))return[];for(a=new Array(n=s-i+1);++l<n;)a[l]=i+l}else{o=-o;let i=Math.round(t*o),s=Math.round(e*o);for(i/o<t&&++i,s/o>e&&--s,a=new Array(n=s-i+1);++l<n;)a[l]=(i+l)/o}return r&&a.reverse(),a})),ud=(t,e,i)=>{let s,r,n=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*i<t&&++a,(o-1)*i>e&&--o,r=new Array(s=o-a+1);++n<s;)r[n]=(a+n)*i}else{i=-i;let a=Math.floor(t*i),o=Math.ceil(e*i);for((a+1)/i<t&&++a,(o-1)/i>e&&--o,r=new Array(s=o-a+1);++n<s;)r[n]=(a+n)/i}return r},pd=s.memoize(((t,e,i,s)=>{let r,n,a;if(i=+i,(t=+t)==(e=+e))return cd(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return cd(t,i,null==s?void 0:s.noDecimals);(r=e<t)&&(a=t,t=e,e=a);const o=md(t,e,i);let l=o.step;if(!isFinite(l))return[];if(l>0){let s=1;const{power:r,gap:a}=o,h=10===a?2*10**r:1*10**r;for(;s<=5&&(n=ud(t,e,l),n.length>i+1)&&i>2;)l+=h,s+=1;i>2&&n.length<i-1&&(n=((t,e,i)=>{let s;const r=t[0],n=t[t.length-1],a=e-t.length;if(n<=0){const e=[];for(s=a;s>=1;s--)e.push(r-s*i);return e.concat(t)}if(r>=0){for(s=1;s<=a;s++)t.push(n+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[r-Math.floor(s/2)*i].concat(o):l.push(n+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(n,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),n=ud(t,e,l);return r&&n.reverse(),n})),gd=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=hd[0];return i>=ad?s=hd[3]:i>=od?s=hd[2]:i>=ld&&(s=hd[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function md(t,e,i){const s=(e-t)/Math.max(0,i);return gd(s)}function fd(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const r=new Array(i);for(let e=0;e<i;e++)r[e]=t+e*s;return r}function vd(t,e,i){let s,r,n=-1;if(i=+i,(r=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++n<a;)o[n]=t+n*i;return r&&o.reverse(),o}function yd(t,e=10){let i,s,r=0,n=t.length-1,a=t[r],o=t[n],l=10;for(o<a&&(s=a,a=o,o=s,s=r,r=n,n=s);l-- >0;){if(s=md(a,o,e).step,s===i)return t[r]=a,t[n]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}const _d=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i);s.memoize(((t,e,i,s,r,n,a)=>{let o=t,l=e;const h=l<o;h&&([o,l]=[l,o]);let c,d,u=r(o),p=r(l),g=[];if(!(s%1)&&p-u<i){if(u=Math.floor(u),p=Math.ceil(p),o>0){for(;u<=p;++u)for(c=1;c<s;++c)if(d=u<0?c/n(-u):c*n(u),!(d<o)){if(d>l)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/n(-u):c*n(u),!(d<o)){if(d>l)break;g.push(d)}2*g.length<i&&(g=pd(o,l,i))}else g=pd(u,p,Math.min(p-u,i)).map(n);return g=g.filter((t=>0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),s.memoize(((t,e,i,s,r,n)=>{const a=[],o={},l=r(t),h=r(e);let c=[];if(Number.isInteger(s))c=pd(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e<i;e++)c.push(l+e*t)}return c.forEach((i=>{const r=n(i),l=Number.isInteger(s)?_d(t,e,r):_d(t,e,qc(r)),h=_d(t,e,((t,e)=>{let i,s;return e[0]<e[1]?(i=e[0],s=e[1]):(i=e[1],s=e[0]),Math.min(Math.max(t,i),s)})(l,[t,e]));!o[h]&&!isNaN(h)&&c.length>1&&(o[h]=1,a.push(h))})),a})),s.memoize(((t,e,i,s,r)=>fd(s(t),s(e),i).map((t=>qc(r(t)))))),s.memoize(((t,e,i,s,r)=>vd(s(t),s(e),i).map((t=>qc(r(t))))));class bd extends nd{constructor(){super(...arguments),this.type=Uc.Linear}clone(){var t;const e=new bd;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return dd(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(s.isFunction(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(s.isValid(this._rangeFactorStart)&&s.isValid(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const r=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,a=r[0],o=r[r.length-1];let l=pd(n[0],n[n.length-1],t,e);if(!l.length)return l;if(this._domainValidator)l=l.filter(this._domainValidator);else if((l[0]!==a||l[l.length-1]!==o)&&this._niceType){const t=r.slice();if("all"===this._niceType?(t[0]=l[0],t[t.length-1]=l[l.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&l[0]!==a?(t[0]=l[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&l[l.length-1]!==o&&(t[t.length-1]=l[l.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);l=l.filter((t=>t>=e&&t<=i))}}return l}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return fd(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return vd(e[0],e[e.length-1],t)}nice(t=10,e){var i,r;const n=this._domain;let a=[];if(e){const t=function(t,e){const i=s.isNumber(e.forceMin),r=s.isNumber(e.forceMax);let n=null;const a=[];let o=null;const l=i&&r?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:r?t=>t<=e.forceMax:null;return i?a[0]=e.forceMin:s.isNumber(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(a[0]=e.min),r?a[1]=e.forceMax:s.isNumber(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(a[1]=e.max),s.isNumber(a[0])&&s.isNumber(a[1])?(o=t.slice(),o[0]=a[0],o[o.length-1]=a[1]):n=s.isNumber(a[0])||s.isNumber(a[1])?s.isNumber(a[0])?"max":"min":"all",{niceType:n,niceDomain:o,niceMinMax:a,domainValidator:l}}(n,e);if(a=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=yd(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=a[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(r=a[0])&&void 0!==r?r:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(t=10){this._niceType="min";const e=this._domain[this._domain.length-1],i=yd(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(t=10){this._niceType="max";const e=this._domain[0],i=yd(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}class Sd{constructor(){this.type=Uc.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!s.isNil(t)&&s.isValidNumber(+t)?this._range[s.bisect(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new Sd).domain(this._domain).range(this._range).unknown(this._unknown)}}var xd,Ad;function Td(t){var e,i;const{type:s}=t;return s===xd.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(xd||(xd={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(Ad||(Ad={}));const Cd={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},kd={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function wd(t,e){var i;if(!t)return[];const r=Od(t,e);if(!r||s.isArray(r))return null!==(i=r)&&void 0!==i?i:[];if(s.isObject(r)){const{dataScheme:i}=r;return i?Pd(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>Bd(i)?Ed(t,i,e):i)).filter(s.isValid)}))):i.map((i=>Bd(i)?Ed(t,i,e):i)).filter(s.isValid):[]}return[]}function Md(t,e){var i,r;return Pd(t)?null!==(r=null===(i=t.find((t=>s.isValid(t.isAvailable)?s.isFunction(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!s.isValid(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==r?r:t[t.length-1].scheme:t}function Ed(t,e,i){var r;const n=Od(t,i);if(!n)return;let a;const{palette:o}=n;if(s.isObject(o)&&(a=null!==(r=function(t,e){const i=Cd[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=kd[e];return s?t[s]:void 0}(o,e.key))&&void 0!==r?r:e.default),!a)return;if(s.isNil(e.a)&&s.isNil(e.l)||!s.isString(a))return a;let l=new s.Color(a);if(s.isValid(e.l)){const{r:t,g:i,b:r}=l.color,{h:n,s:a}=s.rgbToHsl(t,i,r),o=s.hslToRgb(n,a,e.l),h=new s.Color(`rgb(${o.r}, ${o.g}, ${o.b})`);h.setOpacity(l.color.opacity),l=h}return s.isValid(e.a)&&l.setOpacity(e.a),l.toRGBA()}function Bd(t){return t&&"palette"===t.type&&!!t.key}function Pd(t){return!(!s.isArray(t)||0===t.length)&&t.every((t=>s.isValid(t.scheme)))}function Od(t,e){var i,r;const{type:n}=null!=e?e:{};let a;if(!e||s.isNil(n))a=null==t?void 0:t.default;else{const s=Td(e);a=null!==(r=null!==(i=null==t?void 0:t[`${n}_${s}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==r?r:null==t?void 0:t.default}return a}class Id extends Qc{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!Pd(this._range))return void super.range(this._range);const t=Md(this._range,this._domain);super.range(t)}}const Rd={linear:bd,band:id,point:class extends id{constructor(t){super(!1),this.type=Uc.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:Qc,threshold:Sd,colorOrdinal:Id};function Dd(t){const e=Rd[t];return e?new e:null}function Ld(t){return s.isValid(null==t?void 0:t.field)&&s.isValid(null==t?void 0:t.scale)}function Fd(t){return!!s.isString(t)&&!!t.endsWith("%")&&Lc(t.substring(0,t.length-1))}function Nd(t,e,i,r=0){var n,a;return s.isNumber(t)?t:Fd(t)?Number(t.substring(0,t.length-1))*e/100:s.isFunction(t)?t(i):s.isObject(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(a=t.offset)&&void 0!==a?a:0):r}function Ud(t){let e={};return s.isArray(t)?(s.isNil(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),s.isNil(t[1])||(e.left=e.right=t[1]),s.isNil(t[2])||(e.bottom=t[2]),s.isNil(t[3])||(e.left=t[3]),e):s.isNumber(t)||Fd(t)||s.isFunction(t)||(i=t,s.isObject(i)&&("percent"in i||"offset"in i))?(e.top=e.left=e.bottom=e.right=t,e):s.isObject(t)?(e=Object.assign({},t),e):e;var i}const jd=(t,e,i)=>{if(s.isNil(e))return t;const r=e[0];return s.isNil(r)?t:1===e.length?(t[r]=i,t):(s.isNil(t[r])&&("number"==typeof e[1]?t[r]=[]:t[r]={}),jd(t[r],e.slice(1),i))};function Vd(t,...e){let i=-1;const r=e.length;for(;++i<r;){const r=e[i];s.baseMerge(t,r,!0,!0)}return t}const Gd="__VCHART",zd=500,Kd=500,Hd=`${Gd}_DEFAULT_DATA_INDEX`,Wd=`${Gd}_DEFAULT_DATA_KEY`,$d=`${Gd}_DEFAULT_DATA_SERIES_FIELD`,Yd=`${Gd}_DEFAULT_SERIES_STYLE_NAME`,Xd=`${Gd}_STACK_START`,qd=`${Gd}_STACK_END`,Zd=`${Gd}_STACK_START_PERCENT`,Jd=`${Gd}_STACK_END_PERCENT`,Qd=`${Gd}_KEY`;function tu(t,e){for(let i=0;i<e.length;i++){const s=e[i],r=eu(t,s.key);r?r.operations=[...new Set(r.operations.concat(s.operations))]:t.push(s)}return t}function eu(t,e){return t.find((t=>t.key===e))}const iu=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return"line"===(s=i)||"area"===s?e:null==e?void 0:e[0];var s};let su=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},r=Aa.getComposedEvent(t);if(r){const e=new r(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,r,n;const a=null!=i?i:e;if(Aa.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(r=this._composedEventMap.get(e[0]))||void 0===r||r.event.unregister(),this._composedEventMap.delete(e[0]));else if(a){const i=null!==(n=this._getEventHandler(t,a))&&void 0!==n?n:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var ru,nu,au,ou;function lu(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function hu(t,e=!1){let r=e;return t.latestData instanceof i.DataView&&(r=!1),r?s.cloneDeep(t.latestData):t.latestData&&t.latestData.slice()}!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(ru||(ru={})),function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleRawDomainUpdate="scaleRawDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(nu||(nu={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(au||(au={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(ou||(ou={})),ou.mark,ou.model,ou.chart,ou.vchart;const cu=(t,e)=>0===t.length?[]:1===t.length?hu(t[0],null==e?void 0:e.deep):t.map((t=>hu(t,null==e?void 0:e.deep)));function du(t,e,s){lu(e=e instanceof i.DataSet?e:t.dataSet,"copyDataView",cu);const r=new i.DataView(e,s);return r.parse([t],{type:"dataview"}),r.transform({type:"copyDataView",level:gu.copyDataView}),r}function uu(t,e,r=[]){var n;if(t instanceof i.DataView)return t;const{id:a,values:o=[],fromDataIndex:l,fromDataId:h,transforms:c=[]}=t,d=t.parser?s.cloneDeep(t.parser):{clone:!0},u=s.cloneDeep(t.fields);let p;d.clone=!(!1===d.clone);const g=r.find((t=>t.name===a));if(g)p=g;else{const t={name:a};if(u&&(t.fields=u),p=new i.DataView(e,t),"string"==typeof h){const t=r.find((t=>t.name===h));if(!t)return Pc(`no data matches fromDataId ${h}`),null;p.parse([t],{type:"dataview"}),p.transform({type:"copyDataView"})}else if("number"==typeof l){const t=r[l];if(!t)return Pc(`no data matches fromDataIndex ${l}`),null;p.parse([t],{type:"dataview"}),p.transform({type:"copyDataView"})}else Array.isArray(o)?p.parse(o,d):!s.isString(o)||d&&!["csv","dsv","tsv"].includes(d.type)?(p.parse([]),Pc("values should be array")):p.parse(o,null!==(n=d)&&void 0!==n?n:{type:"csv"});c&&c.length&&c.forEach((t=>{e.getTransform(t.type)&&p.transform(t)}))}return p}function pu(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var gu,mu,fu;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(gu||(gu={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(mu||(mu={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(fu||(fu={}));const vu=["line","area","trail"];function yu(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(Qd,i?t.slice().sort(i):t.slice()),{keys:[Qd],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const r=new Set;return t.forEach(((t,i)=>{var n;const a=e(t,i),o=null!==(n=s.get(a))&&void 0!==n?n:[];o.push(t),s.set(a,o),r.add(a)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}const _u=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function bu(t,e,i){var r;const{width:n,height:a}=t;if(s.isValid(n)&&s.isValid(a))return{width:n,height:a};let o=i.width,l=i.height;const h=e.container,c=e.canvas;if(h){const{width:t,height:e}=s.getContainerSize(h,i.width,i.height);o=t,l=e}else if(c&&(("desktop-browser"===(d=e.mode)||"mobile-browser"===d)&&Rc)){let t;t=s.isString(c)?Sl.getElementById(c):c;const{width:e,height:r}=s.getContainerSize(t,i.width,i.height);o=e,l=r}else if(Dc(e.mode)&&(null===(r=e.modeParams)||void 0===r?void 0:r.domref)){const t=e.modeParams.domref;o=t.width,l=t.height}var d;return o=null!=n?n:o,l=null!=a?a:l,{width:o,height:l}}const Su=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function xu(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function Au(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;Su.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}var Tu,Cu,ku;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(Tu||(Tu={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(Cu||(Cu={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(ku||(ku={}));class wu{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){s.isNil(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,s.merge({},wu.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=s.array(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}wu.defaultMarkInfo={};class Mu{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class Eu{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const r=this._getDefaultSpecFromChart(e),n=t=>Vd({},i,r,t);return s.isArray(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}var Bu,Pu,Ou,Iu=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]])}return i};class Ru extends Mu{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=Eu,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new wu,this._lastLayoutRect=null,this.id=va(),this.userId=t.id,this._spec=t,this.effect={},this.event=new su(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,r){s.isValid(t)&&s.isValid(e)&&t.setStyle(this._convertMarkStyle(e),i,r)}initMarkStyleWithSpec(t,e){if(!s.isValid(t)||!s.isValid(e))return;const{style:i,state:r}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),r&&(n.state={},Object.keys(r).forEach((t=>{n.state[t]=this._convertMarkStyle(r[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${Gd}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={},i){const{type:s,name:r}=t,{parent:n}=e,a=Iu(e,["parent"]),o=Aa.createMark(s,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},a));return n?n.addMark(o):this.getCompiler().addRootMark(o),o&&(o.created(),i&&o.setMarkConfig(i)),o}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!s.isNil(e))return s.get(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}function Du(t){const e=[],i=[],r=[];return t.forEach((t=>{s.isNil(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&r.push(t)})),{startItems:e,endItems:r,middleItems:i}}function Lu(t,e,i){e?t.forEach((t=>{const e=s.last(t),r=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-r)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=s.last(t),r=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-r)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function Fu(t,e,i,s){let r;t.forEach(((t,n)=>{t.length>1&&(r=i[n],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),n="middle"===t.alignSelf?.5:1,a=e?r-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):r-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*n,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*n})})))}))}function Nu(t,e,i,s,r,n){if(t.length){let a=0;const o="right"===r,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=Gu(t,e,n),r=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+m,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=r,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+r,t.setLayoutStartPosition({x:h+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),Fu(d,!0,p,l),s&&Lu(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function Uu(t,e,i,s,r){if(t.length){let i=0;const n="right"===s,a=n?-1:1;let o=n?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=Gu(t,e,r),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l<u&&c.length?(d.push(i),o+=a*i,i=p,l=e.bottomCurrent,t.setLayoutStartPosition({x:o+t.layoutOffsetX+g,y:l+t.layoutOffsetY-s.height-t.layoutPaddingBottom}),h.push(c),c=[t]):(t.setLayoutStartPosition({x:o+t.layoutOffsetX+g,y:l+t.layoutOffsetY-s.height-t.layoutPaddingBottom}),i=Math.max(i,p),l-=u,c.push(t))})),d.push(i),h.push(c),Fu(h,!0,d,a),n?e.rightCurrent=o+a*i:e.leftCurrent=o+a*i}}function ju(t,e,i,s,r,n){if(t.length){const a="top"===r,o=a?1:-1;let l=0,h=e.leftCurrent,c=a?e.topCurrent:e.bottomCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=Gu(t,e,n),r=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+m}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=r,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+m}),d.push(u),u=[t]):(l=Math.max(l,r),u.push(t))})),p.push(l),d.push(u),Fu(d,!1,p,o),s&&Lu(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function Vu(t,e,i,s,r){if(t.length){const i="top"===s,n=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=Gu(t,e,r),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;o<g&&c.length?(o=e.rightCurrent,l+=n*a,a=p,t.setLayoutStartPosition({x:e.rightCurrent+t.layoutOffsetX-u.width-t.layoutPaddingRight,y:l+t.layoutOffsetY+m}),h.push(c),c=[t]):(c.push(t),t.setLayoutStartPosition({x:o+t.layoutOffsetX-u.width-t.layoutPaddingRight,y:l+t.layoutOffsetY+m}),a=Math.max(a,p),o-=g)})),d.push(a),h.push(c),Fu(h,!1,d,n),i?e.topCurrent=l+n*a:e.bottomCurrent=l+n*a}}function Gu(t,e,i,r=!0){let n,a,o="recomputeHeight",l="recomputeWidth",h="width";"top"!==t.layoutOrient&&"bottom"!==t.layoutOrient||(o="recomputeWidth",l="recomputeHeight",h="height");let c=!(!t.willLayoutTag&&!1===i[o]);if(c){const o=Object.assign({},t.getLayoutRect()),d=t.lastComputeRect;n=e.getItemComputeLayoutRect(t),!t.willLayoutTag&&s.isEqual(n,d)?(c=!1,a=t.getLayoutRect()):(a=t.computeBoundsInRect(n),s.isEqual(o[h],a[h])?c=!1:(r&&t.setLayoutRect(a),i[l]=!0))}else n=t.getLastComputeOutBounds(),a=t.getLayoutRect();return{layoutRect:n,rect:a,layoutTag:c}}class zu{constructor(t,e){this.leftCurrent=0,this.topCurrent=0,this.rightCurrent=0,this.bottomCurrent=0,this.recomputeWidth=!1,this.recomputeHeight=!1,this._onError=null==e?void 0:e.onError}_layoutInit(t,e,i,s){this._chartLayoutRect=i,this._chartViewBox=s,this.leftCurrent=i.x,this.topCurrent=i.y,this.rightCurrent=i.x+i.width,this.bottomCurrent=i.height+i.y,this.recomputeWidth=!1,this.recomputeHeight=!1,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),r=i.concat(s),n={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{n[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:r,overlapItems:n}}layoutItems(t,e,i,s){var r,n,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(n=null===(r=null==t?void 0:t.getSpec())||void 0===r?void 0:r.layout)||void 0===n?void 0:n.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},r,n,a,o=!1){if(r.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(r,n);(l||h||c||d)&&(this.topCurrent=n.top+l,this.bottomCurrent=n.bottom-h,this.leftCurrent=n.left+c,this.rightCurrent=n.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=Gu(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),r=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:r,middleItems:n,endItems:a}=Du(t);r.length&&Nu(r,e,i,!1,"left",s),n.length&&Nu(n,e,i,!0,"left",s),a.length&&Uu(a,e,0,"left",s)}(i,this,o,e),r.length&&function(t,e,i,s){const{startItems:r,middleItems:n,endItems:a}=Du(t);r.length&&ju(r,e,i,!1,"top",s),n.length&&ju(n,e,i,!0,"top",s),a.length&&Vu(a,e,0,"top",s)}(r,this,a,e),s.length&&function(t,e,i,s){const{startItems:r,middleItems:n,endItems:a}=Du(t);r.length&&Nu(r,e,i,!1,"right",s),n.length&&Nu(n,e,i,!0,"right",s),a.length&&Uu(a,e,0,"right",s)}(s,this,o,e),n.length&&function(t,e,i,s){const{startItems:r,middleItems:n,endItems:a}=Du(t);r.length&&ju(r,e,i,!1,"bottom",s),n.length&&ju(n,e,i,!0,"bottom",s),a.length&&Vu(a,e,0,"bottom",s)}(n,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=Gu(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{s.isEqual(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=Gu(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),r=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=r-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:r,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},r,n=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,r)})),this._layoutRelativeOverlap("left",s.left,r),this._layoutRelativeOverlap("right",s.right,r),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,r)})),this._layoutRelativeOverlap("top",s.top,r),this._layoutRelativeOverlap("bottom",s.bottom,r),h=this.bottomCurrent-this.topCurrent,n&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,r)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Oc)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds(),n=this._getOutInLayout(r,t,e);s?(i.top=Math.max(i.top,n.top),i.bottom=Math.max(i.bottom,n.bottom)):(i.left=Math.max(i.left,n.left),i.right=Math.max(i.right,n.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:r}=e.getLayoutStartPoint(),{width:n,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+n+t.x2-i.right,top:i.top-(r-t.y1),bottom:r+a+t.y2-i.bottom}}}zu.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(Bu||(Bu={})),function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}(Pu||(Pu={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(Ou||(Ou={}));const Ku=["linear","radial","conical"],Hu={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const Wu={};Object.values(Pu).forEach((t=>{Wu[t]=!0})),Pu.STATE_HOVER,Pu.STATE_HOVER_REVERSE,Pu.STATE_SELECTED,Pu.STATE_SELECTED_REVERSE,Pu.STATE_DIMENSION_HOVER,Pu.STATE_DIMENSION_HOVER_REVERSE;class $u extends Mu{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(s.merge(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class Yu extends $u{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;i<this._stateInfoList.length;i++){const s=this._stateInfoList[i].level;if(s&&s>t.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const r=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];s.isValid(r.domain)&&(n.domain=r.domain),s.isValid(r.type)&&(n.type=r.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||function(t){return vu.includes(t)}(this._mark.type)}checkOneState(t,e,i){var r;let n=!1,a=!1;if(s.isValid(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),a=!0;else if(i.items)n=null!==(r=this.checkItemsState(i,t))&&void 0!==r&&r,a=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),a=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),a=!0}return a?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!Wu[t])).map((t=>[t,10]));for(let i=0;i<this._stateInfoList.length;i++){const r=this._stateInfoList[i],n=this.checkOneState(t,e,r);"skip"!==n&&"in"===n&&s.push([r.stateValue,r.level])}return s.map((t=>t[0]))}checkDatumState(t,e){let i=!1;const r=e[0];if(s.isArray(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(Gd)));i=t.datums.some((t=>e&&s.isArray(null==t?void 0:t.items)?n.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==r?void 0:r[e])})):n.every((e=>(null==t?void 0:t[e])===(null==r?void 0:r[e])))))}else if(s.isObject(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(Gd))),s=this._isMultiMark();i=e.every((e=>{var i,n;return s?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===r[e]:(null===(n=t.datums)||void 0===n?void 0:n[e])===r[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let r=!0;for(const n in t.fields){const a=t.fields[n],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[n];if(Vc(o)&&l.length>1){if(this.checkLinearFieldState(l,n,e,i)){r=!1;break}r=!0}else{if(!l.some((t=>t===h))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s){var r;const n=this._isMultiMark()?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return n<t[0]||n>t[t.length-1]}release(){}}class Xu extends Mu{constructor(){super(...arguments),this.id=va(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=Aa.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class qu extends Xu{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const Zu=1e3,Ju="quadInOut",Qu=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],tp=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=r.interpolateColor(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},ep=(t,e,i)=>{const s=[],r=[];e.clear();for(let n=0;n<t.length;n++){const a=t[n],o=a.from,l=a.to,h=a.rotation*i,c=a.fromCp,d=a.toCp,u=Math.sin(h),p=Math.cos(h);r[0]=c[0]+(d[0]-c[0])*i,r[1]=c[1]+(d[1]-c[1])*i;for(let t=0;t<o.length;t+=2){const e=o[t],n=o[t+1],a=e*(1-i)+l[t]*i,h=n*(1-i)+l[t+1]*i;s[t]=a*p-h*u+r[0],s[t+1]=a*u+h*p+r[1]}let g=s[0],m=s[1];e.moveTo(g,m);for(let t=2;t<o.length;t+=6){const i=s[t],r=s[t+1],n=s[t+2],a=s[t+3],o=s[t+4],l=s[t+5];g===i&&m===r&&n===o&&a===l?e.lineTo(o,l):e.bezierCurveTo(i,r,n,a,o,l),g=o,m=l}}},ip=(t,e,i)=>{const s=t?r.pathToBezierCurves(t):[],n=r.pathToBezierCurves(e);i&&s&&(i.fromTransform&&r.applyTransformOnBezierCurves(s,i.fromTransform.clone().getInverse()),r.applyTransformOnBezierCurves(s,i.toTransfrom));const[a,o]=r.alignBezierCurves(s,n);return t?r.findBestMorphingRotation(a,o,10,Math.PI):o.map(((t,e)=>({from:a[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},sp=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],rp=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((a=>{if(!sp.includes(a))return;const o=e[a];if(!s.isNil(o)&&!s.isNil(t[a])&&o!==t[a]){if("fill"===a||"stroke"===a){const e=t=>"string"==typeof t?r.ColorStore.Get(t,r.ColorType.Color255):t;i.push({from:s.isArray(t[a])?t[a].map(e):e(t[a]),to:s.isArray(o)?o.map(e):e(o),key:a})}else i.push({from:t[a],to:o,key:a});n=!0}})),n?i:null};class np extends th{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,r="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;ep(this.morphingData,r,e),this.otherAttrs&&this.otherAttrs.length&&tp(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):Wl(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const ap=(t,e,i,s)=>{var r,n,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=ip(null===(r=null==t?void 0:t.toCustomPath)||void 0===r?void 0:r.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=rp(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new np({morphingData:l,otherAttrs:h},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Zu,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Ju);return c.play(d),c};class op extends th{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;ep(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&tp(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const lp=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Qu.includes(t))(i)||(e[i]=t[i])})),e},hp=(t,e,i)=>{const s=lp(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const a=t.AABBBounds,o=a.width(),l=a.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=r.application.graphicService.creator.rect({x:0,y:0,width:o,height:l,pickable:!1});n.appendChild(i),e.push(i)}))}},cp=(t,e,i)=>{const s=[],n=i?null:lp(t.attribute),a=t.toCustomPath();for(let t=0;t<e;t++){const t={path:(new r.CustomPath2D).fromCustomPath2D(a)};s.push(r.application.graphicService.creator.path(i?t:Object.assign({},n,t)))}return i&&hp(t,s,e),s},dp=(t,e,i)=>{const s=[],n=i?null:lp(t.attribute);if("rect"===t.type)r.splitRect(t,e).forEach((t=>{s.push(r.application.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)r.splitArc(t,e).forEach((t=>{s.push(r.application.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)r.splitCircle(t,e).forEach((t=>{s.push(r.application.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const a=r.splitLine(t,e),o={size:10,symbolType:"circle"};a.forEach((t=>{s.push(r.application.graphicService.creator.symbol(i?Object.assign({},t,o):Object.assign({},n,t,o)))}))}else"polygon"===t.type?r.splitPolygon(t,e).forEach((t=>{s.push(r.application.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?r.splitArea(t,e).forEach((t=>{s.push(r.application.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&r.splitPath(t,e).forEach((t=>{"path"in t?s.push(r.application.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(r.application.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&hp(t,s,e),s},up=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,pp=(t,e,i,n,a)=>{var o;const l={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},h={prev:t.slice(),next:e.slice()},c=null!==(o=i.animation)&&void 0!==o?o:{},d=c.easing,u=up(c.delay,a,l,h),p=up(c.duration,a,l,h),g=up(c.oneByOne,a,l,h),m=up(c.splitPath,a,l,h),f=s.isValidNumber(g)&&g>0?t=>s.isNumber(g)?t*g:!0===g?t*p:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const r=e.filter((t=>t&&t.toCustomPath&&t.valid));r.length||console.error(r," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const n=("clone"===(null==i?void 0:i.splitPath)?cp:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:dp)(t,r.length,!1),a=null==i?void 0:i.onEnd;let o=r.length;const l=()=>{o--,0===o&&a&&a()};r.forEach(((e,s)=>{var a;const o=n[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,r.length,o,e):0);ap(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:u,duration:p,easing:d,onEnd:n,individualDelay:f,splitPath:m}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,a;const o=t.filter((t=>t.toCustomPath&&t.valid));o.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const l=("clone"===(null==i?void 0:i.splitPath)?cp:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:dp)(e,o.length,!0),h=e.attribute;e.setAttribute("visible",!1);const c=o.map(((t,e)=>ip(t.toCustomPath(),l[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:l[e].globalTransMatrix}))),d=o.map(((t,e)=>rp(t.attribute,h)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=o.length;const a=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:r.AttributeUpdateType.ANIMATE_END}),e.detachShadow(),s&&s())};l.forEach(((e,s)=>{var r,n,l;const h=(null!==(r=i.delay)&&void 0!==r?r:0)+i.individualDelay(s,o.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:a}));u.wait(h),u.play(new np({morphingData:c[s],saveOnEnd:!0,otherAttrs:d[s]},null!==(n=i.duration)&&void 0!==n?n:Zu,null!==(l=i.easing)&&void 0!==l?l:Ju))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:r.AttributeUpdateType.ANIMATE_END}),e.detachShadow(),t&&t()};const o=e.animate(s);(null==i?void 0:i.delay)&&o.wait(i.delay),o.play(new op({morphingData:c,otherAttrs:d},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Zu,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Ju))}})(t,e[0],{delay:u,duration:p,easing:d,onEnd:n,individualDelay:f,splitPath:m}):ap(t[0],e[0],{delay:u,duration:p,easing:d,onEnd:n})},gp=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,r)=>t.slice(i*r,r===e-1?t.length:i*(r+1))))},mp=t=>{const e=t.getMarkConfig();s.isValid(e.morphElementKey)&&t.getGraphics().forEach((t=>{var i,s;const r=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];r&&(t.context.morphKey=r[e.morphElementKey])}))},fp=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const r=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,r)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):r.length?t.useStates(r,i):t.clearStates(i)},vp=(t,e,i=!0,s)=>{var r;if(!e)return;const n=i&&null!==(r=t.currentStates)&&void 0!==r?r:[],a=i?Array.from(new Set([...n,e])):[e];fp(t,a,s)},yp=(t,e,i)=>{var s;const r=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!r.length)return;const n=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!r.includes(t)));fp(t,n,i)};var _p=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]])}return i};const bp=Symbol("statesClearedBeforeReInit");class Sp extends Xu{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){s.isValid(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){s.isNil(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const r=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,a;const o="function"==typeof r?r(t,e,i):r;if(e&&e.context&&e.context.compiler&&s.isValid(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},o),{layoutRect:null===(a=null==t?void 0:t.getLayoutRect)||void 0===a?void 0:a.call(t)})}return Object.assign({},o)}})},r={};Object.keys(t).forEach((e=>{const n=t[e];s.isArray(n)?r[e]=n.map(i):s.isValid(n)&&(r[e]=i(n))})),this._animationConfig=r}disableAnimationByState(t){const e=s.array(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=s.array(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new qu(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(s.isValid(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}s.isNil(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else s.isValid(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Cn("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){s.isNil(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:Tu.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new we)),i&&(s.isFunction(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,r;const n=t.context.diffState===Bu.enter||t.context.diffState===Bu.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(r=t.registeredActiveScopes)||void 0===r?void 0:r.size));((null==n?void 0:n.length)||a)&&fp(t,n,e)},this.name=t,this.model=e.model,this.key=e.key,this.state=new Yu(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(s.isValid(t.id)&&(this._userId=t.id),s.isBoolean(t.interactive)&&(this._markConfig.interactive=t.interactive),s.isValid(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),s.isBoolean(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,s.degreeToRadian)}isUserLevel(t){return[ku.User_Mark,ku.User_Series,ku.User_Chart,ku.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(s.isNil(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const r=this.isUserLevel(i);Object.keys(t).forEach((n=>{let a=t[n];s.isNil(a)||(a=this._filterAttribute(n,a,e,i,r),this.setAttribute(n,a,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,r){let n=this._styleConvert(e);if(r)switch(t){case"angle":n=this.convertAngleToRadian(n);break;case"innerPadding":case"outerPadding":n=this._transformStyleValue(n,(t=>-t));break;case"curveType":n=this._transformStyleValue(n,(t=>function(t,e){return"monotone"===t?"horizontal"===e?"monotoneY":"monotoneX":t}(t,this._option.model.direction)))}return n}setReferer(t,e,i){var s;if(t)if(e&&i){const r=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",r=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:r,style:e,referer:void 0});const a=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;s.isValid(a)&&a<=r&&Vd(this.stateStyle[i][t],{style:e,level:r}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Gc(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return s.isString(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=Dd(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let r=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];r||(r=this.stateStyle.normal[t]);const n=this._computeStateAttribute(r,t,e),a=s.isFunction(null==r?void 0:r.postProcess),o=t in this._computeExChannel;if(a&&o){const i=this._computeExChannel[t];return s=>{let a=n(s);return a=r.postProcess(a,s,this._attributeContext,this.getDataView()),i(t,s,e,a)}}if(a)return t=>r.postProcess(n(t),t,this._attributeContext,this.getDataView());if(o){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):Ku.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Gc(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",ku.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let r={stateValue:t};"level"in i&&(r.level=i.level),"filter"in i&&(r=s.isFunction(i.filter)?Object.assign({filter:i.filter},r):Object.assign(Object.assign({},i.filter),r)),this.state.addStateInfo(r),this.setStyle(e,t,ku.User_Mark)}else this.setStyle(i,t,ku.User_Mark)}))}_computeGradientAttr(t){var e,i,r,n,a;const{gradient:o,scale:l,field:h}=t,c=_p(t,["gradient","scale","field"]);let d=l,u=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(d=t),u||(u=e)}const p=Md(wd(this.model.getColorScheme(),"series"===this.model.modelType?null===(i=(e=this.model).getSpec)||void 0===i?void 0:i.call(e):void 0),null!==(a=null===(n=null===(r=this.model)||void 0===r?void 0:r.getDefaultColorDomain)||void 0===n?void 0:n.call(r))&&void 0!==a?a:[]),g=Object.assign(Object.assign({},Hu[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(g).forEach((r=>{const n=g[r];"stops"===r?e.stops=n.map((e=>{const{opacity:r,color:n,offset:a}=e;let o=null!=n?n:null==d?void 0:d.scale(t[u]);return s.isFunction(n)&&(o=n(t,this._attributeContext,i)),s.isValid(r)&&(o=s.Color.SetOpacity(o,r)),{offset:s.isFunction(a)?a(t,this._attributeContext,i):a,color:o||p[0]}})):s.isFunction(n)?e[r]=n(t,this._attributeContext,i):e[r]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:e,field:i}=t,r=_p(t,["scale","field"]);return t=>{var n,a,o;const l={};if(Object.keys(r).forEach((e=>{const i=r[e];s.isFunction(i)?l[e]=i(t,this._attributeContext,this.getDataView()):l[e]=i})),"stroke"in l)Ku.includes(null===(o=r.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(r.stroke)(t));else{const s=Md(wd(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(n=this.model).getSpec)||void 0===a?void 0:a.call(n):void 0),this.model.getDefaultColorDomain());let r=e,o=i;if(!(e&&i||"series"!==this.model.modelType)){const{scale:i,field:n}=this.model.getColorAttribute();e||(r=i),o||(o=n),l.stroke=(null==r?void 0:r.scale(t[o]))||s[0]}}return l}}_getDataByKey(t){return yu(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep<this._markConfig.progressiveThreshold,i=this._markConfig.large&&this._markConfig.largeThreshold>0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return Aa.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=s.isFunction(this.key)?this.key:s.isValid(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[Wd],this._groupKeyGetter=s.isValid(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=yu(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===mu.appear))?mu.appear:t.every((t=>t===mu.disappear))?mu.disappear:t[0];return null!=e?e:mu.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],r=[];t.forEach((t=>{mp(t),s.push(...t.getGraphics())})),e.forEach((t=>{mp(t),r.push(...t.getGraphics())}));const n=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=n(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),r.forEach((t=>{const e=n(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);pp([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),r=Math.min(e.length,s.length);if(r>0){const t=gp(e,r),n=gp(s,r);for(let e=0;e<r;e++)pp(t[e],n[e],i,d,{}),c+=1}})),0===c&&d(),!0})([this._lastMark],[this],{});return this._lastMark=null,e}return!1}_runStateAnimation(t){var e,i;if(!this._animationConfig||0===t.length)return;if(this.tryRunMorphing(t))return;const s=this.getAnimationConfig();if(null!==(e=this._markConfig.useSequentialAnimation)&&void 0!==e&&e&&this._runSequentialAnimations)return void this._runSequentialAnimations(t);const r=t.every((t=>"appear"===t.context.animationState)),n=this.createAnimationStateList("appear",s);if(r&&this._product){const t=n?["appear"]:[],e=n?[{name:"appear",animation:n}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const r=[e];t.applyAnimationState(r,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const r=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===mu.exit?mu.exit:i===mu.update?mu.update:mu.appear}),n=r(t);t.context.animationState=null!=n?n:t.context.diffState,t.context.animationState===Bu.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,r=[],n=new Set(this._graphics.filter((t=>t.context.diffState===Bu.enter))),a=(t,e,i)=>{var a,o,l,h,c,d,u,p,g;let m,f;return s.isNil(e)?(m=this._graphicMap.get(t),m&&(f=Bu.exit)):s.isNil(i)?(m=this._graphicMap.has(t)?this._graphicMap.get(t):{},f=Bu.enter,m.isExiting=!1,this._graphicMap.set(t,m),r.push(m)):(m=this._graphicMap.get(t),m&&(f=Bu.update,r.push(m))),m&&(n.delete(m),m.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:f,reusing:null===(a=m.context)||void 0===a?void 0:a.reusing,originalFieldX:null===(o=m.context)||void 0===o?void 0:o.originalFieldX,originalFieldY:null===(l=m.context)||void 0===l?void 0:l.originalFieldY,fieldX:null===(h=m.context)||void 0===h?void 0:h.fieldX,fieldY:null===(c=m.context)||void 0===c?void 0:c.fieldY,data:null!=e?e:null===(d=m.context)||void 0===d?void 0:d.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=m.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=m.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(m)),m};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{a(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&a(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=a(t,e.data.get(t),null);i&&(i.context.animationState=mu.appear)})):i&&i.keys.forEach((t=>{a(t,null,i.data.get(t)).context.animationState=mu.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const o=r.length;r.forEach(((t,e)=>{t.context.graphicCount=o,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=r,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return _u(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=_u(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((r=>{this._unCompileChannel[r]||(this._option.noSeparateStyle||function(t,e,i){var r;const n=null===(r=e[t])||void 0===r?void 0:r.style;return!!function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n)||!!s.isFunction(n)||!(!(null==n?void 0:n.scale)||n.field===i)}(r,t,this._groupKey)?e[r]=t[r]:i[r]=t[r])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,r;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||s.isFunction(n.postProcess)||e in this._computeExChannel)return!1;const a=n.style;return!(s.isFunction(a)||Ku.includes(null==a?void 0:a.gradient)||["outerBorder","innerBorder"].includes(e)||Gc(null===(r=null==a?void 0:a.scale)||void 0===r?void 0:r.type))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const r={},n=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),r[t]=c,n.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!n.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=n.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=r,this._product.sharedStateDefinitions=r)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const r=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);s.isNil(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==r?void 0:r[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_commitPreventedAnimationStaticAttrs(t,e){var i,s;if(!e||!Object.keys(e).length)return;const r=t;null===(i=r.setFinalAttributes)||void 0===i||i.call(r,e),r._commitAnimationStaticAttributes?r._commitAnimationStaticAttributes(e):null===(s=r.commitInternalBaseAttributes)||void 0===s||s.call(r,e)}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var r,n;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,((t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s})(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?(i.setAttributesAndPreventAnimate(t),this._commitPreventedAnimationStaticAttrs(i,t)):i.setAttributes(t)),!(null===(n=this.renderContext)||void 0===n?void 0:n.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const n=this._graphics===t?s:s+this._graphics.length-t.length;if(n>=0&&(this._graphics[n]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===Pu.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:r,overflow:n}=this._markConfig;if(s.isNil(e)||(t.zIndex=e),s.isNil(i)||(t.clip=i),!s.isNil(r)){const e=s.isArray(r)?r:r(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return s.isNil(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=Aa.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=Aa.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const r=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(r);let a;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();a=t.output()}else a=s.array(n),this._runGroupData(a),this.renderContext=this._parseProgressiveContext(a);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(a),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===fu.before||(this._product||this._initProduct(),((t,...e)=>{Ic.silent||s.Logger.getInstance().info(`[VChart log]: ${t}`,...e)})(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,r=s[bp],n=null==r?void 0:r.includes(t),a=!n&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?vp(i,t,!0,a):yp(i,t,a),n){const e=r.filter((e=>e!==t));e.length?s[bp]=e:delete s[bp]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===Bu.exit&&!e.isExiting)if(e.context.animationState===Bu.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const r=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===r.length?r[0]:r],(()=>{e.context.diffState===Bu.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex<this.renderContext.progressive.totalStep||this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.unfinished())}clearProgressive(){this.renderContext&&this.renderContext.progressive&&(this._graphics=[],this._product.children.forEach((t=>{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const r=this.renderContext.progressive.groupedData.get(s),n=this.renderContext.progressive.step,a=r.slice(t*n,(t+1)*n),o=[];a.forEach(((i,r)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:Bu.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*n+r}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Cn({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const r=t.parent;r&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&r.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||s.isObject(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[bp]=t.currentStates.slice())}))}}const xp=()=>{s.mixin(gn,Il),s.mixin(gn,ch),Mp(),Ep()},Ap=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};Pu.STATE_HIGHLIGHT,Pu.STATE_BLUR;const Tp=(t,e,i,r)=>{if(s.isNil(t[e]))return;const n=s.isArray(t[e]),a=n?t[e]:[t[e]],o=[];return a.forEach(((t,s)=>{!t||r&&!r(t)||o.push({spec:t,specPath:n?[e,s]:[e],specInfoPath:["component",e,s],type:i})})),o},Cp=`${Gd}_BuiltIn_CallBack_Disappear`;var kp;!function(t){t.render="render",t.disappear="disappear"}(kp||(kp={}));const wp={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},Mp=()=>{Cl.registerBuiltInAnimate("scaleIn",xc),Cl.registerBuiltInAnimate("scaleOut",Ac),Cl.registerBuiltInAnimate("fadeIn",Xh),Cl.registerBuiltInAnimate("fadeOut",qh),Cl.registerBuiltInAnimate("moveIn",vc),Cl.registerBuiltInAnimate("moveOut",yc),Cl.registerBuiltInAnimate("rotateIn",bc),Cl.registerBuiltInAnimate("rotateOut",Sc),Cl.registerBuiltInAnimate("update",wc),Cl.registerBuiltInAnimate("state",Tc),Cl.registerBuiltInAnimate("fromTo",ih)},Ep=()=>{Cl.registerBuiltInAnimate(Cp,Mc)};class Bp extends Sp{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}setDataLabelType(){return"rect"}constructor(t,e){super(t,e),this.type=Bp.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}Bp.type="rect3d";const Pp=()=>{Aa.registerMark(Bp.type,Bp),zh(),Vh(),Cl.registerBuiltInAnimate("growHeightIn",rc),Cl.registerBuiltInAnimate("growHeightOut",nc),Cl.registerBuiltInAnimate("growWidthIn",gc),Cl.registerBuiltInAnimate("growWidthOut",mc),Cl.registerBuiltInAnimate("growCenterIn",ec),Cl.registerBuiltInAnimate("growCenterOut",ic),Aa.registerGraphicComponent("rect3d",Wh)};class Op extends e.BarSeries{constructor(){super(...arguments),this.type=$.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d",this.transformerConstructor=Ma}}Op.type=$.bar3d,Op.mark=wa,Op.builtInTheme={bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}}},Op.transformerConstructor=Ma;const Ip=()=>{e.Factory.registerAnimation("bar3d",((t,i)=>({appear:e.barPresetAnimation(t,i),enter:e.barGrowIn(t,!1),exit:e.barGrowOut(t,!1),disappear:e.barGrowOut(t)}))),Pp(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.Factory.registerSeries(Op.type,Op)};class Rp extends zu{layoutItems(t,e,i,s){this._layoutInit(t,e,i,s);const r={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(e,r);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},a=e.filter((t=>"absolute"===t.layoutType)),o=a.filter((t=>"z"===t.layoutOrient));let l={width:0,height:0};if(o.length){l=o[0].getLayoutRect()}this.leftCurrent+=l.width/8,this.rightCurrent-=l.width/8,this.topCurrent+=l.height/8,this.bottomCurrent-=l.height/8;const{regionItems:h,relativeItems:c,relativeOverlapItems:d,allRelatives:u,overlapItems:p}=this._groupItems(e);this.layoutRegionItems(h,c,d,p,r),this._processAutoIndent(h,c,d,p,u,n,r);const g=a.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(g);const m=c.filter((t=>{return"axes"===t.model.specKey&&("bottom"===(e=t.layoutOrient)||"top"===e);var e}))[0],f=c.filter((t=>{return"axes"===t.model.specKey&&("left"===(e=t.layoutOrient)||"right"===e);var e}))[0];if(m&&o.length){const t=m.getLayoutStartPoint(),e=m.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};o[0].model.directionStr="left"===f.layoutOrient?"r2l":"l2r";const s=m.getLayoutRect(),r=f.getLayoutRect(),n={length:o[0].getLayoutRect().width,width:s.width,height:r.height};m.model.setLayout3dBox&&m.model.setLayout3dBox(n),f.model.setLayout3dBox&&f.model.setLayout3dBox(n),o[0].model.setLayout3dBox&&o[0].model.setLayout3dBox(n),this.layoutZAxisItems(o,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this.rightCurrent,s=this._chartViewBox.y2-this._chartViewBox.y1-this.bottomCurrent;return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const r="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds();r?(e.top=Math.max(e.top,n.y1-this.topCurrent),e.bottom=Math.max(e.bottom,n.y2-s)):(e.left=Math.max(e.left,n.x1-this.leftCurrent),e.right=Math.max(e.right,n.x2-i))})),e}}Rp.type="layout3d";const Dp=()=>{Aa.registerLayout(Rp.type,Rp)};class Lp extends e.BarChart{constructor(){super(...arguments),this.transformerConstructor=K,this.type="bar3d",this.seriesType=$.bar3d}}Lp.type="bar3d",Lp.seriesType=$.bar3d,Lp.transformerConstructor=K;const Fp=Object.assign(Object.assign({},e.baseSeriesMark),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class Np extends e.FunnelSeriesSpecTransformer{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class Up extends Sp{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class jp extends Up{_getDefaultStyle(){const t=super._getDefaultStyle();return t.stroke=!1,t}constructor(t,e){super(t,e),this.type=jp.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}jp.type="pyramid3d";const Vp=()=>{Aa.registerMark(jp.type,jp),zh(),Fh(),Cl.registerBuiltInAnimate("growPointsOut",lc),Aa.registerGraphicComponent("pyramid3d",Hh)},Gp=e.getFunnelTheme(!0);class zp extends e.FunnelSeries{constructor(){super(...arguments),this.type=$.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=Np}initMark(){var t,e,i,s,r,n,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},zp.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0},{support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},zp.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(r=this._spec.outerLabel)&&void 0!==r?r:{},{line:e}=null!==(a=null===(n=this._theme)||void 0===n?void 0:n.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(zp.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(zp.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t})}}initMarkStyle(){super.initMarkStyle();const t=this._funnelMark;t&&this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",e.AttributeLevel.Series)}initLabelMarkStyle(t){var i,s;super.initLabelMarkStyle(t),this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",e.AttributeLevel.Series),this._labelMark=t,null===(i=this._funnelOuterLabelMark)||void 0===i||i.label,null===(s=this._funnelOuterLabelMark)||void 0===s||s.line}}zp.type=$.funnel3d,zp.mark=Fp,zp.builtInTheme={funnel3d:Gp},zp.transformerConstructor=Np;const Kp=()=>{Vp(),e.registerTextMark(),e.registerRuleMark(),e.Factory.registerSeries(zp.type,zp)};class Hp extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=e.FunnelChartSpecTransformer,this.type="funnel3d",this.seriesType=$.funnel3d}}Hp.type="funnel3d",Hp.seriesType=$.funnel3d,Hp.transformerConstructor=e.FunnelChartSpecTransformer;class Wp extends e.BaseHistogramChart{constructor(){super(...arguments),this.transformerConstructor=e.HistogramChartSpecTransformer,this.type="histogram3d",this.seriesType=$.bar3d}_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}Wp.type="histogram3d",Wp.seriesType=$.bar3d,Wp.transformerConstructor=e.HistogramChartSpecTransformer;class $p{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=s.array(t);for(let t=0;t<e.length;t++)this._dataArr.push(uu(e[t],this._dataSet,this._dataArr))}updateData(t,e=!1,i=!0){const r=s.array(t);return!(e&&r.length!==this._dataArr.length||(this._dataValueForEach(r,((t,e)=>{e.markRunning()})),this._dataValueForEach(r,((t,e)=>{pu(e,t,i)})),0))}_dataValueForEach(t,e){t.forEach(((t,s)=>{if(t instanceof i.DataView)return;const r=this.getSeriesData(t.id,s);r&&e(t,r,s)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Pc(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Pc(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class Yp{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{Fc(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{tu(e,[{key:t,operations:Vc(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const r=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&tu(e,[{key:i.field,operations:Vc(r.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?Dd("colorOrdinal"):Dd(t.type)),e?(s.isArray(t.range)&&e.range(t.range),s.isArray(t.domain)&&(Fc(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(s.isEqual(t,this._spec))return e;e.change=!0;for(let i=0;i<t.length;i++){const r=t[i],n=this._scaleMap.get(r.id);if(!n)return e.reMake=!0,e;const a=this._spec.find((t=>t.id===r.id));if(!a.id)return e.reMake=!0,e;if(a.type!==r.type)return e.reMake=!0,e;if(!s.isEqual(a.specified,r.specified)){if("color"!==r.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(r.specified);else{if(!r.specified||!t.specified)return e.reMake=!0,e;t.specified(r.specified)}e.reRender=!0}r.range&&!s.isEqual(r.range,n.range())&&(n.range(r.range),e.reRender=!0),Fc(r.domain)?e.reRender=!0:s.isEqual(r.domain,n.domain())||(n.domain(r.domain),e.reRender=!0),this._scaleSpecMap.set(r.id,r)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i<e.length;i++){const s=e[i];if(s.getRawData().name===t)return s}return null}_getSeriesBySeriesId(t){const e=this._chart.getAllSeries();for(let i=0;i<e.length;i++){const s=e[i];if(s.id===t)return s}return null}updateScaleDomain(t){this._scaleSpecMap.forEach(((e,i)=>{const r=this._scaleMap.get(i);if(!r)return;if(!Fc(e.domain))return e.domain&&0!==e.domain.length||r.domain(t),void this._updateMarkScale(i,r,r.domain().slice());let n;n=Vc(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const r=Vc(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,r);e&&(r?(s.isNil(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),s.isNil(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const a=n;Vc(e.type)||(n=Array.from(n)),r.domain(n),this._updateMarkScale(i,r,a)}))}_updateMarkScale(t,e,i){const r=this._markAttributeScaleMap.get(t);r&&0!==r.length&&r.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(s.isNil(t.changeDomain)||"none"===t.changeDomain||s.isNil(t.seriesId))return void(Vc(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const r=this._getSeriesBySeriesId(t.seriesId),n=Vc(e.type),a=r.getRawDataStatisticsByField(t.field,n);if(!s.isEmpty(a))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],a.min),i[1]=Math.max(i[1],a.max)):(a.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([a.min,a.max]):t.markScale.domain(a.values)));Vc(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let r=this._markAttributeScaleMap.get(t.scale);r||(r=[],this._markAttributeScaleMap.set(t.scale,r));let n=i;return(s.isNil(t.field)||!s.isNil(t.changeDomain)&&"none"!==t.changeDomain&&!s.isNil(e))&&(n=i.clone()),r.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}var Xp;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Xp||(Xp={}));class qp{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){t&&[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}_getMarkById(t){const e=new Map;return t.getMarks().forEach((t=>{t&&e.set(t.id,t)})),e}_hasAnimationByGraphicState(t,e){var i,s,r;const n=null!==(s=null===(i=t.parent)||void 0===i?void 0:i.mark)&&void 0!==s?s:e.get(t.context.markId);return!!(null===(r=null==n?void 0:n.hasAnimationByState)||void 0===r?void 0:r.call(n,"state"))}updateStates(t,e,i,s,r){return this._disableTriggerEvent?[]:e&&e.length?(s&&r?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,r),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,r):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):(i&&i.length&&this.clearAllStatesOfTrigger(t,s,r),[])}toggleReverseStateOfGraphics(t,e,i,s){const r=t.getMarkIdByState(),n=this._getMarkById(t);i.forEach((t=>{if(s&&r[s]&&r[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,n);vp(t,s,!0,e)}})),e.forEach((t=>{if(s&&r[s]&&r[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,n);yp(t,s,e)}}))}toggleStateOfGraphics(t,e,i,s){const r=t.getMarkIdByState(),n=this._getMarkById(t);i.forEach((t=>{if(s&&r[s]&&r[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,n);yp(t,s,e)}})),e.forEach((t=>{if(s&&r[s]&&r[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,n);vp(t,s,!0,e)}}))}addBothStateOfGraphics(t,e,i,s){const r=t.getMarks(),n=t.getMarkIdByState();r.forEach((t=>{var r;const a=s&&n[s]&&n[s].includes(t.id),o=i&&n[i]&&n[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(r=t.getGraphics())||void 0===r||r.forEach((t=>{e&&e.includes(t)?o&&vp(t,i,!0,l):a&&vp(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),r=t.getMarkIdByState();s.forEach((t=>{var s;const n=i&&r[i]&&r[i].includes(t.id);if(!n)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&n&&vp(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const r=t.getMarks(),n=t.getMarkIdByState();r.forEach((t=>{if(t){const r=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");r&&r.length&&(i&&n[i]&&n[i].includes(t.id)&&r.forEach((t=>{yp(t,i,a)})),e&&n[e]&&n[e].includes(t.id)&&r.forEach((t=>{s.includes(t)&&yp(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const Zp=[...Object.keys(wp),"normal"];function Jp(t={},e,i){const r={};for(let n=0;n<Zp.length;n++){const a=Zp[n],o=e?e[a]:void 0;if(!1===o)continue;if("normal"===a){o&&(r.normal=o);continue}if("state"===a){!1!==o&&(r.state=null!=o?o:wp.state);continue}if("update"!==a&&!o&&!t[a])continue;let l,h;l=s.isArray(t[a])?t[a]:[Object.assign(Object.assign({},wp[a]),t[a])],"exit"===a&&l.forEach((t=>{t.controlOptions={stopWhenStateChange:!0}})),o?(h=s.isArray(o)?o.map(((t,e)=>{var s;let r=t;return sg(r)&&delete r.type,r.oneByOne&&(r=tg(r,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:eg,null==i?void 0:i.dataCount)),r})):l.map(((t,e)=>{var s;let r=Vd({},l[e],o);return sg(r)&&delete r.type,r.oneByOne&&(r=tg(r,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:eg,null==i?void 0:i.dataCount)),r})),r[a]=h):r[a]=l}return r}function Qp(t,e,i){var r,n,a,o,l,h;const c={};return s.isValid(e.animationAppear)&&(c.appear=null!==(r=e.animationAppear[t])&&void 0!==r?r:e.animationAppear),s.isValid(e.animationDisappear)&&(c.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),s.isValid(e.animationEnter)&&(c.enter=null!==(a=e.animationEnter[t])&&void 0!==a?a:e.animationEnter),s.isValid(e.animationExit)&&(c.exit=null!==(o=e.animationExit[t])&&void 0!==o?o:e.animationExit),s.isValid(e.animationUpdate)&&(c.update=null!==(l=e.animationUpdate[t])&&void 0!==l?l:e.animationUpdate),s.isValid(e.animationState)&&(c.state=null!==(h=e.animationState[t])&&void 0!==h?h:e.animationState),e.animationNormal&&e.animationNormal[t]&&(c.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return rg(t=s.cloneDeep(t,null,i),(t=>{var i;return s.isFunction(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t?(...i)=>t(...i,e):t}),i),t}(c,i)}function tg(t,e,i){const{oneByOne:r,duration:n,delay:a,delayAfter:o}=t;return t.delay=(t,i,o)=>{const l=e(t,o),h=s.isFunction(n)?n(t,i,o):s.isValidNumber(n)?n:0,c=s.isFunction(a)?a(t,i,o):s.isValidNumber(a)?a:0;let d=s.isFunction(r)?r(t,i,o):r;return!1===d?c:(d=!0===d?0:d,c+l*(h+d))},t.delayAfter=(t,a,l)=>{const h=e(t,l),c=s.isFunction(n)?n(t,a,l):s.isValidNumber(n)?n:0,d=s.isFunction(o)?o(t,a,l):s.isValidNumber(o)?o:0;let u=s.isFunction(r)?r(t,a,l):r;return!1===u?d:(u=!0===u?0:u,d+((i?i():a.parent.count-1)-h)*(c+u))},delete t.oneByOne,t}function eg(t,e){var i;return null!==(i=null==t?void 0:t[Hd])&&void 0!==i?i:e.context.graphicIndex}function ig(t,e){var i,s,r,n,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(r=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==r?r:t.animationAppear),l=!1!==(null!==(a=null===(n=t.animationUpdate)||void 0===n?void 0:n[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function sg(t){return!function(t){return s.isValid(t.timeSlices)}(t)&&s.isValid(t.channel)}function rg(t,e,i=[]){if(s.isArray(t))t.forEach(((s,r)=>{t[r]=e(t[r],r),rg(t[r],e,i)}));else if(s.isObject(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),rg(t[s],e,i))}function ng(t){var e,i,s,r,n,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(r=t.getMarks())||void 0===r||r.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(n=t.getRawData())||void 0===n?void 0:n.latestData)||void 0===a?void 0:a.length)>=l)}var ag=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]])}return i};const og={[Bc.markPoint]:!0,[Bc.markLine]:!0,[Bc.markArea]:!0},lg={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class hg extends Mu{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,r,n,a;super(e),this.type="chart",this.id=va(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:zd,height:Kd},this._viewRect={width:zd,height:Kd},this._viewBox={x1:0,y1:0,x2:zd,y2:Kd},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>s.array(t).some((t=>s.isValid(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(lg).some((t=>!s.isNil(e[t])))},this._paddingSpec=Ud(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new su(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new $p(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(r=this._option)||void 0===r?void 0:r.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(a=this._option)||void 0===a?void 0:a.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new qp;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const r=t.getInteractionTriggers();if(r&&r.length){const n=t.getRegion().id;r.forEach((({trigger:t,marks:r})=>{const a=i.find((e=>e.regionId===n&&s.isEqual(e.config,t)));if(a)a.trigger.marks.push(...r);else{const s=Object.assign(Object.assign({},t),{marks:[...r]});i.push({regionId:n,config:Object.assign({},t),trigger:s}),e.push(s)}}))}})),e.forEach((t=>{const e=Aa.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(Jp({},Qp("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||s.isValid(t.gradient))return;const e=s.pickWithout(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=Aa.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:Tu.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,e){if(!t)return;const{spec:i}=e,s=ag(e,["spec"]),r=new t(i,Object.assign(Object.assign({},this._modelOption),s));r&&(r.created(),this._regions.push(r))}_createSeries(t,e){if(!t)return;const{spec:i}=e,r=ag(e,["spec"]);let n;if(s.isValid(i.regionId)?n=this.getRegionsInUserId(i.regionId):s.isValid(i.regionIndex)&&(n=this.getRegionsInIndex([i.regionIndex])[0]),!n&&!(n=this._regions[0]))return;const a=new t(i,Object.assign(Object.assign(Object.assign({},this._modelOption),r),{type:i.type,region:n,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),n.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(s.isString(t))return this.getAllModels().find((e=>e.userId===t));if(s.isFunction(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=Aa.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(nu.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(nu.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(nu.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof Ru)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;return this.getComponentByUserId(t)||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof Sp))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof Sp)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const r=this._dataSet.getDataView(t);r&&(r.markRunning(),r.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){s.array(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),s.array(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&pu(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=bu(this._spec,this._option,{width:zd,height:Kd})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const r=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(s.isArray(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=wd(r),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new Yp(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){Au(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=wd(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),r=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return r.length>0&&r.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const r={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return r.reMake=!0,this.setLayoutTag(!0,null,!1),r;const n=this._getSpecKeys(this._spec),a=this._getSpecKeys(t);if(!s.isEqual(n,a)&&!this._canChangeSpecKeysWithoutRemake(n,a))return r.reMake=!0,this.setLayoutTag(!0,null,!1),r;const o=Array.from(new Set([...n,...a])).sort();for(let e=0;e<o.length;e++){const i=o[e],n=this._spec[i],a=t[i];if(s.isArray(n)&&n.length!==s.array(a).length&&!this._canChangeMarkerComponentsWithoutRemake(i,n,a))return r.reMake=!0,this.setLayoutTag(!0,null,!1),r}const l=this._spec,h=this._isOnlyMarkerComponentsRemoved(this._spec,t,o),c=this._isOnlyComponentSpecsChanged(this._spec,t,o),d=this._isOnlySeriesSpecsChanged(this._spec,t,o),u=!(!c&&!d)||this._isOnlyComponentOrSeriesSpecsChanged(this._spec,t,o);if(this._spec=t,h)return this._removeMarkerComponentsForEmptySpecs(r),r;if(this.updateChartConfig(r,l),r.reMake)return this.setLayoutTag(!0,null,!1),r;if(this.updateGlobalScale(r),r.reMake)return this.setLayoutTag(!0,null,!1),r;if(this.updateRegionSpec(r),r.reMake)return this.setLayoutTag(!0,null,!1),r;const p=this.updateComponentSpec(r);return r.reMake?(this.setLayoutTag(!0,null,!1),r):(!c&&(null===(e=r.effects)||void 0===e?void 0:e.localOnly)&&delete r.effects.localOnly,function(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}(r)?r:c&&!p.hasNonComponentOnlyUpdate&&(xu(r)||this._isComponentScaleDomainOnlyUpdate(r))?(p.componentOnlyUpdatedComponents.forEach((t=>{t.reInit(t.getSpec())})),(null===(i=r.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),r):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(r),r.reMake||(this.reInit(),u&&this._canSkipChartDataStages(r)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),r))}updateChartConfig(t,e){var i,s;this._paddingSpec=Ud(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{Au(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const r={},n={[Bc.title]:!0,[Bc.brush]:!0,[Bc.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===Bc.label||l.type===Bc.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));n[l.type]&&(n[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(s.isArray(u)){if(r[d]=r[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);r[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},o=l.getSpec(),h=l.updateSpec(n,u);xu(h)||this._isComponentScaleDomainOnlyUpdate(h)?e.push(l):s.isEqual(o,n)||(i=!0),Au(t,h)}else{const r=l.getSpec(),n=l.updateSpec(u);xu(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):s.isEqual(r,u)||(i=!0),Au(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,r);for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)){const i=r[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(n).forEach((e=>{if(n[e]){const i=this._spec[e];(s.isArray(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(og[t]&&s.isArray(e)&&s.isArray(i))&&!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake)}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return og[t]&&s.isArray(e)&&e.length>0&&s.isArray(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let r=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(r=!0,!0):s.isEqual(t[i],e[i])));return r&&n}_isComponentSpecKey(t){return!!og[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let r=!1;const n=t,a=e,o=i.every((t=>!!s.isEqual(n[t],a[t])||!!this._isComponentSpecKey(t)&&(r=!0,!0)));return r&&o}_isOnlySeriesSpecsChanged(t,e,i){var r,n;let a=!1;const o=t,l=e,h=null!==(n=null===(r=this._specTransformer)||void 0===r?void 0:r.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},c=i.every((t=>!!s.isEqual(o[t],l[t])||!!h[t]&&(a=!0,!0)));return a&&c}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var r,n;let a=!1;const o=t,l=e,h=null!==(n=null===(r=this._specTransformer)||void 0===r?void 0:r.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},c=i.every((t=>!!s.isEqual(o[t],l[t])||!(!this._isComponentSpecKey(t)&&!h[t])&&(a=!0,!0)));return a&&c}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,r=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,n)=>{if(t.reMake)return;const a=i.specKey||i.type;og[a]&&!this._hasComponentForSpecInfo(a,n)&&(this._isMarkerAdditionSpecSafeWithoutRemake(n.spec)?(this._createComponent(i,n),e[a]&&e[a].componentCount++,s++,r=r||this._isAutoRangeMarkerSpec(n.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),r?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];Au(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:r,y2:n}=t;e={width:r-i,height:n-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=function(t,e,i){var r,n,a,o;const l={top:0,bottom:0,left:0,right:0};return Object.values(t).every((t=>s.isNumber(t)))?(l.top=null!==(r=t.top)&&void 0!==r?r:0,l.right=null!==(n=t.right)&&void 0!==n?n:0,l.bottom=null!==(a=t.bottom)&&void 0!==a?a:0,l.left=null!==(o=t.left)&&void 0!==o?o:0,l):([{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{l[s]=Nd(t[s],e.size,i)}))})),l)}(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(nu.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const r in t){if(s.isEmpty(t[r]))continue;const n=t[r];let a={stateValue:r};a=s.isFunction(n.filter)?Object.assign({filter:n.filter},a):Object.assign(Object.assign({},n.filter),a),n.level&&(a.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[r]&&(e&&!e(t,i,r)||(i.state.changeStateInfo(a),i.updateMarkState(r)))}))}))}}setSelected(t,e,i){this._setStateInDatum(Pu.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum(Pu.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(Pu.STATE_SELECTED)}clearHovered(){this.clearState(Pu.STATE_HOVER)}_initEvent(){[nu.dataZoomChange,nu.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(ru.AFTER_MARK_RENDER_END,e)};this._event.on(ru.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const r=(t=t?s.array(t):null)?Object.keys(t[0]):null,n=[],a=null!==(i=e.getDatum)&&void 0!==i?i:iu;return this.getRegionsInQuerier(e.region).forEach((i=>{const o=[];t&&i.getSeries().forEach((l=>{l.getMarks().forEach((h=>{const c=h.getGraphics();if(c&&c.length&&(!e.filter||s.isFunction(e.filter)&&e.filter(l,h)))if((t=>"line"===t||"area"===t)(h.type))c.filter((s=>{const c=a(s,h,l,i);c&&t.every(((t,e)=>r.every((i=>t[i]==c[e][i]))))&&(o.push(s),n.push(s),e.callback&&e.callback(s,h,l,i))}));else if(t.length>1){const s=t.slice();c.forEach((t=>{const c=a(t,h,l,i),d=c&&s.findIndex((t=>r.every((e=>t[e]==c[e]))));d>=0&&(s.splice(d,1),o.push(t),n.push(t),e.callback&&e.callback(t,h,l,i))}))}else{const s=c.find((e=>{const s=a(e,h,l,i);return s&&r.every((e=>t[0][e]==s[e]))}));s&&(o.push(s),n.push(s),e.callback&&e.callback(s,h,l,i))}}))})),e.regionCallback&&e.regionCallback(o,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const r=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,r)}setDimensionIndex(t,e){var i,r;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===Xp.dimensionHover||s===Xp.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=s.isNil(t)||!n||n.every((t=>zc(t.axis.getScale().type)&&s.isNil(t.index))),o=a||n.every((t=>zc(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(Bc.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(r=(i=t).hideTooltip)||void 0===r||r.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:r}=t,n="left"===e.getOrient()||"right"===e.getOrient();r.forEach((t=>{var e,r,a;const o=n?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(r=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===r?void 0:r[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(Bc.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(Bc.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(Bc.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),r=[];s.forEach((e=>{const i=t(e);!1!==i&&r.push({axis:e,value:i})})),i.showCrosshair(r)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const cg=(t,e)=>{var i;const r=t.spec,{regionId:n,regionIndex:a}=r;if(s.isValid(n)){const t=s.array(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(s.isValid(a))return s.array(a).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(s.isValid)},dg={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class ug{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},dg),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),s.isValid(t.stackInverse)&&t.region.forEach((e=>{!s.isValid(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),s.isValid(t.stackSort)&&t.region.forEach((e=>{!s.isValid(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,r)=>{const{spec:n,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(n,t,r),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(n,t):jd(t,a,c.spec),jd(r,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,r;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=cg(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(r=n.component)&&void 0!==r?r:{}).forEach((t=>t.forEach(((t,e)=>{var i,r,a;if(t){if(!t.regionIndexes){const e=null!==(r=null!==(i=cg(t,n))&&void 0!==i?i:n.region)&&void 0!==r?r:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const r=t.spec,{seriesId:n,seriesIndex:a}=r;if(s.isValid(n)){const t=s.array(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(s.isValid(a))return s.array(a).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(s.isValid)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(a=t.regionIndexes)&&void 0!==a?a:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,r,n,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(r=this._option.globalInstance)||void 0===r?void 0:r.isAnimationEnable(),animationThreshold:null!==(n=t.animationThreshold)&&void 0!==n?n:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(Aa.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(Aa.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,n;const a=[],o=Aa.getComponents();let l,h,c,d;const u=[];for(let e=0;e<o.length;e++){const{cmp:i,alwaysCheck:r}=o[e];i.type.startsWith(Bc.cartesianAxis)?l=i:i.type.startsWith(Bc.polarAxis)?h=i:i.type===Bc.geoCoordinate?c=i:(r||t[null!==(s=i.specKey)&&void 0!==s?s:i.type])&&(i.type===Bc.tooltip?d=i:u.push(o[e]))}let p=!1;if(l){const s=l.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(p=!0,s.forEach((t=>{const s=Aa.getComponentInKey(t.type);a.push(e(s,t,i))})))}if(h&&!p){const s=h.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(p=!0,s.forEach((t=>{const s=Aa.getComponentInKey(t.type);a.push(e(s,t,i))})))}return c&&!p&&(null===(r=c.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{a.push(e(c,t,i))}))),u.sort(((t,e)=>t.createOrder-e.createOrder)),u.forEach((({cmp:s})=>{var r;null===(r=s.getSpecInfo?s.getSpecInfo(t,i):Tp(t,s.specKey,s.type))||void 0===r||r.forEach((t=>{a.push(e(s,t,i))}))})),d&&(null===(n=Tp(t,d.specKey,d.type))||void 0===n||n.forEach((t=>{a.push(e(d,t,i))}))),a}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const r="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!r.includes(i.orient))return!1;if(s.isValid(i.seriesId)){if(s.array(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(s.isValid(i.seriesIndex)){if(s.array(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:r,barMinWidth:n,barWidth:a,barGapInGroup:o}=i;let l=!1;s.isNumber(n)?(t.minBandSize=n,l=!0):s.isNumber(a)?(t.minBandSize=a,l=!0):s.isNumber(r)&&(t.minBandSize=r,l=!0),l&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:s.isArray(o)?o[o.length-1]:o})}}class pg extends ug{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,r;const n=s.array(t.indicator),a=null!==(e=t.innerRadius)&&void 0!==e?e:null===(r=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===r?void 0:r.innerRadius;return s.isValid(a)&&n.forEach((t=>{s.isNil(t.limitRatio)&&(t.limitRatio=a)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),s.isArray(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),s.isValid(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class gg extends pg{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),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 mg extends gg{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class fg extends hg{constructor(){super(...arguments),this.transformerConstructor=gg}}fg.transformerConstructor=gg;const vg=(t,e,i,r)=>{let n;if(n=s.isFunction(t)?t(e,i):s.isPlainObject(t)&&s.isValid(t.field)?s.get(e,t.field):t,r){const{formatFunc:i,args:s}=function(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const r=Aa.getFormatter();return e&&r?{formatFunc:r,args:[i,s,e]}:{}}(void 0,r,t,e);i&&s&&(n=i(...s))}return n};var yg=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]])}return i};const _g=(t,e)=>!(e&&(!1===e.visible||e[t]&&!1===e[t].visible||e.activeType&&!(s.isArray(e.activeType)?e.activeType.includes(t):e.activeType===t)));function bg(t,e,i,r,n,a){const o=e=>{if(e){const o={datum:n},l=s.isNil(e.key)&&s.isNil(e.value)&&!s.isEmpty(e)?Object.assign(Object.assign(Object.assign({},r),i),e):Object.assign(Object.assign({},r),e),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:u,value:p,valueFormatter:g,valueTimeFormat:m,valueTimeFormatMode:f}=l,v=yg(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=xg(vg(h,n,a,c),d,u),o.value=xg(vg(p,n,a,g),m,f),Object.keys(v).forEach((t=>{o[t]=vg(l[t],n,a)})),!1!==o.visible&&(s.isValid(o.key)||s.isValid(o.value))&&t.push(o)}};s.isArray(e)?e.forEach((t=>{o(t)})):o(e)}function Sg(t,e,i,r,n,a,o){s.isFunction(e)?bg(t,e(n,o),i,r,a,o):e&&bg(t,e,i,r,a,o)}const xg=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const r=s.TimeUtil.getInstance();return e=e||"%Y%m%d",("local"===(i=i||"local")?r.timeFormat:r.timeUTCFormat)(e,t)},Ag=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],Tg=(t,e,i,r,n)=>{var a,o,l;const h={activeType:t};switch(t){case"mark":case"group":if(i){const l=null===(a=i.getSpec())||void 0===a?void 0:a.tooltip;return h.visible=!0,(null==l?void 0:l.handler)&&(h.handler=l.handler),(null===(o=h.handler)||void 0===o?void 0:o.showTooltip)?h:((null==l?void 0:l[t])&&Ag.forEach((e=>{s.isValid(l[t][e])&&(h[e]=l[t][e])})),Object.assign(Object.assign({},h),i.tooltipHelper.getTooltipData(t,e,r,r[0].datum,n)))}break;case"dimension":if(null==r?void 0:r.length){if(Cg(r).every((t=>{var e;return!_g("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?h.visible=!1:h.visible=!0,h.handler=e.handler,null===(l=h.handler)||void 0===l?void 0:l.showTooltip)return h;const i=[];return r.forEach((s=>s.data.forEach((s=>{const{series:a}=s,o=a.tooltipHelper.getTooltipData(t,e,r,s.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},Cg=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{s.isValid(t.series)&&e.push(t.series)}))})),e},kg={key:"其他",value:"..."};var wg;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(wg||(wg={}));class Mg{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,r,n;if(s.isNil(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const a=this._cacheActiveSpec;if(s.isNil(a)||!1===a.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=a;const{title:o,content:l}=a,h=s.isNil(null==o?void 0:o.key)&&s.isNil(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(nu.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:h,tooltipData:t,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(i=a.handler)||void 0===i?void 0:i.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(r=this.component.tooltipHandler)||void 0===r?void 0:r.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(n=c(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,r,n,a,o,l,h,c,d;const{changePositionOnly:u,model:p}=e;if(!u||!this._cacheActiveSpec){const u=this.component.getSpec();if(this._cacheActiveSpec=Tg(this.activeType,this.component.getSpec(),p,t,e),this._cacheActiveSpec){s.isNil(this._cacheActiveSpec.handler)&&s.isValid(u.handler)&&(this._cacheActiveSpec.handler=u.handler);const p=null!==(i=u[this.activeType])&&void 0!==i?i:{},g=null!==(r=this._cacheActiveSpec.updateTitle)&&void 0!==r?r:p.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:p.updateContent,f=null!==(o=null!==(a=this._cacheActiveSpec.maxLineCount)&&void 0!==a?a:p.maxLineCount)&&void 0!==o?o:20;if(g&&(this._cacheActiveSpec.title=null!==(l=g(this._cacheActiveSpec.title,t,e))&&void 0!==l?l:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(h=m(this._cacheActiveSpec.content,t,e))&&void 0!==h?h:this._cacheActiveSpec.content;else if(f>=1&&(null===(c=this._cacheActiveSpec.content)||void 0===c?void 0:c.length)>f){const t=null!==(d=this._cacheActiveSpec.othersLine)&&void 0!==d?d:p.othersLine,e=t?Object.assign(Object.assign({},kg),t):kg;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,f-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[f-1]),e)]}}}}shouldHandleTooltip(t,e){var i,r;return!!this.component.enable&&!s.isNil(e)&&_g(this.activeType,null===(r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===r?void 0:r.spec)}clearCache(){this._cacheActiveSpec=void 0}}class Eg extends Mg{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,r,n;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(r=null==d?void 0:d.mark)||void 0===r?void 0:r.checkOverlap;let p=!1;if(!0===u||!0===(null===(n=l.mark)||void 0===n?void 0:n.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Rt.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(iu(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const r=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===r){const e=t.model,r=e.tooltipHelper,n=null==r?void 0:r.activeTriggerSet.mark,a=null==r?void 0:r.ignoreTriggerSet.mark;(null==n?void 0:n.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===r){const e=t.model,r=t.node;if("label"===e.name&&r){const t=e.getLabelInfoByTextGraphic(r),{baseMark:n,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:n,datum:r.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const Bg=`${Gd}_ARC_TRANSFORM_VALUE`,Pg=`${Gd}_ARC_RATIO`,Og=`${Gd}_ARC_START_ANGLE`,Ig=`${Gd}_ARC_END_ANGLE`,Rg=`${Gd}_ARC_K`,Dg=`${Gd}_ARC_MIDDLE_ANGLE`,Lg=`${Gd}_ARC_QUADRANT`,Fg=`${Gd}_ARC_RADIAN`,Ng=-Math.PI/2,Ug=3*Math.PI/2;class jg extends Sp{constructor(t,e){super(t,e),this.type=Vg.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var r;return s+(null!==(r=this.getAttribute("radiusOffset",e,i))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",r)=>s.polarToCartesian({x:0,y:0},this.getAttribute("centerOffset",e,i),e[Dg])[t]+r,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class Vg extends jg{constructor(){super(...arguments),this.type=Vg.type}}Vg.type="arc";class Gg extends jg{setDataLabelType(){return"arc"}constructor(t,e){super(t,e),this.type=Gg.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}Gg.type="arc3d";const zg=()=>{Cl.registerBuiltInAnimate("growRadiusIn",dc),Cl.registerBuiltInAnimate("growRadiusOut",uc),Cl.registerBuiltInAnimate("growAngleIn",Qh),Cl.registerBuiltInAnimate("growAngleOut",tc),zh(),Ih(),Aa.registerGraphicComponent("arc3d",Kh),Aa.registerMark("arc3d",Gg)},Kg={label:{name:"label",type:"text"}},Hg={data:!0},Wg={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},$g=Object.assign(Object.assign({},Kg),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),Yg=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t};class Xg{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:r}=this,n=r.getSeriesField();return{seriesFields:s.isValid(n)?s.array(n):null!==(t=r.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=r.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=r.getMeasureField())&&void 0!==i?i:[],type:r.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(s.isValid(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const r=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[r]},this._getSeriesStyle=(t,e,i)=>{var r;for(const i of s.array(e)){const e=null===(r=this.series.getSeriesStyle(t))||void 0===r?void 0:r(i);if(s.isValid(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,r,n,a,o,l,h,c,d,u,p,g;const m=e?"content":"title",f=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(r=null==i?void 0:i[t])||void 0===r?void 0:r[m]),null===(n=this.spec)||void 0===n?void 0:n[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[m]);return{shapeType:null!==(l=f.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=f.shapeFill)&&void 0!==h?h:f.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=f.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=f.shapeHollow)&&void 0!==u&&u,shapeLineWidth:f.shapeLineWidth,shapeSize:null!==(p=f.shapeSize)&&void 0!==p?p:f.size,hasShape:null!==(g=f.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,r,n,a){var o;return function(t,e,i,r,n,a){if(n&&n.length){const o=[];return n.forEach((n=>{s.isArray(t)?t.forEach((t=>{Sg(o,t,e,i,r,n,a)})):s.isFunction(t)?Sg(o,t,e,i,r,n,a):t&&bg(o,t,e,i,n,a)})),o}return null}(null!==(o=null==e?void 0:e.content)&&void 0!==o?o:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,r,n,a)}getTitleResult(t,e,i,r,n){let a=s.isFunction(e)?e(r,n):e;if(a?s.isNil(a.value)&&(a=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),a)):a=this.getDefaultTitlePattern(t),a&&!1!==a.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(r),e={visible:vg(a.visible,t,n),value:xg(vg(a.value,t,n,a.valueFormatter),a.valueTimeFormat,a.valueTimeFormatMode),valueStyle:vg(a.valueStyle,t,n),hasShape:a.hasShape};return Object.keys(i).forEach((s=>{e[s]=vg(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,r){var n,a;if(!(this.enableByType(t)&&_g(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(n=this.spec)||void 0===n?void 0:n[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;return"dimension"===t?(c=[],this.getContentList(t,o,l,i,s,r).forEach((t=>{c.push(t)}))):c=this.getContentList(t,o,l,i,s,r),{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,r),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const qg={min:t=>t.length?s.minInArray(t.map((t=>1*t))):0,max:t=>t.length?s.maxInArray(t.map((t=>1*t))):0,"array-min":t=>t.length?s.minInArray(t.map((t=>1*t))):0,"array-max":t=>t.length?s.maxInArray(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},Zg=(t,e)=>{var i,r;let n=e.fields;if(s.isFunction(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=tu([],n);const a="parser"===e.target?"parserData":"latestData",o=t[0][a]?t[0][a]:t||[],l=null===(r=(i=t[0]).getFields)||void 0===r?void 0:r.call(i);return Jg(o,n,l)},Jg=(t,e,i)=>{const r={};let n=[],a=[];return e.forEach((e=>{const o=e.key;r[o]={};const l=null==i?void 0:i[o],h=e.operations,c=h.some((t=>"min"===t||"max"===t||"allValid"===t));let d=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[o])}));const u=n.length;if(c){a.length=0,n.forEach(((t,e)=>{Lc(t)&&a.push(t)}));const t=n;n=a,a=t,d=n.length===u}else n=h.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{Lc(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),h.forEach((t=>{if(e.customize)r[o][t]=e.customize;else{if(l&&!0===l.lockStatisticsByDomain&&!s.isNil(l.domain)){if("values"===t)return void(r[o][t]=l.domain.slice())}else if("allValid"===t)return;r[o][t]=qg[t](n),"array-max"===t&&(r[o].max=r[o][t]),"array-min"===t&&(r[o].min=r[o][t])}})),c&&(r[o].allValid=d)})),r},Qg=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:r}=i();return"zero"!==s||r&&r.length&&t.forEach((t=>{r.forEach((e=>{Lc(t[e])||(t[e]=0)}))})),t};function tm(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function em(t,e,i){t&&(i.needDefaultSeriesField&&(t[$d]=i.defaultSeriesField),t[Hd]=e,t[Wd]=i.getKey(t,e,i))}class im extends Eu{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=s.array(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,r,n;const a=Td(t),o=null===(i=this._option)||void 0===i?void 0:i.getTheme,l=this._option.type,h=Aa.getSeriesMarkMap(l)?function(t,e,i){const r=Aa.getSeriesMarkMap(e);if(!r)return t;const n={};return Object.values(r).forEach((({type:e,name:r})=>{n[r]=Vd({},i("mark",s.array(e)[0]),i("markByName",r),null==t?void 0:t[r])})),Object.assign(Object.assign({},t),n)}(o("series",l),l,o):{},c=o("series",`${l}_${a}`);return Vd({},h,c,(null!==(n=null!==(r=this.stack)&&void 0!==r?r:null==c?void 0:c.stack)&&void 0!==n?n:null==h?void 0:h.stack)?o("series",`${l}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){s.isBoolean(t.stack)&&(this.stack=t.stack),s.isBoolean(t.percent)&&(this.stack=t.percent||this.stack),s.isNil(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",r="initLabelMarkStyle",n=!0,a){t&&s.array(t[i]).forEach((i=>{var o,l,h;if(i&&i.visible){const{animation:c=!0,animationUpdate:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:m=!0,animationExit:f=!0}=t,v=!!(null!==(h=null!==(l=null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&void 0!==l?l:t.animation)&&void 0!==h?h:i.animation)&&!!n;this.addLabelSpec(s.isFunction(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&c,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&m&&u)&&m,animationExit:!!(v&&m&&p)&&f,getStyleHandler:t=>{var e;return null===(e=t[r])||void 0===e?void 0:e.bind(t)}}),a)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:r,innerRadius:n,direction:a}=t;return s.isValid(r)&&(i.outerRadius=r),s.isValid(n)&&(i.innerRadius=n),s.isValid(a)&&(i.direction=a),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const r=this._getDefaultSpecFromChart(e),n=t=>{const e=Vd({},i,r,t),n=i.label;return n&&s.isObject(n)&&s.isArray(e.label)&&(e.label=e.label.map((t=>Vd({},n,t)))),e};return s.isArray(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}function sm(t){return t===Ec["desktop-browser"]||t===Ec["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:function(t){return Dc(t)||"mobile-browser"===t}(t)||Dc(t)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null}const rm=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(Wg[e]||(t[e]=!0),t)),{}),nm={compileOnlyKeys:Wg,dataRelatedKeys:rm,seriesOnlyKeys:{tooltip:!0}},am={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},om=t=>(t=>s.isObject(t)&&!s.isArray(t)&&!s.isFunction(t))(t)?t:s.isNil(t)?{}:null,lm=(t,e,i)=>{const r=om(t),n=om(e);if(!r||!n)return!1;let a=!1;const o=Array.from(new Set([...Object.keys(n),...Object.keys(r)]));for(const t of o)if(!s.isEqual(r[t],n[t])){if(!i[t])return!1;a=!0}return a};function hm(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class cm extends Ru{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){s.isValid(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${Gd}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=im,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=Tu.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(nu.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=ng(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(nu.afterInitEvent,{model:this})}_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)},seriesColor:t=>{var e;return s.isNil(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),s.isValid(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(lu(this._rawData.dataSet,"invalidTravel",Qg),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=uu(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=du(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=du(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new qu(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,r,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(s.isNil(this._rawStatisticsCache[t].min)||s.isNil(this._rawStatisticsCache[t].max))||!e&&s.isNil(this._rawStatisticsCache[t].values))if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(r=this._rawData.getFields())||void 0===r?void 0:r[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=s.minInArray(i.domain),this._rawStatisticsCache[t].max=s.maxInArray(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=Jg(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=s.merge(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}return this._rawStatisticsCache[t]}_statisticViewData(){lu(this._dataSet,"dimensionStatistics",Zg);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new i.DataView(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&tu(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,s){lu(this._dataSet,"dimensionStatistics",Zg);const r=new i.DataView(this._dataSet,{name:t});return r.parse([e],{type:"dataview"}),r.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const i=tu(this.getStatisticFields(),null!==(t=null==s?void 0:s(e.name))&&void 0!==t?t:[]);return this._seriesField&&tu(i,[{key:this._seriesField,operations:["values"]}]),i},target:"latest"}},!1),r}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new i.DataView(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:()=>({fields:this.getStackGroupFields()})},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return s.isNil(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,r=this._getSeriesDataKey(t);return void 0===s.get(r)?(s.set(r,0),r):(s.set(r,s.get(r)+1),`${r}_${s.get(r)}`)}:s.isString(t)?e=>e[t]:s.isArray(t)&&t.every((t=>s.isString(t)))?e=>t.map((t=>e[t])).join("-"):s.isFunction(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(lu(this._rawData.dataSet,"addVChartProperty",Yg),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:tm.bind(this),call:em}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(nu.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(nu.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(nu.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(nu.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||s.isNil(e)?null:t[e]}getDatumPositionValues(t,e){return!t||s.isNil(e)?[]:s.isString(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,r,n){var a;const o=this._createMark({type:t.type,name:s.isValid(t.name)?`${t.name}`:`${i}_${r}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(o){if(s.isValid(t.id)&&o.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=Jp({},Qp(t.type,t,this._markAttributeContext));o.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${r}`,null===(a=t.children)||void 0===a||a.forEach(((t,e)=>{this._createExtensionMark(t,o,i,e,n)}))),!s.isNil(t.dataId)||!s.isNil(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?o.setData(this._data):(o.setDataView(e),e.target.addListener("change",(()=>{o.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:s.isValid(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=sm(this._option.mode);let i=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const n=this._spec.hover;s.isBoolean(n)?i.enable=n:s.isObject(n)&&(i.enable=!0,i=Vd(i,n));const a=this._spec.select;s.isBoolean(a)?r.enable=a:s.isObject(a)&&(r.enable=!0,r=Vd(r,a));const o=[{trigger:{type:"dimension-hover"},marks:t}];if(i.enable){const e=Ap(i,t);e.length&&o.push({trigger:this._defaultHoverConfig(i),marks:e})}if(r.enable){const e=Ap(r,t);e.length&&o.push({trigger:this._defaultSelectConfig(r),marks:e})}return o}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:Pu.STATE_HOVER_REVERSE,highlightState:Pu.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=s.isValid(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:Pu.STATE_SELECTED_REVERSE,state:Pu.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=Ap(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:$d;this.getMarksWithoutRoot().forEach((t=>{const r={},n={},a={};e.forEach((e=>{var i;const s=null===(i=e[t.name])||void 0===i?void 0:i.style;s&&(r[e.name]=!0,a[e.name]=a[e.name]||{},Object.keys(s).forEach((t=>{n[t]=!0,a[e.name][t]=s[t]})))})),t.state.addStateInfo({stateValue:Yd,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===r[t[0][i]]:!0===r[t[i]]});const o={};Object.keys(n).forEach((e=>{o[e]=r=>{var n,o;let l;if(Array.isArray(r)){if(0===r.length)return;l=null===(n=a[r[0][i]])||void 0===n?void 0:n[e]}return l=null===(o=a[r[i]])||void 0===o?void 0:o[e],s.isValid(l)?l:t.getAttribute(e,r)}})),this.setMarkStyle(t,o,Yd,ku.User_SeriesStyle)}))}afterInitMark(){this.event.emit(nu.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",ku.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(Aa.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new Xg(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!s.isEqual(e,t[i]))))&&(i.reCompile=!0,hm(i))}_getSpecUpdatePolicy(){return nm}_compareSpec(t,e,i){var r,n,a,o,l;const h=super._compareSpec(t,e),c=Object.keys(e||{}).sort(),d=Object.keys(t||{}).sort();if(!s.isEqual(c,d))return h.reMake=!0,h;const u=this._getSpecUpdatePolicy(),p=null!==(r=u.compileOnlyKeys)&&void 0!==r?r:{},g=null!==(n=u.dataRelatedKeys)&&void 0!==n?n:{},m=null!==(a=u.compileOnlySubKeys)&&void 0!==a?a:{},f=null!==(o=u.seriesOnlyKeys)&&void 0!==o?o:{},v=Object.assign(Object.assign({},p),g),y=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Hg),v),f),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(s.array(t.extensionMark),s.array(e.extensionMark),h),!h.reMake&&this._compareLabelSpec(s.array(t.label),s.array(e.label),h),!h.reMake&&this._compareLabelSpec(s.array(t.totalLabel),s.array(e.totalLabel),h),h.reMake)return h;const _=this._getMarkSpecNamesForCompare().filter((i=>lm(t[i],e[i],am)));_.forEach((t=>{y[t]=!0})),!h.reCompile&&_.length&&(h.reCompile=!0);const b=c.filter((i=>v[i]&&!s.isEqual(t[i],e[i]))),S=c.filter((i=>f[i]&&!s.isEqual(t[i],e[i]))),x=c.filter((i=>m[i]&&lm(t[i],e[i],m[i])));return x.forEach((t=>{y[t]=!0})),h.reCompile||!b.length&&!x.length||(h.reCompile=!0),b.some((t=>g[t]))?hm(h,!0):h.reCompile&&!(null===(l=h.effects)||void 0===l?void 0:l.series)&&(b.length||x.length||_.length)&&hm(h),S.length&&((A=h).change=!0,A.effects=Object.assign(Object.assign({},A.effects),{series:!0,render:!0})),c.some((i=>!y[i]&&!s.isEqual(t[i],e[i])))?(h.reMake=!0,h):h;var A}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof i.DataView||pu(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),this.initMarkState(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec(),ng(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){s.isValidNumber(t.x)&&(this._layoutStartPoint.x=t.x),s.isValidNumber(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){s.isValidNumber(t)&&(this._layoutRect.width=t),s.isValidNumber(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),r=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,n=new Map;return null==r||r.forEach((e=>{const i=this.getSeriesFieldValue(e,t);n.has(i)||n.set(i,e)})),e.map((e=>{var i;const r=null!==(i=n.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:r,style:this.getSeriesStyle(r),shapeType:s}}))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:$d,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new Id).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return wd(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:$d}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var r,n,a,o,l;const{key:h,groupKey:c,skipBeforeLayouted:d,themeSpec:u={},markSpec:p,dataView:g,parent:m,isSeriesMark:f,noSeparateStyle:v=!1}=e,y=super._createMark(t,{key:null!=h?h:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:v,parent:!1!==m?null!=m?m:this._rootMark:null});if(s.isValid(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),f&&(this._seriesMark=y),s.isNil(g)?y.setData(this._data):!1!==g&&y.setDataView(g),y.setSkipBeforeLayouted(!1!==d),s.isNil(c)||y.setGroupKey(c);const h=null!==(r=i.morph)&&void 0!==r&&r,m=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(h?1:0),v=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(h?`${this.getSpecIndex()}_${m}`:void 0),_=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:h,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(a=i.support3d)&&void 0!==a?a:e.support3d||!!e.zField,morphKey:v,morphElementKey:null!==(l=null===(o=e.morph)||void 0===o?void 0:o.morphElementKey)&&void 0!==l?l:i.morphElementKey});y.setMarkConfig(_),this.initMarkStyleWithSpec(y,Vd({},u,p||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:Wd}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),r=this.getDimensionField(),n=i?t[i]:void 0;let a,o=!1;for(let n=0;n<r.length;n++){const l=r[n],h=t[l];e+=`${n>0?"_":""}${s.isNil(h)?"":h}`,o||(o=l===i),a=h}return!i||o||r.length>1&&a===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==qd&&t!==Jd&&t!==Xd&&t!==Zd||(t=this.getStackValueField()),null!==(e=function(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Lc(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:$d]}}cm.mark=Kg,cm.transformerConstructor=im;class dm extends cm{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=.6,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=s.isValid(t)?s.array(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=s.isValid(t)?s.array(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=s.array(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(s.isNil(t)||s.isNil(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(s.array(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const r=this.angleAxisHelper.dataToPosition(s.array(t));return this.angleAxisHelper.coordToPoint({angle:r,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}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}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Vc(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};Vc(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),s.isValid(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),s.isValid(this._spec.radius)&&(this._outerRadius=this._spec.radius),s.isValid(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),s.isValid(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(nu.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&function(t,e,i){const s=t.getScale(0),r="isInverse"in t&&t.isInverse();Vc(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(r?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(r?-1:1)))}(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function um(t){return Lc(t)?Number.parseFloat(t):0}const pm=(t,e)=>{const{asStartAngle:i,asEndAngle:r,asMiddleAngle:n,asRadian:a,asRatio:o,asQuadrant:l,asK:h,showAllZero:c,supportNegative:d,showEmptyCircle:u}=e,p=e.angleField(),g=e.startAngle(),m=e.endAngle(),f=e.minAngle(),v=t.map((t=>Object.assign({},t)));if(!v||0===v.length)return v;if(!c&&u&&gm(v,p,d))return[];const y=(t,e,o)=>{t[i]=e,t[r]=e+o,t[n]=e+o/2,t[a]=o,t[l]=s.computeQuadrant(e+o/2)};let _=0,b=-1/0,S=!0;for(let t=0;t<v.length;t++){const e=d?Math.abs(um(v[t][p])):um(v[t][p]);_+=e,b=Math.max(e,b),S&&0!==e&&(S=!1),v[t][Bg]=e}const x=v.map((t=>Number(t[p]))),A=m-g;let T=g,C=A,k=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),r=t.map((t=>(isNaN(t)?0:t)/i*s*100)),n=100*s,a=r.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=r.map(((t,e)=>t-a[e]));for(;o<n;){let t=Number.NEGATIVE_INFINITY,e=null;for(let i=0;i<l.length;i++)l[i]>t&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(v.forEach(((t,e)=>{const i=t[Bg],s=_?i/_:0;let r=s*A;r<f?(r=f,C-=f):k+=i;const n=T,a=T+r;t[o]=s,t[h]=b?i/b:0,t._percent_=w[e],y(t,n,r),T=a})),C<A)if(C<=.001){const t=A/v.length;v.forEach(((e,i)=>{y(e,g+i*t,t)}))}else{const t=C/k;T=g,v.forEach((e=>{const i=e[a]===f?f:e[Bg]*t;y(e,T,i),T+=i}))}if(0!==_&&(v[v.length-1][r]=m),S&&c){const t=A/v.length;v.forEach(((e,i)=>{y(e,g+i*t,t)}))}return v},gm=(t,e,i)=>!!s.isNil(t)||0===t.length||!!t.every((t=>0===um(t[e])))||!i&&0===t.reduce(((t,i)=>t+um(i[e])),0);function mm(t,e,i){return(s,r,n)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,r,i)}:{overall:!1}}const fm=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:mm(t,!0,mu.appear)}),vm={type:"fadeIn"},ym=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:mm(t,!0,mu.enter)}),_m=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:mm(t,!0,mu.exit)}),bm=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:mm(t,!0,mu.exit)});function Sm(t,e){if(!1===e)return{};switch(e){case"fadeIn":return vm;case"growRadius":return fm(Object.assign(Object.assign({},t),{growField:"radius"}));default:return fm(Object.assign(Object.assign({},t),{growField:"angle"}))}}const xm=Object.assign(Object.assign({},Kg),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class Am extends im{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let r=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);r=Vd({},this._theme,i,t);const n=(t,e)=>Vd({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);s.isArray(r.label)?r.label=r.label.map((t=>n(t.position,t))):r.label=n(r.label.position,r.label)}return{spec:r,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:r,centerY:n}=t;return s.isValid(r)&&(i.centerX=r),s.isValid(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const Tm=`${Gd}_LABEL_VISIBLE`,Cm={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},km={outerRadius:!0};class wm extends dm{constructor(){super(...arguments),this.transformerConstructor=Am,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:Nd(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:Nd(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=Ng,this._endAngle=Ug,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[Dg];if(s.isNil(e))return null;const i=this.computeDatumRadius(t),r=this.computeDatumInnerRadius(t),n=this.computeCenter(t);return s.polarToCartesian(n,(i+r)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,r,n,a;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const o=function(t,e){let i=0,r=2*Math.PI;const n=s.isValid(t),a=s.isValid(e);for(n||a?a?n?(i=t,r=e):(i=e-2*Math.PI,r=e):(i=t,r=t+2*Math.PI):(i=0,r=2*Math.PI);r<=i;)r+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,r-=2*Math.PI;for(;r<0;)i+=2*Math.PI,r+=2*Math.PI;return{startAngle:i,endAngle:r}}(s.isValid(this._spec.startAngle)?s.degreeToRadian(this._spec.startAngle):this._startAngle,s.isValid(this._spec.endAngle)?s.degreeToRadian(this._spec.endAngle):this._endAngle);this._startAngle=o.startAngle,this._endAngle=o.endAngle,this._padAngle=s.isValid(this._spec.padAngle)?s.degreeToRadian(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(r=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==r&&r,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(a=this._spec.supportNegative)&&void 0!==a&&a}initData(){super.initData();const t=this.getViewData();if(!t)return;lu(this._dataSet,"pie",pm),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>s.isValid(this._spec.minAngle)?s.degreeToRadian(this._spec.minAngle):0,asStartAngle:Og,asEndAngle:Ig,asRatio:Pg,asMiddleAngle:Dg,asRadian:Fg,asQuadrant:Lg,asK:Rg,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new i.DataView(this._dataSet,{name:`${Gd}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new qu(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},wm.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:Wd,groupKey:this._seriesField,isSeriesMark:!0},{morph:ig(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return Nc(Og)(t)}endAngleScale(t){return Nc(Ig)(t)}_computeLayoutRadius(){return((t,e,i,r)=>{const n=t();if(s.isNumber(n))return n;if(s.isFunction(n))return n(e(),i());const a=e();if("auto"===n&&a.width>0&&a.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=r();return s.calculateMaxRadius(a,i(),t,e)}return Math.min(a.width/2,a.height/2)})((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:Ld(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:Ld(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",ku.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",ku.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,ku.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",ku.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:Nc(Tm).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(nu.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,r,n,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(n=this.getSpec()[(null===(r=this._pieMark)||void 0===r?void 0:r.name)||"pie"])||void 0===n?void 0:n.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,r,n,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(n=this.getSpec()[(null===(r=this._pieMark)||void 0===r?void 0:r.name)||"pie"])||void 0===n?void 0:n.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(s.isNil(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),km),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Cm)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const r=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(r.reRender=!0,r.change=!0),r}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[Dg];if(s.isNil(i))return null;if(e&&!this.isDatumInViewData(t))return null;const r=this.computeDatumRadius(t),n=this.computeCenter(t);return s.polarToCartesian(n,r,i)}initAnimation(){var t,e,i;const r={growFrom:(t,e,i)=>{var s,r;if(i===mu.appear)return this._startAngle;if(i===mu.disappear)return this._endAngle;const n=[mu.disappear,mu.exit],a=this._pieMark.getGraphics(),o=null==t?void 0:t[Hd];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Hd])<o})))return this._startAngle;if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Hd])>o})))return this._endAngle;const l=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Hd])<o}));return n.includes(i)?null===(s=null==l?void 0:l.getFinalAttribute())||void 0===s?void 0:s.endAngle:null===(r=null==l?void 0:l.attribute)||void 0===r?void 0:r.endAngle}},n=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._pieMark){const t=Jp(null===(e=Aa.getAnimationInKey("pie"))||void 0===e?void 0:e(r,n),Qp("pie",this._spec,this._markAttributeContext));t.normal&&t.normal.type&&(t.normal=function(t,e){var i,r,n,a;const o=null!==(r=null===(i=e.options)||void 0===i?void 0:i.distance)&&void 0!==r?r:10,l=s.isValidNumber(e.duration)?e.duration/2:1e3,h=null!==(n=e.options.easing)&&void 0!==n?n:"cubicOut";return{oneByOne:e.oneByOne,loop:null!==(a=e.loop)&&void 0!==a&&a,timeSlices:[{duration:l,effects:{easing:h,channel:{x:{from:e=>t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+s.polarToCartesian({x:0,y:0},o,e[Dg]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+s.polarToCartesian({x:0,y:0},o,e[Dg]).y}}}},{duration:l,effects:{easing:h,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+s.polarToCartesian({x:0,y:0},o,e[Dg]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+s.polarToCartesian({x:0,y:0},o,e[Dg]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=Jp(null===(i=Aa.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(r,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}wm.transformerConstructor=Am,wm.mark=xm,wm.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};(class extends wm{constructor(){super(...arguments),this.type=xd.pie}}).type=xd.pie;class Mm extends Am{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class Em extends wm{constructor(){super(...arguments),this.type=$.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=Mm}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const t=this._pieMark;t&&this.setMarkStyle(t,{beta:()=>this._angle3d},"normal",ku.Series)}initLabelMarkStyle(t,e={}){t&&(super.initLabelMarkStyle(t),this.setMarkStyle(t,{support3d:!0},void 0,ku.Mark))}}Em.type=$.pie3d,Em.mark=$g,Em.builtInTheme={pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside"}}},Em.transformerConstructor=Mm;const Bm=()=>{Aa.registerAnimation("pie3d",((t,e)=>({appear:Sm(t,e),enter:ym(t),exit:_m(t),disappear:bm(t)}))),zg(),Aa.registerSeries(Em.type,Em)};class Pm extends fg{constructor(){super(...arguments),this.transformerConstructor=mg,this.type="pie3d",this.seriesType=$.pie3d}}Pm.type="pie3d",Pm.seriesType=$.pie3d,Pm.transformerConstructor=mg;const Om="combinationCandlestick";class Im extends e.CartesianChartSpecTransformer{_getDefaultSeriesSpec(t){const e=[t.openField,t.highField,t.lowField,t.closeField],i=super._getDefaultSeriesSpec(t,["candlestick","openField","highField","lowField","closeField","rising","falling","doji"]);return i.yField=e,i}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),e.setDefaultCrosshairForCartesianChart(t)}}class Rm extends e.GlyphMark{constructor(){super(...arguments),this.type=Rm.type}setGlyphConfig(t){super.setGlyphConfig(t),this._subMarks={line:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"}},this._positionChannels=["x","boxWidth","open","close","high","low"],this._channelEncoder=null,this._positionEncoder=(t,e,i)=>{const{x:s=i.attribute.x,boxWidth:r=i.attribute.boxWidth,open:n=i.attribute.open,close:a=i.attribute.close,low:o=i.attribute.low,high:l=i.attribute.high}=t,h={};return h.line={points:[{x:s,y:o},{x:s,y:l}]},h.box={x:s-r/2,x1:s+r/2,y:Math.min(n,a),y1:Math.max(n,a),drawStrokeWhenZeroWH:!0},h}}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}}Rm.type="candlestick";class Dm extends e.ACustomAnimate{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){const t=(t=>{const i=t.getFinalAttribute(),{x:s,y:r,open:n,high:a,low:o,close:l}=i,h={from:{x:s,y:r},to:{x:s,y:r}};return e.isValidNumber(n)&&e.isValidNumber(l)&&(n>l?(h.from.open=o,h.to.open=n,h.from.close=o,h.to.close=l,e.isValidNumber(a)&&(h.from.high=o,h.to.high=a)):(h.from.open=a,h.to.open=n,h.from.close=a,h.to.close=l,e.isValidNumber(o)&&(h.from.low=a,h.to.low=o))),h})(this.target,this.params,this.params.options);return t}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 Lm extends e.ACustomAnimate{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){const t=(t=>{const i=t.getFinalAttribute(),{x:s,y:r,open:n,high:a,low:o,close:l}=i,h={from:{x:s,y:r},to:{x:s,y:r}};return e.isValidNumber(n)&&e.isValidNumber(l)&&(n>l?(h.from.open=n,h.to.open=o,h.from.close=l,h.to.close=o,e.isValidNumber(a)&&(h.from.high=a,h.to.high=o)):(h.from.open=n,h.to.open=a,h.from.close=l,h.to.close=a,e.isValidNumber(o)&&(h.from.low=o,h.to.low=a))),h})(this.target,this.params,this.params.options);return t}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 Fm="candlestick";var Nm,Um;!function(t){t.OPEN="open",t.HIGH="high",t.LOW="low",t.CLOSE="close",t.SERIES_FIELD="seriesField"}(Nm||(Nm={})),function(t){t.candlestick="candlestick"}(Um||(Um={}));const jm=Object.assign(Object.assign({},e.baseSeriesMark),{candlestick:{name:"candlestick",type:"candlestick"}});class Vm extends e.BaseSeriesTooltipHelper{constructor(){super(...arguments),this.getContentKey=t=>e=>{switch(t){case Nm.OPEN:return this.series.getOpenField();case Nm.HIGH:return this.series.getHighField();case Nm.LOW:return this.series.getLowField();case Nm.CLOSE:return this.series.getCloseField();case Nm.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{switch(t){case Nm.OPEN:return e[this.series.getOpenField()];case Nm.HIGH:return e[this.series.getHighField()];case Nm.LOW:return e[this.series.getLowField()];case Nm.CLOSE:return e[this.series.getCloseField()];case Nm.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>this.series.getMarkInName("candlestick").getAttribute("stroke",t)}getDefaultContentList(t){return[{key:this.getContentKey(Nm.OPEN),value:this.getContentValue(Nm.OPEN)},{key:this.getContentKey(Nm.HIGH),value:this.getContentValue(Nm.HIGH)},{key:this.getContentKey(Nm.LOW),value:this.getContentValue(Nm.LOW)},{key:this.getContentKey(Nm.CLOSE),value:this.getContentValue(Nm.CLOSE)},{key:this.getContentKey(Nm.SERIES_FIELD),value:this.getContentValue(Nm.SERIES_FIELD)}]}}const Gm={rising:{style:{boxFill:"#FF0000",stroke:"#FF0000"}},falling:{style:{boxFill:"#00AA00",stroke:"#00AA00"}},doji:{style:{boxFill:"#000000",stroke:"#000000"}},candlestick:{style:{lineWidth:1}}};class zm extends e.CartesianSeries{constructor(){super(...arguments),this.type=Fm,this._mergedStyles={rising:{},falling:{},doji:{}}}getOpenField(){return this._openField}getHighField(){return this._highField}getLowField(){return this._lowField}getCloseField(){return this._closeField}getBoxFill(){return this._boxFill}getStrokeColor(){return this._strokeColor}setAttrFromSpec(){var t,e,i,s,r,n,a,o;super.setAttrFromSpec();const l=this._spec,h=null!==(e=null===(t=l.candlestick)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._openField=l.openField,this._highField=l.highField,this._lowField=l.lowField,this._closeField=l.closeField,this._boxWidth=h.boxWidth,this._boxFill=h.boxFill,this._strokeColor=h.strokeColor,this._buildMergedStyles(h,null!==(s=null===(i=l.rising)||void 0===i?void 0:i.style)&&void 0!==s?s:{},null!==(n=null===(r=l.falling)||void 0===r?void 0:r.style)&&void 0!==n?n:{},null!==(o=null===(a=l.doji)||void 0===a?void 0:a.style)&&void 0!==o?o:{})}initMark(){this._candlestickMark=this._createMark(zm.mark.candlestick,{groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var t;const i=this._candlestickMark;if(i){const s={fill:t=>this.mergeStyle(t).boxFill,stroke:t=>this.mergeStyle(t).stroke,lineWidth:t=>this.mergeStyle(t).lineWidth,boxWidth:null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth.bind(this),x:this.dataToPositionX.bind(this)};i.setGlyphConfig({}),this.setMarkStyle(i,s,e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}}initCandlestickMarkStyle(){var t;const i=this._candlestickMark,s=this._yAxisHelper;if(i&&s){const{dataToPosition:r}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{open:t=>e.valueInScaleRange(r(this.getDatumPositionValues(t,this._openField),{bandPosition:this._bandPosition}),n),high:t=>e.valueInScaleRange(r(this.getDatumPositionValues(t,this._highField),{bandPosition:this._bandPosition}),n),low:t=>e.valueInScaleRange(r(this.getDatumPositionValues(t,this._lowField),{bandPosition:this._bandPosition}),n),close:t=>e.valueInScaleRange(r(this.getDatumPositionValues(t,this._closeField),{bandPosition:this._bandPosition}),n)},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}}init(t){super.init(t),this.initCandlestickMarkStyle()}_initAnimationSpec(t={}){const i=e.merge({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{i[t]&&"scaleIn"===i[t].type?i[t].type="candlestickScaleIn":i[t]&&"scaleOut"===i[t].type&&(i[t].type="candlestickScaleOut")})),i}initAnimation(){var t;const i=e.getGroupAnimationParams(this);if(this._candlestickMark){const s=this._initAnimationSpec(null===(t=e.Factory.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),r=this._initAnimationSpec(e.userAnimationConfig(Fm,this._spec,this._markAttributeContext));this._candlestickMark.setAnimationConfig(e.animationConfig(s,r,i))}}initTooltip(){this._tooltipHelper=new Vm(this),this._candlestickMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._candlestickMark)}_buildMergedStyles(t,i,s,r){this._mergedStyles.rising=e.merge({},t,i),this._mergedStyles.falling=e.merge({},t,s),this._mergedStyles.doji=e.merge({},t,r)}mergeStyle(t){const e=this.getDatumPositionValues(t,this._openField)[0],i=this.getDatumPositionValues(t,this._closeField)[0];return e<i?this._mergedStyles.rising:e>i?this._mergedStyles.falling:this._mergedStyles.doji}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._xAxisHelper,e=this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}getActiveMarks(){return[this._candlestickMark]}}zm.type=Fm,zm.builtInTheme={candlestick:Gm},zm.mark=jm;const Km=()=>{e.registerGlyphMark(),e.registerLine(),e.registerRect(),e.Factory.registerGraphicComponent("line",(t=>e.createLine(t))),e.Factory.registerGraphicComponent("rect",(t=>e.createRect(t))),e.Factory.registerMark(Rm.type,Rm),e.registerSymbolMark(),e.registerScaleInOutAnimation(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.AnimateExecutor.registerBuiltInAnimate("candlestickScaleIn",Dm),e.AnimateExecutor.registerBuiltInAnimate("candlestickScaleOut",Lm),e.Factory.registerSeries(zm.type,zm)};class Hm extends e.BaseChart{_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}Hm.type="candlestick",Hm.seriesType=Fm,Hm.transformerConstructor=Im;function Wm(t){t.yField=[t.openField,t.highField,t.lowField,t.closeField]}class $m extends e.CartesianChartSpecTransformer{needAxes(){return!0}transformSpec(t){this.transformRegion(t),void 0===t.tooltip&&(t.tooltip={}),this.transformSeriesSpec(t),this._transformAxisSpec(t),this._transformLayout(t)}transformRegion(t){var e,i;const s=t;s.region=[null!==(e=t.candlestickRegion)&&void 0!==e?e:{}],t.previewSeries&&s.region.push(null!==(i=t.previewRegion)&&void 0!==i?i:{})}transformSeriesSpec(t){var i;t.series=null!==(i=t.series)&&void 0!==i?i:[],t.series.forEach((e=>{this._transformSeriesData(t,e),e.regionIndex=0}));const s=t.series.find((e=>e.id===t.candlestickSeries.id));let r;s?(e.merge(s,t.candlestickSeries),r=s):(t.series.push(t.candlestickSeries),r=t.candlestickSeries),Wm(r),this._transformSeriesData(t,r),r.regionIndex=0,t.previewSeries&&e.array(t.previewSeries).forEach((i=>{const s=t.series.find((t=>t.id===i.id));let r;s?(e.merge(s,i),r=s):(t.series.push(i),r=i),r.regionIndex=1,this._transformSeriesData(t,r)}))}_transformSeriesData(t,i){var s;i.data&&(t.data=e.array(null!==(s=t.data)&&void 0!==s?s:[]),e.array(i.data).forEach(((e,s)=>{t.data.push(e),0===s&&(i.dataIndex=t.data.length-1,"id"in e?i.dataId=e.id:"name"in e&&(i.dataId=e.name))})),delete i.data)}_transformAxisSpec(t){super._transformAxisSpec(t),t.previewSeries&&(t.previewAxes||(t.previewAxes={type:"linear",orient:"left",visible:!1}),t.previewAxes.regionIndex=[1],t.axes.push(t.previewAxes),t.axes.forEach((e=>{e!==t.previewAxes&&("left"!==e.orient&&"right"!==e.orient||(e.regionIndex=[0]))})))}_transformDataZoomSpec(t){t.dataZoom&&e.array(t.dataZoom).forEach((t=>{"left"!==t.orient&&"right"!==t.orient||(t.regionIndex=[0])}))}_transformLayout(t){var i,s;const r={type:"grid",col:2,row:6,elements:[],colWidth:[],rowHeight:[]};let n=0,a=0;if(t.title&&!1!==(null===(i=t.title)||void 0===i?void 0:i.visible)&&n++,t.legends){const i=e.array(t.legends)[0];!1!==(null==i?void 0:i.visible)&&("top"===i.orient||"bottom"===i.orient?n++:a++)}if(t.dataZoom&&e.array(t.dataZoom).forEach((t=>{!1!==(null==t?void 0:t.visible)&&("top"===t.orient||"bottom"===t.orient?n++:a++)})),t.axes){const i={top:!1,bottom:!1,left:!1,right:!1,z:!1};e.array(t.axes).forEach((t=>{i[t.orient]||(i[t.orient]=!0,"top"===t.orient||"bottom"===t.orient?n++:a++)}))}n++,a++,t.previewSeries&&n++,r.row=n,r.col=a;const o={top:0,bottom:0,left:0,right:0};if(t.title&&!1!==(null===(s=t.title)||void 0===s?void 0:s.visible)&&this._layoutOrientItem(r,t.title,o,{specKey:"title",index:0},"total"),t.legends){const i=e.array(t.legends)[0];!1!==(null==i?void 0:i.visible)&&this._layoutOrientItem(r,i,o,{specKey:"legends",index:0},"less")}if(t.dataZoom&&e.array(t.dataZoom).forEach(((t,e)=>{!1!==(null==t?void 0:t.visible)&&this._layoutOrientItem(r,t,o,{specKey:"dataZoom",index:e},"one")})),t.axes){const e={left:!1,right:!1};t.axes.forEach(((t,i)=>{"left"!==t.orient&&"right"!==t.orient||e[t.orient]||(e[t.orient]=!0,this._layoutOrientItem(r,t,o,{specKey:"axes",index:i},"one"))}))}const l=this._layoutOrientItem(r,{orient:"top"},o,{specKey:"region",index:0},"one");if(t.previewSeries){const i=this._layoutOrientItem(r,{orient:"bottom"},o,{specKey:"region",index:1},"one"),s=t.axes.findIndex((e=>e===t.previewAxes));if(-1!==s){const t={col:i.col-1,row:i.row,modelKey:"axes",modelIndex:s};r.elements.push(t)}if(t.previewHeight)if("string"==typeof t.previewHeight){if(e.isPercent(t.previewHeight)){const e=t.previewHeight;r.rowHeight.push({index:i.row,size:t=>Number(e.substring(0,e.length-1))*t/100})}}else r.rowHeight.push({index:i.row,size:t.previewHeight})}const h=t.axes.findIndex((t=>"bottom"===t.orient));this._layoutOrientItem(r,t.axes[h],o,{specKey:"axes",index:h},"one"),t.axes.forEach(((e,i)=>{if(e===t.previewAxes)return;const s=r.elements.find((t=>"modelKey"in t&&"axes"===t.modelKey&&t.modelIndex===i));s&&("top"===e.orient||"bottom"===e.orient?s.col=l.col:s.row=l.row)})),e.array(t.dataZoom).forEach(((t,e)=>{const i=r.elements.find((t=>"modelKey"in t&&"dataZoom"===t.modelKey&&t.modelIndex===e));i&&("top"===t.orient||"bottom"===t.orient?i.col=l.col:i.row=l.row)})),t.layout=r}_layoutOrientItem(t,e,i,s,r){var n;const a={modelKey:s.specKey,modelIndex:s.index,col:0,row:0},o=null!==(n=e.orient)&&void 0!==n?n:"top",{span:l,index:h}=this._getLayoutElementCommon(t,i,r,o);return t.elements.push(a),"top"===o?(a.row=i.top,a.rowSpan=1,a.colSpan=l,a.col=h,i.top++):"bottom"===o?(a.row=t.row-i.bottom-1,a.rowSpan=1,a.colSpan=l,a.col=h,i.bottom++):"left"===o?(a.col=i.left,a.colSpan=1,a.rowSpan=l,a.row=h,i.left++):"right"===o&&(a.col=t.col-i.right-1,a.colSpan=1,a.rowSpan=l,a.row=h,i.right++),a}_getLayoutElementCommon(t,e,i,s){return"top"===s||"bottom"===s?{span:"total"===i?t.col:"one"===i?1:t.col-e.left-e.right,index:"total"===i?0:e.left}:{span:"total"===i?t.row:"one"===i?1:t.row-e.top-e.bottom,index:"total"===i?0:e.top}}}class Ym extends e.BaseChart{constructor(){super(...arguments),this.type=Om,this.transformerConstructor=$m}_setModelOption(){this._modelOption.getDimensionInfo=(t,i,s)=>{var r;return[...null!==(r=e.getCartesianDimensionInfo(t,i,s))&&void 0!==r?r:[]]},this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}Ym.type=Om,Ym.transformerConstructor=$m,e.mixin(Ym,e.StackChartMixin);const Xm=t=>({custom:e.RotateBySphereAnimate,customParameters:()=>t,easing:"linear",loop:1/0,duration:6e3});class qm extends e.BaseWordCloudSeries{constructor(){super(...arguments),this.type=$.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(e.BaseWordCloudSeries.mark.word,{groupKey:this._seriesField,isSeriesMark:!0},{support3d:!0})}initMarkStyle(){super.initMarkStyle();const t=this._wordMark;t&&this.setMarkStyle(t,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",e.AttributeLevel.Series)}initAnimation(){var t,i;const s=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(e.animationConfig(null===(i=e.Factory.getAnimationInKey("wordCloud3d"))||void 0===i?void 0:i((()=>{var t;const e=this.getCompiler().getStage(),i=e.width-s.left||0-s.right||0,r=e.height-s.top||0-s.bottom||0,n=Math.max(i,r)/2;return{center:{x:n,y:n,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:n},r:n}})),e.userAnimationConfig("word",this._spec,this._markAttributeContext)))}}qm.type=$.wordCloud3d,qm.builtInTheme={wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}}};const Zm=()=>{e.registerTextMark(),e.Factory.registerAnimation("wordCloud3d",(t=>({appear:Xm(t)}))),e.Factory.registerSeries(qm.type,qm)},Jm=()=>{Zm()};class Qm extends e.BaseWordCloudChartSpecTransformer{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.depth_3d=t.depth_3d,e}}class tf extends e.BaseWordCloudChart{constructor(){super(...arguments),this.transformerConstructor=Qm,this.type="wordCloud3d",this.seriesType=$.wordCloud3d}}tf.type="wordCloud3d",tf.seriesType=$.wordCloud3d,tf.transformerConstructor=Qm;const ef=()=>{ka(),Zm(),e.Factory.registerChart(tf.type,tf)},sf={label:{space:0}};class rf{setLayout3dBox(t){this.layout3dBox=t}_afterUpdateAttribute(t,i){const s=e.isZAxis(this._orient),r=e.isXAxis(this._orient),n=e.isYAxis(this._orient);let a=0,o=0;if(!i){const t=this.getRegions();let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,r=i+t[0].getLayoutRect().height;for(let n=1;n<t.length;n++){const a=t[n],{x:o,y:l}=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();e=Math.min(e,o),s=Math.max(s,h+o),i=Math.min(i,l),r=Math.max(r,c+l)}a=Math.abs(r-i),o=Math.abs(s-e)}let l=0,h=0;const{width:c,height:d}=this.getLayoutRect();let u={x:0,y:0};r?(u={x:c,y:0},l=a,h=c):n&&(u={x:0,y:d},l=o,h=d);const p=this.layout3dBox?this.layout3dBox.length:0;if(!s){const e=this.getLabelItems(h);return t.grid={length:l},t.start={x:0,y:0},t.text=this._spec.title.text||this._dataFieldText,t.maxWidth=this._getTitleLimit(r),t.items=e,t.grid={type:"line",start:{x:0,y:0},end:u,items:e[0],depth:p,length:l},t}return((t,i)=>{var s;const r=e.getCombinedSizeOfRegions(t.getRegions()),{width:n}=t.getLayoutRect(),a=n,o=t.layout3dBox?t.layout3dBox.length:0,l=t.layout3dBox?t.layout3dBox.width:0,h={x:o,y:0},c=t.getLabelItems(a),d={start:{x:0,y:0},end:h,title:{text:t._spec.title.text||t._dataFieldText,maxWidth:t._getTitleLimit(!1)},items:c,scale:t._scale.clone()},u=null!==(s=t.directionStr)&&void 0!==s?s:"r2l";let p=[0,0],g=-Math.PI/2,m=0;return"l2r"===u&&(m=t.layout3dBox.length,p=[0,0,0],g=Math.PI/2),d.z=m,d.alpha=g,d.anchor3d=p,i||(d.grid={type:"line",start:{x:0,y:0},end:h,items:c[0],verticalFactor:t._axisStyle.verticalFactor,depth:l,length:i?0:r.height,alpha:g,z:m,anchor3d:p}),d})(this,i)}}const nf=Object.assign(Object.assign({},wa),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class af extends e.RangeColumnSeries{constructor(){super(...arguments),this.type=$.rangeColumn3d,this._barMarkType="rect3d",this._barName=$.bar3d}}af.type=$.rangeColumn3d,af.mark=nf;const of=()=>{Pp(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.Factory.registerSeries(af.type,af)};class lf extends e.RangeColumnSeriesSpecTransformer{_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar3d")}}class hf extends e.CartesianChartSpecTransformer{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bar3d","barGapInGroup"]);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}}class cf extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=hf,this.type="rangeColumn3d",this.seriesType=$.rangeColumn3d}_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}cf.type="rangeColumn3d",cf.seriesType=$.rangeColumn3d,cf.transformerConstructor=hf;const df="pictogram",uf="pictogram";var pf;!function(t){t.pictogram="pictogram"}(pf||(pf={}));const gf=Object.assign(Object.assign({},e.baseSeriesMark),{pictogram:{name:"pictogram",type:"group"}});class mf extends e.BaseChartSpecTransformer{_isValidSeries(t){return t===uf}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","svg","pictogram","defaultFillColor"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}const ff=new Map,vf="_vchartViewportRect";let yf;const _f=/-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi;function bf(t,i){ff.has(t)&&e.warn(`svg source key of '${t}' already exists, will be overwritten.`),yf||(yf=new e.DataSet,e.registerDataSetInstanceParser(yf,"svg",e.svgParser));const s=new e.DataView(yf);s.parse(i,{type:"svg"});const r=s.latestData,n=function(t){var e,i,s,r;const n=null===(e=t.match(/<svg\b[\s\S]*?>/i))||void 0===e?void 0:e[0],a=null===(i=null==n?void 0:n.match(/\benable-background\s*=\s*(['"])(.*?)\1/i))||void 0===i?void 0:i[2];if(!a||!/^\s*new\b/i.test(a))return null;const o=null!==(r=null===(s=a.match(_f))||void 0===s?void 0:s.map(Number))&&void 0!==r?r:[],[l,h,c,d]=o;return!Number.isFinite(l)||!Number.isFinite(h)||!Number.isFinite(c)||!Number.isFinite(d)||c<=0||d<=0?null:{x:l,y:h,width:c,height:d}}(i);r&&n&&!r.viewBoxRect&&!function(t){return Number.isFinite(t.width)&&Number.isFinite(t.height)&&t.width>0&&t.height>0}(r)&&(r[vf]=n),ff.set(t,s)}function Sf(t){ff.has(t)?ff.delete(t):e.warn(`map type of '${t}' does not exists.`)}function xf(t){return ff.get(t)}class Af extends e.BaseSeriesSpecTransformer{_getDefaultSpecFromChart(t){var i,s,r;const n=null!==(i=super._getDefaultSpecFromChart(t))&&void 0!==i?i:{},a=t.svg,o=null===(r=null===(s=ff.get(a))||void 0===s?void 0:s.latestData)||void 0===r?void 0:r.elements;if(o&&o.length){o.map((t=>t.name)).filter((t=>e.isValid(t))).forEach((e=>{t[e]&&(n[e]=t[e])}))}return n}}class Tf extends e.BaseSeriesTooltipHelper{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)},this.markTooltipValueCallback=(t,e)=>{const{measureFields:i}=this._seriesCacheInfo;if(i[0]&&t.data)return t.data[i[0]]},this.markTooltipKeyCallback=t=>{var e;return null===(e=t.data)||void 0===e?void 0:e[this.series.getDimensionField()[0]]}}}const Cf="element-highlight-by-graphic-name";class kf extends e.ElementHighlight{constructor(){super(...arguments),this.type=Cf,this.handleStart=t=>{if(t&&t.item&&this.isGraphicInMark(t.item)){if(this.options.shouldStart?this.options.shouldStart(t):this._filterByName(t)){const e=this._parseTargetKey(t);this.start(e)}}},this.handleReset=t=>{t&&t.item&&this.isGraphicInMark(t.item)&&this.reset()}}_filterByName(t){var e;return!!(null===(e=null==t?void 0:t.node)||void 0===e?void 0:e.name)}_parseTargetKey(t){return t.node.name}start(t){if(e.isNil(t))return;const{interaction:i,highlightState:s,blurState:r}=this.options,n=i.getStatedGraphics(this),a=[];this.getMarks().forEach((e=>{var i;null===(i=e.getGraphics())||void 0===i||i.forEach((e=>{e.name===t&&a.push(e)}))})),i.updateStates(this,a,n,s,r),i.setStatedGraphics(this,a)}reset(){const{highlightState:t,blurState:e,interaction:i}=this.options;i.clearAllStatesOfTrigger(this,t,e),i.setStatedGraphics(this,[])}}kf.type=Cf;const wf="element-select-by-graphic-name";class Mf extends e.ElementSelect{constructor(){super(...arguments),this.type=wf}start(t){const e=null==t?void 0:t.name;e&&this.getMarks().forEach((t=>{var i;null===(i=t.getGraphics())||void 0===i||i.forEach((t=>{t.name===e&&super.start(t)}))}))}}Mf.type=wf;function Ef(t){var i;return e.isValid(t)&&"none"!==t&&!(null===(i=t.includes)||void 0===i?void 0:i.call(t,"url"))}const Bf=t=>{const e=parseFloat(t.strokeWidth);if(!isNaN(e))return e;const i=t.stroke;return i&&Ef(i)?1:0},Pf=(t,e)=>{var i;const s=null!==(i=t.fill)&&void 0!==i?i:e;return s&&Ef(s)?s:void 0},Of=(t,e)=>{var i;const s=null!==(i=t.stroke)&&void 0!==i?i:e;return!(!s||!Ef(s))&&s},If=t=>Object.assign(Object.assign({},t),{x:parseFloat(t.x)||void 0,y:parseFloat(t.y)||void 0,fillStrokeOrder:!1,fill:Pf(t),lineWidth:Bf(t),stroke:Of(t)}),Rf={group:t=>{const e=If(t);return Object.assign(Object.assign({},e),{visibleAll:!1!==e.visible})},rule:t=>Object.assign(Object.assign({},If(t)),{x:parseFloat(t.x1),y:parseFloat(t.y1),x1:parseFloat(t.x2),y1:parseFloat(t.y2)}),rect:t=>Object.assign(Object.assign({},If(t)),{fill:Pf(t,"#000"),width:parseFloat(t.width),height:parseFloat(t.height)}),polygon:t=>Object.assign(Object.assign({},If(t)),{fill:Pf(t,"#000"),points:t.points.trim().split(/\s+/).map((t=>{const[e,i]=t.split(",").map(Number);return{x:e,y:i}}))}),line:t=>Object.assign(Object.assign({},If(t)),{points:t.points.trim().split(/\s+/).map((t=>{const[e,i]=t.split(",").map(Number);return{x:e,y:i}}))}),path:t=>Object.assign(Object.assign({},If(t)),{path:t.d,fillStrokeOrder:!1,fill:Pf(t,"#000")}),arc:t=>{var e;return Object.assign(Object.assign({},If(t)),{outerRadius:null!==(e=t.r)&&void 0!==e?e:t.ry,x:parseFloat(t.cx),y:parseFloat(t.cy),startAngle:0,endAngle:2*Math.PI,scaleX:parseFloat(t.rx)/parseFloat(t.ry)||1,fill:Pf(t,"#000")})},text:(t,e)=>{var i,s;return Object.assign(Object.assign({},If(t)),{text:e,textAlign:null!==(i=t.textAlign)&&void 0!==i?i:"left",textBaseLine:null!==(s=t.textAnchor)&&void 0!==s?s:"middle",anchor:[0,0],fill:Pf(t,"#000")})}},Df=t=>{var i,s;if(!t||!t[0])return{};const{elements:r}=t[0].latestData;if(r&&r.length){r.forEach(((t,i)=>{var s;t[e.DEFAULT_DATA_INDEX]=i,t._uniqueId=`${t.id}-${i}`,t.data=void 0;const{graphicType:r,transform:n}=t,a={visible:"hidden"!==t.attributes.visibility&&"collapse"!==t.attributes.visibility};"text"===t.graphicType?e.merge(a,t._inheritStyle,null===(s=t.parent)||void 0===s?void 0:s._textGroupStyle,t.attributes):"group"!==t.graphicType&&e.merge(a,t._inheritStyle,t.attributes),Rf[r]?t._finalAttributes=Rf[r](a,t.value):t._finalAttributes=a,n&&(t._finalAttributes.postMatrix=Object.assign({},n))}));const t=r.filter((t=>"text"===t.tagName));for(let n=0;n<t.length;n++){const a=t[n]._uniqueId,o=r.filter((t=>{let e=!1,i=t.parent;for(;i;){if(i._uniqueId===a){e=!0;break}i=i.parent}return e}));if(o&&o.length){const r=null!==(s=null===(i=t[n]._textGroupStyle)||void 0===i?void 0:i.x)&&void 0!==s?s:0;let a=r;for(let t=0;t<o.length;t++){const i=o[t];if("group"===i.graphicType)a=r;else if(i.value&&void 0===i.parent._textGroupStyle.x){const s=o.slice(0,t).reverse().find((t=>"text"===t.graphicType&&t.value));if(s){a+=e.measureText(s.value,s._finalAttributes).width}i._finalAttributes.x=a}}}}}return r};class Lf extends e.GeoSeries{constructor(){super(...arguments),this.type=uf,this._idToMark=new Map}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.svg=this._spec.svg,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this.svg||null===(t=this._option)||void 0===t||t.onError("svg source is not specified !"),this._parsedSvgResult=null===(e=xf(this.svg))||void 0===e?void 0:e.latestData,this._parsedSvgResult||null===(i=this._option)||void 0===i||i.onError(`'${this.svg}' is not registered !`)}getDatumCenter(t){return[Number.NaN,Number.NaN]}getDatumName(t){return t.name||t._nameFromParent}getMarksWithoutRoot(){return this.getMarks().filter((t=>t.name&&!t.name.includes("seriesGroup")&&!t.name.includes("root")&&t!==this._pictogramMark))}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getTransformMatrix=this.getRootMatrix.bind(this),this._markAttributeContext.coordToPosition=this.coordToPosition.bind(this),this._markAttributeContext.dataToPosition=this.dataToPosition.bind(this)}_defaultHoverConfig(t){return{type:"element-highlight-by-graphic-name",trigger:t.trigger,triggerOff:"pointerout",blurState:e.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:e.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(t){const i="multiple"===t.mode,s=e.isValid(t.triggerOff)?t.triggerOff:i?["empty","self"]:["empty",t.trigger];return{type:"element-select-by-graphic-name",trigger:t.trigger,triggerOff:s,reverseState:e.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:e.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}initMark(){var t;if(this._pictogramMark=this._createMark(Lf.mark.pictogram,{groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0},{morph:e.shouldMarkDoMorph(this._spec,Lf.mark.pictogram.name)}),this._pictogramMark){this._pictogramMark.setData(this._mapViewData),this._pictogramMark.setUserId(Lf.mark.pictogram.name);for(const i of this._mapViewData.getDataView().latestData){const{graphicType:s,name:r,parent:n,id:a,_nameFromParent:o,_uniqueId:l}=i,h=this._createMark({type:s,name:null!=r?r:o},{groupKey:l,isSeriesMark:!1,skipBeforeLayouted:!0,parent:null!==(t=this._idToMark.get(null==n?void 0:n._uniqueId))&&void 0!==t?t:this._pictogramMark},{morph:e.shouldMarkDoMorph(this._spec,Lf.mark.pictogram.name)});h&&(h.setData(this._mapViewData),h.setUserId(l),this._idToMark.set(l,h),"group"!==h.type&&h.setMarkConfig({graphicName:h.name}),h.setTransform([{type:"filter",callback:t=>t._uniqueId===l}]))}this._initLabelMark()}}_initLabelMark(){if(!0!==this._spec.label.visible)return;const t=this._createMark(Lf.mark.label,{isSeriesMark:!1,parent:this._pictogramMark,groupKey:"_uniqueId",skipBeforeLayouted:!0});t&&(this._labelMark=t,this._labelMark.setData(this._mapViewData))}initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:t=>!!this._validElement(t),x:t=>{var e;return null===(e=this.dataToPosition(t,!0))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t,!0))||void 0===e?void 0:e.y},text:t=>t[this.nameField],textAlign:"center",textBaseline:"middle"},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}initMarkStyle(){const{root:t}=this._parsedSvgResult,i=this._getSvgViewportRect(),s=this._mapViewData.getDataView().latestData;t&&(this.setMarkStyle(this._pictogramMark,Rf.group(t.attributes),"normal",e.AttributeLevel.Built_In),this.setMarkStyle(this._pictogramMark,{postMatrix:()=>this._getFittedSvgRootMatrix()},"normal",e.AttributeLevel.Built_In),i&&this._pictogramMark.setMarkConfig({clip:!0,clipPath:[e.createRect(Object.assign(Object.assign({},i),{fill:!0}))]}));for(const t of s){const{_uniqueId:i,_finalAttributes:s}=t,r=this._idToMark.get(i),n=this._validElement(t);r&&(this.setMarkStyle(r,{keepStrokeScale:!0},"normal",e.AttributeLevel.Built_In),n?(this.initMarkStyleWithSpec(r,e.merge({},this._spec.pictogram,this._spec[r.name])),this.setMarkStyle(r,s,"normal",e.AttributeLevel.Series),r.setPostProcess("fill",((t,i)=>e.isValid(t)?t:this._spec.defaultFillColor))):(r.setMarkConfig({interactive:!1}),this.setMarkStyle(r,s,"normal",e.AttributeLevel.Built_In)))}this.initLabelMarkStyle()}_validElement(t){return t.name||t._nameFromParent}initTooltip(){this._tooltipHelper=new Tf(this),this.getMarksWithoutRoot().forEach((t=>{t&&t.name&&this._tooltipHelper.activeTriggerSet.mark.add(t)}))}dataToPosition(t,i=!1){if(!t)return null;const s=t[this.nameField];if(!s)return null;const r=this.getMarksWithoutRoot().filter((t=>t.name===s));if(!r||0===r.length)return null;let n=new e.Bounds;i?r.forEach((t=>{n=n.union(t.getGraphics()[0].globalAABBBounds)})):r.forEach((t=>{n=n.union(t.getProduct().AABBBounds)}));const a={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2};if(i){const{x:t,y:e}=this.getLayoutStartPoint();a.x-=t,a.y-=e}return a}coordToPosition(t){if(!t)return null;const{x:e,y:i}=t,s=this.getRootMatrix();if(!s)return null;const r={};return s.getInverse().transformPoint({x:e,y:i},r),r}getRootMatrix(){var t;return null===(t=this.getPictogramRootGraphic())||void 0===t?void 0:t.transMatrix}getPictogramRootGraphic(){return this._pictogramMark.getProduct()}_getSvgRootMatrix(){var t,i;const s=null===(i=null===(t=this._parsedSvgResult)||void 0===t?void 0:t.root)||void 0===i?void 0:i.transform;return s?new e.Matrix(s.a,s.b,s.c,s.d,s.e,s.f):new e.Matrix}_getSvgViewportRect(){var t,e,i,s;const r=null===(t=this._parsedSvgResult)||void 0===t?void 0:t.viewBoxRect;if(r)return r;const{width:n,height:a}=null!==(e=this._parsedSvgResult)&&void 0!==e?e:{};return Number.isFinite(n)&&Number.isFinite(a)&&n>0&&a>0?{x:0,y:0,width:n,height:a}:null!==(s=null===(i=this._parsedSvgResult)||void 0===i?void 0:i[vf])&&void 0!==s?s:null}_getSvgRootBounds(t){const i=this._getSvgViewportRect();if(!i)return null;const s=(new e.Bounds).setValue(i.x,i.y,i.x+i.width,i.y+i.height);return s.transformWithMatrix(t),s}_appendMatrixScale(t,i,s){const r=new e.Matrix;return r.translate(s.x,s.y),r.scale(i,i),r.translate(-s.x,-s.y),r.multiply(t.a,t.b,t.c,t.d,t.e,t.f),r}_appendMatrixTranslate(t,i,s){const r=new e.Matrix;return r.translate(i,s),r.multiply(t.a,t.b,t.c,t.d,t.e,t.f),r}_getFittedSvgRootMatrix(){const t=this._getSvgRootMatrix(),e=this._getSvgRootBounds(t);if(!e)return t;const i=e.width(),s=e.height();if(!Number.isFinite(i)||!Number.isFinite(s)||i<=0||s<=0)return t;const{width:r,height:n}=this.getLayoutRect(),a=(e.x1+e.x2)/2,o=(e.y1+e.y2)/2,l=Math.min(r/i,n/s),h=this._appendMatrixScale(t,l,{x:a,y:o});return this._appendMatrixTranslate(h,r/2-a,n/2-o)}initData(){var t,i;super.initData();const s=ff.get(this.svg);s||null===(t=this._option)||void 0===t||t.onError("no valid svg found!");const r=new e.DataView(this._dataSet,{name:`pictogram_${this.id}_data`});e.registerDataSetInstanceTransform(this._dataSet,"pictogram",Df),e.registerDataSetInstanceTransform(this._dataSet,"lookup",e.lookup),r.parse([s],{type:"dataview"}).transform({type:"pictogram"}).transform({type:"lookup",options:{from:()=>this.getViewData().latestData,key:"name",fields:this._nameField,set:(t,e)=>{e&&(t.data=e)}}}).transform({type:"lookup",options:{from:()=>this.getViewData().latestData,key:"_nameFromParent",fields:this._nameField,set:(t,e)=>{e&&(t.data=e)}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",r.reRunAllTransform),this._mapViewData=new e.CompilableData(this._option,r)}mapViewDataUpdate(){this._mapViewData.updateData()}onLayoutEnd(){var t;super.onLayoutEnd(),null===(t=this._mapViewData)||void 0===t||t.getDataView().reRunAllTransform()}updateSVGSize(){const t=this.getPictogramRootGraphic();t&&t.setAttributes({postMatrix:this._getFittedSvgRootMatrix()})}initEvent(){var t;super.initEvent(),null===(t=this._mapViewData.getDataView())||void 0===t||t.target.addListener("change",this.mapViewDataUpdate.bind(this))}handleZoom(t){const{scale:i,scaleCenter:s}=t;if(1===i)return;const r=this.getPictogramRootGraphic();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new e.Matrix}),r.scale(i,i,s))}handlePan(t){const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getPictogramRootGraphic();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new e.Matrix}),s.translate(i[0],i[1]))}getMarkData(t){var e;return null!==(e=t.data)&&void 0!==e?e:{}}getMeasureField(){return[this.valueField]}getDimensionField(){return[this.nameField]}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({data:{[t]:e}}),shapeType:i})))}release(){this._parsedSvgResult=null,this._idToMark.clear(),this._idToMark=null}}Lf.type=uf,Lf.mark=gf,Lf.transformerConstructor=Af;const Ff=()=>{e.Factory.registerSeries(Lf.type,Lf),e.Factory.registerImplement("registerSVG",bf),e.Factory.registerImplement("unregisterSVG",Sf),e.Factory.registerInteractionTrigger(kf.type,kf),e.Factory.registerInteractionTrigger(Mf.type,Mf)};class Nf extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=mf,this.type=df,this.seriesType=uf}}Nf.type=uf,Nf.seriesType=df,Nf.transformerConstructor=mf;class Uf extends e.BaseChartSpecTransformer{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["urlField","nameField","valueField","imageSize","imageSizeRange","ratio","maskShape","imageMask","layoutConfig","image"])}}const jf="imageCloud",Vf="imageCloud";var Gf;!function(t){t.image="image",t.imageMask="imageMask"}(Gf||(Gf={}));const zf=Object.assign(Object.assign({},e.baseSeriesMark),{image:{name:"image",type:"image"},imageMask:{name:"imageMask",type:"rect"}});class Kf extends e.ACustomAnimate{constructor(t,e,i,s,r){var n;super(t,e,i,s,r),this._rotations=null!==(n=null==r?void 0:r.rotation)&&void 0!==n?n:1}onBind(){this._scaleX=this.target.attribute.scaleX,e.isValidNumber(this._rotations)||(this.valid=!1)}onUpdate(t,e,i){var s;if(!1===this.valid)return;if(t)return void(i.scaleX=this._scaleX);const r=360*this._rotations*e*Math.PI/180,n=Math.abs(Math.cos(r))*(null!==(s=this._scaleX)&&void 0!==s?s:1);this.target.attribute.scaleX=n,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}function Hf(t,i){switch(i){case"axialRotate":return[{custom:Kf,customParameters:{rotation:1},duration:e.DEFAULT_ANIMATION_CONFIG.appear.duration},{channel:{y:{from:(e,i)=>t.height()+i.getFinalAttribute().y},fillOpacity:{from:0,to:1}},easing:"sineInOut"}];case"growIn":return{channel:{scaleX:{from:0,to:1},scaleY:{from:0,to:1},x:{from:()=>t.center().x},y:{from:()=>t.center().y}},duration:e.DEFAULT_ANIMATION_CONFIG.appear.duration};case"scaleIn":return{type:"scaleIn",duration:e.DEFAULT_ANIMATION_CONFIG.appear.duration};default:return{type:"fadeIn",easing:"linear",duration:e.DEFAULT_ANIMATION_CONFIG.appear.duration}}}class Wf extends e.BaseSeriesTooltipHelper{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,r=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&r)return null!==(i=r[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"}}class $f extends e.BaseSeries{constructor(){super(...arguments),this.type=Vf}setValueField(t){e.isValid(t)&&(this._valueField=t)}setAttrFromSpec(){super.setAttrFromSpec(),this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._urlField=this._spec.urlField}initMark(){var t;(null===(t=this._spec.imageMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(zf.imageMask,{dataView:!1,skipBeforeLayouted:!0})),this._imageMark=this._createMark(zf.image,{key:t=>`${t[e.DEFAULT_DATA_KEY]}-${t.frequency}`,isSeriesMark:!0,skipBeforeLayouted:!0})}initMarkStyle(){this._initImageMarkStyle(),this._initMaskMarkStyle()}_initImageMarkStyle(){var t,i;if(!this._imageMark)return;this._imageMark.setTransform([Object.assign({type:"imagecloud"},this._imageCloudTransformOption())]),this.setMarkStyle(this._imageMark,{x:t=>t.x,y:t=>t.y,width:t=>t.width,height:t=>t.height,visible:t=>t.visible,angle:t=>t.angle,clipConfig:t=>t.clipConfig,image:t=>t[this._urlField],scaleCenter:["50%","50%"]},"normal",e.AttributeLevel.Series);"masked"===(null===(t=this._spec.layoutConfig)||void 0===t?void 0:t.placement)&&(this.setMarkStyle(this._imageMark,{globalCompositeOperation:"source-atop"},"normal",e.AttributeLevel.Series),this.setMarkStyle(this._rootMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,globalCompositeOperation:"destination-in",clip:!0,drawMode:1},"normal",e.AttributeLevel.Series)),"stack"===(null===(i=this._spec.layoutConfig)||void 0===i?void 0:i.layoutMode)&&this.setMarkStyle(this._imageMark,{stroke:"white",lineWidth:2,shadowBlur:6,shadowColor:"grey"},"normal",e.AttributeLevel.Series)}isFillingImage(t){return t._frequency>1}_initMaskMarkStyle(){this._maskMark&&(this._maskMark.setMarkConfig({interactive:!1}),this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height},"normal",e.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Wf(this),this._imageMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._imageMark)}_imageCloudTransformOption(){var t;return{size:()=>{const{width:t,height:e}=this._region.getLayoutRect();return[t,e]},image:{field:this._urlField},weight:{field:this._valueField},imageConfig:{imageSize:this._spec.imageSize,imageSizeRange:this._spec.imageSizeRange,padding:null===(t=this._spec.image)||void 0===t?void 0:t.padding},ratio:this._spec.ratio,mask:this._spec.maskShape,maskConfig:this._spec.imageMask,layoutConfig:this._spec.layoutConfig,createCanvas:e.vglobal.createCanvas.bind(e.vglobal),createImage:e.createImage,onUpdateMaskCanvas:((t,e)=>{var i;t&&this._maskMark&&this._maskMark.getProduct().getChildren().forEach((e=>{e.setAttribute("background",t)})),e&&"masked"===(null===(i=this._spec.layoutConfig)||void 0===i?void 0:i.placement)&&this._rootMark.getProduct().setAttribute("background",e)}).bind(this),onLayoutFinished:()=>{var t,e;return null===(e=null===(t=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===t?void 0:t.afterWordcloudShapeDraw)||void 0===e?void 0:e.call(t,this._option.globalInstance)}}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.isFillingImage=this.isFillingImage.bind(this)}initAnimation(){[this._imageMark].forEach((t=>{var i,s;if(t){const r=null===(s=null===(i=this._spec)||void 0===i?void 0:i.animationAppear)||void 0===s?void 0:s.preset,n={center:()=>{const{width:t,height:e}=this._region.getLayoutRect();return{x:t/2,y:e/2}},height:()=>{const{height:t}=this._region.getLayoutRect();return t}};t.setAnimationConfig(e.animationConfig(e.Factory.getAnimationInKey("imageCloud")(n,r),e.userAnimationConfig("image",this._spec,this._markAttributeContext)))}}))}getDimensionField(){var t;return[null!==(t=this._nameField)&&void 0!==t?t:this._spec.urlField]}getMeasureField(){return[this._valueField]}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getActiveMarks(){return[this._imageMark]}getMarkData(t){var e;return null!==(e=null==t?void 0:t.datum)&&void 0!==e?e:t}getGroupFields(){return[]}dataToPosition(t){return null}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}valueToPosition(t,e){return null}getStackGroupFields(){return[]}getStackValueField(){return""}}$f.type=Vf,$f.mark=zf;const Yf=()=>{e.registerImageMark(),e.Factory.registerAnimation("imageCloud",((t,e)=>({appear:Hf(t,e),enter:Hf(t,e),exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),e.Factory.registerSeries($f.type,$f),e.Factory.registerGrammarTransform("imagecloud",{transform:e.imagecloudTransform})};class Xf extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=Xf.transformerConstructor,this.type=jf,this.seriesType=Vf}}Xf.type=jf,Xf.seriesType=Vf,Xf.transformerConstructor=Uf;class qf extends e.BaseChartSpecTransformer{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["timeField","eventField","seriesField","titleField","subTitleField","iconField","dot","title","subTitle","icon","line","arrow","labelPosition","sortDataByAxis"])}_setDefaultXAxisSpec(t){return{type:"band",orient:"bottom",label:{visible:!1},tick:{visible:!1},grid:{visible:!1},domainLine:{visible:!1},paddingInner:0,paddingOuter:0}}_setDefaultYAxisSpec(t){return{type:"band",inverse:!0,orient:"left",label:{visible:!1},tick:{visible:!1},grid:{visible:!1},domainLine:{visible:!1},paddingInner:0,paddingOuter:0}}_transformAxisSpec(t){t.axes||(t.axes=[]);const e={x:!1,y:!1};t.axes.forEach((i=>{const{orient:r}=i;let n=null;"top"!==r&&"bottom"!==r||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==r&&"right"!==r||(e.y=!0,n=this._setDefaultYAxisSpec(t)),n&&Object.keys(n).forEach((t=>{i[t]=s.isObject(i[t])?s.merge(n[t],i[t]):s.isNil(i[t])?n[t]:i[t]}))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t))}transformSpec(t){var e,i;super.transformSpec(t),this.transformSeriesSpec(t),this._transformAxisSpec(t);const s=null!==(e=t.direction)&&void 0!==e?e:"horizontal";null===(i=t.series)||void 0===i||i.forEach((t=>{"vertical"===s?(t.timeField&&!t.yField&&(t.yField=t.timeField),t.xField||(t.xField=t.seriesField||"__vchart_timeline_dummy__")):(t.timeField&&!t.xField&&(t.xField=t.timeField),t.yField||(t.yField=t.seriesField||"__vchart_timeline_dummy__"))}))}}const Zf="event",Jf=Object.assign(Object.assign({},e.baseSeriesMark),{line:{name:"line",type:"line"},dot:{name:"dot",type:"symbol"},icon:{name:"icon",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},arrow:{name:"arrow",type:"path"}});class Qf extends e.CartesianSeries{constructor(){super(...arguments),this.type=Zf,this.transformerConstructor=e.BaseSeriesSpecTransformer,this.coordinate="cartesian"}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),this._timeField=this._spec.timeField,this._eventField=this._spec.eventField,this._subTitleField=this._spec.subTitleField,this._iconField=this._spec.iconField,this._labelPosition=this._spec.labelPosition}getDimensionField(){return this._timeField?[this._timeField]:[]}getMeasureField(){const t=[];return this._eventField&&t.push(this._eventField),this._subTitleField&&t.push(this._subTitleField),t}initMark(){this._axisLineMark=this._createMark(Qf.mark.line,{isSeriesMark:!0,groupKey:this._seriesField}),this._arrowMark=this._createMark(Qf.mark.arrow,{isSeriesMark:!0}),this._dotMark=this._createMark(Qf.mark.dot,{isSeriesMark:!0}),this._iconMark=this._createMark(Qf.mark.icon,{isSeriesMark:!0}),this._titleMark=this._createMark(Qf.mark.title),this._subTitleMark=this._createMark(Qf.mark.subTitle)}initTooltip(){super.initTooltip(),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark),this._titleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._titleMark),this._subTitleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._subTitleMark),this._iconMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._iconMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}initMarkStyle(){var t,i,r,n,a,o,l,h,c,d,u;this._axisLineMark&&this.setMarkStyle(this._axisLineMark,{points:this._getAxisPoints.bind(this),visible:this._isFirstDataInGroup.bind(this),stroke:"#c0c3c7",lineWidth:1},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series);const p=this._spec.dot,g="number"==typeof(null===(t=null==p?void 0:p.style)||void 0===t?void 0:t.size)?p.style.size:8,m=this._spec.title,f=null!==(i=null==m?void 0:m.style)&&void 0!==i?i:{},v=this._spec.subTitle,y=null!==(r=null==v?void 0:v.style)&&void 0!==r?r:{},_="number"==typeof f.fontSize?f.fontSize:14,b=g/2+(null!==(n=null==m?void 0:m.offset)&&void 0!==n?n:6);this._dotMark&&this.setMarkStyle(this._dotMark,{x:t=>this._getPoint(t).x,y:t=>this._getPoint(t).y,size:g,fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute()},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series),this._arrowMark&&this.setMarkStyle(this._arrowMark,{path:t=>this._getArrowPath(t),fill:null!==(h=null===(l=null==p?void 0:p.style)||void 0===l?void 0:l.fill)&&void 0!==h?h:this.getColorAttribute()},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series),this._titleMark&&this.setMarkStyle(this._titleMark,Object.assign(Object.assign({fontSize:14},f),{x:t=>this._getTitlePosition(t,b).x,y:t=>this._getTitlePosition(t,b).y,textAlign:t=>this._getLabelTextAlign(t),textBaseline:t=>this._getLabelTextBaseline(t,!0),text:t=>this._getDatumString(t,this._eventField)}),e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series),this._subTitleMark&&this.setMarkStyle(this._subTitleMark,Object.assign(Object.assign({},y),{x:t=>this._getSubTitlePosition(t,b,_).x,y:t=>this._getSubTitlePosition(t,b,_).y,textAlign:t=>this._getLabelTextAlign(t),textBaseline:t=>this._getLabelTextBaseline(t,!1),text:t=>this._getDatumString(t,this._subTitleField)}),e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series);const S=this._spec.icon,x="number"==typeof(null===(c=null==S?void 0:S.style)||void 0===c?void 0:c.size)?S.style.size:20,A=(s.isValid(null==S?void 0:S.offset)?S.offset+g/2:b)+x/2;this._iconMark&&this.setMarkStyle(this._iconMark,{x:t=>this._getIconPosition(t,A).x,y:t=>this._getIconPosition(t,A).y,size:x,fill:null!==(u=null===(d=null==S?void 0:S.style)||void 0===d?void 0:d.fill)&&void 0!==u?u:this.getColorAttribute(),shape:t=>this._getDatumString(t,this._iconField)||"circle"},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}_getLabelSide(t){const e=this._getViewDataList().indexOf(t),i=this._labelPosition;if("vertical"===this.direction)switch(i){case"left":default:return"primary";case"right":return"secondary";case"left-right":return e%2==0?"primary":"secondary";case"right-left":return e%2==0?"secondary":"primary"}else switch(i){case"top":default:return"primary";case"bottom":return"secondary";case"top-bottom":return e%2==0?"primary":"secondary";case"bottom-top":return e%2==0?"secondary":"primary"}}_getLabelTextAlign(t){if("vertical"===this.direction){return"primary"===this._getLabelSide(t)?"right":"left"}return"center"}_getLabelTextBaseline(t,e){if("vertical"===this.direction)return"middle";return"primary"===this._getLabelSide(t)?"bottom":"top"}_getTitlePosition(t,e){const i=this._getPoint(t),s=this._getLabelSide(t);return"vertical"===this.direction?{x:"primary"===s?i.x-e:i.x+e,y:i.y}:{x:i.x,y:"primary"===s?i.y-e:i.y+e}}_getSubTitlePosition(t,e,i){var s,r,n,a;const o=this._getPoint(t),l=this._getLabelSide(t),h=null!==(r=null===(s=this._spec.title)||void 0===s?void 0:s.subTitleGap)&&void 0!==r?r:4;if("vertical"===this.direction){const t=null!==(a=null===(n=this._spec.title)||void 0===n?void 0:n.style)&&void 0!==a?a:{},s="number"==typeof t.lineHeight?t.lineHeight:1.2*i;return{x:"primary"===l?o.x-e:o.x+e,y:o.y+s+h}}return{x:o.x,y:"primary"===l?o.y-(e+i+h):o.y+(e+i+h)}}_getIconPosition(t,e){const i=this._getPoint(t),s=this._getLabelSide(t);return"vertical"===this.direction?{x:"primary"===s?i.x+e:i.x-e,y:i.y}:{x:i.x,y:"primary"===s?i.y+e:i.y-e}}_getViewDataList(){var t,e;return null!==(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)&&void 0!==e?e:[]}_getPoint(t){if("vertical"===this.direction){return{x:this._getPositionFromAxis(t,this.getXAxisHelper(),this._seriesField),y:this._getPositionFromAxis(t,this.getYAxisHelper(),this._timeField)}}return{x:this._getPositionFromAxis(t,this.getXAxisHelper(),this._timeField),y:this._getPositionFromAxis(t,this.getYAxisHelper(),this._seriesField)}}_getPositionFromAxis(t,e,i){var s,r,n,a,o,l;if(!e)return this._getDefaultPosition(i);if(!i||!(i in t))return this._getDefaultPosition(i);const h=t[i];return"band"!==(null===(r=null===(s=e.getSpec)||void 0===s?void 0:s.call(e))||void 0===r?void 0:r.type)&&e.isContinuous?null!==(l=null===(o=e.valueToPosition)||void 0===o?void 0:o.call(e,h))&&void 0!==l?l:this._getDefaultPosition(i):null!==(a=null===(n=e.dataToPosition)||void 0===n?void 0:n.call(e,[h],{bandPosition:.5}))&&void 0!==a?a:this._getDefaultPosition(i)}onXAxisHelperUpdate(){var t;null===(t=super.onXAxisHelperUpdate)||void 0===t||t.call(this),this.onMarkPositionUpdate()}onYAxisHelperUpdate(){var t;null===(t=super.onYAxisHelperUpdate)||void 0===t||t.call(this),this.onMarkPositionUpdate()}_getDefaultPosition(t){const e=this._region.getLayoutRect();if(!this._seriesField||t===this._seriesField){return"vertical"!==this.direction?.5*e.height:.5*e.width}return 0}_getAxisPoints(t){const e=this._region.getLayoutRect();if("vertical"===this.direction){const i=this._getPositionFromAxis(t,this.getXAxisHelper(),this._seriesField);return[{x:i,y:0},{x:i,y:e.height}]}const i=this._getPositionFromAxis(t,this.getYAxisHelper(),this._seriesField);return[{x:0,y:i},{x:e.width,y:i}]}_isFirstDataInGroup(t){if(!this._seriesField){return 0===this._getViewDataList().indexOf(t)}const e=this._getViewDataList(),i=t[this._seriesField];return t===e.find((t=>this._seriesField&&t[this._seriesField]===i))}_getNextDatum(t){const e=this._getViewDataList(),i=e.indexOf(t);if(-1===i||i===e.length-1)return null;if(!this._seriesField)return e[i+1];const s=t[this._seriesField];for(let t=i+1;t<e.length;t++){const i=e[t];if(i[this._seriesField]===s)return i}return null}_getPreviousDatum(t){const e=this._getViewDataList(),i=e.indexOf(t);if(-1===i||0===i)return null;if(!this._seriesField)return e[i-1];const s=t[this._seriesField];for(let t=i-1;t>=0;t--){const i=e[t];if(i[this._seriesField]===s)return i}return null}_getArrowPath(t){var e,i;const s=this._getPoint(t),r=this._getNextDatum(t),n=this._getPreviousDatum(t),a=null!==(i=null===(e=this._spec.arrow)||void 0===e?void 0:e.thickness)&&void 0!==i?i:16,o=this._region.getLayoutRect();if("vertical"===this.direction){const t=this.getYAxisHelper().isInverse(),e=n?{x:s.x,y:(this._getPoint(n).y+s.y)/2}:{x:s.x,y:t?0:o.height},i=r?{x:s.x,y:(this._getPoint(r).y+s.y)/2}:{x:s.x,y:t?o.height:0},l=t?1:-1,h=a/3,c=a/2;return`M ${e.x-c} ${e.y} L ${e.x} ${e.y+l*h} L ${e.x+c} ${e.y} \n L ${i.x+c} ${i.y-l*h} \n L ${i.x} ${i.y}\n L ${i.x-c} ${i.y-l*h} Z`}const l=this.getXAxisHelper().isInverse(),h=n?{x:(this._getPoint(n).x+s.x)/2,y:s.y}:{x:l?o.width:0,y:s.y},c=r?{x:(this._getPoint(r).x+s.x)/2,y:s.y}:{x:l?0:o.width,y:s.y},d=l?-1:1,u=a/2,p=a/3;return`M ${h.x} ${h.y-u} L ${h.x+d*p} ${h.y} L ${h.x} ${h.y+u} \n L ${c.x-d*p} ${c.y+u} \n L ${c.x} ${c.y} \n L ${c.x-d*p} ${c.y-u} Z`}_getDatumString(t,e){if(!t||!e)return"";const i=t[e];return"string"==typeof i?i:null==i?"":String(i)}valueToPosition(t,e){if(t&&"object"==typeof t)return this.dataToPosition(t);const i={};return this._timeField&&(i[this._timeField]=t),this._eventField&&void 0!==e&&(i[this._eventField]=e),this._getPoint(i)}getActiveMarks(){return[this._axisLineMark,this._dotMark,this._iconMark,this._arrowMark,this._titleMark,this._subTitleMark].filter(Boolean)}}Qf.type=Zf,Qf.mark=Jf,Qf.builtInTheme={event:{dot:{style:{size:8}},icon:{visible:!1,style:{size:20}},line:{visible:!0,style:{stroke:"#c0c3c7",lineWidth:1}},title:{visible:!0,offset:6,subTitleGap:4,style:{fontSize:14}},subTitle:{visible:!0,style:{fontSize:12}},arrow:{visible:!1,thickness:16}}},Qf.transformerConstructor=e.BaseSeriesSpecTransformer;const tv=()=>{e.registerSymbolMark(),e.registerTextMark(),e.registerLineMark(),e.registerPathMark(),e.Factory.registerSeries(Qf.type,Qf)};class ev extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=qf,this.type="timeline",this.seriesType="event"}}ev.type="timeline",ev.seriesType="event",ev.transformerConstructor=qf;const iv="seriesBreak";function sv(t,e,i,s,r=!1){const n=[],{x:a,y:o}=t,{x:l,y:h}=e,c=r?Math.floor((h-o)/(2*i)):Math.floor((l-a)/(2*i)),d=Math.PI/180*s,u=i*Math.cos(d),p=i*Math.sin(d);n.push(`M ${a} ${o}`);for(let t=0;t<=c;t++){const e=r?a+(t%2==0?u:-u):a+t*i*2,s=r?o+t*i*2:t%2==0?o-p:o+p;n.push(`L ${e} ${s}`)}return n.push(`L ${r?a:l} ${r?h:o}`),n.join(" ")}class rv extends e.AbstractComponent{constructor(){super(...arguments),this.name=iv}render(){this.removeAllChild();const{data:t=[]}=this.attribute;if(e.isEmpty(t))return;const i=[],s=[];t.forEach((t=>{const{start:r,end:n}=t;((t,i)=>{const{start:s,end:r}=i,n=s.x===r.x,a=n?"x":"y",o=n?"y":"x";let l=!0;const h=1e-6;t.length&&t.forEach((t=>{if(e.isNumberClose(t.start[a],s[a])){const e=Math.min(s[o],r[o]),i=Math.max(s[o],r[o]),n=Math.min(t.start[o],t.end[o]),a=Math.max(t.start[o],t.end[o]);if(!(i<n-h||e>a+h))return t.start[o]=Math.min(n,e),t.end[o]=Math.max(a,i),void(l=!1)}})),l&&t.push(i)})(r.x===n.x?i:s,t)})),[...i,...s].forEach(((t,i)=>{var s;const{start:r,end:n,size:a=4,gap:o=5,style:l={}}=t,h=v(t,["start","end","size","gap","style"]),c=e.createGroup({}),d=r.x===n.x;let u,p,g,m;d?(u={x:r.x-o/2,y:r.y},p={x:n.x-o/2,y:n.y},g={x:r.x+o/2,y:r.y},m={x:n.x+o/2,y:n.y}):(u={x:r.x,y:r.y-o/2},p={x:n.x,y:n.y-o/2},g={x:r.x,y:r.y+o/2},m={x:n.x,y:n.y+o/2});const f=sv(u,p,a,d?75:15,d),y=sv(r,n,a,d?75:15,d),_=sv(g,m,a,d?75:15,d);c.add(e.createPath(Object.assign(Object.assign({path:f,stroke:"#000",lineWidth:1},l),{pickable:!1,zIndex:1}))),c.add(e.createPath(Object.assign(Object.assign({path:_,stroke:"#000",lineWidth:1},l),{pickable:!1,zIndex:1}))),c.add(e.createPath({path:y,stroke:"#fff",lineWidth:o,pickable:!1,zIndex:0})),c.name="series-break",c.data=h,e.isValid(h.axisId)&&(c.id=`${null!==(s=h.axisId)&&void 0!==s?s:""}_${i}`),this.add(c)}))}}function nv(t,e,i=1){return Math.abs(t-e)<i}function av(t,i){return{type:"component",componentType:iv,interactive:!0,zIndex:500,style:{data:(s,r)=>{const n=[],a=r.vchart.getChart(),o="horizontal"===a.getAllSeries()[0].direction;return t.forEach(((t,s)=>{var r,l;const h=t.id,c=e.isValid(h)?a.getComponentByUserId(h):i&&e.isValid(i[s])?a.getComponentByIndex("axes",i[s]):null===(r=a.getComponentsByKey("axes").filter((e=>e.getSpec().breaks===t.breaks)))||void 0===r?void 0:r[0];if(!c)return;const d=null!=h?h:`${c.type}-${c.id}`,u=function(t){let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,r=i+t[0].getLayoutRect().height;for(let n=1;n<t.length;n++){const a=t[n],{x:o,y:l}=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();e=Math.min(e,o),s=Math.max(s,h+o),i=Math.min(i,l),r=Math.max(r,c+l)}return{x1:e,y1:i,x2:s,y2:r}}(c.getRegions());e.array(null===(l=c._break)||void 0===l?void 0:l.breaks).forEach((t=>{const{range:e,breakSymbol:i,gap:s=5}=t,r=c.valueToPosition(e[0]),l=c.valueToPosition(e[1]),h=(r+l)/2+(o?u.x1:u.y1);a.getAllSeries().forEach((t=>{if("bar"===t.type||"waterfall"===t.type){t.getMarkInName("bar").getGraphics().forEach((t=>{const a=t.AABBBounds;let c,p,g,m,f=!1;o?(f=a.x1<(r+l-s)/2&&a.x2>(r+l+s)/2,c=h,p=Math.max(a.y1+u.y1-2,u.y1),g=h,m=Math.min(a.y2+u.y1+2,u.y2)):(f=a.y1<(r+l-s)/2&&a.y2>(r+l+s)/2,c=Math.max(a.x1+u.x1-2,u.x1),p=h,g=Math.min(a.x2+u.x1+2,u.x2),m=h),f&&n.push({start:{x:c,y:p},end:{x:g,y:m},gap:s,style:null==i?void 0:i.style,axisId:d,data:e})}))}else if("line"===t.type){t.getMarkInName(t.type).getGraphics().forEach((t=>{lv(t,"line").forEach((t=>{ov(o?{start:{x:(r+l)/2,y:0},end:{x:(r+l)/2,y:u.y2-u.y1}}:{start:{x:0,y:(r+l)/2},end:{x:u.x2-u.x1,y:(r+l)/2}},t).forEach((t=>{let r,a;o?(r={x:h,y:Math.max(t[1]+u.y1-10,u.y1)},a={x:h,y:Math.min(t[1]+u.y1+10,u.y2)}):(r={x:Math.max(t[0]+u.x1-10,u.x1),y:h},a={x:Math.min(t[0]+u.x1+10,u.x2),y:h}),n.push({start:r,end:a,gap:s,style:null==i?void 0:i.style,axisId:d,data:e})}))}))}))}else if("area"===t.type){t.getMarkInName("area").getGraphics().forEach((t=>{lv(t,"area").forEach((t=>{const a=ov(o?{start:{x:(r+l)/2,y:0},end:{x:(r+l)/2,y:u.y2-u.y1}}:{start:{x:0,y:(r+l)/2},end:{x:u.x2-u.x1,y:(r+l)/2}},t);a.sort(((t,e)=>t[0]-e[0]));for(let r=0;r<a.length-1;r++){const l={x:a[r][0],y:a[r][1]},h={x:a[r+1][0],y:a[r+1][1]};if(hv(o?{x:l.x,y:(l.y+h.y)/2}:{x:(l.x+h.x)/2,y:l.y},t)){let t,r;o?(t={x:l.x+u.x1,y:Math.max(l.y+u.y1-0,u.y1)},r={x:h.x+u.x1,y:Math.min(h.y+u.y1+0,u.y2)}):(t={x:Math.max(l.x+u.x1-0,u.x1),y:l.y+u.y1},r={x:Math.min(h.x+u.x1+0,u.x2),y:h.y+u.y1}),n.push({start:t,end:r,gap:s,style:null==i?void 0:i.style,axisId:d,data:e})}}}))}))}}))}))})),n}}}}function ov(t,i){const s=[];for(let r=1;r<i.length;r++){const n=e.getIntersectPoint([t.start.x,t.start.y],[t.end.x,t.end.y],[i[r].x,i[r].y],[i[r-1].x,i[r-1].y]);n&&!s.find((t=>nv(e.PointService.distancePP({x:t[0],y:t[1]},{x:n[0],y:n[1]}),0)))&&s.push(n)}return s}function lv(t,e){const{points:i,segments:s}=t.attribute,r=[];let n=[];const a=t=>{if(t&&t.length){let i=[];if(t.forEach((t=>{var s,a;if(!1===t.defined){if(r.push(n),"area"===e&&i.length){for(let t=i.length-1;t>=0;t--)n.push({x:i[t].x,y:i[t].y});n.push(n[0])}n=[],i=[]}else n.push({x:t.x,y:t.y}),"area"===e&&i.push({x:null!==(s=t.x1)&&void 0!==s?s:t.x,y:null!==(a=t.y1)&&void 0!==a?a:t.y})})),"area"===e&&i.length){for(let t=i.length-1;t>=0;t--)n.push({x:i[t].x,y:i[t].y});n.push(n[0])}r.push(n)}};return i&&i.length?a(i):s&&s.length&&s.forEach((t=>{a(t.points)})),r}function hv(t,e){const{x:i,y:s}=t;let r=!1;for(let t=0,n=e.length-1;t<e.length;n=t++){const{x:a,y:o}=e[t],{x:l,y:h}=e[n];o>s!=h>s&&i<(l-a)*(s-o)/(h-o)+a&&(r=!r)}return r}const cv="barLink";class dv extends e.AbstractComponent{constructor(){super(...arguments),this.name=cv}render(){const{data:t,linkStyle:i,areaStyle:s,styleMap:r,label:n,linkType:a="total"}=this.attribute;e.isEmpty(t)||(this.removeAllChild(),t.forEach(((t,o)=>{var l,h,c,d,u;const{linePoints:p,areaPoints:g,id:m=o,color:f,data:v}=t;if(g&&!1!==(null===(l=null==r?void 0:r[`area-${m}`])||void 0===l?void 0:l.visible)){const t=e.createArea(Object.assign(Object.assign({points:g,fillOpacity:.3,fill:f,zIndex:0},s),null==r?void 0:r[`area-${m}`]));t.name="bar-link-area",t.id=`area-${m}`,this.add(t)}if(p&&!1!==(null===(h=null==r?void 0:r[`line-${m}`])||void 0===h?void 0:h.visible)&&0!==(null===(c=null==i?void 0:i.lineStyle)||void 0===c?void 0:c.lineWidth)&&0!==(null===(d=null==r?void 0:r[`line-${m}`])||void 0===d?void 0:d.lineWidth)){const{startSymbol:t={},endSymbol:s={},lineStyle:n}=i||{},a=e.cloneDeep(t),o=e.cloneDeep(s);(null==r?void 0:r[`line-${m}`])&&r[`line-${m}`].stroke&&(a.style=Object.assign(Object.assign({},a.style),{color:r[`line-${m}`].stroke}),o.style=Object.assign(Object.assign({},o.style),{color:r[`line-${m}`].stroke})),a.symbolType||a.originSymbolType||(a.originSymbolType="solidArrow"),o.symbolType||o.originSymbolType||(o.originSymbolType="solidArrow");const l=new e.Segment({points:p,startSymbol:Object.assign({size:8},a),endSymbol:Object.assign({size:8},o),lineStyle:Object.assign(Object.assign({lineDash:[3,3],lineWidth:1,stroke:"#000"},n),null==r?void 0:r[`line-${m}`]),pickable:!0,childrenPickable:!1,zIndex:1});l.name="bar-link-line",l.id=`line-${m}`,this.add(l)}if((null==n?void 0:n.visible)&&!1!==(null===(u=null==r?void 0:r[`label-${m}`])||void 0===u?void 0:u.visible)){const{style:t,formatMethod:i}=n,[s,o]=v;let l=s[e.STACK_FIELD_END],h=o[e.STACK_FIELD_END];"value"===a&&(l=s[e.STACK_FIELD_END]-s[e.STACK_FIELD_START],h=o[e.STACK_FIELD_END]-o[e.STACK_FIELD_START]);const c=h-l,d=(h-l)/l*100,u=e.createText(Object.assign(Object.assign({x:.5*(p[0].x+p[1].x),y:.5*(p[0].y+p[1].y),text:i?i(c,d,v):`${c} ${d}`,fontSize:14,fill:"#000",stroke:"#fff",lineWidth:1,textAlign:"center",textBaseline:"middle",background:"#fff",zIndex:2},t),null==r?void 0:r[`label-${m}`]));u.name="bar-link-label",u.id=`label-${m}`,this.add(u)}})))}}function uv(t,i,s){const{isHorizontal:r,isXAxisInverse:n,isYAxisInverse:a,linkType:o,doFill:l,regionStartX:h,regionStartY:c}=s,d=t.AABBBounds,u=i.AABBBounds;let p,g;return r?(p=[{x:(d.x1+d.x2)/2+h,y:d.y1+c},{x:(u.x1+u.x2)/2+h,y:u.y2+c}],n?("total"===o&&(p=[{x:d.x1+h,y:d.y1+c},{x:u.x1+h,y:u.y2+c}]),l&&(g=[{x:d.x1+h,x1:d.x2+h,y:d.y1+c},{x:u.x1+h,x1:u.x2+h,y:u.y2+c}])):("total"===o&&(p=[{x:d.x2+h,y:d.y1+c},{x:u.x2+h,y:u.y2+c}]),l&&(g=[{x:d.x2+h,x1:d.x1+h,y:d.y1+c},{x:u.x2+h,x1:u.x1+h,y:u.y2+c}]))):(p=[{x:d.x2+h,y:(d.y1+d.y2)/2+c},{x:u.x1+h,y:(u.y1+u.y2)/2+c}],a?("total"===o&&(p=[{x:d.x2+h,y:d.y2+c},{x:u.x1+h,y:u.y2+c}]),l&&(g=[{x:d.x2+h,y:d.y2+c,y1:d.y1+c},{x:u.x1+h,y:u.y2+c,y1:u.y1+c}])):("total"===o&&(p=[{x:d.x2+h,y:d.y1+c},{x:u.x1+h,y:u.y1+c}]),l&&(g=[{x:d.x2+h,y:d.y1+c,y1:d.y2+c},{x:u.x1+h,y:u.y1+c,y1:u.y2+c}]))),{areaPoints:g,linePoints:p,data:[e.getDatumOfGraphic(t),e.getDatumOfGraphic(i)],color:t.attribute.fill}}function pv(t={},i){const{linkType:s="total",doFill:r}=t,n=v(t,["linkType","doFill"]);return{type:"component",componentType:cv,zIndex:500,interactive:!1,style:Object.assign(Object.assign({data:(t,i)=>{const{vchart:n}=i,a=n.getChart().getAllRegions(),o=[];return a.forEach((t=>{const i=t.getSeries().filter((t=>"bar"===t.type)),{x:n,y:a}=t.getLayoutStartPoint();if(i.length){const t=i[0].getGroupFields(),l=[];i.forEach((t=>{var e;(null===(e=t.getMarkInName("bar"))||void 0===e?void 0:e.getGraphics()).forEach((t=>{l.push(t)}))}));const h=function(t,i){const s={};for(let r=0;r<t.length;r++){const n=t[r],a=e.getDatumOfGraphic(n),o=i.map((t=>a[t])).join("-");s[o]||(s[o]=[]),s[o].push(n)}return s}(l,t);Object.values(h).forEach((t=>{t.sort(((t,i)=>e.getDatumOfGraphic(t)[e.STACK_FIELD_END]-e.getDatumOfGraphic(i)[e.STACK_FIELD_END]))}));const c=i[0],d="horizontal"===c.direction,u=c.getYAxisHelper().isInverse(),p=c.getXAxisHelper().isInverse(),g=Object.values(h);if(g.length)if(d){g[0][0].AABBBounds.y1<g[g.length-1][0].AABBBounds.y1&&g.reverse()}else{g[0][0].AABBBounds.x1>g[g.length-1][0].AABBBounds.x1&&g.reverse()}for(let t=0;t<g.length-1;t++){const e=g[t],i=g[t+1];if(e.forEach(((t,e)=>{var l;const h=uv(t,null!==(l=i[e])&&void 0!==l?l:i[i.length-1],{isHorizontal:d,isXAxisInverse:p,isYAxisInverse:u,doFill:r,linkType:s,regionStartX:n,regionStartY:a});o.push(h)})),e.length<i.length){const t=e[e.length-1];for(let l=e.length;l<i.length;l++){const e=uv(t,i[l],{isHorizontal:d,isXAxisInverse:p,isYAxisInverse:u,doFill:r,linkType:s,regionStartX:n,regionStartY:a});o.push(e)}}}}})),o},linkType:s},n),i)}}const gv="seriesLabel";function mv(t,e=10,i=10,s=.1){const r=t.length;if(!t.every(isFinite))return t;if(!(r>1))return t;const n=function(t,e,i){t=+t,e=+e;let s=arguments.length;i=s<2?(e=t,t=0,1):s<3?1:+i;let r=-1;s=0|Math.max(0,Math.ceil((e-t)/i));const n=new Array(s);for(;++r<s;)n[r]=t+r*i;return n}(t.length);for(let a=0;a<i;++a){n.sort(((e,i)=>{return s=t[e],r=t[i],null==s||null==r?NaN:s<r?-1:s>r?1:s>=r?0:NaN;var s,r}));let i=0;for(let s=1;s<r;++s){let r=t[n[s]]-t[n[s-1]];r<e&&(r=(e-r)/2,i=Math.max(i,r),t[n[s-1]]-=r,t[n[s]]+=r)}if(i<s)break}return t}function fv(t,e){return!(e.x1>t.x2||e.x2<t.x1||e.y1>t.y2||e.y2<t.y1)}function vv(t,e=10,i=10){const s=t.length;let r,n=0;do{r=!1;for(let i=0;i<s;++i)for(let n=i+1;n<s;++n){const s=t[i].AABBBounds,a=t[n].AABBBounds;if(fv(s,a)){const i=e-(a.x1-s.x2);i>0&&(t[n].attribute.x+=i,a.x1+=i,a.x2+=i,r=!0)}}n++}while(r&&n<i)}function yv(t,i){const{label:s,line:r}=i;return{type:"component",componentType:gv,interactive:!1,style:{position:t,layout:(t,e)=>{var i;return null!==(i=e.vchart.getChart().getAllSeries()[0].getSpec().direction)&&void 0!==i?i:"vertical"},data:(i,s)=>{var r;const n=s.vchart.getChart(),a=n.getAllSeries()[0],o="horizontal"===a.direction,l=o?a.getYAxisHelper():a.getXAxisHelper(),h=null===(r=l.getScale)||void 0===r?void 0:r.call(l,0),c=l.isInverse(),d=a.getDimensionField()[0],u=a.getSeriesField(),p=n.getAllSeries().map((t=>t.type)).filter(((t,e,i)=>i.indexOf(t)===e)),g=[];if(1===p.length&&["bar","area","line","waterfall"].includes(p[0])){("both-ends"===t?["start","end"]:[t]).forEach((t=>{const i="end"===t?e.last(h.domain()):h.domain()[0],s=a.getRegion(),{x:r,y:l}=s.getLayoutStartPoint();let m=0;n.getAllSeries().forEach((e=>{e.getMarkInName("waterfall"===p[0]?"bar":p[0]).getGraphics().forEach((s=>{var n;const a=s.context.data.find((t=>t[d]===i));if(a){const i=s.AABBBounds;let h,f,v,y;"bar"===p[0]||"waterfall"===p[0]?(h="end"===t?{x:o?(i.x1+i.x2)/2:c?i.x1:i.x2,y:o?c?i.y2:i.y1:(i.y1+i.y2)/2}:{x:o?(i.x1+i.x2)/2:c?i.x2:i.x1,y:o?c?i.y1:i.y2:(i.y1+i.y2)/2},f=s.attribute.fill):(h=e.dataToPosition(a),f=s.attribute.stroke||s.attribute.fill),"end"===t?(v=o?"center":c?"end":"start",y=o?c?"top":"bottom":"middle"):(v=o?"center":c?"start":"end",y=o?c?"bottom":"top":"middle");const _=null!==(n=a[u])&&void 0!==n?n:a[d];g.push({point:{x:h.x+r,y:h.y+l},label:_,color:f,textAlign:v,textBaseline:y,series:e,datum:a,id:`${t}-${m}`,position:t}),m++}}))}))}))}return g},line:r,label:Object.assign({space:12},s)}}}class _v extends e.AbstractComponent{constructor(){super(...arguments),this.name=gv}render(){var t,i,s,r;this.removeAllChild();const{data:n,layout:a,label:o,line:l={}}=this.attribute;if(e.isEmpty(n))return;const h=null!==(t=null==o?void 0:o.styleMap)&&void 0!==t?t:{},c={},d=n.filter((t=>{var e;return!1!==(null===(e=h[t.id])||void 0===e?void 0:e.visible)}));if("vertical"===a){const t=1.5*(null!==(s=null===(i=null==o?void 0:o.style)||void 0===i?void 0:i.fontSize)&&void 0!==s?s:12),r=(t,i,s)=>{var r,n,a,o,l,h,c,d;const{label:u,color:p,textAlign:g,textBaseline:m,id:f}=t,v=null!==(n=null===(r=s[f])||void 0===r?void 0:r.formatMethod)&&void 0!==n?n:null===(a=this.attribute.label)||void 0===a?void 0:a.formatMethod,y=e.createText(Object.assign(Object.assign(Object.assign(Object.assign({text:v?v(u,t.datum,{series:t.series}):u},null===(o=this.attribute.label)||void 0===o?void 0:o.style),i),{textAlign:g,textBaseline:m,fill:null!==(c=null===(h=null===(l=this.attribute.label)||void 0===l?void 0:l.style)||void 0===h?void 0:h.fill)&&void 0!==c?c:p}),null===(d=s[f])||void 0===d?void 0:d.style));return y.name="series-label-text",y.id=f,this.add(y),y};["start","end"].forEach((e=>{const i=d.filter((t=>t.position===e)),s=mv(i.map((t=>t.point.y)),t);i.forEach(((t,e)=>{var i;const n={x:t.point.x+(null!==(i=null==o?void 0:o.space)&&void 0!==i?i:8)*("start"===t.textAlign?1:-1),y:s[e]};r(t,n,h),c[t.id]=n}))}))}else{const t=[],i=[];d.forEach((s=>{var r,n,a,l,c;const{point:d,label:u,color:p,textAlign:g,textBaseline:m,id:f,position:v}=s,y={x:d.x,y:d.y},_=null!==(n=null===(r=h[f])||void 0===r?void 0:r.formatMethod)&&void 0!==n?n:null==o?void 0:o.formatMethod,b=e.createText(Object.assign(Object.assign(Object.assign(Object.assign({text:_?_(u,s.datum,{series:s.series}):u},null==o?void 0:o.style),y),{textAlign:g,textBaseline:m,fill:null!==(l=null===(a=null==o?void 0:o.style)||void 0===a?void 0:a.fill)&&void 0!==l?l:p}),null===(c=h[f])||void 0===c?void 0:c.style));b.id=f,b.name="series-label-text",this.add(b),"start"===v?t.push(b):"end"===v&&i.push(b)})),t.length&&vv(t,4,10),i.length&&vv(i,4,10);const s=null!==(r=null==o?void 0:o.space)&&void 0!==r?r:8;[...t,...i].forEach((t=>{const e="top"===t.attribute.textBaseline?1:-1;t.setAttribute("y",t.attribute.y+s*e),c[t.id]={x:t.attribute.x,y:t.attribute.y}}))}!1!==l.visible&&d.forEach((t=>{var i,s,r,n,o,d;const{point:u,color:p,id:g}=t,m={x:c[g].x+(null!==(r=null===(s=null===(i=h[g])||void 0===i?void 0:i.style)||void 0===s?void 0:s.dx)&&void 0!==r?r:0),y:c[g].y+(null!==(d=null===(o=null===(n=h[g])||void 0===n?void 0:n.style)||void 0===o?void 0:o.dy)&&void 0!==d?d:0)};if(!1!==l.autoVisible){if("vertical"===a&&u.y!==m.y||"horizontal"===a&&u.x!==m.x){const t=e.createLine(Object.assign({points:[u,m],lineWidth:1,stroke:p},l.style));t.name="series-label-line",this.add(t)}}else{const t=e.createLine(Object.assign({points:[u,m],lineWidth:1,stroke:p},l.style));t.name="series-label-line",this.add(t)}}))}}function bv(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function Sv(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function xv(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:Sv(t.rect),anchorCandidates:Mv(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const r=i[t],n=r.bound;let a=s.some((t=>bv(t,n)));if(r.anchorCandidates)if(a&&(null===(e=r.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;t<r.anchorCandidates.length;t++){const e=r.anchorCandidates[t],i={x1:e.x,y1:e.y,x2:e.x+n.x2-n.x1,y2:e.y+n.y2-n.y1,anchor:e};if(!s.some((t=>bv(t,i)))){s.push(i),a=!1;break}}a&&s.push(r.bound)}else s.push(r.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function Av(t,i,s){const r=t.map((t=>t.pointCoord)),{x1:n,x2:a,y1:o,y2:l}=e.getAABBFromPoints(r),h=s([(n+a)/2,(o+l)/2]);if(!h)return[];const c=t.map((t=>{const r=t.rect,n=kv(i,t.pointCoord)?s(function(t,i,s,r=200){const n=5621/r;let a=i;for(let i=1;i<=n;i++){const i=e.destination(a,r,s);if(!kv(t,i))return[i.x,i.y];a=[i.x,i.y]}return i}(i,[t.pointCoord.x,t.pointCoord.y],Tv(Cv(t.point,h)))):t.point;n&&(r.x=n.x,r.y=n.y);const a=Tv(Cv(t.point,h));let o;const l=[];return a>=-45&&a<45?(o="top",l.push("left","right")):a>=45&&a<135?o="right":a>=-135&&a<-45?(o="left",l.push("left")):(o="bottom",l.push("left","right")),t.anchors=l,t.offset=20,t.rect=wv(t.rect,o,0),t}));return xv(c)}function Tv(t){return t>180?t-360:t}function Cv(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function kv(t,i){for(let s=0;s<t.length;s++){if(e.isPointInPolygon(i,t[s]))return!0}return!1}function wv(t,e,i=0){const s=Object.assign({},t);return"top"===e?(s.x-=t.width/2,s.y-=i+t.height/2):"bottom"===e?(s.x-=t.width/2,s.y+=i-t.height/2):"left"===e?(s.x-=i+t.width,s.y-=t.height/2):"right"===e&&(s.x+=i,s.y-=t.height/2),s}function Mv(t,e,i,s=0){const r=[];return t.forEach((t=>{const{x:n,y:a}=wv(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);r.push({x:n,y:a})})),r}const Ev={visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:10}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:10}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"black"}}};class Bv extends e.BaseComponentSpecTransformer{_getDefaultSpecFromChart(){return Ev}}class Pv extends e.BaseComponent{constructor(){super(...arguments),this.type="mapLabel",this.name=" mapLabel",this.specKey="mapLabel",this.transformerConstructor=Bv,this.layoutType="none",this.layoutZIndex=e.LayoutZIndex.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){return e.getSpecInfo(t,this.specKey,this.type,(t=>t.visible&&e.isValid(t.seriesId)))}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,r,n,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(r=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===r?void 0:r.longitudeField,this._latitudeField=null===(o=null===(a=(n=this._regions[0]).getSpec)||void 0===a?void 0:a.call(n))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const i=t.getViewData();if(i){const t=new e.DataView(this._option.dataSet,{name:`${this.name}_data`});t.parse([i],{type:"dataview"}),t.transform({type:"copyDataView",level:e.TransformLevel.copyDataView},!1),this._data=new e.CompilableData(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(()=>(this.handleZoom(),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("element-highlight:start",(t=>{const i=t.graphics[0];this._isRelativeSeries(i)&&this._updateDatum(e.getDatumOfGraphic(i))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this._updateDatum(null)}))):"click"===t&&(this.event.on("element-select:start",(t=>{const i=t.graphics[0];this._isRelativeSeries(i)&&this._updateDatum(e.getDatumOfGraphic(i))})),this.event.on("elementSelectReset",(t=>{this._activeDatum&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const i=[],s=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,i)=>{var s;const r=new e.MarkPoint({position:void 0,animation:!1});return r&&(r.name=`${this.name}_marker_${i}`,r.id=null!==(s=this._spec.id)&&void 0!==s?s:`${this.name}_marker_${this.id}`,r.setAttribute("zIndex",this.layoutZIndex)),r})));this._markerComponents.forEach(((t,e)=>{const{pairInfo:r,contentMarks:n}=this._evaluateMarker(this._data.getLatestData()[e],e);r&&i.push(r),n&&s.push(n)}));const r=this._layoutLabels(i);this._layoutMarkers(r,s),this._renderMarkers()}_evaluateMarker(t,i){var s,r,n,a,o,l,h,c,d,u,p,g,m,f;let v=0,y=0,_=0,b=0,S=0;const x=this._spec.position||"top",A=this._spec.offset,T=e.normalizeLayoutPaddingSpec(null===(s=this._spec.background)||void 0===s?void 0:s.padding),C=this._spec.space||0;y+=((null==T?void 0:T.left)||0)+((null==T?void 0:T.right)||0),_+=((null==T?void 0:T.top)||0)+((null==T?void 0:T.bottom)||0);const k={},w=this.dataToPosition(t),M=e.graphicCreator.group({});if(M.name=`${this.name}_marker_itemContainer_${i}`,k.container=M,null===(r=this._spec.background)||void 0===r?void 0:r.visible){const t=e.graphicCreator.rect(e.transformToGraphic(Object.assign({},this._spec.background.style)));t.setAttributes(w),k.labelBackground=t,M.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=e.graphicCreator.symbol(e.transformToGraphic(Object.assign({},this._spec.icon.style)));t.setAttributes(w),t.setAttribute("symbolType",null!==(o=null===(a=this._spec.icon.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:null===(l=this._spec.icon.style)||void 0===l?void 0:l.shape);const i=t.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,r=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;k.icon=t,M.appendChild(t),S=s,b+=r,v++}if(null===(d=this._spec.nameLabel)||void 0===d?void 0:d.visible){const i=e.graphicCreator.text(e.transformToGraphic(Object.assign({},this._spec.nameLabel.style)));i.setAttributes(w),i.setAttribute("text",t[this.nameField]);const s=i.AABBBounds,r=null!==(u=(null==s?void 0:s.y2)-(null==s?void 0:s.y1))&&void 0!==u?u:0,n=null!==(p=(null==s?void 0:s.x2)-(null==s?void 0:s.x1))&&void 0!==p?p:0;k.nameLabel=i,M.appendChild(i),S=Math.max(S,r),b+=n,v++}if((null===(g=this._spec.valueLabel)||void 0===g?void 0:g.visible)&&e.isValid(t[this.valueField])){const i=e.graphicCreator.text(e.transformToGraphic(Object.assign({},this._spec.valueLabel.style)));i.setAttributes(w),i.setAttribute("text",t[this.valueField]);const s=i.AABBBounds,r=null!==(m=(null==s?void 0:s.y2)-(null==s?void 0:s.y1))&&void 0!==m?m:0,n=null!==(f=(null==s?void 0:s.x2)-(null==s?void 0:s.x1))&&void 0!==f?f:0;k.valueLabel=i,M.appendChild(i),S=Math.max(S,r),b+=n,v++}const E=Object.values(k).find((t=>!!t&&"group"!==t.type)),B={x:null==E?void 0:E.getComputedAttribute("x"),y:null==E?void 0:E.getComputedAttribute("y")},P={x:B.x,y:B.y,width:0,height:0};P.width=y+b+(v-1)*C,P.height=_+S;const O={rect:P,point:B,index:i};if("outer"!==x){const t=["top","right","left","bottom"].filter((t=>t!==x));O.rect=wv(P,x,A),O.anchors=t,O.offset=A}else O.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:O,contentMarks:k}}_layoutMarkers(t,i){var s,r,n;for(let a=0;a<i.length;a++){if(!t[a]||!i[a])return;const{icon:o,nameLabel:l,valueLabel:h,labelBackground:c,container:d}=i[a],u=t[a],p=e.normalizeLayoutPaddingSpec(null===(s=this._spec.background)||void 0===s?void 0:s.padding),g=this._spec.space||0,m=u.height/2;let f=(null==p?void 0:p.left)||0;[o,l,h].forEach(((t,e)=>{var i,s;if(t){const r=t.AABBBounds;let n=0;"symbol"===t.type&&(n+=(null!==(i=r.x2-r.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:f+n,y:m}),f+=null!==(s=r.x2-r.x1)&&void 0!==s?s:0,2!==e&&(f+=g)}})),null==c||c.setAttributes({x:0,y:0,width:u.width,height:u.height}),null==d||d.setAttributes({dx:-u.width/2,dy:-u.height/2});const v=this._data.getLatestData()[a],y=this.dataToPosition(v),_=this.getRegions()[0].getLayoutStartPoint(),b=!(!(null===(r=this._spec.leader)||void 0===r?void 0:r.visible)||!(o||l||h));this._markerComponents[a].setAttributes({x:_.x,y:_.y,position:y,visible:this._activeDatum.includes(v),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>d,autoRotate:!1,offsetX:u.x+u.width/2-y.x,offsetY:u.y+u.height/2-y.y},itemLine:{visible:b,type:"type-po",lineStyle:e.transformToGraphic(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;t<this._markerComponents.length;t++)this.getContainer().add(this._markerComponents[t])}_layoutLabels(t){return"outer"===this._spec.position&&this._map?Av(t,this._map,(t=>this._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):xv(t)}_isRelativeModel(t){var e,i,s;const r=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===r}_isRelativeSeries(t){var e;return(null===(e=t.context)||void 0===e?void 0:e.modelId)===this._series.id}_getNeedClearVRenderComponents(){return this._markerComponents}getVRenderComponents(){return this._markerComponents}}Pv.type="mapLabel",Pv.specKey="mapLabel",Pv.transformerConstructor=Bv;const Ov="regressionLine";class Iv extends e.AbstractComponent{constructor(){super(...arguments),this.name=Ov}render(){this.removeAllChild();const{data:t,line:i={},label:s,name:r="regression-line",confidenceInterval:n}=this.attribute;e.isEmpty(t)||t.forEach((t=>{const{color:a}=t;if(t.area&&!1!==(null==n?void 0:n.visible)){const i=e.createArea(Object.assign(Object.assign({points:t.area},e.isValid(a)?{fill:a,fillOpacity:.12}:null),null==n?void 0:n.style));i.name="scatter-regression-area",this.add(i)}if(t.line&&!1!==(null==i?void 0:i.visible)){const s=e.createLine(Object.assign(Object.assign({points:t.line,lineWidth:1},e.isValid(a)?{stroke:a}:null),null==i?void 0:i.style));s.name=`${r}-curve`,this.add(s)}const o=e.last(t.line);if(s&&!1!==s.visible&&s.text&&o){const t=e.createText(Object.assign(Object.assign(Object.assign({},o),{text:s.text,textAlign:"end",textBaseline:"middle"}),s.style));t.name=`${r}-label`,this.add(t)}}))}}const Rv=(t,i,s=(t=>t.x),r=(t=>t.y),n)=>{switch(t){case"logisitc":return e.regressionLogistic(i,s,r);case"lowess":return e.regressionLowess(i,s,r);case"polynomial":return e.regressionPolynomial(i,s,r,{degree:n});default:return e.regressionLinear(i,s,r)}};function Dv(t,i){const{color:s,line:r,confidenceInterval:n,label:a}=i;return{type:"component",componentType:Ov,interactive:!1,style:{data:(r,n)=>{const a=n.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.scatter)),o=[];return a&&a.length&&a.forEach((r=>{var n,a;const l=r.getRegion().getLayoutStartPoint(),h=r.getRegion().getLayoutRect(),c=e.clamper(l.y,l.y+h.height),d=r.getColorAttribute(),u=r.getSeriesKeys(),p=r.getViewData().latestData,g=null===(n=r.fieldX)||void 0===n?void 0:n[0],m=null===(a=r.fieldY)||void 0===a?void 0:a[0];g&&m&&p&&!(p.length<=2)&&u.forEach((e=>{var n;const a=p.filter((t=>t[null==d?void 0:d.field]===e));if(!a.length)return;const{evaluateGrid:u,confidenceInterval:f}=Rv(t,a,(t=>null==t?void 0:t[g]),(t=>null==t?void 0:t[m]),i.polynomialDegree),v=Math.max(3,Math.floor(a.length/4)),y=u(v),_=f(v);o.push({color:null!=s?s:null===(n=null==d?void 0:d.scale)||void 0===n?void 0:n.scale(e),line:y.map((e=>{const i={[g]:e.x,[m]:e.y};return{x:r.dataToPositionX(i)+l.x,y:c("logisitc"===t?l.y+h.height*(1-e.y):r.dataToPositionY(i)+l.y)}})),area:_.map((t=>{const e={[g]:t.x,[m]:t.lower};return{x:r.dataToPositionX(e)+l.x,y:c(r.dataToPositionY(e)+l.y),y1:c(r.dataToPositionY({[m]:t.upper})+l.y)}}))})}))})),o},line:r,confidenceInterval:n,label:a}}}function Lv(t){const{color:i,line:s,confidenceInterval:r,label:n}=t;return{type:"component",componentType:Ov,interactive:!1,zIndex:500,style:{data:(s,r)=>{const n=r.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.bar)),a=[];return n&&n.length&&n.forEach((s=>{var r,n,o;const l=s.getRegion().getLayoutStartPoint(),h=s.getRegion().getLayoutStartPoint(),c=s.getRegion().getLayoutRect(),d=e.clamper(h.y,h.y+c.height),u=s.getViewData().latestData,p=null===(r=s.fieldX)||void 0===r?void 0:r[0],g=null===(n=s.fieldY)||void 0===n?void 0:n[0],m="horizontal"===s.direction,f=s.getRawDataStatisticsByField(p).values;if(m||!p||!g||!u||u.length<=2||f.length<=2)return;const{evaluateGrid:v,confidenceInterval:y}=e.regressionPolynomial(u,(t=>f.indexOf(null==t?void 0:t[p])),(t=>null==t?void 0:t[g]),{degree:t.degree}),_=f.length,b=v(_),S=y(_),x=s.getXAxisHelper().getBandwidth(0)/2;a.push({color:null!=i?i:null===(o=s.getOption().globalScale.getScale("color"))||void 0===o?void 0:o.scale(s.getSeriesKeys()[0]),line:b.map((t=>{const e={[p]:f[t.x],[g]:t.y};return{x:s.dataToPositionX(e)+l.x+x,y:d(s.dataToPositionY(e)+l.y)}})),area:S.map((t=>{const e={[p]:f[t.x],[g]:t.lower};return{x:s.dataToPositionX(e)+l.x+x,y:d(s.dataToPositionY(e)+l.y),y1:d(s.dataToPositionY({[g]:t.upper})+l.y)}}))})})),a},line:s,confidenceInterval:r,label:n}}}const Fv=(t,i,s)=>{switch(t){case"kde":return e.kde(i,s);case"ecdf":return e.ecdf(i)}};function Nv(t,i){const{line:s,label:r,color:n}=i;return{type:"component",componentType:Ov,interactive:!1,zIndex:500,style:{data:(i,s)=>{const r=s.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.bar)),a=[];return r&&r.length&&r.forEach((i=>{var s,r,o,l,h,c,d,u;const p=i.getRegion().getLayoutStartPoint(),g=i._rawData,m=null==g?void 0:g.rawData,f=null===(r=null===(s=g.transformsArr)||void 0===s?void 0:s.find((t=>"bin"===t.type)))||void 0===r?void 0:r.options,v=null===(o=i.fieldX)||void 0===o?void 0:o[0],y=i.getYAxisHelper().getScale(0),_=i.getViewData().latestData;if(!(m&&m.length&&(null==f?void 0:f.field)&&y&&_&&_.length))return;const b=m.map((t=>t[f.field])),S=Fv(t,b,"kde"===t?{bandwidth:_[0][null!==(h=null===(l=f.outputNames)||void 0===l?void 0:l.x1)&&void 0!==h?h:"x1"]-_[0][null!==(d=null===(c=f.outputNames)||void 0===c?void 0:c.x0)&&void 0!==d?d:"x0"]}:null),x=Math.max(3,Math.floor(b.length/4)),A=S.evaluateGrid(x),T=y.range(),C=T[0],k=e.last(T),w="kde"===t?t=>y.scale(t*m.length*S.bandwidth):t=>C+(k-C)*t;a.push({color:null!=n?n:null===(u=i.getOption().globalScale.getScale("color"))||void 0===u?void 0:u.scale(i.getSeriesKeys()[0]),line:A.map((t=>{const e={[v]:t.x};return{x:i.dataToPositionX(e)+p.x,y:w(t.y)+p.y}}))})})),a},line:s,label:r}}}const Uv="ExtensionMarkSyncStatePlugin";class jv extends e.BasePlugin{constructor(){super(Uv),this.type=Uv}onAfterInitChart(t,i){var s;if(!this._detectSyncState(i))return;const r=t.globalInstance.getChart();if(!r)return;const n=r.getEvent();if(this._subscribedEvent===n)return;null===(s=this._unsubscribeAfterRender)||void 0===s||s.call(this);const a=()=>this._syncStates();n.on(e.ChartEvent.afterRender,a),this._subscribedEvent=n,this._unsubscribeAfterRender=()=>{n.off(e.ChartEvent.afterRender,a),this._subscribedEvent=void 0}}release(){var t;null===(t=this._unsubscribeAfterRender)||void 0===t||t.call(this),super.release()}_detectSyncState(t){const e=null==t?void 0:t.series;return!!(null==e?void 0:e.some((t=>this._hasExtensionMarkWithSyncState(t.extensionMark))))||this._hasExtensionMarkWithSyncState(null==t?void 0:t.extensionMark)}_hasExtensionMarkWithSyncState(t){return!!(null==t?void 0:t.some((t=>"group"!==t.type&&t.syncState)))}_syncStates(){var t;const e=null===(t=this.service)||void 0===t?void 0:t.globalInstance.getChart();e&&e.getAllSeries().forEach((t=>{var e,i;const s=null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.extensionMark)||void 0===i?void 0:i.filter((t=>"group"!==t.type&&t.syncState));(null==s?void 0:s.length)&&this._syncSeriesStates(t,s)}))}_syncSeriesStates(t,i){const s=new Map;if(t.getActiveMarks().forEach((t=>{t.getGraphics().forEach((t=>{var i;const r=null===(i=t.context)||void 0===i?void 0:i.key;e.isValid(r)&&s.set(String(r),t)}))})),0===s.size)return;const r=`${t.type}_${t.id}_extensionMark`;i.forEach(((i,n)=>{const a=e.isValid(i.name)?`${i.name}`:`${r}_${n}`,o=t.getMarkInName(a);o&&o.getGraphics().forEach((t=>{var i;const r=null===(i=t.context)||void 0===i?void 0:i.key;if(!e.isValid(r))return;const n=s.get(String(r));if(!n)return;const a=n.currentStates;(null==a?void 0:a.length)?t.useStates(a):t.clearStates()}))}))}}jv.pluginType="chart",jv.type=Uv;t.BAR_LINK=cv,t.Bar3dChart=Lp,t.Bar3dChartSpecTransformer=K,t.Bar3dSeries=Op,t.Bar3dSeriesSpecTransformer=Ma,t.BarLinkComponent=dv,t.CandlestickChart=Hm,t.CandlestickChartSpecTransformer=Im,t.CandlestickSeries=zm,t.CombinationCandlestickChart=Ym,t.CombinationCandlestickChart_TYPE=Om,t.ConversionFunnelChart=B,t.ConversionFunnelSeries=P,t.DEFAULT_STROKE_COLOR="#000",t.DefaultBandWidth=6,t.ExtensionMarkSyncStatePlugin=jv,t.Funnel3dChart=Hp,t.Funnel3dSeries=zp,t.Funnel3dSeriesSpecTransformer=Np,t.Histogram3dChart=Wp,t.ImageCloudChart=Xf,t.MapLabelComponent=Pv,t.PictogramChart=Nf,t.PictogramChartSpecTransformer=mf,t.PictogramSeries=Lf,t.Pie3dChart=Pm,t.Pie3dChartSpecTransformer=mg,t.Pie3dSeries=Em,t.Pie3dSeriesSpecTransformer=Mm,t.REGRESSION_LINE=Ov,t.RangeColumn3dChart=cf,t.RangeColumn3dChartSpecTransformer=hf,t.RangeColumn3dSeries=af,t.RangeColumn3dSeriesSpecTransformer=lf,t.RankingBar=l,t.RankingList=f,t.RegressionLine=Iv,t.SERIES_BREAK=iv,t.SVG_VIEWPORT_RECT_KEY=vf,t.SequenceScatterKDE=U,t.SequenceScatterLink=R,t.SequenceScatterPixel=z,t.SeriesBreakComponent=rv,t.SeriesLabelComponent=_v,t.TimelineChart=ev,t.WordCloud3dChart=tf,t.WordCloud3dChartSpecTransformer=Qm,t.WordCloud3dSeries=qm,t.appendBarLinkConfig=function(t,i){t.customMark=e.array(t.customMark).filter((t=>t.componentType!==cv)),t.customMark.push(pv(i))},t.appendBarRegressionLineConfig=function(t,i){var s;if(!i){const r=Array.isArray(t.series)?t.series:t.series?[t.series]:[];i=null!==(s=e.get(t,Ov))&&void 0!==s?s:e.get(r.find((t=>t.type===e.SeriesTypeEnum.bar)),Ov)}e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const i=v(e,["visible"]);t.customMark.push(Lv(i))}}))},t.appendHistogramRegressionLineConfig=function(t,i){var s;if(!i){const r=Array.isArray(t.series)?t.series:t.series?[t.series]:[];i=null!==(s=e.get(t,Ov))&&void 0!==s?s:e.get(r.find((t=>t.type===e.SeriesTypeEnum.bar)),Ov)}e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const{type:i}=e,s=v(e,["type"]);t.customMark.push(Nv(i,s))}}))},t.appendScatterRegressionLineConfig=function(t,i){var s;if(!i){const r=Array.isArray(t.series)?t.series:t.series?[t.series]:[];i=null!==(s=e.get(t,Ov))&&void 0!==s?s:e.get(r.find((t=>t.type===e.SeriesTypeEnum.scatter)),Ov)}e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const{type:i}=e,s=v(e,["type"]);t.customMark.push(Dv(i,s))}}))},t.appendSeriesBreakConfig=t=>{var i;if(null===(i=t.axes)||void 0===i?void 0:i.length){const i=t.axes.filter((t=>t.breaks&&t.breaks.length&&!1!==t.visible));if(i.length)return t.customMark=e.array(t.customMark).filter((t=>t.componentType!==iv)),t.customMark.push(av(i,i.map((e=>t.axes.indexOf(e))))),!0}return!1},t.appendSeriesLabelConfig=function(t,i){var s,r,n;if(t.customMark=e.array(t.customMark).filter((t=>t.componentType!==gv)),i||(i=null!==(n=null!==(s=e.get(t,gv))&&void 0!==s?s:e.get(null===(r=t.series)||void 0===r?void 0:r[0],gv))&&void 0!==n?n:{}),i.visible){const{position:e="end"}=i,s=v(i,["position"]);t.customMark.push(yv(e,s))}},t.clearSVGSource=function(){ff.clear(),yf=null},t.getBarLinkConfig=pv,t.getBarRegressionLineConfig=Lv,t.getHistogramRegressionLineConfig=Nv,t.getSVGSource=xf,t.getScatterRegressionLineConfig=Dv,t.getSeriesBreakConfig=av,t.getSeriesLabelConfig=yv,t.register3DPlugin=ka,t.registerAxis3dPlugin=()=>{ka(),Dp(),(()=>{e.registerCartesianBandAxis();const t=e.Factory.getComponentInKey(e.CartesianBandAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},e.CartesianBandAxis.builtInTheme.axisX),sf)}),e.mixin(t,rf)})(),(()=>{e.registerCartesianLinearAxis();const t=e.Factory.getComponentInKey(e.CartesianLinearAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},e.CartesianLinearAxis.builtInTheme.axisX),sf)}),e.mixin(t,rf)})(),(()=>{e.registerCartesianTimeAxis();const t=e.Factory.getComponentInKey(e.CartesianTimeAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},t.builtInTheme.axisX),sf)}),e.mixin(t,rf)})(),(()=>{e.registerCartesianLogAxis();const t=e.Factory.getComponentInKey(e.CartesianSymlogAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},t.builtInTheme.axisX),sf)}),e.mixin(t,rf)})(),(()=>{e.registerCartesianLogAxis();const t=e.Factory.getComponentInKey(e.CartesianLogAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},e.CartesianLogAxis.builtInTheme.axisX),sf)}),e.mixin(t,rf)})()},t.registerBar3dChart=()=>{ka(),Dp(),Ip(),e.Factory.registerChart(Lp.type,Lp)},t.registerBar3dSeries=Ip,t.registerBarLink=()=>{e.Factory.registerGraphicComponent(cv,(t=>new dv(t)))},t.registerCandlestickChart=()=>{e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),Km(),e.Factory.registerChart(Hm.type,Hm)},t.registerCandlestickSeries=Km,t.registerCombinationCandlestickChart=()=>{Km(),e.Factory.registerChart(Ym.type,Ym)},t.registerConversionFunnelChart=t=>{e.registerMarkFilterTransform();const i=(null==t?void 0:t.VChart)||e.VChart;i&&(i.useChart([B]),i.useSeries([P]))},t.registerEventSeries=tv,t.registerExtensionMarkSyncStatePlugin=()=>{e.registerChartPlugin(jv)},t.registerFunnel3dChart=()=>{e.registerMarkTooltipProcessor(),ka(),Dp(),Kp(),e.Factory.registerChart(Hp.type,Hp)},t.registerFunnel3dSeries=Kp,t.registerHistogram3dChart=()=>{e.registerGroupTooltipProcessor(),e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),ka(),Dp(),Ip(),e.Factory.registerChart(Wp.type,Wp)},t.registerImageCloudChart=()=>{Yf(),e.Factory.registerChart(Xf.type,Xf)},t.registerMapLabel=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useComponent([Pv])},t.registerPictogramChart=()=>{e.registerMarkTooltipProcessor(),Ff(),e.Factory.registerChart(Nf.type,Nf)},t.registerPictogramSeries=Ff,t.registerPie3dChart=()=>{xp(),Aa.registerTooltipProcessor("mark",Eg),ka(),Dp(),Bm(),Aa.registerChart(Pm.type,Pm)},t.registerPie3dSeries=Bm,t.registerRangeColumn3dChart=()=>{e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),ka(),Dp(),of(),e.Factory.registerChart(cf.type,cf)},t.registerRangeColumn3dSeries=of,t.registerRankingBarChart=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([l])},t.registerRankingList=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([f,e.BarChart])},t.registerRegressionLine=()=>{e.Factory.registerGraphicComponent(Ov,(t=>new Iv(t)))},t.registerSVGSource=bf,t.registerSequenceScatterKDE=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([U,e.ScatterChart])},t.registerSequenceScatterLink=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([R,e.ScatterChart])},t.registerSequenceScatterPixel=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([z,e.ScatterChart])},t.registerSeriesBreak=()=>{e.Factory.registerGraphicComponent("seriesBreak",(t=>new rv(t)))},t.registerSeriesLabel=()=>{e.Factory.registerGraphicComponent("seriesLabel",(t=>new _v(t)))},t.registerTimelineChart=()=>{e.registerMarkTooltipProcessor(),tv(),e.Factory.registerChart(ev.type,ev)},t.registerWordCloud3dChart=ef,t.registerWordCloud3dSeries=Zm,t.registerWordCloudShape3dChart=()=>{ka(),Jm(),ef()},t.registerWordCloudShape3dSeries=Jm,t.svgSourceMap=ff,t.transformCandlestickSeriesSpec=Wm,t.unregisterSVGSource=Sf}));
|