visactor-C6yu58Ir.js 1.8 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import{g as dC,R as Ki,r as ss}from"./react-core-DtMAePju.js";var uC={exports:{}},pt={};/**
  2. * @license React
  3. * react-is.production.min.js
  4. *
  5. * Copyright (c) Facebook, Inc. and its affiliates.
  6. *
  7. * This source code is licensed under the MIT license found in the
  8. * LICENSE file in the root directory of this source tree.
  9. */var hx=Symbol.for("react.element"),dx=Symbol.for("react.portal"),Kg=Symbol.for("react.fragment"),qg=Symbol.for("react.strict_mode"),Zg=Symbol.for("react.profiler"),Jg=Symbol.for("react.provider"),Qg=Symbol.for("react.context"),NI=Symbol.for("react.server_context"),e_=Symbol.for("react.forward_ref"),t_=Symbol.for("react.suspense"),i_=Symbol.for("react.suspense_list"),n_=Symbol.for("react.memo"),s_=Symbol.for("react.lazy"),UI=Symbol.for("react.offscreen"),cC;cC=Symbol.for("react.module.reference");function Zn(n){if(typeof n=="object"&&n!==null){var e=n.$$typeof;switch(e){case hx:switch(n=n.type,n){case Kg:case Zg:case qg:case t_:case i_:return n;default:switch(n=n&&n.$$typeof,n){case NI:case Qg:case e_:case s_:case n_:case Jg:return n;default:return e}}case dx:return e}}}pt.ContextConsumer=Qg;pt.ContextProvider=Jg;pt.Element=hx;pt.ForwardRef=e_;pt.Fragment=Kg;pt.Lazy=s_;pt.Memo=n_;pt.Portal=dx;pt.Profiler=Zg;pt.StrictMode=qg;pt.Suspense=t_;pt.SuspenseList=i_;pt.isAsyncMode=function(){return!1};pt.isConcurrentMode=function(){return!1};pt.isContextConsumer=function(n){return Zn(n)===Qg};pt.isContextProvider=function(n){return Zn(n)===Jg};pt.isElement=function(n){return typeof n=="object"&&n!==null&&n.$$typeof===hx};pt.isForwardRef=function(n){return Zn(n)===e_};pt.isFragment=function(n){return Zn(n)===Kg};pt.isLazy=function(n){return Zn(n)===s_};pt.isMemo=function(n){return Zn(n)===n_};pt.isPortal=function(n){return Zn(n)===dx};pt.isProfiler=function(n){return Zn(n)===Zg};pt.isStrictMode=function(n){return Zn(n)===qg};pt.isSuspense=function(n){return Zn(n)===t_};pt.isSuspenseList=function(n){return Zn(n)===i_};pt.isValidElementType=function(n){return typeof n=="string"||typeof n=="function"||n===Kg||n===Zg||n===qg||n===t_||n===i_||n===UI||typeof n=="object"&&n!==null&&(n.$$typeof===s_||n.$$typeof===n_||n.$$typeof===Jg||n.$$typeof===Qg||n.$$typeof===e_||n.$$typeof===cC||n.getModuleId!==void 0)};pt.typeOf=Zn;uC.exports=pt;var $I=uC.exports;const YI=n=>n;var Yt;(function(n){n["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx"})(Yt||(Yt={}));var X;(function(n){n.cartesianAxis="cartesianAxis",n.cartesianBandAxis="cartesianAxis-band",n.cartesianLinearAxis="cartesianAxis-linear",n.cartesianTimeAxis="cartesianAxis-time",n.cartesianLogAxis="cartesianAxis-log",n.cartesianSymlogAxis="cartesianAxis-symlog",n.polarAxis="polarAxis",n.polarBandAxis="polarAxis-band",n.polarLinearAxis="polarAxis-linear",n.crosshair="crosshair",n.cartesianCrosshair="cartesianCrosshair",n.polarCrosshair="polarCrosshair",n.dataZoom="dataZoom",n.geoCoordinate="geoCoordinate",n.indicator="indicator",n.discreteLegend="discreteLegend",n.continuousLegend="continuousLegend",n.colorLegend="colorLegend",n.sizeLegend="sizeLegend",n.mapLabel="mapLabel",n.markLine="markLine",n.markArea="markArea",n.markPoint="markPoint",n.tooltip="tooltip",n.title="title",n.player="player",n.scrollBar="scrollBar",n.label="label",n.totalLabel="totalLabel",n.brush="brush",n.poptip="poptip",n.customMark="customMark"})(X||(X={}));var fC={exports:{}};(function(n){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function s(l,h,d){this.fn=l,this.context=h,this.once=d||!1}function r(l,h,d,u,c){if(typeof d!="function")throw new TypeError("The listener must be a function");var f=new s(d,u||l,c),p=t?t+h:h;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],f]:l._events[p].push(f):(l._events[p]=f,l._eventsCount++),l}function a(l,h){--l._eventsCount===0?l._events=new i:delete l._events[h]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var h=[],d,u;if(this._eventsCount===0)return h;for(u in d=this._events)e.call(d,u)&&h.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(d)):h},o.prototype.listeners=function(h){var d=t?t+h:h,u=this._events[d];if(!u)return[];if(u.fn)return[u.fn];for(var c=0,f=u.length,p=new Array(f);c<f;c++)p[c]=u[c].fn;return p},o.prototype.listenerCount=function(h){var d=t?t+h:h,u=this._events[d];return u?u.fn?1:u.length:0},o.prototype.emit=function(h,d,u,c,f,p){var g=t?t+h:h;if(!this._events[g])return!1;var _=this._events[g],m=arguments.length,y,b;if(_.fn){switch(_.once&&this.removeListener(h,_.fn,void 0,!0),m){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,d),!0;case 3:return _.fn.call(_.context,d,u),!0;case 4:return _.fn.call(_.context,d,u,c),!0;case 5:return _.fn.call(_.context,d,u,c,f),!0;case 6:return _.fn.call(_.context,d,u,c,f,p),!0}for(b=1,y=new Array(m-1);b<m;b++)y[b-1]=arguments[b];_.fn.apply(_.context,y)}else{var v=_.length,x;for(b=0;b<v;b++)switch(_[b].once&&this.removeListener(h,_[b].fn,void 0,!0),m){case 1:_[b].fn.call(_[b].context);break;case 2:_[b].fn.call(_[b].context,d);break;case 3:_[b].fn.call(_[b].context,d,u);break;case 4:_[b].fn.call(_[b].context,d,u,c);break;default:if(!y)for(x=1,y=new Array(m-1);x<m;x++)y[x-1]=arguments[x];_[b].fn.apply(_[b].context,y)}}return!0},o.prototype.on=function(h,d,u){return r(this,h,d,u,!1)},o.prototype.once=function(h,d,u){return r(this,h,d,u,!0)},o.prototype.removeListener=function(h,d,u,c){var f=t?t+h:h;if(!this._events[f])return this;if(!d)return a(this,f),this;var p=this._events[f];if(p.fn)p.fn===d&&(!c||p.once)&&(!u||p.context===u)&&a(this,f);else{for(var g=0,_=[],m=p.length;g<m;g++)(p[g].fn!==d||c&&!p[g].once||u&&p[g].context!==u)&&_.push(p[g]);_.length?this._events[f]=_.length===1?_[0]:_:a(this,f)}return this},o.prototype.removeAllListeners=function(h){var d;return h?(d=t?t+h:h,this._events[d]&&a(this,d)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,n.exports=o})(fC);var XI=fC.exports;const po=dC(XI),mh=(n,e)=>Object.prototype.toString.call(n)===`[object ${e}]`,ht=(n,e=!1)=>e?typeof n=="boolean":n===!0||n===!1||mh(n,"Boolean"),Y=n=>typeof n=="function",C=n=>n==null,P=n=>n!=null,He=n=>{const e=typeof n;return n!==null&&e==="object"||e==="function"},Iy=n=>typeof n=="object"&&n!==null,_s=function(n){if(!Iy(n)||!mh(n,"Object"))return!1;if(Object.getPrototypeOf(n)===null)return!0;let e=n;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(n)===e},bt=n=>n===void 0,ae=(n,e=!1)=>{const t=typeof n;return e?t==="string":t==="string"||mh(n,"String")},W=n=>Array.isArray?Array.isArray(n):mh(n,"Array"),r_=function(n){return n!==null&&typeof n!="function"&&Number.isFinite(n.length)},KI=n=>mh(n,"Date"),oe=(n,e=!1)=>{const t=typeof n;return e?t==="number":t==="number"||mh(n,"Number")},qI=n=>typeof n=="string"&&!isNaN(Number(n))&&!isNaN(parseFloat(n)),j=n=>oe(n)&&Number.isFinite(n),pC=n=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(n),gC=n=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(n),ZI=n=>({}).toString.call(n).replace(/^\[object /,"").replace(/]$/,""),JI=Object.prototype,QI=function(n){const e=n&&n.constructor;return n===(typeof e=="function"&&e.prototype||JI)},eD=Object.prototype.hasOwnProperty;function fe(n){if(C(n))return!0;if(r_(n))return!n.length;const e=ZI(n);if(e==="Map"||e==="Set")return!n.size;if(QI(n))return!Object.keys(n).length;for(const t in n)if(eD.call(n,t))return!1;return!0}const Te=(n,e,t)=>{const i=ae(e)?e.split("."):e;for(let s=0;s<i.length;s++)n=n?n[i[s]]:void 0;return n===void 0?t:n},tD=Object.prototype.hasOwnProperty,Fn=(n,e)=>n!=null&&tD.call(n,e);function ri(n){let e;if(!P(n)||typeof n!="object")return n;const t=W(n),i=n.length;e=t?new Array(i):typeof n=="object"?{}:ht(n)||oe(n)||ae(n)?n:KI(n)?new Date(+n):void 0;const s=t?void 0:Object.keys(Object(n));let r=-1;if(e)for(;++r<(s||n).length;){const a=s?s[r]:r,o=n[a];e[a]=ri(o)}return e}function _C(n,e,t=!1){if(e){if(n===e)return;if(P(e)&&typeof e=="object"){const i=Object(e),s=[];for(const o in i)s.push(o);let{length:r}=s,a=-1;for(;r--;){const o=s[++a];P(i[o])&&typeof i[o]=="object"?iD(n,e,o,t):mC(n,o,i[o])}}}}function iD(n,e,t,i=!1){const s=n[t],r=e[t];let a=e[t],o=!0;if(W(r)){if(i)a=[];else if(W(s))a=s;else if(r_(s)){a=new Array(s.length);let l=-1;const h=s.length;for(;++l<h;)a[l]=s[l]}}else _s(r)?(a=s,typeof s!="function"&&typeof s=="object"||(a={})):o=!1;o&&_C(a,r,i),mC(n,t,a)}function mC(n,e,t){(t!==void 0&&!nD(n[e],t)||t===void 0&&!(e in n))&&(n[e]=t)}function nD(n,e){return n===e||Number.isNaN(n)&&Number.isNaN(e)}function re(n,...e){let t=-1;const i=e.length;for(;++t<i;)_C(n,e[t],!0);return n}function Nl(n,e){if(!n||!_s(n))return n;const t={};return Object.keys(n).forEach(i=>{const s=n[i];let r=!1;e.forEach(a=>{(ae(a)&&a===i||a instanceof RegExp&&i.match(a))&&(r=!0)}),r||(t[i]=s)}),t}function vS(n){return Object.prototype.toString.call(n)}function xS(n){return Object.keys(n)}function ft(n,e,t){if(n===e)return!0;if(typeof n!=typeof e||n==null||e==null)return!1;if(Number.isNaN(n)&&Number.isNaN(e))return!0;if(vS(n)!==vS(e))return!1;if(Y(n))return!!(t!=null&&t.skipFunction);if(typeof n!="object")return!1;if(W(n)){if(n.length!==e.length)return!1;for(let r=n.length-1;r>=0;r--)if(!ft(n[r],e[r],t))return!1;return!0}if(!_s(n))return!1;const i=xS(n),s=xS(e);if(i.length!==s.length)return!1;i.sort(),s.sort();for(let r=i.length-1;r>=0;r--)if(i[r]!=s[r])return!1;for(let r=i.length-1;r>=0;r--){const a=i[r];if(!ft(n[a],e[a],t))return!1}return!0}function sD(n){if(!n)return[];if(Object.keys)return Object.keys(n);const e=[];for(const t in n)n.hasOwnProperty(t)&&e.push(t);return e}function rD(n,e,t){const i=sD(e);for(let s=0;s<i.length;s++){const r=i[s];(t?e[r]!=null:n[r]==null)&&(n[r]=e[r])}return n}function li(n,e,t=!0){if(n="prototype"in n?n.prototype:n,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const i=Object.getOwnPropertyNames(e);for(let s=0;s<i.length;s++){const r=i[s];r!=="constructor"&&(t?e[r]!=null:n[r]==null)&&(n[r]=e[r])}}else rD(n,e,t)}function N(n){return P(n)?W(n)?n:[n]:[]}function ra(n){if(r_(n))return n[n.length-1]}const Vt=(n,e)=>{var t;if(n.length===0)return;let i=n[0];for(let s=1;s<n.length;s++){const r=n[s];((t=e==null?void 0:e(r,i))!==null&&t!==void 0?t:r-i>0)&&(i=r)}return i},hi=(n,e)=>{var t;if(n.length===0)return;let i=n[0];for(let s=1;s<n.length;s++){const r=n[s];((t=e==null?void 0:e(r,i))!==null&&t!==void 0?t:r-i<0)&&(i=r)}return i};function dc(n,e){if(!W(n)||!W(e)||n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function aD(n){return n&&W(n)?Array.from(new Set(N(n))):n}function yC(n,e=Math.random){let t,i,s=n.length;for(;s;)t=Math.floor(e()*s),i=n[--s],n[s]=n[t],n[t]=i;return n}function Dy(n){if(!W(n))return[n];const e=[];for(const t of n)e.push(...Dy(t));return e}function bC(n,e,t){P(e)||(e=n,n=0),P(t)||(t=1);let i=-1;const s=0|Math.max(0,Math.ceil((e-n)/t)),r=new Array(s);for(;++i<s;)r[i]=n+i*t;return r}function vC(n,e){return n<e?-1:n>e?1:n>=e?0:NaN}function Ds(n){return Number(n)}function oD(n,e,t=Ds){const i=n.length;if(!i)return;if(i<2)return t(n[0],0,n);const s=(i-1)*e,r=Math.floor(s),a=t(n[r],r,n);return a+(t(n[r+1],r+1,n)-a)*(s-r)}function xC(n,e,t=0,i){for(C(i)&&(i=n.length);t<i;){const s=t+i>>>1;vC(n[s],e)>0?i=s:t=s+1}return t}const lD=(n,e)=>{let t=n;return t=n.sort(vC),oD(t,.5)},hD=1e-10,dD=1e-10;function Qi(n,e,t=dD,i=hD){const s=i,r=t*Math.max(n,e);return Math.abs(n-e)<=Math.max(s,r)}function Ts(n,e,t,i){return n>e&&!Qi(n,e,t,i)}function rs(n,e,t,i){return n<e&&!Qi(n,e,t,i)}const yh=n=>{let e=null,t=null;return(...i)=>(e&&i.every((s,r)=>s===e[r])||(e=i,t=n(...i)),t)},ai=function(n,e,t){return n<e?e:n>t?t:n},Ir=(n,e,t)=>{let[i,s]=n;s<i&&(i=n[1],s=n[0]);const r=s-i;return r>=t-e?[e,t]:(i=Math.min(Math.max(i,e),t-r),[i,i+r])};function ux(n,e){let t;return n>e&&(t=n,n=e,e=t),i=>Math.max(n,Math.min(e,i))}let Sf=!1;try{Sf=typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"}catch{Sf=!1}function Us(n,e,t){let i,s,r,a,o,l,h=0,d=!1,u=!1,c=!0;const f=!e&&e!==0&&Sf;if(typeof n!="function")throw new TypeError("Expected a function");function p(v){const x=i,S=s;return i=s=void 0,h=v,a=n.apply(S,x),a}function g(v,x){return f?(cancelAnimationFrame(o),requestAnimationFrame(v)):setTimeout(v,x)}function _(v){const x=v-l;return l===void 0||x>=e||x<0||u&&v-h>=r}function m(){const v=Date.now();if(_(v))return y(v);o=g(m,function(x){const S=x-h,A=e-(x-l);return u?Math.min(A,r-S):A}(v))}function y(v){return o=void 0,c&&i?p(v):(i=s=void 0,a)}function b(...v){const x=Date.now(),S=_(x);if(i=v,s=this,l=x,S){if(o===void 0)return function(A){return h=A,o=g(m,e),d?p(A):a}(l);if(u)return o=g(m,e),p(l)}return o===void 0&&(o=g(m,e)),a}return e=+e||0,He(t)&&(d=!!t.leading,u="maxWait"in t,u&&(r=Math.max(j(t.maxWait)?t.maxWait:0,e)),c="trailing"in t?!!t.trailing:c),b.cancel=function(){o!==void 0&&function(v){if(f)return cancelAnimationFrame(v);clearTimeout(v)}(o),h=0,i=l=s=o=void 0},b.flush=function(){return o===void 0?a:y(Date.now())},b.pending=function(){return o!==void 0},b}Sf=!1;function Ta(n,e,t){let i=!0,s=!0;if(typeof n!="function")throw new TypeError("Expected a function");return He(t)&&(i="leading"in t?!!t.leading:i,s="trailing"in t?!!t.trailing:s),Us(n,e,{leading:i,trailing:s,maxWait:e})}function rd(n,e){return t=>n*(1-t)+e*t}function uD(n,e){return function(t){return Math.round(n*(1-t)+e*t)}}function cD(n,e){const t=n.valueOf(),i=e.valueOf(),s=new Date;return r=>(s.setTime(t*(1-r)+i*r),s)}const Fy=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Am=new RegExp(Fy.source,"g");function fD(n){return function(){return n}}function pD(n){return function(e){return n(e)+""}}function gD(n,e){let t,i,s,r=Fy.lastIndex=Am.lastIndex=0,a=-1;const o=[],l=[];for(n+="",e+="";(t=Fy.exec(n))&&(i=Am.exec(e));)(s=i.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(t=t[0])===(i=i[0])?o[a]?o[a]+=i:o[++a]=i:(o[++a]=null,l.push({i:a,x:rd(t,i)})),r=Am.lastIndex;return r<e.length&&(s=e.slice(r),o[a]?o[a]+=s:o[++a]=s),o.length<2?l[0]?pD(l[0].x):fD(e):(e=l.length,function(h){for(let d,u=0;u<e;++u)o[(d=l[u]).i]=d.x(h);return o.join("")})}function _D(n,e){return n&&e?n.replace(/\\?\{([^{}]+)\}/g,(t,i)=>t.charAt(0)==="\\"?t.slice(1):e[i]===void 0?"":e[i]):n}const Qe=1e-12,et=Math.PI,zn=et/2,ei=2*et,Be=2*Math.PI,Ve=Math.abs,it=Math.atan2,nt=Math.cos,Ji=Math.max,gi=Math.min,Ze=Math.sin,en=Math.sqrt,Ao=Math.pow;function SC(n){return n>1?0:n<-1?et:Math.acos(n)}function SS(n){return n>=1?zn:n<=-1?-zn:Math.asin(n)}function AS(n,e,t,i,s){let r,a;return typeof n=="number"&&typeof t=="number"&&(r=(1-s)*n+s*t),typeof e=="number"&&typeof i=="number"&&(a=(1-s)*e+s*i),{x:r,y:a}}function kS(n,e){return n[0]*e[1]-n[1]*e[0]}function mD(n,e){return Ve(n[0]-e[0])+Ve(n[1]-e[1])<1e-12}function AC(n,e=10){return Math.round(n*e)/e}function Ul(n){const e=n.toString().split(/[eE]/),t=(e[0].split(".")[1]||"").length-(+e[1]||0);return t>0?t:0}function zy(n,e){return AC(n+e,10**Math.max(Ul(n),Ul(e)))}function yD(n,e){return AC(n-e,10**Math.max(Ul(n),Ul(e)))}class Et{constructor(e=0,t=0,i,s){this.x=0,this.y=0,this.x=e,this.y=t,this.x1=i,this.y1=s}clone(){return new Et(this.x,this.y)}copyFrom(e){return this.x=e.x,this.y=e.y,this.x1=e.x1,this.y1=e.y1,this.defined=e.defined,this.context=e.context,this}set(e,t){return this.x=e,this.y=t,this}add(e){return oe(e)?(this.x+=e,void(this.y+=e)):(this.x+=e.x,this.y+=e.y,this)}sub(e){return oe(e)?(this.x-=e,void(this.y-=e)):(this.x-=e.x,this.y-=e.y,this)}multi(e){throw new Error("暂不支持")}div(e){throw new Error("暂不支持")}}class wt{static distancePP(e,t){return en(Ao(e.x-t.x,2)+Ao(e.y-t.y,2))}static distanceNN(e,t,i,s){return en(Ao(e-i,2)+Ao(t-s,2))}static distancePN(e,t,i){return en(Ao(t-e.x,2)+Ao(i-e.y,2))}static pointAtPP(e,t,i){return new Et((t.x-e.x)*i+e.x,(t.y-e.y)*i+e.y)}}function jy(n,e,t){const{x1:i,y1:s,x2:r,y2:a}=e;return t.onlyTranslate()?(n!==e&&n.setValue(e.x1,e.y1,e.x2,e.y2),n.translate(t.e,t.f),e):(n.clear(),n.add(t.a*i+t.c*s+t.e,t.b*i+t.d*s+t.f),n.add(t.a*r+t.c*s+t.e,t.b*r+t.d*s+t.f),n.add(t.a*r+t.c*a+t.e,t.b*r+t.d*a+t.f),n.add(t.a*i+t.c*a+t.e,t.b*i+t.d*a+t.f),e)}class _i{constructor(e){e?this.setValue(e.x1,e.y1,e.x2,e.y2):this.clear()}clone(){return new _i(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2}setValue(e=0,t=0,i=0,s=0){return this.x1=e,this.y1=t,this.x2=i,this.y2=s,this}set(e=0,t=0,i=0,s=0){return i<e?(this.x2=e,this.x1=i):(this.x1=e,this.x2=i),s<t?(this.y2=t,this.y1=s):(this.y1=t,this.y2=s),this}add(e=0,t=0){return e<this.x1&&(this.x1=e),t<this.y1&&(this.y1=t),e>this.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this}expand(e=0){return W(e)?(this.y1-=e[0],this.x2+=e[1],this.y2+=e[2],this.x1-=e[3]):(this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(e=0,t=0){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this}rotate(e=0,t=0,i=0){const s=this.rotatedPoints(e,t,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(e=0,t=0,i=0,s=0){const r=this.scalePoints(e,t,i,s);return this.clear().add(r[0],r[1]).add(r[2],r[3])}union(e){return e.x1<this.x1&&(this.x1=e.x1),e.y1<this.y1&&(this.y1=e.y1),e.x2>this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this}intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2<this.x2&&(this.x2=e.x2),e.y2<this.y2&&(this.y2=e.y2),this}encloses(e){return e&&this.x1<=e.x1&&this.x2>=e.x2&&this.y1<=e.y1&&this.y2>=e.y2}alignsWith(e){return e&&(this.x1===e.x1||this.x2===e.x2||this.y1===e.y1||this.y2===e.y2)}intersects(e){return e&&!(this.x2<e.x1||this.x1>e.x2||this.y2<e.y1||this.y1>e.y2)}contains(e=0,t=0){return!(e<this.x1||e>this.x2||t<this.y1||t>this.y2)}containsPoint(e){return!(e.x<this.x1||e.x>this.x2||e.y<this.y1||e.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(e=0){return this.x1*=e,this.x2*=e,this}scaleY(e=0){return this.y1*=e,this.y2*=e,this}transformWithMatrix(e){return jy(this,this,e),this}copy(e){return this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2,this}rotatedPoints(e,t,i){const{x1:s,y1:r,x2:a,y2:o}=this,l=Math.cos(e),h=Math.sin(e),d=t-t*l+i*h,u=i-t*h-i*l;return[l*s-h*r+d,h*s+l*r+u,l*s-h*o+d,h*s+l*o+u,l*a-h*r+d,h*a+l*r+u,l*a-h*o+d,h*a+l*o+u]}scalePoints(e,t,i,s){const{x1:r,y1:a,x2:o,y2:l}=this;return[e*r+(1-e)*i,t*a+(1-t)*s,e*o+(1-e)*i,t*l+(1-t)*s]}}class St extends _i{}function st(n){return n*(Math.PI/180)}function $l(n){return 180*n/Math.PI}const bD=(n=0)=>{if(n<0)for(;n<-ei;)n+=ei;else if(n>0)for(;n>ei;)n-=ei;return n},vD=bD;function as(n,e,t){return{x:n.x+e*Math.cos(t),y:n.y+e*Math.sin(t)}}function Af(n,e){return Math.atan2(e.y-n.y,e.x-n.x)}class Ft{constructor(e=1,t=0,i=0,s=1,r=0,a=0){this.a=e,this.b=t,this.c=i,this.d=s,this.e=r,this.f=a}equalToMatrix(e){return!(this.e!==e.e||this.f!==e.f||this.a!==e.a||this.d!==e.d||this.b!==e.b||this.c!==e.c)}equalTo(e,t,i,s,r,a){return!(this.e!==r||this.f!==a||this.a!==e||this.d!==s||this.b!==t||this.c!==i)}setValue(e,t,i,s,r,a){return this.a=e,this.b=t,this.c=i,this.d=s,this.e=r,this.f=a,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const e=this.a,t=this.b,i=this.c,s=this.d,r=this.e,a=this.f,o=new Ft,l=e*s-t*i;return o.a=s/l,o.b=-t/l,o.c=-i/l,o.d=e/l,o.e=(i*a-s*r)/l,o.f=-(e*a-t*r)/l,o}rotate(e){const t=Math.cos(e),i=Math.sin(e),s=this.a*t+this.c*i,r=this.b*t+this.d*i,a=this.a*-i+this.c*t,o=this.b*-i+this.d*t;return this.a=s,this.b=r,this.c=a,this.d=o,this}rotateByCenter(e,t,i){const s=Math.cos(e),r=Math.sin(e),a=(1-s)*t+r*i,o=(1-s)*i-r*t,l=s*this.a-r*this.b,h=r*this.a+s*this.b,d=s*this.c-r*this.d,u=r*this.c+s*this.d,c=s*this.e-r*this.f+a,f=r*this.e+s*this.f+o;return this.a=l,this.b=h,this.c=d,this.d=u,this.e=c,this.f=f,this}scale(e,t){return this.a*=e,this.b*=e,this.c*=t,this.d*=t,this}setScale(e,t){return this.b=this.b/this.a*e,this.c=this.c/this.d*t,this.a=e,this.d=t,this}transform(e,t,i,s,r,a){return this.multiply(e,t,i,s,r,a),this}translate(e,t){return this.e+=this.a*e+this.c*t,this.f+=this.b*e+this.d*t,this}transpose(){const{a:e,b:t,c:i,d:s,e:r,f:a}=this;return this.a=t,this.b=e,this.c=s,this.d=i,this.e=a,this.f=r,this}multiply(e,t,i,s,r,a){const o=this.a,l=this.b,h=this.c,d=this.d,u=o*e+h*t,c=l*e+d*t,f=o*i+h*s,p=l*i+d*s,g=o*r+h*a+this.e,_=l*r+d*a+this.f;return this.a=u,this.b=c,this.c=f,this.d=p,this.e=g,this.f=_,this}interpolate(e,t){const i=new Ft;return i.a=this.a+(e.a-this.a)*t,i.b=this.b+(e.b-this.b)*t,i.c=this.c+(e.c-this.c)*t,i.d=this.d+(e.d-this.d)*t,i.e=this.e+(e.e-this.e)*t,i.f=this.f+(e.f-this.f)*t,i}transformPoint(e,t){const{a:i,b:s,c:r,d:a,e:o,f:l}=this,h=i*a-s*r,d=a/h,u=-s/h,c=-r/h,f=i/h,p=(r*l-a*o)/h,g=-(i*l-s*o)/h,{x:_,y:m}=e;t.x=_*d+m*c+p,t.y=_*u+m*f+g}onlyTranslate(e=1){return this.a===e&&this.b===0&&this.c===0&&this.d===e}clone(){return new Ft(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const e=this.a,t=this.b,i=this.c,s=this.d,r=e*s-t*i,a={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!==0||t!==0){const o=Math.sqrt(e*e+t*t);a.rotateDeg=t>0?Math.acos(e/o):-Math.acos(e/o),a.scaleX=o,a.scaleY=r/o,a.skewX=(e*i+t*s)/r,a.skewY=0}else if(i!==0||s!==0){const o=Math.sqrt(i*i+s*s);a.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/o):-Math.acos(i/o)),a.scaleX=r/o,a.scaleY=o,a.skewX=0,a.skewY=(e*i+t*s)/r}return a.rotateDeg=$l(a.rotateDeg),a}}function xD(n,e,t,i,s,r,a,o){const l=e.a,h=e.b,d=e.c,u=e.d,c=e.e,f=e.f,p=nt(a),g=Ze(a);let _,m;o?(_=o[0],m=o[1]):(_=t,m=i);const y=_-t,b=m-i,v=l*p+d*g,x=h*p+u*g,S=d*p-l*g,A=u*p-h*g;n.a=s*v,n.b=s*x,n.c=r*S,n.d=r*A,n.e=c+l*_+d*m-v*y-S*b,n.f=f+h*_+u*m-x*y-A*b}class SD{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(e,t){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:r=this.R_COUNT}=t;if(e.size<i)return 0;let a=0;const o=h=>{a++,e.delete(h)},l=Date.now();return e.forEach((h,d)=>{if(h.timestamp.length<r)return o(d);let u=0;for(;l-h.timestamp[h.timestamp.length-1-u]<s&&(u++,!(u>=r)););if(u<r)return o(d);for(;l-h.timestamp[0]>s;)h.timestamp.shift()}),a}addLimitedTimestamp(e,t,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;e.timestamp.length>s&&e.timestamp.shift(),e.timestamp.push(t)}clearTimeStamp(e,t){const{L_TIME:i=this.L_TIME}=t,s=Date.now();e.forEach(r=>{for(;s-r.timestamp[0]>i;)r.timestamp.shift()})}clearItemTimestamp(e,t){const{L_TIME:i=this.L_TIME}=t,s=Date.now();for(;s-e.timestamp[0]>i;)e.timestamp.shift()}}function kf(n,e,t){e/=100,t/=100;const i=(1-Math.abs(2*t-1))*e,s=i*(1-Math.abs(n/60%2-1)),r=t-i/2;let a=0,o=0,l=0;return 0<=n&&n<60?(a=i,o=s,l=0):60<=n&&n<120?(a=s,o=i,l=0):120<=n&&n<180?(a=0,o=i,l=s):180<=n&&n<240?(a=0,o=s,l=i):240<=n&&n<300?(a=s,o=0,l=i):300<=n&&n<360&&(a=i,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function a_(n,e,t){n/=255,e/=255,t/=255;const i=Math.min(n,e,t),s=Math.max(n,e,t),r=s-i;let a=0,o=0,l=0;return a=r===0?0:s===n?(e-t)/r%6:s===e?(t-n)/r+2:(n-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+i)/2,o=r===0?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l}}const wS=/^#([0-9a-f]{3,8})$/,MS={transparent:4294967040},af={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function uc(n){return((n=Math.max(0,Math.min(255,Math.round(n)||0)))<16?"0":"")+n.toString(16)}function km(n){return oe(n)?new Si(n>>16,n>>8&255,255&n,1):W(n)?new Si(n[0],n[1],n[2]):new Si(255,255,255)}function AD(n){return oe(n)?new Si(n>>>24,n>>>16&255,n>>>8&255,255&n):W(n)?new Si(n[0],n[1],n[2],n[3]):new Si(255,255,255,1)}function wm(n){return n<.04045?.0773993808*n:Math.pow(.9478672986*n+.0521327014,2.4)}function Mm(n){return n<.0031308?12.92*n:1.055*Math.pow(n,.41666)-.055}class Gt{static Brighter(e,t=1){return t===1?e:new Gt(e).brighter(t).toRGBA()}static SetOpacity(e,t=1){return t===1?e:new Gt(e).setOpacity(t).toRGBA()}static getColorBrightness(e,t="hsl"){const i=e instanceof Gt?e:new Gt(e);switch(t){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(e){if(P(MS[e]))return AD(MS[e]);if(P(af[e]))return km(af[e]);const t=`${e}`.trim().toLowerCase(),i=wS.exec(t);if(i){const s=parseInt(i[1],16),r=i[1].length;return r===3?new Si((s>>8&15)+((s>>8&15)<<4),(s>>4&15)+((s>>4&15)<<4),(15&s)+((15&s)<<4),1):r===6?km(s):r===8?new Si(s>>24&255,s>>16&255,s>>8&255,(255&s)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(t)){const s=t.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Si(parseInt(s[0],10),parseInt(s[1],10),parseInt(s[2],10),parseFloat(s[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(t)){const s=t.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),r=kf(parseInt(s[0],10),parseInt(s[1],10),parseInt(s[2],10));return new Si(r.r,r.g,r.b,parseFloat(s[3]))}}constructor(e){const t=Gt.parseColorString(e);t?this.color=t:(console.warn(`Warn: 传入${e}无法解析为Color`),this.color=new Si(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(e){const{r:t,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(t*e))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*e))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*e))),this}add(e){const{r:t,g:i,b:s}=this.color;return this.color.r+=Math.min(255,t+e.color.r),this.color.g+=Math.min(255,i+e.color.g),this.color.b+=Math.min(255,s+e.color.b),this}sub(e){return this.color.r=Math.max(0,this.color.r-e.color.r),this.color.g=Math.max(0,this.color.g-e.color.g),this.color.b=Math.max(0,this.color.b-e.color.b),this}multiply(e){const{r:t,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(t*e.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*e.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*e.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return .5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(e,t,i){const s=this.color.opacity,r=a_(this.color.r,this.color.g,this.color.b),a=kf(C(e)?r.h:ai(e,0,360),C(t)?r.s:t>=0&&t<=1?100*t:t,C(i)?r.l:i<=1&&i>=0?100*i:i);return this.color=new Si(a.r,a.g,a.b,s),this}setRGB(e,t,i){return!C(e)&&(this.color.r=e),!C(t)&&(this.color.g=t),!C(i)&&(this.color.b=i),this}setHex(e){const t=`${e}`.trim().toLowerCase(),i=wS.exec(t),s=parseInt(i[1],16),r=i[1].length;return r===3?new Si((s>>8&15)+((s>>8&15)<<4),(s>>4&15)+((s>>4&15)<<4),(15&s)+((15&s)<<4),1):r===6?km(s):r===8?new Si(s>>24&255,s>>16&255,s>>8&255,(255&s)/255):this}setColorName(e){const t=af[e.toLowerCase()];return t!==void 0?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this}setScalar(e){return this.color.r=e,this.color.g=e,this.color.b=e,this}setOpacity(e=1){return this.color.opacity=e,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new Gt(this.color.toString())}copyGammaToLinear(e,t=2){return this.color.r=Math.pow(e.color.r,t),this.color.g=Math.pow(e.color.g,t),this.color.b=Math.pow(e.color.b,t),this}copyLinearToGamma(e,t=2){const i=t>0?1/t:1;return this.color.r=Math.pow(e.color.r,i),this.color.g=Math.pow(e.color.g,i),this.color.b=Math.pow(e.color.b,i),this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.color.r=wm(e.color.r),this.color.g=wm(e.color.g),this.color.b=wm(e.color.b),this}copyLinearToSRGB(e){return this.color.r=Mm(e.color.r),this.color.g=Mm(e.color.g),this.color.b=Mm(e.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class Si{constructor(e,t,i,s){this.r=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.g=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),P(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${uc(this.r)+uc(this.g)+uc(this.b)+(this.opacity===1?"":uc(255*this.opacity))}`}formatRgb(){const e=this.opacity;return`${e===1?"rgb(":"rgba("}${this.r},${this.g},${this.b}${e===1?")":`,${e})`}`}formatHsl(){const e=this.opacity,{h:t,s:i,l:s}=a_(this.r,this.g,this.b);return`${e===1?"hsl(":"hsla("}${t},${i}%,${s}%${e===1?")":`,${e})`}`}toString(){return this.formatHex()}}function kC(n){let e="",t="",i="";const s=n[0]==="#"?1:0;for(let r=s;r<n.length;r++)n[r]!=="#"&&(r<s+2?e+=n[r]:r<s+4?t+=n[r]:r<s+6&&(i+=n[r]));return[parseInt(e,16),parseInt(t,16),parseInt(i,16)]}function kD(n,e,t){return Number((1<<24)+(n<<16)+(e<<8)+t).toString(16).slice(1)}function wD(n,e){const t=n.r,i=e.r,s=n.g,r=e.g,a=n.b,o=e.b,l=n.opacity,h=e.opacity;return d=>{const u=Math.round(t*(1-d)+i*d),c=Math.round(s*(1-d)+r*d),f=Math.round(a*(1-d)+o*d);return new Si(u,c,f,l*(1-d)+h*d)}}const MD=Object.freeze(Object.defineProperty({__proto__:null,Color:Gt,DEFAULT_COLORS:af,RGB:Si,hexToRgb:kC,hslToRgb:kf,interpolateRgb:wD,rgbToHex:kD,rgbToHsl:a_},Symbol.toStringTag,{value:"Module"}));function Tm(n,e,t){n[0]=e[0]-t[0],n[1]=e[1]-t[1]}let ji,Hi,Gi,Wi,ls,hs,ds,us;function wC(n,e,t,i){let s,r=n[0],a=e[0],o=t[0],l=i[0];return a<r&&(s=a,a=r,r=s),l<o&&(s=l,l=o,o=s),!(a<o||l<r)&&(r=n[1],a=e[1],o=t[1],l=i[1],a<r&&(s=a,a=r,r=s),l<o&&(s=l,l=o,o=s),!(a<o||l<r))}function MC(n,e,t,i){if(!wC(n,e,t,i))return!1;const s=[0,0],r=[0,0],a=[0,0];if(Tm(s,e,n),Tm(r,i,t),mD(s,r))return!0;Tm(a,t,n);const o=kS(a,r)/kS(s,r);return o>=0&&o<=1&&[n[0]+s[0]*o,n[1]+s[1]*o]}function TC(n,e,t){return n===null?e:e===null?n:(ji=n.x1,Hi=n.x2,Gi=n.y1,Wi=n.y2,ls=e.x1,hs=e.x2,ds=e.y1,us=e.y2,ji>=hs||Hi<=ls||Gi>=us||Wi<=ds?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(ji,ls),y1:Math.max(Gi,ds),x2:Math.min(Hi,hs),y2:Math.min(Wi,us)})}var jo;(function(n){n[n.NONE=0]="NONE",n[n.BBOX1=1]="BBOX1",n[n.BBOX2=2]="BBOX2"})(jo||(jo={}));function TD(n,e,t){return n&&e?(ji=n.x1,Hi=n.x2,Gi=n.y1,Wi=n.y2,ls=e.x1,hs=e.x2,ds=e.y1,us=e.y2,ji>ls&&Hi<hs&&Gi>ds&&Wi<us?jo.BBOX1:ls>ji&&hs<Hi&&ds>Gi&&us<Wi?jo.BBOX2:jo.NONE):jo.NONE}function Dd(n,e,t){return!n||!e||(t?(ji=n.x1,Hi=n.x2,Gi=n.y1,Wi=n.y2,ls=e.x1,hs=e.x2,ds=e.y1,us=e.y2,ji>Hi&&([ji,Hi]=[Hi,ji]),Gi>Wi&&([Gi,Wi]=[Wi,Gi]),ls>hs&&([ls,hs]=[hs,ls]),ds>us&&([ds,us]=[us,ds]),!(ji>hs||Hi<ls||Gi>us||Wi<ds)):!(n.x1>e.x2||n.x2<e.x1||n.y1>e.y2||n.y2<e.y1))}function ad(n,e,t){return!e||(t?(ji=e.x1,Hi=e.x2,Gi=e.y1,Wi=e.y2,ji>Hi&&([ji,Hi]=[Hi,ji]),Gi>Wi&&([Gi,Wi]=[Wi,Gi]),n.x>=ji&&n.x<=Hi&&n.y>=Gi&&n.y<=Wi):n.x>=e.x1&&n.x<=e.x2&&n.y>=e.y1&&n.y<=e.y2)}function Cm(n,e){return Math.abs(e[0]*n[0]+e[1]*n[1])}function cc({x:n,y:e},t,i={x:0,y:0}){return{x:(n-i.x)*Math.cos(t)+(e-i.y)*Math.sin(t)+i.x,y:(n-i.x)*Math.sin(t)+(i.y-e)*Math.cos(t)+i.y}}function Uh(n){return n/180*Math.PI}function Hy(n){return{x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2}}function TS(n,e){const t=e?n.angle:Uh(n.angle),i=Hy(n);return[cc({x:n.x1,y:n.y1},t,i),cc({x:n.x2,y:n.y1},t,i),cc({x:n.x2,y:n.y2},t,i),cc({x:n.x1,y:n.y2},t,i)]}function CD(n,e,t=!1,i){const s=TS(n,t),r=TS(e,t),a=(b,v)=>[v.x-b.x,v.y-b.y],o=Hy(n),l=Hy(e),h=a(o,l),d=a(s[0],s[1]),u=a(s[1],s[2]),c=a(r[0],r[1]),f=a(r[1],r[2]),p=t?n.angle:Uh(n.angle);let g=t?n.angle+zn:Uh(90-n.angle);const _=t?e.angle:Uh(e.angle);let m=t?e.angle+zn:Uh(90-e.angle);g>Be&&(g-=Be),m>Be&&(m-=Be);const y=(b,v,x,S)=>{const A=[Math.cos(v),Math.sin(v)];return b+(Cm(A,x)+Cm(A,S))/2>Cm(A,h)};return y((n.x2-n.x1)/2,p,c,f)&&y((n.y2-n.y1)/2,g,c,f)&&y((e.x2-e.x1)/2,_,d,u)&&y((e.y2-e.y1)/2,m,d,u)}let fc,pc,gc,_c;function PD(n){return fc=1/0,pc=1/0,gc=-1/0,_c=-1/0,n.forEach(e=>{fc>e.x&&(fc=e.x),gc<e.x&&(gc=e.x),pc>e.y&&(pc=e.y),_c<e.y&&(_c=e.y)}),{x1:fc,y1:pc,x2:gc,y2:_c}}const ED=1e-8;function RD(n,e,t,i,s){for(let r=0,a=s[s.length-1];r<s.length;r++){const o=s[r];if(wC([n,e],[t,i],[o.x,o.y],[a.x,a.y]))return!0;a=o}return!1}function Va(n,e,t){let i=0,s=n[0];if(!s)return!1;for(let a=1;a<n.length;a++){const o=n[a];i+=CS(s.x,s.y,o.x,o.y,e,t),s=o}const r=n[0];return PS(s.x,r.x)&&PS(s.y,r.y)||(i+=CS(s.x,s.y,r.x,r.y,e,t)),i!==0}function CS(n,e,t,i,s,r){if(r>e&&r>i||r<e&&r<i||i===e)return 0;const a=(r-e)/(i-e);let o=i<e?1:-1;a!==1&&a!==0||(o=i<e?.5:-.5);const l=a*(t-n)+n;return l===s?1/0:l>s?o:0}function PS(n,e){return Math.abs(n-e)<ED}function ES(n,e){for(let t=0;t<e.length;t++)if(Va(n,e[t].x,e[t].y)||t>0&&RD(e[t-1].x,e[t-1].y,e[t].x,e[t].y,n))return!0;return!1}const RS=n=>{let e=n.charCodeAt(0),t=n.length===2?n.charCodeAt(1):0,i=e;return 55296<=e&&e<=56319&&56320<=t&&t<=57343&&(e&=1023,t&=1023,i=e<<10|t,i+=65536),i===12288||65281<=i&&i<=65376||65504<=i&&i<=65510?"F":i===8361||65377<=i&&i<=65470||65474<=i&&i<=65479||65482<=i&&i<=65487||65490<=i&&i<=65495||65498<=i&&i<=65500||65512<=i&&i<=65518?"H":4352<=i&&i<=4447||4515<=i&&i<=4519||4602<=i&&i<=4607||9001<=i&&i<=9002||11904<=i&&i<=11929||11931<=i&&i<=12019||12032<=i&&i<=12245||12272<=i&&i<=12283||12289<=i&&i<=12350||12353<=i&&i<=12438||12441<=i&&i<=12543||12549<=i&&i<=12589||12593<=i&&i<=12686||12688<=i&&i<=12730||12736<=i&&i<=12771||12784<=i&&i<=12830||12832<=i&&i<=12871||12880<=i&&i<=13054||13056<=i&&i<=19903||19968<=i&&i<=42124||42128<=i&&i<=42182||43360<=i&&i<=43388||44032<=i&&i<=55203||55216<=i&&i<=55238||55243<=i&&i<=55291||63744<=i&&i<=64255||65040<=i&&i<=65049||65072<=i&&i<=65106||65108<=i&&i<=65126||65128<=i&&i<=65131||110592<=i&&i<=110593||127488<=i&&i<=127490||127504<=i&&i<=127546||127552<=i&&i<=127560||127568<=i&&i<=127569||131072<=i&&i<=194367||177984<=i&&i<=196605||196608<=i&&i<=262141?"W":32<=i&&i<=126||162<=i&&i<=163||165<=i&&i<=166||i===172||i===175||10214<=i&&i<=10221||10629<=i&&i<=10630?"Na":i===161||i===164||167<=i&&i<=168||i===170||173<=i&&i<=174||176<=i&&i<=180||182<=i&&i<=186||188<=i&&i<=191||i===198||i===208||215<=i&&i<=216||222<=i&&i<=225||i===230||232<=i&&i<=234||236<=i&&i<=237||i===240||242<=i&&i<=243||247<=i&&i<=250||i===252||i===254||i===257||i===273||i===275||i===283||294<=i&&i<=295||i===299||305<=i&&i<=307||i===312||319<=i&&i<=322||i===324||328<=i&&i<=331||i===333||338<=i&&i<=339||358<=i&&i<=359||i===363||i===462||i===464||i===466||i===468||i===470||i===472||i===474||i===476||i===593||i===609||i===708||i===711||713<=i&&i<=715||i===717||i===720||728<=i&&i<=731||i===733||i===735||768<=i&&i<=879||913<=i&&i<=929||931<=i&&i<=937||945<=i&&i<=961||963<=i&&i<=969||i===1025||1040<=i&&i<=1103||i===1105||i===8208||8211<=i&&i<=8214||8216<=i&&i<=8217||8220<=i&&i<=8221||8224<=i&&i<=8226||8228<=i&&i<=8231||i===8240||8242<=i&&i<=8243||i===8245||i===8251||i===8254||i===8308||i===8319||8321<=i&&i<=8324||i===8364||i===8451||i===8453||i===8457||i===8467||i===8470||8481<=i&&i<=8482||i===8486||i===8491||8531<=i&&i<=8532||8539<=i&&i<=8542||8544<=i&&i<=8555||8560<=i&&i<=8569||i===8585||8592<=i&&i<=8601||8632<=i&&i<=8633||i===8658||i===8660||i===8679||i===8704||8706<=i&&i<=8707||8711<=i&&i<=8712||i===8715||i===8719||i===8721||i===8725||i===8730||8733<=i&&i<=8736||i===8739||i===8741||8743<=i&&i<=8748||i===8750||8756<=i&&i<=8759||8764<=i&&i<=8765||i===8776||i===8780||i===8786||8800<=i&&i<=8801||8804<=i&&i<=8807||8810<=i&&i<=8811||8814<=i&&i<=8815||8834<=i&&i<=8835||8838<=i&&i<=8839||i===8853||i===8857||i===8869||i===8895||i===8978||9312<=i&&i<=9449||9451<=i&&i<=9547||9552<=i&&i<=9587||9600<=i&&i<=9615||9618<=i&&i<=9621||9632<=i&&i<=9633||9635<=i&&i<=9641||9650<=i&&i<=9651||9654<=i&&i<=9655||9660<=i&&i<=9661||9664<=i&&i<=9665||9670<=i&&i<=9672||i===9675||9678<=i&&i<=9681||9698<=i&&i<=9701||i===9711||9733<=i&&i<=9734||i===9737||9742<=i&&i<=9743||9748<=i&&i<=9749||i===9756||i===9758||i===9792||i===9794||9824<=i&&i<=9825||9827<=i&&i<=9829||9831<=i&&i<=9834||9836<=i&&i<=9837||i===9839||9886<=i&&i<=9887||9918<=i&&i<=9919||9924<=i&&i<=9933||9935<=i&&i<=9953||i===9955||9960<=i&&i<=9983||i===10045||i===10071||10102<=i&&i<=10111||11093<=i&&i<=11097||12872<=i&&i<=12879||57344<=i&&i<=63743||65024<=i&&i<=65039||i===65533||127232<=i&&i<=127242||127248<=i&&i<=127277||127280<=i&&i<=127337||127344<=i&&i<=127386||917760<=i&&i<=917999||983040<=i&&i<=1048573||1048576<=i&&i<=1114109?"A":"N"};function OD(n,e={}){const{fontStyle:t=e.fontStyle,fontVariant:i=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=n;return(t?t+" ":"")+(i?i+" ":"")+(s?s+" ":"")+r+"px "+(a||"sans-serif")}class si{constructor(e,t){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet=`-/: .,@%'"~`,this._option=e,this._userSpec=t??{},this.textSpec=this._initSpec(),P(e.specialCharSet)&&(this.specialCharSet=e.specialCharSet),this._standardMethod=P(e.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(C(this._canvas)&&(P(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),C(this._canvas)&&typeof window<"u"&&window.document!==void 0&&globalThis&&P(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),C(this._context)&&P(this._canvas)){const e=this._canvas.getContext("2d");P(e)&&(e.save(),e.font=OD(this.textSpec),this._contextSaved=!0,this._context=e)}return!C(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var e,t,i;const{defaultFontParams:s={}}=this._option,{fontStyle:r=s.fontStyle,fontVariant:a=s.fontVariant,fontWeight:o=(e=s.fontWeight)!==null&&e!==void 0?e:"normal",fontSize:l=(t=s.fontSize)!==null&&t!==void 0?t:12,fontFamily:h=(i=s.fontFamily)!==null&&i!==void 0?i:"sans-serif",align:d,textAlign:u=d??"center",baseline:c,textBaseline:f=c??"middle",ellipsis:p,limit:g}=this._userSpec;let{lineHeight:_=l}=this._userSpec;if(ae(_)&&_[_.length-1]==="%"){const m=Number.parseFloat(_.substring(0,_.length-1))/100;_=l*m}return{fontStyle:r,fontVariant:a,fontFamily:h,fontSize:l,fontWeight:o,textAlign:u,textBaseline:f,ellipsis:p,limit:g,lineHeight:_}}measure(e,t){switch(t){case"vrender":case"canopus":return this.fullMeasure(e);case"canvas":return this.measureWithNaiveCanvas(e);case"simple":return this.quickMeasureWithoutCanvas(e);default:return this.quickMeasure(e)}}fullMeasure(e){if(C(e))return{width:0,height:0};if(C(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(e);const{fontFamily:t,fontSize:i,fontWeight:s,textAlign:r,textBaseline:a,ellipsis:o,limit:l,lineHeight:h}=this.textSpec;let d;try{const u=this._option.getTextBounds({text:e,fontFamily:t,fontSize:i,fontWeight:s,textAlign:r,textBaseline:a,ellipsis:!!o,maxLineWidth:l||1/0,lineHeight:h});d={width:u.width(),height:u.height()}}catch{this._notSupportVRender=!0,d=this.measureWithNaiveCanvas(e)}return d}measureWithNaiveCanvas(e){return this._measureReduce(e,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(e){var t;if(!this.initContext())return this._quickMeasureWithoutCanvas(e);const i=this._context.measureText(e),{fontSize:s,lineHeight:r}=this.textSpec;return{width:i.width,height:(t=r)!==null&&t!==void 0?t:s}}quickMeasure(e){return this._measureReduce(e,this._quickMeasure.bind(this))}_quickMeasure(e){const t={width:0,height:0};for(let i=0;i<e.length;i++){const s=e[i];let r=this._measureSpecialChar(s);C(r)&&si.NUMBERS_CHAR_SET.includes(s)&&(r=this._measureNumberChar()),C(r)&&["F","W"].includes(RS(s))&&(r=this._measureFullSizeChar()),C(r)&&(r=this._measureLetterChar()),t.width+=r.width,t.height=Math.max(t.height,r.height)}return t}quickMeasureWithoutCanvas(e){return this._measureReduce(e,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(e){var t;const i={width:0,height:0},{fontSize:s,lineHeight:r}=this.textSpec;for(let a=0;a<e.length;a++){const o=e[a],l=["F","W"].includes(RS(o))?1:.53;i.width+=l*s}return i.height=(t=r)!==null&&t!==void 0?t:s,i}_measureReduce(e,t){var i;const{fontSize:s,lineHeight:r}=this.textSpec,a={width:0,height:0};if(C(e))return a;if(W(e)){const o=e.filter(P).map(l=>l.toString());return o.length===0?a:o.length===1?t(o[0]):{width:o.reduce((l,h)=>Math.max(l,t(h).width),0),height:o.length*(((i=r)!==null&&i!==void 0?i:s)+1)+1}}return t(e.toString())}_measureNumberChar(){if(C(this._numberCharSize)){const e=this._standardMethod(si.NUMBERS_CHAR_SET);this._numberCharSize={width:e.width/si.NUMBERS_CHAR_SET.length,height:e.height}}return this._numberCharSize}_measureFullSizeChar(){return C(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(si.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(C(this._letterCharSize)){const e=this._standardMethod(si.ALPHABET_CHAR_SET);this._letterCharSize={width:e.width/si.ALPHABET_CHAR_SET.length,height:e.height}}return this._letterCharSize}_measureSpecialChar(e){return P(this._specialCharSizeMap[e])?this._specialCharSizeMap[e]:this.specialCharSet.includes(e)?(this._specialCharSizeMap[e]=this._standardMethod(e),this._specialCharSizeMap[e]):null}release(){P(this._canvas)&&(this._canvas=null),P(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}si.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",si.NUMBERS_CHAR_SET="0123456789",si.FULL_SIZE_CHAR="字";const BD=typeof console<"u";function mc(n,e,t){const i=[e].concat([].slice.call(t));BD&&console[n].apply(console,i)}var gn;(function(n){n[n.None=0]="None",n[n.Error=1]="Error",n[n.Warn=2]="Warn",n[n.Info=3]="Info",n[n.Debug=4]="Debug"})(gn||(gn={}));class De{static getInstance(e,t){return De._instance&&oe(e)?De._instance.level(e):De._instance||(De._instance=new De(e,t)),De._instance}static setInstance(e){return De._instance=e}static setInstanceLevel(e){De._instance?De._instance.level(e):De._instance=new De(e)}static clearInstance(){De._instance=null}constructor(e=gn.None,t){this._onErrorHandler=[],this._level=e,this._method=t}addErrorHandler(e){this._onErrorHandler.find(t=>t===e)||this._onErrorHandler.push(e)}removeErrorHandler(e){const t=this._onErrorHandler.findIndex(i=>i===e);t<0||this._onErrorHandler.splice(t,1)}callErrorHandler(...e){this._onErrorHandler.forEach(t=>t(...e))}canLogInfo(){return this._level>=gn.Info}canLogDebug(){return this._level>=gn.Debug}canLogError(){return this._level>=gn.Error}canLogWarn(){return this._level>=gn.Warn}level(e){return arguments.length?(this._level=+e,this):this._level}error(...e){var t;return this._level>=gn.Error&&(this._onErrorHandler.length?this.callErrorHandler(...e):mc((t=this._method)!==null&&t!==void 0?t:"error","ERROR",e)),this}warn(...e){return this._level>=gn.Warn&&mc(this._method||"warn","WARN",e),this}info(...e){return this._level>=gn.Info&&mc(this._method||"log","INFO",e),this}debug(...e){return this._level>=gn.Debug&&mc(this._method||"log","DEBUG",e),this}}De._instance=null;function tn(n){if(j(n))return[n,n,n,n];if(W(n)){const e=n.length;if(e===1){const t=n[0];return[t,t,t,t]}if(e===2){const[t,i]=n;return[t,i,t,i]}if(e===3){const[t,i,s]=n;return[t,i,s,i]}if(e===4)return n}if(He(n)){const{top:e=0,right:t=0,bottom:i=0,left:s=0}=n;return[e,t,i,s]}return[0,0,0,0]}function Gy(n,e=0,t=0){if(!n)return{width:e,height:t};let i;try{i=window==null?void 0:window.getComputedStyle}catch{i=()=>({})}const s=i(n);if(/^(\d*\.?\d+)(px)$/.exec(s.width)){const r=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||n.clientWidth-1,a=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||n.clientHeight-1;return{width:r<=0?e:r,height:a<=0?t:a}}return{width:e,height:t}}function LD(n){const{x:e,y:t}=n.getBoundingClientRect();return{x:e,y:t}}function ID(n,e){let t=n.parentNode;for(;t!==null;){if(t===e)return!0;t=t.parentNode}return!1}var on=63710088e-1,DD={centimeters:on*100,centimetres:on*100,degrees:on/111325,feet:on*3.28084,inches:on*39.37,kilometers:on/1e3,kilometres:on/1e3,meters:on,metres:on,miles:on/1609.344,millimeters:on*1e3,millimetres:on*1e3,nauticalmiles:on/1852,radians:1,yards:on*1.0936};function OS(n,e,t){t===void 0&&(t={});var i={type:"Feature"};return(t.id===0||t.id)&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.properties=e||{},i.geometry=n,i}function CC(n,e){e===void 0&&(e={});var t={type:"FeatureCollection"};return e.id&&(t.id=e.id),e.bbox&&(t.bbox=e.bbox),t.features=n,t}function FD(n,e){e===void 0&&(e="kilometers");var t=DD[e];if(!t)throw new Error(e+" units is invalid");return n/t}function zD(n){return!!n&&n.constructor===Object}function jD(n){return n.type==="Feature"?n.geometry:n}function HD(n,e){if(!n||!e)return!1;const t=jD(e),i=t.type,s=e.bbox;let r=t.coordinates;if(s&&ad(n,{x1:s[0],x2:s[1],y1:s[1],y2:s[3]},!0)===!0)return!1;i==="Polygon"&&(r=[r]);let a=!1;for(let o=0;o<r.length;++o)for(let l=0;l<r[o].length;++l)if(Va(r[o][l].map(h=>({x:h[0],y:h[1]})),n.x,n.y))return a=!0,a;return a}function GD(n,e,t,i={}){const s=st(n[0]),r=st(n[1]),a=st(t),o=FD(e,i.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a)),h=s+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l));return{x:$l(h),y:$l(l)}}const WD=(n,e)=>{const{callback:t}=e;return t&&(n=n.filter(t)),n};function o_(){return new wf}function wf(){this.reset()}wf.prototype={constructor:wf,reset:function(){this.s=this.t=0},add:function(n){BS(yc,n,this.t),BS(this,yc.s,this.s),this.s?this.t+=yc.t:this.s=yc.t},valueOf:function(){return this.s}};var yc=new wf;function BS(n,e,t){var i=n.s=e+t,s=i-e,r=i-s;n.t=e-r+(t-s)}var Ne=1e-6,VD=1e-12,qe=Math.PI,Wt=qe/2,LS=qe/4,xn=qe*2,Bi=180/qe,It=qe/180,ct=Math.abs,bh=Math.atan,mr=Math.atan2,$e=Math.cos,PC=Math.exp,Mf=Math.log,Pm=Math.pow,je=Math.sin,Gn=Math.sign||function(n){return n>0?1:n<0?-1:0},un=Math.sqrt,cx=Math.tan;function EC(n){return n>1?0:n<-1?qe:Math.acos(n)}function Xn(n){return n>1?Wt:n<-1?-Wt:Math.asin(n)}function Wn(){}function Tf(n,e){n&&DS.hasOwnProperty(n.type)&&DS[n.type](n,e)}var IS={Feature:function(n,e){Tf(n.geometry,e)},FeatureCollection:function(n,e){for(var t=n.features,i=-1,s=t.length;++i<s;)Tf(t[i].geometry,e)}},DS={Sphere:function(n,e){e.sphere()},Point:function(n,e){n=n.coordinates,e.point(n[0],n[1],n[2])},MultiPoint:function(n,e){for(var t=n.coordinates,i=-1,s=t.length;++i<s;)n=t[i],e.point(n[0],n[1],n[2])},LineString:function(n,e){Wy(n.coordinates,e,0)},MultiLineString:function(n,e){for(var t=n.coordinates,i=-1,s=t.length;++i<s;)Wy(t[i],e,0)},Polygon:function(n,e){FS(n.coordinates,e)},MultiPolygon:function(n,e){for(var t=n.coordinates,i=-1,s=t.length;++i<s;)FS(t[i],e)},GeometryCollection:function(n,e){for(var t=n.geometries,i=-1,s=t.length;++i<s;)Tf(t[i],e)}};function Wy(n,e,t){var i=-1,s=n.length-t,r;for(e.lineStart();++i<s;)r=n[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function FS(n,e){var t=-1,i=n.length;for(e.polygonStart();++t<i;)Wy(n[t],e,1);e.polygonEnd()}function Oo(n,e){n&&IS.hasOwnProperty(n.type)?IS[n.type](n,e):Tf(n,e)}function Vy(n){return[mr(n[1],n[0]),Xn(n[2])]}function Yl(n){var e=n[0],t=n[1],i=$e(t);return[i*$e(e),i*je(e),je(t)]}function bc(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]}function Cf(n,e){return[n[1]*e[2]-n[2]*e[1],n[2]*e[0]-n[0]*e[2],n[0]*e[1]-n[1]*e[0]]}function Em(n,e){n[0]+=e[0],n[1]+=e[1],n[2]+=e[2]}function vc(n,e){return[n[0]*e,n[1]*e,n[2]*e]}function Ny(n){var e=un(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=e,n[1]/=e,n[2]/=e}function Uy(n,e){function t(i,s){return i=n(i,s),e(i[0],i[1])}return n.invert&&e.invert&&(t.invert=function(i,s){return i=e.invert(i,s),i&&n.invert(i[0],i[1])}),t}function $y(n,e){return[ct(n)>qe?n+Math.round(-n/xn)*xn:n,e]}$y.invert=$y;function RC(n,e,t){return(n%=xn)?e||t?Uy(jS(n),HS(e,t)):jS(n):e||t?HS(e,t):$y}function zS(n){return function(e,t){return e+=n,[e>qe?e-xn:e<-qe?e+xn:e,t]}}function jS(n){var e=zS(n);return e.invert=zS(-n),e}function HS(n,e){var t=$e(n),i=je(n),s=$e(e),r=je(e);function a(o,l){var h=$e(l),d=$e(o)*h,u=je(o)*h,c=je(l),f=c*t+d*i;return[mr(u*s-f*r,d*t-c*i),Xn(f*s+u*r)]}return a.invert=function(o,l){var h=$e(l),d=$e(o)*h,u=je(o)*h,c=je(l),f=c*s-u*r;return[mr(u*s+c*r,d*t+f*i),Xn(f*t-d*i)]},a}function ND(n){n=RC(n[0]*It,n[1]*It,n.length>2?n[2]*It:0);function e(t){return t=n(t[0]*It,t[1]*It),t[0]*=Bi,t[1]*=Bi,t}return e.invert=function(t){return t=n.invert(t[0]*It,t[1]*It),t[0]*=Bi,t[1]*=Bi,t},e}function UD(n,e,t,i,s,r){if(t){var a=$e(e),o=je(e),l=i*t;s==null?(s=e+i*xn,r=e-l/2):(s=GS(a,s),r=GS(a,r),(i>0?s<r:s>r)&&(s+=i*xn));for(var h,d=s;i>0?d>r:d<r;d-=l)h=Vy([a,-o*$e(d),-o*je(d)]),n.point(h[0],h[1])}}function GS(n,e){e=Yl(e),e[0]-=n,Ny(e);var t=EC(-e[1]);return((-e[2]<0?-t:t)+xn-Ne)%xn}function OC(){var n=[],e;return{point:function(t,i,s){e.push([t,i,s])},lineStart:function(){n.push(e=[])},lineEnd:Wn,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var t=n;return n=[],e=null,t}}}function of(n,e){return ct(n[0]-e[0])<Ne&&ct(n[1]-e[1])<Ne}function xc(n,e,t,i){this.x=n,this.z=e,this.o=t,this.e=i,this.v=!1,this.n=this.p=null}function BC(n,e,t,i,s){var r=[],a=[],o,l;if(n.forEach(function(p){if(!((g=p.length-1)<=0)){var g,_=p[0],m=p[g],y;if(of(_,m)){if(!_[2]&&!m[2]){for(s.lineStart(),o=0;o<g;++o)s.point((_=p[o])[0],_[1]);s.lineEnd();return}m[0]+=2*Ne}r.push(y=new xc(_,p,null,!0)),a.push(y.o=new xc(_,null,y,!1)),r.push(y=new xc(m,p,null,!1)),a.push(y.o=new xc(m,null,y,!0))}}),!!r.length){for(a.sort(e),WS(r),WS(a),o=0,l=a.length;o<l;++o)a[o].e=t=!t;for(var h=r[0],d,u;;){for(var c=h,f=!0;c.v;)if((c=c.n)===h)return;d=c.z,s.lineStart();do{if(c.v=c.o.v=!0,c.e){if(f)for(o=0,l=d.length;o<l;++o)s.point((u=d[o])[0],u[1]);else i(c.x,c.n.x,1,s);c=c.n}else{if(f)for(d=c.p.z,o=d.length-1;o>=0;--o)s.point((u=d[o])[0],u[1]);else i(c.x,c.p.x,-1,s);c=c.p}c=c.o,d=c.z,f=!f}while(!c.v);s.lineEnd()}}}function WS(n){if(e=n.length){for(var e,t=0,i=n[0],s;++t<e;)i.n=s=n[t],s.p=i,i=s;i.n=s=n[0],s.p=i}}var Rm=o_();function Om(n){return ct(n[0])<=qe?n[0]:Gn(n[0])*((ct(n[0])+qe)%xn-qe)}function $D(n,e){var t=Om(e),i=e[1],s=je(i),r=[je(t),-$e(t),0],a=0,o=0;Rm.reset(),s===1?i=Wt+Ne:s===-1&&(i=-Wt-Ne);for(var l=0,h=n.length;l<h;++l)if(u=(d=n[l]).length)for(var d,u,c=d[u-1],f=Om(c),p=c[1]/2+LS,g=je(p),_=$e(p),m=0;m<u;++m,f=b,g=x,_=S,c=y){var y=d[m],b=Om(y),v=y[1]/2+LS,x=je(v),S=$e(v),A=b-f,k=A>=0?1:-1,w=k*A,M=w>qe,T=g*x;if(Rm.add(mr(T*k*je(w),_*S+T*$e(w))),a+=M?A+k*xn:A,M^f>=t^b>=t){var E=Cf(Yl(c),Yl(y));Ny(E);var O=Cf(r,E);Ny(O);var B=(M^A>=0?-1:1)*Xn(O[2]);(i>B||i===B&&(E[0]||E[1]))&&(o+=M^A>=0?1:-1)}}return(a<-1e-6||a<Ne&&Rm<-1e-6)^o&1}function LC(n,e){return n<e?-1:n>e?1:n>=e?0:NaN}function YD(n){return n.length===1&&(n=XD(n)),{left:function(e,t,i,s){for(i==null&&(i=0),s==null&&(s=e.length);i<s;){var r=i+s>>>1;n(e[r],t)<0?i=r+1:s=r}return i},right:function(e,t,i,s){for(i==null&&(i=0),s==null&&(s=e.length);i<s;){var r=i+s>>>1;n(e[r],t)>0?s=r:i=r+1}return i}}}function XD(n){return function(e,t){return LC(n(e),t)}}YD(LC);function IC(n){for(var e=n.length,t,i=-1,s=0,r,a;++i<e;)s+=n[i].length;for(r=new Array(s);--e>=0;)for(a=n[e],t=a.length;--t>=0;)r[--s]=a[t];return r}function DC(n,e,t,i){return function(s){var r=e(s),a=OC(),o=e(a),l=!1,h,d,u,c={point:f,lineStart:g,lineEnd:_,polygonStart:function(){c.point=m,c.lineStart=y,c.lineEnd=b,d=[],h=[]},polygonEnd:function(){c.point=f,c.lineStart=g,c.lineEnd=_,d=IC(d);var v=$D(h,i);d.length?(l||(s.polygonStart(),l=!0),BC(d,qD,v,t,s)):v&&(l||(s.polygonStart(),l=!0),s.lineStart(),t(null,null,1,s),s.lineEnd()),l&&(s.polygonEnd(),l=!1),d=h=null},sphere:function(){s.polygonStart(),s.lineStart(),t(null,null,1,s),s.lineEnd(),s.polygonEnd()}};function f(v,x){n(v,x)&&s.point(v,x)}function p(v,x){r.point(v,x)}function g(){c.point=p,r.lineStart()}function _(){c.point=f,r.lineEnd()}function m(v,x){u.push([v,x]),o.point(v,x)}function y(){o.lineStart(),u=[]}function b(){m(u[0][0],u[0][1]),o.lineEnd();var v=o.clean(),x=a.result(),S,A=x.length,k,w,M;if(u.pop(),h.push(u),u=null,!!A){if(v&1){if(w=x[0],(k=w.length-1)>0){for(l||(s.polygonStart(),l=!0),s.lineStart(),S=0;S<k;++S)s.point((M=w[S])[0],M[1]);s.lineEnd()}return}A>1&&v&2&&x.push(x.pop().concat(x.shift())),d.push(x.filter(KD))}}return c}}function KD(n){return n.length>1}function qD(n,e){return((n=n.x)[0]<0?n[1]-Wt-Ne:Wt-n[1])-((e=e.x)[0]<0?e[1]-Wt-Ne:Wt-e[1])}const VS=DC(function(){return!0},ZD,QD,[-qe,-Wt]);function ZD(n){var e=NaN,t=NaN,i=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(r,a){var o=r>0?qe:-qe,l=ct(r-e);ct(l-qe)<Ne?(n.point(e,t=(t+a)/2>0?Wt:-Wt),n.point(i,t),n.lineEnd(),n.lineStart(),n.point(o,t),n.point(r,t),s=0):i!==o&&l>=qe&&(ct(e-i)<Ne&&(e-=i*Ne),ct(r-o)<Ne&&(r-=o*Ne),t=JD(e,t,r,a),n.point(i,t),n.lineEnd(),n.lineStart(),n.point(o,t),s=0),n.point(e=r,t=a),i=o},lineEnd:function(){n.lineEnd(),e=t=NaN},clean:function(){return 2-s}}}function JD(n,e,t,i){var s,r,a=je(n-t);return ct(a)>Ne?bh((je(e)*(r=$e(i))*je(t)-je(i)*(s=$e(e))*je(n))/(s*r*a)):(e+i)/2}function QD(n,e,t,i){var s;if(n==null)s=t*Wt,i.point(-qe,s),i.point(0,s),i.point(qe,s),i.point(qe,0),i.point(qe,-s),i.point(0,-s),i.point(-qe,-s),i.point(-qe,0),i.point(-qe,s);else if(ct(n[0]-e[0])>Ne){var r=n[0]<e[0]?qe:-qe;s=t*r/2,i.point(-r,s),i.point(0,s),i.point(r,s)}else i.point(e[0],e[1])}function e2(n){var e=$e(n),t=6*It,i=e>0,s=ct(e)>Ne;function r(d,u,c,f){UD(f,n,t,c,d,u)}function a(d,u){return $e(d)*$e(u)>e}function o(d){var u,c,f,p,g;return{lineStart:function(){p=f=!1,g=1},point:function(_,m){var y=[_,m],b,v=a(_,m),x=i?v?0:h(_,m):v?h(_+(_<0?qe:-qe),m):0;if(!u&&(p=f=v)&&d.lineStart(),v!==f&&(b=l(u,y),(!b||of(u,b)||of(y,b))&&(y[2]=1)),v!==f)g=0,v?(d.lineStart(),b=l(y,u),d.point(b[0],b[1])):(b=l(u,y),d.point(b[0],b[1],2),d.lineEnd()),u=b;else if(s&&u&&i^v){var S;!(x&c)&&(S=l(y,u,!0))&&(g=0,i?(d.lineStart(),d.point(S[0][0],S[0][1]),d.point(S[1][0],S[1][1]),d.lineEnd()):(d.point(S[1][0],S[1][1]),d.lineEnd(),d.lineStart(),d.point(S[0][0],S[0][1],3)))}v&&(!u||!of(u,y))&&d.point(y[0],y[1]),u=y,f=v,c=x},lineEnd:function(){f&&d.lineEnd(),u=null},clean:function(){return g|(p&&f)<<1}}}function l(d,u,c){var f=Yl(d),p=Yl(u),g=[1,0,0],_=Cf(f,p),m=bc(_,_),y=_[0],b=m-y*y;if(!b)return!c&&d;var v=e*m/b,x=-e*y/b,S=Cf(g,_),A=vc(g,v),k=vc(_,x);Em(A,k);var w=S,M=bc(A,w),T=bc(w,w),E=M*M-T*(bc(A,A)-1);if(!(E<0)){var O=un(E),B=vc(w,(-M-O)/T);if(Em(B,A),B=Vy(B),!c)return B;var R=d[0],L=u[0],I=d[1],F=u[1],H;L<R&&(H=R,R=L,L=H);var G=L-R,U=ct(G-qe)<Ne,$=U||G<Ne;if(!U&&F<I&&(H=I,I=F,F=H),$?U?I+F>0^B[1]<(ct(B[0]-R)<Ne?I:F):I<=B[1]&&B[1]<=F:G>qe^(R<=B[0]&&B[0]<=L)){var Z=vc(w,(-M+O)/T);return Em(Z,A),[B,Vy(Z)]}}}function h(d,u){var c=i?n:qe-n,f=0;return d<-c?f|=1:d>c&&(f|=2),u<-c?f|=4:u>c&&(f|=8),f}return DC(a,o,r,i?[0,-n]:[-qe,n-qe])}function t2(n,e,t,i,s,r){var a=n[0],o=n[1],l=e[0],h=e[1],d=0,u=1,c=l-a,f=h-o,p;if(p=t-a,!(!c&&p>0)){if(p/=c,c<0){if(p<d)return;p<u&&(u=p)}else if(c>0){if(p>u)return;p>d&&(d=p)}if(p=s-a,!(!c&&p<0)){if(p/=c,c<0){if(p>u)return;p>d&&(d=p)}else if(c>0){if(p<d)return;p<u&&(u=p)}if(p=i-o,!(!f&&p>0)){if(p/=f,f<0){if(p<d)return;p<u&&(u=p)}else if(f>0){if(p>u)return;p>d&&(d=p)}if(p=r-o,!(!f&&p<0)){if(p/=f,f<0){if(p>u)return;p>d&&(d=p)}else if(f>0){if(p<d)return;p<u&&(u=p)}return d>0&&(n[0]=a+d*c,n[1]=o+d*f),u<1&&(e[0]=a+u*c,e[1]=o+u*f),!0}}}}}var Sc=1e9,Ac=-1e9;function FC(n,e,t,i){function s(h,d){return n<=h&&h<=t&&e<=d&&d<=i}function r(h,d,u,c){var f=0,p=0;if(h==null||(f=a(h,u))!==(p=a(d,u))||l(h,d)<0^u>0)do c.point(f===0||f===3?n:t,f>1?i:e);while((f=(f+u+4)%4)!==p);else c.point(d[0],d[1])}function a(h,d){return ct(h[0]-n)<Ne?d>0?0:3:ct(h[0]-t)<Ne?d>0?2:1:ct(h[1]-e)<Ne?d>0?1:0:d>0?3:2}function o(h,d){return l(h.x,d.x)}function l(h,d){var u=a(h,1),c=a(d,1);return u!==c?u-c:u===0?d[1]-h[1]:u===1?h[0]-d[0]:u===2?h[1]-d[1]:d[0]-h[0]}return function(h){var d=h,u=OC(),c,f,p,g,_,m,y,b,v,x,S,A={point:k,lineStart:E,lineEnd:O,polygonStart:M,polygonEnd:T};function k(R,L){s(R,L)&&d.point(R,L)}function w(){for(var R=0,L=0,I=f.length;L<I;++L)for(var F=f[L],H=1,G=F.length,U=F[0],$,Z,q=U[0],ie=U[1];H<G;++H)$=q,Z=ie,U=F[H],q=U[0],ie=U[1],Z<=i?ie>i&&(q-$)*(i-Z)>(ie-Z)*(n-$)&&++R:ie<=i&&(q-$)*(i-Z)<(ie-Z)*(n-$)&&--R;return R}function M(){d=u,c=[],f=[],S=!0}function T(){var R=w(),L=S&&R,I=(c=IC(c)).length;(L||I)&&(h.polygonStart(),L&&(h.lineStart(),r(null,null,1,h),h.lineEnd()),I&&BC(c,o,R,r,h),h.polygonEnd()),d=h,c=f=p=null}function E(){A.point=B,f&&f.push(p=[]),x=!0,v=!1,y=b=NaN}function O(){c&&(B(g,_),m&&v&&u.rejoin(),c.push(u.result())),A.point=k,v&&d.lineEnd()}function B(R,L){var I=s(R,L);if(f&&p.push([R,L]),x)g=R,_=L,m=I,x=!1,I&&(d.lineStart(),d.point(R,L));else if(I&&v)d.point(R,L);else{var F=[y=Math.max(Ac,Math.min(Sc,y)),b=Math.max(Ac,Math.min(Sc,b))],H=[R=Math.max(Ac,Math.min(Sc,R)),L=Math.max(Ac,Math.min(Sc,L))];t2(F,H,n,e,t,i)?(v||(d.lineStart(),d.point(F[0],F[1])),d.point(H[0],H[1]),I||d.lineEnd(),S=!1):I&&(d.lineStart(),d.point(R,L),S=!1)}y=R,b=L,v=I}return A}}function Fd(n){return n}var Bm=o_(),Yy=o_(),zC,jC,Xy,Ky,rr={point:Wn,lineStart:Wn,lineEnd:Wn,polygonStart:function(){rr.lineStart=i2,rr.lineEnd=s2},polygonEnd:function(){rr.lineStart=rr.lineEnd=rr.point=Wn,Bm.add(ct(Yy)),Yy.reset()},result:function(){var n=Bm/2;return Bm.reset(),n}};function i2(){rr.point=n2}function n2(n,e){rr.point=HC,zC=Xy=n,jC=Ky=e}function HC(n,e){Yy.add(Ky*n-Xy*e),Xy=n,Ky=e}function s2(){HC(zC,jC)}var Xl=1/0,Pf=Xl,zd=-Xl,Ef=zd,Rf={point:r2,lineStart:Wn,lineEnd:Wn,polygonStart:Wn,polygonEnd:Wn,result:function(){var n=[[Xl,Pf],[zd,Ef]];return zd=Ef=-(Pf=Xl=1/0),n}};function r2(n,e){n<Xl&&(Xl=n),n>zd&&(zd=n),e<Pf&&(Pf=e),e>Ef&&(Ef=e)}var qy=0,Zy=0,$h=0,Of=0,Bf=0,Ho=0,Jy=0,Qy=0,Yh=0,GC,WC,Rs,Os,jn={point:Qa,lineStart:NS,lineEnd:US,polygonStart:function(){jn.lineStart=l2,jn.lineEnd=h2},polygonEnd:function(){jn.point=Qa,jn.lineStart=NS,jn.lineEnd=US},result:function(){var n=Yh?[Jy/Yh,Qy/Yh]:Ho?[Of/Ho,Bf/Ho]:$h?[qy/$h,Zy/$h]:[NaN,NaN];return qy=Zy=$h=Of=Bf=Ho=Jy=Qy=Yh=0,n}};function Qa(n,e){qy+=n,Zy+=e,++$h}function NS(){jn.point=a2}function a2(n,e){jn.point=o2,Qa(Rs=n,Os=e)}function o2(n,e){var t=n-Rs,i=e-Os,s=un(t*t+i*i);Of+=s*(Rs+n)/2,Bf+=s*(Os+e)/2,Ho+=s,Qa(Rs=n,Os=e)}function US(){jn.point=Qa}function l2(){jn.point=d2}function h2(){VC(GC,WC)}function d2(n,e){jn.point=VC,Qa(GC=Rs=n,WC=Os=e)}function VC(n,e){var t=n-Rs,i=e-Os,s=un(t*t+i*i);Of+=s*(Rs+n)/2,Bf+=s*(Os+e)/2,Ho+=s,s=Os*n-Rs*e,Jy+=s*(Rs+n),Qy+=s*(Os+e),Yh+=s*3,Qa(Rs=n,Os=e)}function NC(n){this._context=n}NC.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(n,e){switch(this._point){case 0:{this._context.moveTo(n,e),this._point=1;break}case 1:{this._context.lineTo(n,e);break}default:{this._context.moveTo(n+this._radius,e),this._context.arc(n,e,this._radius,0,xn);break}}},result:Wn};var eb=o_(),Lm,UC,$C,Xh,Kh,jd={point:Wn,lineStart:function(){jd.point=u2},lineEnd:function(){Lm&&YC(UC,$C),jd.point=Wn},polygonStart:function(){Lm=!0},polygonEnd:function(){Lm=null},result:function(){var n=+eb;return eb.reset(),n}};function u2(n,e){jd.point=YC,UC=Xh=n,$C=Kh=e}function YC(n,e){Xh-=n,Kh-=e,eb.add(un(Xh*Xh+Kh*Kh)),Xh=n,Kh=e}function XC(){this._string=[]}XC.prototype={_radius:4.5,_circle:$S(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(n,e){switch(this._point){case 0:{this._string.push("M",n,",",e),this._point=1;break}case 1:{this._string.push("L",n,",",e);break}default:{this._circle==null&&(this._circle=$S(this._radius)),this._string.push("M",n,",",e,this._circle);break}}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}else return null}};function $S(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function fx(n,e){var t=4.5,i,s;function r(a){return a&&(typeof t=="function"&&s.pointRadius(+t.apply(this,arguments)),Oo(a,i(s))),s.result()}return r.area=function(a){return Oo(a,i(rr)),rr.result()},r.measure=function(a){return Oo(a,i(jd)),jd.result()},r.bounds=function(a){return Oo(a,i(Rf)),Rf.result()},r.centroid=function(a){return Oo(a,i(jn)),jn.result()},r.projection=function(a){return arguments.length?(i=a==null?(n=null,Fd):(n=a).stream,r):n},r.context=function(a){return arguments.length?(s=a==null?(e=null,new XC):new NC(e=a),typeof t!="function"&&s.pointRadius(t),r):e},r.pointRadius=function(a){return arguments.length?(t=typeof a=="function"?a:(s.pointRadius(+a),+a),r):t},r.projection(n).context(e)}function l_(n){return function(e){var t=new tb;for(var i in n)t[i]=n[i];return t.stream=e,t}}function tb(){}tb.prototype={constructor:tb,point:function(n,e){this.stream.point(n,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function px(n,e,t){var i=n.clipExtent&&n.clipExtent();return n.scale(150).translate([0,0]),i!=null&&n.clipExtent(null),Oo(t,n.stream(Rf)),e(Rf.result()),i!=null&&n.clipExtent(i),n}function h_(n,e,t){return px(n,function(i){var s=e[1][0]-e[0][0],r=e[1][1]-e[0][1],a=Math.min(s/(i[1][0]-i[0][0]),r/(i[1][1]-i[0][1])),o=+e[0][0]+(s-a*(i[1][0]+i[0][0]))/2,l=+e[0][1]+(r-a*(i[1][1]+i[0][1]))/2;n.scale(150*a).translate([o,l])},t)}function gx(n,e,t){return h_(n,[[0,0],e],t)}function _x(n,e,t){return px(n,function(i){var s=+e,r=s/(i[1][0]-i[0][0]),a=(s-r*(i[1][0]+i[0][0]))/2,o=-r*i[0][1];n.scale(150*r).translate([a,o])},t)}function mx(n,e,t){return px(n,function(i){var s=+e,r=s/(i[1][1]-i[0][1]),a=-r*i[0][0],o=(s-r*(i[1][1]+i[0][1]))/2;n.scale(150*r).translate([a,o])},t)}var YS=16,c2=$e(30*It);function XS(n,e){return+e?p2(n,e):f2(n)}function f2(n){return l_({point:function(e,t){e=n(e,t),this.stream.point(e[0],e[1])}})}function p2(n,e){function t(i,s,r,a,o,l,h,d,u,c,f,p,g,_){var m=h-i,y=d-s,b=m*m+y*y;if(b>4*e&&g--){var v=a+c,x=o+f,S=l+p,A=un(v*v+x*x+S*S),k=Xn(S/=A),w=ct(ct(S)-1)<Ne||ct(r-u)<Ne?(r+u)/2:mr(x,v),M=n(w,k),T=M[0],E=M[1],O=T-i,B=E-s,R=y*O-m*B;(R*R/b>e||ct((m*O+y*B)/b-.5)>.3||a*c+o*f+l*p<c2)&&(t(i,s,r,a,o,l,T,E,w,v/=A,x/=A,S,g,_),_.point(T,E),t(T,E,w,v,x,S,h,d,u,c,f,p,g,_))}}return function(i){var s,r,a,o,l,h,d,u,c,f,p,g,_={point:m,lineStart:y,lineEnd:v,polygonStart:function(){i.polygonStart(),_.lineStart=x},polygonEnd:function(){i.polygonEnd(),_.lineStart=y}};function m(k,w){k=n(k,w),i.point(k[0],k[1])}function y(){u=NaN,_.point=b,i.lineStart()}function b(k,w){var M=Yl([k,w]),T=n(k,w);t(u,c,d,f,p,g,u=T[0],c=T[1],d=k,f=M[0],p=M[1],g=M[2],YS,i),i.point(u,c)}function v(){_.point=m,i.lineEnd()}function x(){y(),_.point=S,_.lineEnd=A}function S(k,w){b(s=k,w),r=u,a=c,o=f,l=p,h=g,_.point=b}function A(){t(u,c,d,f,p,g,r,a,s,o,l,h,YS,i),_.lineEnd=v,v()}return _}}var g2=l_({point:function(n,e){this.stream.point(n*It,e*It)}});function _2(n){return l_({point:function(e,t){var i=n(e,t);return this.stream.point(i[0],i[1])}})}function m2(n,e,t,i,s){function r(a,o){return a*=i,o*=s,[e+n*a,t-n*o]}return r.invert=function(a,o){return[(a-e)/n*i,(t-o)/n*s]},r}function KS(n,e,t,i,s,r){var a=$e(r),o=je(r),l=a*n,h=o*n,d=a/n,u=o/n,c=(o*t-a*e)/n,f=(o*e+a*t)/n;function p(g,_){return g*=i,_*=s,[l*g-h*_+e,t-h*g-l*_]}return p.invert=function(g,_){return[i*(d*g-u*_+c),s*(f-u*g-d*_)]},p}function Sr(n){return KC(function(){return n})()}function KC(n){var e,t=150,i=480,s=250,r=0,a=0,o=0,l=0,h=0,d,u=0,c=1,f=1,p=null,g=VS,_=null,m,y,b,v=Fd,x=.5,S,A,k,w,M;function T(R){return k(R[0]*It,R[1]*It)}function E(R){return R=k.invert(R[0],R[1]),R&&[R[0]*Bi,R[1]*Bi]}T.stream=function(R){return w&&M===R?w:w=g2(_2(d)(g(S(v(M=R)))))},T.preclip=function(R){return arguments.length?(g=R,p=void 0,B()):g},T.postclip=function(R){return arguments.length?(v=R,_=m=y=b=null,B()):v},T.clipAngle=function(R){return arguments.length?(g=+R?e2(p=R*It):(p=null,VS),B()):p*Bi},T.clipExtent=function(R){return arguments.length?(v=R==null?(_=m=y=b=null,Fd):FC(_=+R[0][0],m=+R[0][1],y=+R[1][0],b=+R[1][1]),B()):_==null?null:[[_,m],[y,b]]},T.scale=function(R){return arguments.length?(t=+R,O()):t},T.translate=function(R){return arguments.length?(i=+R[0],s=+R[1],O()):[i,s]},T.center=function(R){return arguments.length?(r=R[0]%360*It,a=R[1]%360*It,O()):[r*Bi,a*Bi]},T.rotate=function(R){return arguments.length?(o=R[0]%360*It,l=R[1]%360*It,h=R.length>2?R[2]%360*It:0,O()):[o*Bi,l*Bi,h*Bi]},T.angle=function(R){return arguments.length?(u=R%360*It,O()):u*Bi},T.reflectX=function(R){return arguments.length?(c=R?-1:1,O()):c<0},T.reflectY=function(R){return arguments.length?(f=R?-1:1,O()):f<0},T.precision=function(R){return arguments.length?(S=XS(A,x=R*R),B()):un(x)},T.fitExtent=function(R,L){return h_(T,R,L)},T.fitSize=function(R,L){return gx(T,R,L)},T.fitWidth=function(R,L){return _x(T,R,L)},T.fitHeight=function(R,L){return mx(T,R,L)};function O(){var R=KS(t,0,0,c,f,u).apply(null,e(r,a)),L=(u?KS:m2)(t,i-R[0],s-R[1],c,f,u);return d=RC(o,l,h),A=Uy(e,L),k=Uy(d,A),S=XS(A,x),B()}function B(){return w=M=null,T}return function(){return e=n.apply(this,arguments),T.invert=e.invert&&E,O()}}function yx(n){var e=0,t=qe/3,i=KC(n),s=i(e,t);return s.parallels=function(r){return arguments.length?i(e=r[0]*It,t=r[1]*It):[e*Bi,t*Bi]},s}function y2(n){var e=$e(n);function t(i,s){return[i*e,je(s)/e]}return t.invert=function(i,s){return[i/e,Xn(s*e)]},t}function b2(n,e){var t=je(n),i=(t+je(e))/2;if(ct(i)<Ne)return y2(n);var s=1+t*(2*i-t),r=un(s)/i;function a(o,l){var h=un(s-2*i*je(l))/i;return[h*je(o*=i),r-h*$e(o)]}return a.invert=function(o,l){var h=r-l,d=mr(o,ct(h))*Gn(h);return h*i<0&&(d-=qe*Gn(o)*Gn(h)),[d/i,Xn((s-(o*o+h*h)*i*i)/(2*i))]},a}function Lf(){return yx(b2).scale(155.424).center([0,33.6442])}function qC(){return Lf().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function v2(n){var e=n.length;return{point:function(t,i){for(var s=-1;++s<e;)n[s].point(t,i)},sphere:function(){for(var t=-1;++t<e;)n[t].sphere()},lineStart:function(){for(var t=-1;++t<e;)n[t].lineStart()},lineEnd:function(){for(var t=-1;++t<e;)n[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<e;)n[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<e;)n[t].polygonEnd()}}}function x2(){var n,e,t=qC(),i,s=Lf().rotate([154,0]).center([-2,58.5]).parallels([55,65]),r,a=Lf().rotate([157,0]).center([-3,19.9]).parallels([8,18]),o,l,h={point:function(c,f){l=[c,f]}};function d(c){var f=c[0],p=c[1];return l=null,i.point(f,p),l||(r.point(f,p),l)||(o.point(f,p),l)}d.invert=function(c){var f=t.scale(),p=t.translate(),g=(c[0]-p[0])/f,_=(c[1]-p[1])/f;return(_>=.12&&_<.234&&g>=-.425&&g<-.214?s:_>=.166&&_<.234&&g>=-.214&&g<-.115?a:t).invert(c)},d.stream=function(c){return n&&e===c?n:n=v2([t.stream(e=c),s.stream(c),a.stream(c)])},d.precision=function(c){return arguments.length?(t.precision(c),s.precision(c),a.precision(c),u()):t.precision()},d.scale=function(c){return arguments.length?(t.scale(c),s.scale(c*.35),a.scale(c),d.translate(t.translate())):t.scale()},d.translate=function(c){if(!arguments.length)return t.translate();var f=t.scale(),p=+c[0],g=+c[1];return i=t.translate(c).clipExtent([[p-.455*f,g-.238*f],[p+.455*f,g+.238*f]]).stream(h),r=s.translate([p-.307*f,g+.201*f]).clipExtent([[p-.425*f+Ne,g+.12*f+Ne],[p-.214*f-Ne,g+.234*f-Ne]]).stream(h),o=a.translate([p-.205*f,g+.212*f]).clipExtent([[p-.214*f+Ne,g+.166*f+Ne],[p-.115*f-Ne,g+.234*f-Ne]]).stream(h),u()},d.fitExtent=function(c,f){return h_(d,c,f)},d.fitSize=function(c,f){return gx(d,c,f)},d.fitWidth=function(c,f){return _x(d,c,f)},d.fitHeight=function(c,f){return mx(d,c,f)};function u(){return n=e=null,d}return d.scale(1070)}function ZC(n){return function(e,t){var i=$e(e),s=$e(t),r=n(i*s);return[r*s*je(e),r*je(t)]}}function Fu(n){return function(e,t){var i=un(e*e+t*t),s=n(i),r=je(s),a=$e(s);return[mr(e*r,i*a),Xn(i&&t*r/i)]}}var JC=ZC(function(n){return un(2/(1+n))});JC.invert=Fu(function(n){return 2*Xn(n/2)});function S2(){return Sr(JC).scale(124.75).clipAngle(180-.001)}var QC=ZC(function(n){return(n=EC(n))&&n/je(n)});QC.invert=Fu(function(n){return n});function A2(){return Sr(QC).scale(79.4188).clipAngle(180-.001)}function d_(n,e){return[n,Mf(cx((Wt+e)/2))]}d_.invert=function(n,e){return[n,2*bh(PC(e))-Wt]};function k2(){return eP(d_).scale(961/xn)}function eP(n){var e=Sr(n),t=e.center,i=e.scale,s=e.translate,r=e.clipExtent,a=null,o,l,h;e.scale=function(u){return arguments.length?(i(u),d()):i()},e.translate=function(u){return arguments.length?(s(u),d()):s()},e.center=function(u){return arguments.length?(t(u),d()):t()},e.clipExtent=function(u){return arguments.length?(u==null?a=o=l=h=null:(a=+u[0][0],o=+u[0][1],l=+u[1][0],h=+u[1][1]),d()):a==null?null:[[a,o],[l,h]]};function d(){var u=qe*i(),c=e(ND(e.rotate()).invert([0,0]));return r(a==null?[[c[0]-u,c[1]-u],[c[0]+u,c[1]+u]]:n===d_?[[Math.max(c[0]-u,a),o],[Math.min(c[0]+u,l),h]]:[[a,Math.max(c[1]-u,o)],[l,Math.min(c[1]+u,h)]])}return d()}function kc(n){return cx((Wt+n)/2)}function w2(n,e){var t=$e(n),i=n===e?je(n):Mf(t/$e(e))/Mf(kc(e)/kc(n)),s=t*Pm(kc(n),i)/i;if(!i)return d_;function r(a,o){s>0?o<-Wt+Ne&&(o=-Wt+Ne):o>Wt-Ne&&(o=Wt-Ne);var l=s/Pm(kc(o),i);return[l*je(i*a),s-l*$e(i*a)]}return r.invert=function(a,o){var l=s-o,h=Gn(i)*un(a*a+l*l),d=mr(a,ct(l))*Gn(l);return l*i<0&&(d-=qe*Gn(a)*Gn(l)),[d/i,2*bh(Pm(s/h,1/i))-Wt]},r}function M2(){return yx(w2).scale(109.5).parallels([30,30])}function If(n,e){return[n,e]}If.invert=If;function T2(){return Sr(If).scale(152.63)}function C2(n,e){var t=$e(n),i=n===e?je(n):(t-$e(e))/(e-n),s=t/i+n;if(ct(i)<Ne)return If;function r(a,o){var l=s-o,h=i*a;return[l*je(h),s-l*$e(h)]}return r.invert=function(a,o){var l=s-o,h=mr(a,ct(l))*Gn(l);return l*i<0&&(h-=qe*Gn(a)*Gn(l)),[h/i,s-Gn(i)*un(a*a+l*l)]},r}function P2(){return yx(C2).scale(131.154).center([0,13.9389])}var od=1.340264,ld=-.081106,hd=893e-6,dd=.003796,Df=un(3)/2,E2=12;function tP(n,e){var t=Xn(Df*je(e)),i=t*t,s=i*i*i;return[n*$e(t)/(Df*(od+3*ld*i+s*(7*hd+9*dd*i))),t*(od+ld*i+s*(hd+dd*i))]}tP.invert=function(n,e){for(var t=e,i=t*t,s=i*i*i,r=0,a,o,l;r<E2&&(o=t*(od+ld*i+s*(hd+dd*i))-e,l=od+3*ld*i+s*(7*hd+9*dd*i),t-=a=o/l,i=t*t,s=i*i*i,!(ct(a)<VD));++r);return[Df*n*(od+3*ld*i+s*(7*hd+9*dd*i))/$e(t),Xn(je(t)/Df)]};function R2(){return Sr(tP).scale(177.158)}function iP(n,e){var t=$e(e),i=$e(n)*t;return[t*je(n)/i,je(e)/i]}iP.invert=Fu(bh);function O2(){return Sr(iP).scale(144.049).clipAngle(60)}function B2(){var n=1,e=0,t=0,i=1,s=1,r=0,a,o,l=null,h,d,u,c=1,f=1,p=l_({point:function(v,x){var S=b([v,x]);this.stream.point(S[0],S[1])}}),g=Fd,_,m;function y(){return c=n*i,f=n*s,_=m=null,b}function b(v){var x=v[0]*c,S=v[1]*f;if(r){var A=S*a-x*o;x=x*a+S*o,S=A}return[x+e,S+t]}return b.invert=function(v){var x=v[0]-e,S=v[1]-t;if(r){var A=S*a+x*o;x=x*a-S*o,S=A}return[x/c,S/f]},b.stream=function(v){return _&&m===v?_:_=p(g(m=v))},b.postclip=function(v){return arguments.length?(g=v,l=h=d=u=null,y()):g},b.clipExtent=function(v){return arguments.length?(g=v==null?(l=h=d=u=null,Fd):FC(l=+v[0][0],h=+v[0][1],d=+v[1][0],u=+v[1][1]),y()):l==null?null:[[l,h],[d,u]]},b.scale=function(v){return arguments.length?(n=+v,y()):n},b.translate=function(v){return arguments.length?(e=+v[0],t=+v[1],y()):[e,t]},b.angle=function(v){return arguments.length?(r=v%360*It,o=je(r),a=$e(r),y()):r*Bi},b.reflectX=function(v){return arguments.length?(i=v?-1:1,y()):i<0},b.reflectY=function(v){return arguments.length?(s=v?-1:1,y()):s<0},b.fitExtent=function(v,x){return h_(b,v,x)},b.fitSize=function(v,x){return gx(b,v,x)},b.fitWidth=function(v,x){return _x(b,v,x)},b.fitHeight=function(v,x){return mx(b,v,x)},b}function nP(n,e){var t=e*e,i=t*t;return[n*(.8707-.131979*t+i*(-.013791+i*(.003971*t-.001529*i))),e*(1.007226+t*(.015085+i*(-.044475+.028874*t-.005916*i)))]}nP.invert=function(n,e){var t=e,i=25,s;do{var r=t*t,a=r*r;t-=s=(t*(1.007226+r*(.015085+a*(-.044475+.028874*r-.005916*a)))-e)/(1.007226+r*(.015085*3+a*(-.044475*7+.028874*9*r-.005916*11*a)))}while(ct(s)>Ne&&--i>0);return[n/(.8707+(r=t*t)*(-.131979+r*(-.013791+r*r*r*(.003971-.001529*r)))),t]};function L2(){return Sr(nP).scale(175.295)}function sP(n,e){return[$e(e)*je(n),je(e)]}sP.invert=Fu(Xn);function I2(){return Sr(sP).scale(249.5).clipAngle(90+Ne)}function rP(n,e){var t=$e(e),i=1+$e(n)*t;return[t*je(n)/i,je(e)/i]}rP.invert=Fu(function(n){return 2*bh(n)});function D2(){return Sr(rP).scale(250).clipAngle(142)}function aP(n,e){return[Mf(cx((Wt+e)/2)),-n]}aP.invert=function(n,e){return[-e,2*bh(PC(n))-Wt]};function F2(){var n=eP(aP),e=n.center,t=n.rotate;return n.center=function(i){return arguments.length?e([-i[1],i[0]]):(i=e(),[i[1],-i[0]])},n.rotate=function(i){return arguments.length?t([i[0],i[1],i.length>2?i[2]+90:90]):(i=t(),[i[0],i[1],i[2]-90])},t([0,0,90]).scale(159.155)}function z2(n){return n}function j2(n){if(n==null)return z2;var e,t,i=n.scale[0],s=n.scale[1],r=n.translate[0],a=n.translate[1];return function(o,l){l||(e=t=0);var h=2,d=o.length,u=new Array(d);for(u[0]=(e+=o[0])*i+r,u[1]=(t+=o[1])*s+a;h<d;)u[h]=o[h],++h;return u}}function H2(n,e){for(var t,i=n.length,s=i-e;s<--i;)t=n[s],n[s++]=n[i],n[i]=t}function G2(n,e){return typeof e=="string"&&(e=n.objects[e]),e.type==="GeometryCollection"?{type:"FeatureCollection",features:e.geometries.map(function(t){return qS(n,t)})}:qS(n,e)}function qS(n,e){var t=e.id,i=e.bbox,s=e.properties==null?{}:e.properties,r=W2(n,e);return t==null&&i==null?{type:"Feature",properties:s,geometry:r}:i==null?{type:"Feature",id:t,properties:s,geometry:r}:{type:"Feature",id:t,bbox:i,properties:s,geometry:r}}function W2(n,e){var t=j2(n.transform),i=n.arcs;function s(d,u){u.length&&u.pop();for(var c=i[d<0?~d:d],f=0,p=c.length;f<p;++f)u.push(t(c[f],f));d<0&&H2(u,p)}function r(d){return t(d)}function a(d){for(var u=[],c=0,f=d.length;c<f;++c)s(d[c],u);return u.length<2&&u.push(u[0]),u}function o(d){for(var u=a(d);u.length<4;)u.push(u[0]);return u}function l(d){return d.map(o)}function h(d){var u=d.type,c;switch(u){case"GeometryCollection":return{type:u,geometries:d.geometries.map(h)};case"Point":c=r(d.coordinates);break;case"MultiPoint":c=d.coordinates.map(r);break;case"LineString":c=a(d.arcs);break;case"MultiLineString":c=d.arcs.map(a);break;case"Polygon":c=l(d.arcs);break;case"MultiPolygon":c=d.arcs.map(l);break;default:return null}return{type:u,coordinates:c}}return h(e)}var oP={exports:{}},vs=function(n,e){this.p1=n,this.p2=e};vs.prototype.rise=function(){return this.p2[1]-this.p1[1]};vs.prototype.run=function(){return this.p2[0]-this.p1[0]};vs.prototype.slope=function(){return this.rise()/this.run()};vs.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)};vs.prototype.isVertical=function(){return!isFinite(this.slope())};vs.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]};vs.prototype._perpendicularDistanceHorizontal=function(n){return Math.abs(this.p1[1]-n[1])};vs.prototype._perpendicularDistanceVertical=function(n){return Math.abs(this.p1[0]-n[0])};vs.prototype._perpendicularDistanceHasSlope=function(n){var e=this.slope(),t=this.yIntercept();return Math.abs(e*n[0]-n[1]+t)/Math.sqrt(Math.pow(e,2)+1)};vs.prototype.perpendicularDistance=function(n){return this.isVertical()?this._perpendicularDistanceVertical(n):this.isHorizontal()?this._perpendicularDistanceHorizontal(n):this._perpendicularDistanceHasSlope(n)};var V2=vs,N2=V2,ib=function(n,e){for(var t=0,i=0,s=1;s<=n.length-2;s++){var r=new N2(n[0],n[n.length-1]).perpendicularDistance(n[s]);r>t&&(i=s,t=r)}if(t>e)var a=ib(n.slice(0,i),e),o=ib(n.slice(i,n.length),e),l=a.concat(o);else n.length>1?l=[n[0],n[n.length-1]]:l=[n[0]];return l},U2=ib;(function(n){var e=U2;n.exports=function(s,r,a){return a||(s=JSON.parse(JSON.stringify(s))),s.features?i(s,r):s.type&&s.type==="Feature"?t(s,r):new Error("FeatureCollection or individual Feature required")},n.exports.simplify=function(s,r){return e(s,r)};function t(s,r){var a=s.geometry,o=a.type;if(o==="LineString")a.coordinates=n.exports.simplify(a.coordinates,r);else if(o==="Polygon"||o==="MultiLineString")for(var l=0;l<a.coordinates.length;l++)a.coordinates[l]=n.exports.simplify(a.coordinates[l],r);else if(o==="MultiPolygon")for(var h=0;h<a.coordinates.length;h++)for(var d=0;d<a.coordinates[h].length;d++)a.coordinates[h][d]=n.exports.simplify(a.coordinates[h][d],r);return s}function i(s,r){for(var a=0;a<s.features.length;a++)s.features[a]=t(s.features[a],r);return s}})(oP);var $2=oP.exports;const Y2=dC($2),u_=function(n,...e){return K2(ri(n),...e)};function lP(n,e,t){const i=e[t];if(i===void 0)n[t]=null;else if(He(i)){He(n[t])||(n[t]={});for(const s in i)lP(n[t],i,s)}else n[t]=i}function X2(n,e){if(He(e)&&n!==e)for(const t in e)lP(n,e,t)}function K2(n,...e){n||(n={});let t=-1;const i=e.length;for(;++t<i;)X2(n,e[t]);return n}const q2={tolerance:.01},hP=(n,e)=>{const t=u_(q2,e),{tolerance:i}=t;return Y2(n,i)};var eo;(function(n){n.DSV="dsv",n.TREE="tree",n.GEO="geo",n.BYTE="bytejson",n.HEX="hex",n.GRAPH="graph",n.TABLE="table",n.GEO_GRATICULE="geo-graticule"})(eo||(eo={}));const Z2=(n,e)=>{const{fields:t,key:i,value:s,retains:r}=e,a=[];for(let o=0;o<n.length;o++)t.forEach(l=>{const h={};if(h[i]=l,h[s]=n[o][l],r)r.forEach(d=>{h[d]=n[o][d]});else for(const d in n[o])t.indexOf(d)===-1&&(h[d]=n[o][d]);a.push(h)});return a},dP=(n,e)=>{var t,i;if(!(e!=null&&e.fields)||n.length===0)return n;const s=e.fields,r=n[0],a={},o=[];for(const l in s)if(Object.prototype.hasOwnProperty.call(s,l)){const h=s[l];if(!h.type){let u=r;l in r||(u=(t=n.find(c=>l in c))!==null&&t!==void 0?t:r),h.type=typeof u[l]=="number"?"linear":"ordinal"}let d;if(typeof h.sortIndex=="number"&&(d={key:l,type:h.type,index:h.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:h.sortReverse===!0},o.push(d)),((i=h.domain)===null||i===void 0?void 0:i.length)>0)if(h.type==="ordinal"){h._domainCache={},a[l]=h;const u={};h.domain.forEach((c,f)=>{u[c]=f,h._domainCache[c]=f}),d&&(d.sortIndex=u,d.sortIndexCount=h.domain.length)}else h.domain.length>=2&&(a[l]=h)}return Object.keys(a).length>0&&(n=n.filter(l=>{for(const h in a){const d=a[h];if(d.type==="ordinal"){if(!(l[h]in d._domainCache))return!1}else if(d.domain[0]>l[h]||d.domain[1]<l[h])return!1}return!0})),o.sort((l,h)=>l.index-h.index),n.sort((l,h)=>J2(l,h,o)),n};function J2(n,e,t){for(let i=0;i<t.length;i++){const s=t[i];let r=0;if(s.type==="ordinal"?(s.sortIndex[e[s.key]]===void 0&&(s.sortIndex[e[s.key]]=s.sortIndexCount++),s.sortIndex[n[s.key]]===void 0&&(s.sortIndex[n[s.key]]=s.sortIndexCount++),r=s.sortIndex[n[s.key]]-s.sortIndex[e[s.key]]):s.type==="linear"&&(r=n[s.key]-e[s.key]),s.sortReverse&&(r=-r),r!==0)return r}return 0}var ZS={},Im={},Dm=34,Eh=10,Fm=13;function uP(n){return new Function("d","return {"+n.map(function(e,t){return JSON.stringify(e)+": d["+t+'] || ""'}).join(",")+"}")}function Q2(n,e){var t=uP(n);return function(i,s){return e(t(i),s,n)}}function JS(n){var e=Object.create(null),t=[];return n.forEach(function(i){for(var s in i)s in e||t.push(e[s]=s)}),t}function ln(n,e){var t=n+"",i=t.length;return i<e?new Array(e-i+1).join(0)+t:t}function eF(n){return n<0?"-"+ln(-n,6):n>9999?"+"+ln(n,6):ln(n,4)}function tF(n){var e=n.getUTCHours(),t=n.getUTCMinutes(),i=n.getUTCSeconds(),s=n.getUTCMilliseconds();return isNaN(n)?"Invalid Date":eF(n.getUTCFullYear())+"-"+ln(n.getUTCMonth()+1,2)+"-"+ln(n.getUTCDate(),2)+(s?"T"+ln(e,2)+":"+ln(t,2)+":"+ln(i,2)+"."+ln(s,3)+"Z":i?"T"+ln(e,2)+":"+ln(t,2)+":"+ln(i,2)+"Z":t||e?"T"+ln(e,2)+":"+ln(t,2)+"Z":"")}function bx(n){var e=new RegExp('["'+n+`
  10. \r]`),t=n.charCodeAt(0);function i(u,c){var f,p,g=s(u,function(_,m){if(f)return f(_,m-1);p=_,f=c?Q2(_,c):uP(_)});return g.columns=p||[],g}function s(u,c){var f=[],p=u.length,g=0,_=0,m,y=p<=0,b=!1;u.charCodeAt(p-1)===Eh&&--p,u.charCodeAt(p-1)===Fm&&--p;function v(){if(y)return Im;if(b)return b=!1,ZS;var S,A=g,k;if(u.charCodeAt(A)===Dm){for(;g++<p&&u.charCodeAt(g)!==Dm||u.charCodeAt(++g)===Dm;);return(S=g)>=p?y=!0:(k=u.charCodeAt(g++))===Eh?b=!0:k===Fm&&(b=!0,u.charCodeAt(g)===Eh&&++g),u.slice(A+1,S-1).replace(/""/g,'"')}for(;g<p;){if((k=u.charCodeAt(S=g++))===Eh)b=!0;else if(k===Fm)b=!0,u.charCodeAt(g)===Eh&&++g;else if(k!==t)continue;return u.slice(A,S)}return y=!0,u.slice(A,p)}for(;(m=v())!==Im;){for(var x=[];m!==ZS&&m!==Im;)x.push(m),m=v();c&&(x=c(x,_++))==null||f.push(x)}return f}function r(u,c){return u.map(function(f){return c.map(function(p){return d(f[p])}).join(n)})}function a(u,c){return c==null&&(c=JS(u)),[c.map(d).join(n)].concat(r(u,c)).join(`
  11. `)}function o(u,c){return c==null&&(c=JS(u)),r(u,c).join(`
  12. `)}function l(u){return u.map(h).join(`
  13. `)}function h(u){return u.map(d).join(n)}function d(u){return u==null?"":u instanceof Date?tF(u):e.test(u+="")?'"'+u.replace(/"/g,'""')+'"':u}return{parse:i,parseRows:s,format:a,formatBody:o,formatRows:l,formatRow:h,formatValue:d}}var iF=bx(","),nF=iF.parse,sF=bx(" "),rF=sF.parse;const aF={delimiter:","},cP=(n,e={},t)=>{t.type=eo.DSV;const i=u_(aF,e),{delimiter:s}=i;if(!ae(s))throw new TypeError("Invalid delimiter: must be a string!");return bx(s).parse(n)},fP=(n,e={},t)=>(t.type=eo.DSV,nF(n)),pP=(n,e={},t)=>(t.type=eo.DSV,rF(n));function oF(n){if(!n)throw new Error("geojson is required");switch(n.type){case"Feature":return gP(n);case"FeatureCollection":return lF(n);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return vx(n);default:throw new Error("unknown GeoJSON type")}}function gP(n){var e={type:"Feature"};return Object.keys(n).forEach(function(t){switch(t){case"type":case"properties":case"geometry":return;default:e[t]=n[t]}}),e.properties=_P(n.properties),e.geometry=vx(n.geometry),e}function _P(n){var e={};return n&&Object.keys(n).forEach(function(t){var i=n[t];typeof i=="object"?i===null?e[t]=null:Array.isArray(i)?e[t]=i.map(function(s){return s}):e[t]=_P(i):e[t]=i}),e}function lF(n){var e={type:"FeatureCollection"};return Object.keys(n).forEach(function(t){switch(t){case"type":case"features":return;default:e[t]=n[t]}}),e.features=n.features.map(function(t){return gP(t)}),e}function vx(n){var e={type:n.type};return n.bbox&&(e.bbox=n.bbox),n.type==="GeometryCollection"?(e.geometries=n.geometries.map(function(t){return vx(t)}),e):(e.coordinates=mP(n.coordinates),e)}function mP(n){var e=n;return typeof e[0]!="object"?e.slice():e.map(function(t){return mP(t)})}function qh(n){if(Array.isArray(n))return n;if(n.type==="Feature"){if(n.geometry!==null)return n.geometry.coordinates}else if(n.coordinates)return n.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function nb(n){for(var e=qh(n),t=0,i=1,s,r;i<e.length;)s=r||e[0],r=e[i],t+=(r[0]-s[0])*(r[1]+s[1]),i++;return t>0}function QS(n,e){if(n.type==="Feature")e(n,0);else if(n.type==="FeatureCollection")for(var t=0;t<n.features.length&&e(n.features[t],t)!==!1;t++);}function xx(n,e){var t,i,s,r,a,o,l,h,d,u,c=0,f=n.type==="FeatureCollection",p=n.type==="Feature",g=f?n.features.length:1;for(t=0;t<g;t++){for(o=f?n.features[t].geometry:p?n.geometry:n,h=f?n.features[t].properties:p?n.properties:{},d=f?n.features[t].bbox:p?n.bbox:void 0,u=f?n.features[t].id:p?n.id:void 0,l=o?o.type==="GeometryCollection":!1,a=l?o.geometries.length:1,s=0;s<a;s++){if(r=l?o.geometries[s]:o,r===null){if(e(null,c,h,d,u)===!1)return!1;continue}switch(r.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(r,c,h,d,u)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<r.geometries.length;i++)if(e(r.geometries[i],c,h,d,u)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}c++}}function hF(n,e){xx(n,function(t,i,s,r,a){var o=t===null?null:t.type;switch(o){case null:case"Point":case"LineString":case"Polygon":return e(OS(t,s,{bbox:r,id:a}),i,0)===!1?!1:void 0}var l;switch(o){case"MultiPoint":l="Point";break;case"MultiLineString":l="LineString";break;case"MultiPolygon":l="Polygon";break}for(var h=0;h<t.coordinates.length;h++){var d=t.coordinates[h],u={type:l,coordinates:d};if(e(OS(u,s),i,h)===!1)return!1}})}function dF(n,e){if(e=e||{},!zD(e))throw new Error("options is invalid");var t=e.reverse||!1,i=e.mutate||!1;if(!n)throw new Error("<geojson> is required");if(typeof t!="boolean")throw new Error("<reverse> must be a boolean");if(typeof i!="boolean")throw new Error("<mutate> must be a boolean");i===!1&&(n=oF(n));var s=[];switch(n.type){case"GeometryCollection":return xx(n,function(r){lf(r,t)}),n;case"FeatureCollection":return QS(n,function(r){QS(lf(r,t),function(a){s.push(a)})}),CC(s)}return lf(n,t)}function lf(n,e){var t=n.type==="Feature"?n.geometry.type:n.type;switch(t){case"GeometryCollection":return xx(n,function(i){lf(i,e)}),n;case"LineString":return eA(qh(n),e),n;case"Polygon":return tA(qh(n),e),n;case"MultiLineString":return qh(n).forEach(function(i){eA(i,e)}),n;case"MultiPolygon":return qh(n).forEach(function(i){tA(i,e)}),n;case"Point":case"MultiPoint":return n}}function eA(n,e){nb(n)===e&&n.reverse()}function tA(n,e){nb(n[0])!==e&&n[0].reverse();for(var t=1;t<n.length;t++)nb(n[t])===e&&n[t].reverse()}function uF(n){if(!n)throw new Error("geojson is required");var e=[];return hF(n,function(t){e.push(t)}),CC(e)}const iA=fx(),yP={centroid:!1,name:!1,bbox:!1,rewind:!1},nA=n=>{if(n.geometry.type.startsWith("Multi")){const e=uF(n).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},n),n.properties)},cF=n=>{const e=[];return n.forEach(t=>{t.type==="FeatureCollection"?t.features.forEach(i=>{e.push(nA(i))}):e.push(nA(t))}),e},bP=(n,e={},t)=>{t.type=eo.GEO;const i=u_(yP,e),{centroid:s,name:r,bbox:a,rewind:o}=i;if(Array.isArray(n))return cF(n);let l=n.features;return o&&(l=dF(n,{reverse:!He(o)||o.reverse}).features),l.forEach(h=>{if(s){const d=iA.centroid(h);h.centroidX=d[0],h.centroidY=d[1]}if(r&&(h.name=h.properties.name),a){const d=iA.bounds(h);h.bbox=d}}),n.features=l,n},fF={},pF=(n,e,t)=>{t.type=eo.GEO;const i=u_(yP,fF,e),{object:s}=i;if(!ae(s))throw new TypeError("Invalid object: must be a string!");const r=G2(n,n.objects[s]);return bP(r,i,t)},c_=(n,e,t)=>{const i=!ht(e==null?void 0:e.dependencyUpdate)||(e==null?void 0:e.dependencyUpdate);if(!n||!W(n))throw new TypeError("Invalid data: must be DataView array!");return W(t.rawData)&&t.rawData.forEach(s=>{s.target&&(s.target.removeListener("change",t.reRunAllTransform),s.target.removeListener("markRunning",t.markRunning))}),i&&n.forEach(s=>{s.target.addListener("change",t.reRunAllTransform),s.target.addListener("markRunning",t.markRunning)}),n};let zm=0;const gF=1e8;function vP(n="dataset"){return zm>gF&&(zm=0),n+"_"+zm++}class to{constructor(e){var t;let i;this.options=e,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new po,i=e!=null&&e.name?e.name:vP("dataset"),this.name=i,this._logger=(t=e==null?void 0:e.logger)!==null&&t!==void 0?t:De.getInstance()}setLogger(e){this._logger=e}getDataView(e){return this.dataViewMap[e]}setDataView(e,t){var i;this.dataViewMap[e]&&((i=this._logger)===null||i===void 0||i.error(`Error: dataView ${e} 之前已存在,请重新命名`)),this.dataViewMap[e]=t}removeDataView(e){this.dataViewMap[e]=null,delete this.dataViewMap[e]}registerParser(e,t){var i;this.parserMap[e]&&((i=this._logger)===null||i===void 0||i.warn(`Warn: transform ${e} 之前已注册,执行覆盖逻辑`)),this.parserMap[e]=t}removeParser(e){this.parserMap[e]=null,delete this.parserMap[e]}getParser(e){return this.parserMap[e]||this.parserMap.default}registerTransform(e,t){var i;this.transformMap[e]&&((i=this._logger)===null||i===void 0||i.warn(`Warn: transform ${e} 之前已注册,执行覆盖逻辑`)),this.transformMap[e]=t}removeTransform(e){this.transformMap[e]=null,delete this.transformMap[e]}getTransform(e){return this.transformMap[e]}multipleDataViewAddListener(e,t,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{e.some(r=>r.isRunning)||i()}),e.forEach(r=>{r.target.addListener(t,s)}),this._callMap.set(i,s)}allDataViewAddListener(e,t){this.multipleDataViewAddListener(Object.values(this.dataViewMap),e,t)}multipleDataViewRemoveListener(e,t,i){if(this._callMap){const s=this._callMap.get(i);s&&e.forEach(r=>{r.target.removeListener(t,s)}),this._callMap.delete(i)}}multipleDataViewUpdateInParse(e){e.forEach(t=>{var i;return(i=this.getDataView(t.name))===null||i===void 0?void 0:i.markRunning()}),e.forEach(t=>{var i;return(i=this.getDataView(t.name))===null||i===void 0?void 0:i.parseNewData(t.data,t.options)})}multipleDataViewUpdateInRawData(e){e.forEach(t=>{var i;return(i=this.getDataView(t.name))===null||i===void 0?void 0:i.markRunning()}),e.forEach(t=>{var i;return(i=this.getDataView(t.name))===null||i===void 0?void 0:i.updateRawData(t.data,t.options)})}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const jm="_data-view-diff-rank";class Ye{constructor(e,t){let i;this.dataSet=e,this.options=t,this.isDataView=!0,this.target=new po,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(s={pushHistory:!0,emitMessage:!0})=>(this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach(r=>{this.executeTransform(r,{pushHistory:s.pushHistory,emitMessage:!1}),this.isLastTransform(r)&&this.diffLastData()}),this.isRunning=!1,s.emitMessage!==!1&&this.target.emit("change",[]),this),this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=t!=null&&t.name?t.name:vP("dataview"),this.name=i,t!=null&&t.history&&(this.history=t.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(t==null?void 0:t.fields)}parse(e,t,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),t&&(this.parseOption=t);const r=this.cloneParseData(e,t);if(t!=null&&t.type){const a=((s=this.dataSet.getParser(t.type))!==null&&s!==void 0?s:this.dataSet.getParser("bytejson"))(r,t.options,this);this.rawData=r,this.parserData=a,this.history&&this.historyData.push(r,a),this.latestData=a}else this.parserData=r,this.rawData=r,this.history&&this.historyData.push(r),this.latestData=r;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(e,t=!0){if(this.isRunning=!0,e&&e.type){let i=!0;if(e.type==="fields"){this._fields=e.options.fields;const s=this.transformsArr.findIndex(r=>r.type===e.type);s>=0&&(i=!1,this.transformsArr[s].options.fields=this._fields)}if(i&&this.transformsArr.push(e),t){const s=this.isLastTransform(e);this.executeTransform(e),s&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(e){return this.transformsArr[this.transformsArr.length-1]===e}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort((e,t)=>{var i,s;return((i=e.level)!==null&&i!==void 0?i:0)-((s=t.level)!==null&&s!==void 0?s:0)})}executeTransform(e,t={pushHistory:!0,emitMessage:!0}){const{pushHistory:i,emitMessage:s}=t,r=this.dataSet.getTransform(e.type)(this.latestData,e.options);this.history&&i!==!1&&this.historyData.push(r),this.latestData=r,s!==!1&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(e){this._diffData=!0,this._diffKeys=e,this._diffMap=new Map,this._diffRank=0}disableDiff(){this._diffData=!1,this._diffMap=null,this._diffRank=null}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var e;if(!this._diffData||!this.latestData.forEach||!(!((e=this._diffKeys)===null||e===void 0)&&e.length))return;const t=this._diffRank+1;if(this._diffRank===0)this.latestData.forEach(i=>{i[jm]=t,this._diffMap.set(this._diffKeys.reduce((s,r)=>s+i[r],""),i)}),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let i;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach(s=>{s[jm]=t,i=this._diffKeys.reduce((r,a)=>r+s[a],""),this._diffMap.get(i)?this.latestDataAUD.update.push(s):this.latestDataAUD.add.push(s),this._diffMap.set(i,s)}),this._diffMap.forEach((s,r)=>{s[jm]<t&&(this.latestDataAUD.del.push(s),this._diffMap.delete(r))})}this._diffRank=t}cloneParseData(e,t){let i=!1;return e instanceof Ye||(t==null?void 0:t.clone)!==!0||(i=!0),i?ri(e):e}parseNewData(e,t){this.parse(e,t||this.parseOption),this.reRunAllTransform()}updateRawData(e,t){const i=this.cloneParseData(e,t);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var e;return this._fields?this._fields:((e=this.parseOption)===null||e===void 0?void 0:e.type)==="dataview"&&this.rawData.length===1&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(e,t=!1){this._fields=e&&t?re({},this._fields,e):e;const i=this.transformsArr.find(s=>s.type==="fields");!C(this._fields)&&C(i)?(this.dataSet.registerTransform("fields",dP),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this._diffMap=null,this._diffRank=null,this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class Vr{static getInstance(){return Vr.instance||(Vr.instance=new Vr),Vr.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=e=>this.locale_shortWeekdays[e.getDay()],this.formatWeekday=e=>this.locale_weekdays[e.getDay()],this.formatShortMonth=e=>this.locale_shortMonths[e.getMonth()],this.formatMonth=e=>this.locale_months[e.getMonth()],this.formatDayOfMonth=(e,t)=>this.pad(e.getDate(),t,2),this.formatHour24=(e,t)=>this.pad(e.getHours(),t,2),this.formatHour12=(e,t)=>this.pad(e.getHours()%12||12,t,2),this.formatMilliseconds=(e,t)=>this.pad(e.getMilliseconds(),t,3),this.formatMonthNumber=(e,t)=>this.pad(e.getMonth()+1,t,2),this.formatMinutes=(e,t)=>this.pad(e.getMinutes(),t,2),this.formatPeriod=e=>this.locale_periods[+(e.getHours()>=12)],this.formatSeconds=(e,t)=>this.pad(e.getSeconds(),t,2),this.formatFullYear=(e,t)=>this.pad(e.getFullYear()%1e4,t,4),this.formatUTCShortWeekday=e=>this.locale_shortWeekdays[e.getUTCDay()],this.formatUTCWeekday=e=>this.locale_weekdays[e.getUTCDay()],this.formatUTCShortMonth=e=>this.locale_shortMonths[e.getUTCMonth()],this.formatUTCMonth=e=>this.locale_months[e.getUTCMonth()],this.formatUTCDayOfMonth=(e,t)=>this.pad(e.getUTCDate(),t,2),this.formatUTCHour24=(e,t)=>this.pad(e.getUTCHours(),t,2),this.formatUTCHour12=(e,t)=>this.pad(e.getUTCHours()%12||12,t,2),this.formatUTCMilliseconds=(e,t)=>this.pad(e.getUTCMilliseconds(),t,3),this.formatUTCMonthNumber=(e,t)=>this.pad(e.getUTCMonth()+1,t,2),this.formatUTCMinutes=(e,t)=>this.pad(e.getUTCMinutes(),t,2),this.formatUTCPeriod=e=>this.locale_periods[+(e.getUTCHours()>=12)],this.formatUTCSeconds=(e,t)=>this.pad(e.getUTCSeconds(),t,2),this.formatUTCFullYear=(e,t)=>this.pad(e.getUTCFullYear()%1e4,t,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(e,t,i)=>{const s=this.shortWeekdayRe.exec(t.slice(i));return s?(e.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(e,t,i)=>{const s=this.weekdayRe.exec(t.slice(i));return s?(e.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(e,t,i)=>{const s=this.shortMonthRe.exec(t.slice(i));return s?(e.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(e,t,i)=>{const s=this.monthRe.exec(t.slice(i));return s?(e.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(e,t,i)=>{const s=this.numberRe.exec(t.slice(i,i+2));return s?(e.d=+s[0],i+s[0].length):-1},this.parseHour24=(e,t,i)=>{const s=this.numberRe.exec(t.slice(i,i+2));return s?(e.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(e,t,i)=>{const s=this.numberRe.exec(t.slice(i,i+3));return s?(e.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(e,t,i)=>{const s=this.numberRe.exec(t.slice(i,i+2));return s?(e.m=s-1,i+s[0].length):-1},this.parseMinutes=(e,t,i)=>{const s=this.numberRe.exec(t.slice(i,i+2));return s?(e.M=+s[0],i+s[0].length):-1},this.parsePeriod=(e,t,i)=>{const s=this.periodRe.exec(t.slice(i));return s?(e.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(e,t,i)=>{const s=this.numberRe.exec(t.slice(i,i+2));return s?(e.S=+s[0],i+s[0].length):-1},this.parseFullYear=(e,t,i)=>{const s=this.numberRe.exec(t.slice(i,i+4));return s?(e.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(e,t)=>this.newFormat(e,this.formats)(new Date(this.getFullTimeStamp(t))),this.timeUTCFormat=(e,t)=>this.newFormat(e,this.utcFormats)(new Date(this.getFullTimeStamp(t))),this.timeParse=(e,t)=>this.newParse(e,!1)(t+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(e){return e.replace(this.requoteRe,"\\$&")}localDate(e){if(0<=e.y&&e.y<100){const t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}utcDate(e){if(0<=e.y&&e.y<100){const t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}newDate(e,t,i){return{y:e,m:t,d:i,H:0,M:0,S:0,L:0}}formatRe(e){return new RegExp("^(?:"+e.map(this.requoteF).join("|")+")","i")}formatLookup(e){return new Map(e.map((t,i)=>[t.toLowerCase(),i]))}pad(e,t,i){const s=e<0?"-":"",r=(s?-e:e)+"",a=r.length;return s+(a<i?new Array(i-a+1).join(t)+r:r)}parseSpecifier(e,t,i,s){let r=0;const a=t.length,o=i.length;let l,h;for(;r<a;){if(s>=o)return-1;if(l=t.charCodeAt(r++),l===37){if(l=t.charAt(r++),h=this.parses[l in this.pads?t.charAt(r++):l],!h||(s=h(e,i,s))<0)return-1}else if(l!==i.charCodeAt(s++))return-1}return s}newParse(e,t){const i=this;return function(s){const r=i.newDate(1900,void 0,1);return i.parseSpecifier(r,e,s+="",0)!==s.length?null:"Q"in r?new Date(r.Q):"s"in r?new Date(1e3*r.s+("L"in r?r.L:0)):(t&&!("Z"in r)&&(r.Z=0),"p"in r&&(r.H=r.H%12+12*r.p),r.m===void 0&&(r.m="q"in r?r.q:0),"Z"in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,i.utcDate(r)):i.localDate(r))}}newFormat(e,t){const i=this;return function(s){const r=[];let a=-1,o=0;const l=e.length;let h,d,u;for(s instanceof Date||(s=new Date(+s));++a<l;)e.charCodeAt(a)===37&&(r.push(e.slice(o,a)),(d=i.pads[h=e.charAt(++a)])?h=e.charAt(++a):d=h==="e"?" ":"0",u=t[h],h=u(s,d),r.push(h),o=a+1);return r.push(e.slice(o,a)),r.join("")}}getFullTimeStamp(e){const t=parseInt(e+"",10);return String(t).length===10?1e3*t:t}}const ba=(n,e)=>(Y(Ff.warnHandler)&&Ff.warnHandler.call(null,n,e),De.getInstance().warn(`[VChart warn]: ${n}`)),Kl=(n,e,t)=>{{if(!Y(Ff.errorHandler))throw new Error(n);Ff.errorHandler.call(null,n,e)}},Ff={silent:!1,warnHandler:!1,errorHandler:!1};class Nt{static GenAutoIncrementId(){return Nt.auto_increment_id++}}Nt.auto_increment_id=0;class Me{constructor(e){this.id=Nt.GenAutoIncrementId(),this.registry=e}}const f_="named",xP="inject",SP="multi_inject",AP="inversify:tagged",kP="inversify:paramtypes";class Sx{constructor(e,t){this.key=e,this.value=t}toString(){return this.key===f_?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var sA={};const El=function(n){var e;return function(t){const i=Object.prototype.hasOwnProperty,s=typeof Symbol=="function",r=s&&Symbol.toPrimitive!==void 0?Symbol.toPrimitive:"@@toPrimitive",a=s&&Symbol.iterator!==void 0?Symbol.iterator:"@@iterator",o=typeof Object.create=="function",l={__proto__:[]}instanceof Array,h=!o&&!l,d={create:o?function(){return ie(Object.create(null))}:l?function(){return ie({__proto__:null})}:function(){return ie({})},has:h?function(K,V){return i.call(K,V)}:function(K,V){return V in K},get:h?function(K,V){return i.call(K,V)?K[V]:void 0}:function(K,V){return K[V]}},u=Object.getPrototypeOf(Function),c=typeof process=="object"&&sA&&sA.REFLECT_METADATA_USE_MAP_POLYFILL==="true",f=c||typeof Map!="function"||typeof Map.prototype.entries!="function"?$():Map,p=((c||typeof Set!="function"||typeof Set.prototype.entries!="function")&&Z(),new(c||typeof WeakMap!="function"?q():WeakMap));function g(K,V,te,le){if(!O(te))throw new TypeError;return k(K,V,te,le)}function _(K,V,te){if(!O(V))throw new TypeError;return M(te)||(te=F(te)),v(K,V,te)}function m(K,V,te){if(!O(V))throw new TypeError;return M(te)||(te=F(te)),x(K,V,te)}function y(K,V,te){if(!O(V))throw new TypeError;return M(te)||(te=F(te)),S(K,V,te)}function b(K,V,te){let le=p.get(K);if(M(le)){if(!te)return;le=new f,p.set(K,le)}let he=le.get(V);if(M(he)){if(!te)return;he=new f,le.set(V,he)}return he}function v(K,V,te){if(x(K,V,te))return!0;const le=U(V);return!T(le)&&v(K,le,te)}function x(K,V,te){const le=b(V,te,!1);return!M(le)&&L(le.has(K))}function S(K,V,te){if(x(K,V,te))return A(K,V,te);const le=U(V);return T(le)?void 0:S(K,le,te)}function A(K,V,te){const le=b(V,te,!1);if(!M(le))return le.get(K)}function k(K,V,te,le){b(te,le,!0).set(K,V)}function w(K){if(K===null)return 1;switch(typeof K){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return K===null?1:6;default:return 6}}function M(K){return K===void 0}function T(K){return K===null}function E(K){return typeof K=="symbol"}function O(K){return typeof K=="object"?K!==null:typeof K=="function"}function B(K,V){switch(w(K)){case 0:case 1:case 2:case 3:case 4:case 5:return K}const te="string",le=G(K,r);if(le!==void 0){const he=le.call(K,te);if(O(he))throw new TypeError;return he}return R(K)}function R(K,V){{const te=K.toString;if(H(te)){const he=te.call(K);if(!O(he))return he}const le=K.valueOf;if(H(le)){const he=le.call(K);if(!O(he))return he}}throw new TypeError}function L(K){return!!K}function I(K){return""+K}function F(K){const V=B(K);return E(V)?V:I(V)}function H(K){return typeof K=="function"}function G(K,V){const te=K[V];if(te!=null){if(!H(te))throw new TypeError;return te}}function U(K){const V=Object.getPrototypeOf(K);if(typeof K!="function"||K===u||V!==u)return V;const te=K.prototype,le=te&&Object.getPrototypeOf(te);if(le==null||le===Object.prototype)return V;const he=le.constructor;return typeof he!="function"||he===K?V:he}function $(){const K={},V=[],te=function(){function ge(ke,xe,Re){this._index=0,this._keys=ke,this._values=xe,this._selector=Re}return ge.prototype["@@iterator"]=function(){return this},ge.prototype[a]=function(){return this},ge.prototype.next=function(){const ke=this._index;if(ke>=0&&ke<this._keys.length){const xe=this._selector(this._keys[ke],this._values[ke]);return ke+1>=this._keys.length?(this._index=-1,this._keys=V,this._values=V):this._index++,{value:xe,done:!1}}return{value:void 0,done:!0}},ge.prototype.throw=function(ke){throw this._index>=0&&(this._index=-1,this._keys=V,this._values=V),ke},ge.prototype.return=function(ke){return this._index>=0&&(this._index=-1,this._keys=V,this._values=V),{value:ke,done:!0}},ge}();return function(){function ge(){this._keys=[],this._values=[],this._cacheKey=K,this._cacheIndex=-2}return Object.defineProperty(ge.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),ge.prototype.has=function(ke){return this._find(ke,!1)>=0},ge.prototype.get=function(ke){const xe=this._find(ke,!1);return xe>=0?this._values[xe]:void 0},ge.prototype.set=function(ke,xe){const Re=this._find(ke,!0);return this._values[Re]=xe,this},ge.prototype.delete=function(ke){const xe=this._find(ke,!1);if(xe>=0){const Re=this._keys.length;for(let Pe=xe+1;Pe<Re;Pe++)this._keys[Pe-1]=this._keys[Pe],this._values[Pe-1]=this._values[Pe];return this._keys.length--,this._values.length--,ke===this._cacheKey&&(this._cacheKey=K,this._cacheIndex=-2),!0}return!1},ge.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=K,this._cacheIndex=-2},ge.prototype.keys=function(){return new te(this._keys,this._values,le)},ge.prototype.values=function(){return new te(this._keys,this._values,he)},ge.prototype.entries=function(){return new te(this._keys,this._values,Ce)},ge.prototype["@@iterator"]=function(){return this.entries()},ge.prototype[a]=function(){return this.entries()},ge.prototype._find=function(ke,xe){return this._cacheKey!==ke&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=ke)),this._cacheIndex<0&&xe&&(this._cacheIndex=this._keys.length,this._keys.push(ke),this._values.push(void 0)),this._cacheIndex},ge}();function le(ge,ke){return ge}function he(ge,ke){return ke}function Ce(ge,ke){return[ge,ke]}}function Z(){return function(){function K(){this._map=new f}return Object.defineProperty(K.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),K.prototype.has=function(V){return this._map.has(V)},K.prototype.add=function(V){return this._map.set(V,V),this},K.prototype.delete=function(V){return this._map.delete(V)},K.prototype.clear=function(){this._map.clear()},K.prototype.keys=function(){return this._map.keys()},K.prototype.values=function(){return this._map.values()},K.prototype.entries=function(){return this._map.entries()},K.prototype["@@iterator"]=function(){return this.keys()},K.prototype[a]=function(){return this.keys()},K}()}function q(){const V=d.create(),te=le();return function(){function xe(){this._key=le()}return xe.prototype.has=function(Re){const Pe=he(Re,!1);return Pe!==void 0&&d.has(Pe,this._key)},xe.prototype.get=function(Re){const Pe=he(Re,!1);return Pe!==void 0?d.get(Pe,this._key):void 0},xe.prototype.set=function(Re,Pe){return he(Re,!0)[this._key]=Pe,this},xe.prototype.delete=function(Re){const Pe=he(Re,!1);return Pe!==void 0&&delete Pe[this._key]},xe.prototype.clear=function(){this._key=le()},xe}();function le(){let xe;do xe="@@WeakMap@@"+ke();while(d.has(V,xe));return V[xe]=!0,xe}function he(xe,Re){if(!i.call(xe,te)){if(!Re)return;Object.defineProperty(xe,te,{value:d.create()})}return xe[te]}function Ce(xe,Re){for(let Pe=0;Pe<Re;++Pe)xe[Pe]=255*Math.random()|0;return xe}function ge(xe){return typeof Uint8Array=="function"?typeof crypto<"u"?crypto.getRandomValues(new Uint8Array(xe)):Ce(new Uint8Array(xe),xe):Ce(new Array(xe),xe)}function ke(){const xe=ge(16);xe[6]=79&xe[6]|64,xe[8]=191&xe[8]|128;let Re="";for(let Pe=0;Pe<16;++Pe){const Ei=xe[Pe];Pe!==4&&Pe!==6&&Pe!==8||(Re+="-"),Ei<16&&(Re+="0"),Re+=Ei.toString(16).toLowerCase()}return Re}}function ie(K){return K.__=void 0,delete K.__,K}t("defineMetadata",g),t("hasMetadata",_),t("hasOwnMetadata",m),t("getMetadata",y)}((e=n,function(t,i){typeof e[t]!="function"&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),n}({});function _F(n,e,t,i){const s=[i];let r={};El.hasOwnMetadata(n,e)&&(r=El.getMetadata(n,e));let a=r[t];a===void 0&&(a=[]),a.push(...s),r[t]=a,El.defineMetadata(n,r,e)}function mF(n,e,t,i){_F(AP,n,t.toString(),i)}function wP(n){return(e,t,i)=>{mF(e,t,i,n)}}function MP(n){return e=>(t,i,s)=>wP(new Sx(n,e))(t,i,s)}const Ee=MP(xP),TP=MP(SP);function ue(){return function(n){return El.defineMetadata(kP,null,n),n}}function di(n){return wP(new Sx(f_,n))}const io={Singleton:"Singleton",Transient:"Transient"},Nr={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"};class Ax{constructor(e,t){this.id=Nt.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=e,this.scope=t,this.type=Nr.Invalid,this.constraint=i=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const e=new Ax(this.serviceIdentifier,this.scope);return e.activated=e.scope===io.Singleton&&this.activated,e.implementationType=this.implementationType,e.dynamicValue=this.dynamicValue,e.scope=this.scope,e.type=this.type,e.provider=this.provider,e.constraint=this.constraint,e.cache=this.cache,e}}class yF{getConstructorMetadata(e){return{compilerGeneratedMetadata:El.getMetadata(kP,e),userGeneratedMetadata:El.getMetadata(AP,e)||{}}}getPropertiesMetadata(e){throw new Error("暂未实现")}}const bF=n=>e=>{const t=i=>{if(i==null)return!1;if(i.key===n&&i.value===e)return!0;if(i.constructorArgsMetadata==null)return!1;const s=i.constructorArgsMetadata;for(let r=0;r<s.length;r++)if(s[r].key===n&&s[r].value===e)return!0;return!1};return t.metaData=new Sx(n,e),t},vF=bF(f_);class wc{constructor(e){this._binding=e}inRequestScope(){throw new Error("暂未实现")}inSingletonScope(){return this._binding.scope=io.Singleton,this}inTransientScope(){return this._binding.scope=io.Transient,this}whenTargetNamed(e){return this._binding.constraint=vF(e),this}}class xF{constructor(e){this._binding=e}to(e){return this._binding.type=Nr.Instance,this._binding.implementationType=e,new wc(this._binding)}toSelf(){const e=this._binding.serviceIdentifier;return this.to(e)}toDynamicValue(e){return this._binding.type=Nr.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=e,this._binding.implementationType=null,new wc(this._binding)}toConstantValue(e){return this._binding.type=Nr.ConstantValue,this._binding.cache=e,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=io.Singleton,new wc(this._binding)}toFactory(e){return this._binding.type=Nr.Factory,this._binding.factory=e,this._binding.scope=io.Singleton,new wc(this._binding)}toService(e){this.toDynamicValue(t=>t.container.get(e))}}class SF{constructor(e){const t=e||{};t.defaultScope=t.defaultScope||io.Transient,this.options=t,this.id=Nt.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new yF}load(e){const t=this._getContainerModuleHelpersFactory()(e.id);e.registry(t.bindFunction,t.unbindFunction,t.isboundFunction,t.rebindFunction)}get(e){const t=this._getNotAllArgs(e,!1);return this._get(t)}getAll(e){const t=this._getAllArgs(e);return this._get(t)}getTagged(e,t,i){const s=this._getNotAllArgs(e,!1,t,i);return this._get(s)}getNamed(e,t){return this.getTagged(e,f_,t)}isBound(e){return this._bindingDictionary.has(e)}bind(e){const t=this.options.defaultScope,i=new Ax(e,t),s=this._bindingDictionary.get(e)||[];return s.push(i),this._bindingDictionary.set(e,s),new xF(i)}unbind(e){this._bindingDictionary.delete(e)}rebind(e){return this.unbind(e),this.bind(e)}_getContainerModuleHelpersFactory(){const e=(a,o)=>{a._binding.moduleId=o},t=a=>o=>{const l=this.bind(o);return e(l,a),l},i=()=>a=>this.unbind(a),s=()=>a=>this.isBound(a),r=a=>o=>{const l=this.rebind(o);return e(l,a),l};return a=>({bindFunction:t(a),isboundFunction:s(),rebindFunction:r(a),unbindFunction:i(),unbindAsyncFunction:o=>null})}_getNotAllArgs(e,t,i,s){return{avoidConstraints:!1,isMultiInject:t,serviceIdentifier:e,key:i,value:s}}_getAllArgs(e){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:e}}_get(e){const t=[];return this._bindingDictionary.get(e.serviceIdentifier).filter(i=>i.constraint(e)).forEach(i=>{t.push(this._resolveFromBinding(i))}),e.isMultiInject||t.length!==1?t:t[0]}_getChildRequest(e){const t=e.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(t),s=Object.keys(i),r=[];for(let a=0;a<s.length;a++){const o=i[a],l={};o.forEach(f=>{l[f.key]=f.value});const h={inject:l[xP],multiInject:l[SP]},d=h.inject||h.multiInject,u={serviceIdentifier:d,constructorArgsMetadata:o},c={injectIdentifier:d,metadata:o,bindings:this._bindingDictionary.get(d).filter(f=>f.constraint(u))};r.push(c)}return r}_resolveFromBinding(e){const t=this._getResolvedFromBinding(e);return this._saveToScope(e,t),t}_getResolvedFromBinding(e){let t;switch(e.type){case Nr.ConstantValue:case Nr.Function:t=e.cache;break;case Nr.Instance:t=this._resolveInstance(e,e.implementationType);break;default:t=e.dynamicValue({container:this})}return t}_resolveInstance(e,t){if(e.activated)return e.cache;const i=this._getChildRequest(e);return this._createInstance(t,i)}_createInstance(e,t){return t.length?new e(...this._resolveRequests(t)):new e}_resolveRequests(e){return e.map(t=>t.bindings.length>1?t.bindings.map(i=>this._resolveFromBinding(i)):this._resolveFromBinding(t.bindings[0]))}_saveToScope(e,t){e.scope===io.Singleton&&(e.cache=t,e.activated=!0)}}const Kt=Symbol("ContributionProvider");class CP{constructor(e,t){this.serviceIdentifier=e,this.container=t}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function ki(n,e){n(Kt).toDynamicValue(({container:t})=>new CP(e,t)).inSingletonScope().whenTargetNamed(e)}function AF(n,e){n(Kt).toDynamicValue(({container:t})=>new CP(e,t)).whenTargetNamed(e)}class kF{constructor(e,t){this._args=e,this.name=t,this.taps=[]}tap(e,t){this._tap("sync",e,t)}unTap(e,t){const i=typeof e=="string"?e.trim():e.name;i&&(this.taps=this.taps.filter(s=>s.name!==i&&(!t||s.fn===t)))}_parseOptions(e,t,i){let s;if(typeof t=="string")s={name:t.trim()};else if(typeof t!="object"||t===null)throw new Error("Invalid tap options");if(typeof s.name!="string"||s.name==="")throw new Error("Missing name for tap");return s=Object.assign({type:e,fn:i},s),s}_tap(e,t,i){this._insert(this._parseOptions(e,t,i))}_insert(e){let t;typeof e.before=="string"?t=new Set([e.before]):Array.isArray(e.before)&&(t=new Set(e.before));let i=0;typeof e.stage=="number"&&(i=e.stage);let s=this.taps.length;for(;s>0;){s--;const r=this.taps[s];this.taps[s+1]=r;const a=r.stage||0;if(t){if(t.has(r.name)){t.delete(r.name);continue}if(t.size>0)continue}if(!(a>i)){s++;break}}this.taps[s]=e}}class _n extends kF{call(...e){this.taps.map(t=>t.fn).forEach(t=>t(...e))}}const p_=Symbol.for("EnvContribution"),kx=Symbol.for("VGlobal");var wF=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},MF=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},rA=function(n,e){return function(t,i){e(t,i,n)}};let sb=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(n){this._env||this.setEnv("browser"),this.envContribution.supportEvent=n}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(n){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=n}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(n){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=n}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(n){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=n}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(n){this._env||this.setEnv("browser"),this.envContribution.applyStyles=n}constructor(n){this.contributions=n,this.id=Nt.GenAutoIncrementId(),this.hooks={onSetEnv:new _n(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(n){const e=[];if(this.contributions.getContributions().forEach(t=>{const i=t.configure(this,n);i&&i.then&&e.push(i)}),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(n,e){if(e&&e.force===!0||this._env!==n)return this.deactiveCurrentEnv(),this.activeEnv(n,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(n,e){const t=this._env;this._env=n;const i=this.bindContribution(e);if(i&&i.then)return i.then(()=>{this.envParams=e,this.hooks.onSetEnv.call(t,n,this)});this.envParams=e,this.hooks.onSetEnv.call(t,n,this)}setActiveEnvContribution(n){this.envContribution=n}createCanvas(n){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(n)}createOffscreenCanvas(n){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(n)}releaseCanvas(n){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(n)}addEventListener(n,e,t){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(n,e,t)}removeEventListener(n,e,t){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(n,e,t)}dispatchEvent(n){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(n)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(n){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(n):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(n,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(n,e):null}loadImage(n){return this._env||this.setEnv("browser"),this.envContribution.loadImage(n)}loadSvg(n){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(n)}loadJson(n){return this._env||this.setEnv("browser"),this.envContribution.loadJson(n)}loadArrayBuffer(n){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(n)}loadBlob(n){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(n)}isChrome(){return this._isChrome!=null||(this._env||this.setEnv("browser"),this._isChrome=this._env==="browser"&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return this._isSafari!=null||(this._env||this.setEnv("browser"),this._isSafari=this._env==="browser"&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(n){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(n)}removeDom(n){return this._env||this.setEnv("browser"),this.envContribution.removeDom(n)}createDom(n){return this._env||this.setEnv("browser"),this.envContribution.createDom(n)}getElementTop(n,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(n,e)}getElementLeft(n,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(n,e)}getElementTopLeft(n,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(n,e)}};sb=wF([ue(),rA(0,Ee(Kt)),rA(0,di(p_)),MF("design:paramtypes",[Object])],sb);const TF=ei-1e-8;class PP{constructor(e){this.init(e)}init(e){this.bounds=e}arc(e,t,i,s,r,a){if(Math.abs(r-s)>TF)return this.bounds.add(e-i,t-i),void this.bounds.add(e+i,t+i);let o,l,h,d,u=1/0,c=-1/0,f=1/0,p=-1/0;function g(_){h=i*Math.cos(_),d=i*Math.sin(_),h<u&&(u=h),h>c&&(c=h),d<f&&(f=d),d>p&&(p=d)}if(g(s),g(r),r!==s)if((s%=ei)<0&&(s+=ei),(r%=ei)<0&&(r+=ei),r<s&&(a=!a,o=s,s=r,r=o),a)for(r-=ei,o=s-s%zn,l=0;l<4&&o>r;++l,o-=zn)g(o);else for(o=s-s%zn+zn,l=0;l<4&&o<r;++l,o+=zn)g(o);this.bounds.add(e+u,t+f),this.bounds.add(e+c,t+p)}arcTo(e,t,i,s,r){throw new Error("不支持arcTo")}bezierCurveTo(e,t,i,s,r,a){this.bounds.add(e,t),this.bounds.add(i,s),this.bounds.add(r,a)}closePath(){}ellipse(){throw new Error("不支持ellipse")}lineTo(e,t){this.bounds.add(e,t)}moveTo(e,t){this.bounds.add(e,t)}quadraticCurveTo(e,t,i,s){this.bounds.add(e,t),this.bounds.add(i,s)}rect(e,t,i,s){this.bounds.add(e,t),this.bounds.add(e+i,t+s)}clear(){this.bounds.clear()}release(...e){}}class CF{constructor(){this.curves=[],this.bounds=new St}getCurveLengths(){return this.curves.map(e=>e.getLength())}getPointAt(e){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const PF=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,EF={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},Oe={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Hm,aA,Mc,oA,Gm,Tc;function RF(n){if(!n)return[];const e=n.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(e===null)return[];let t,i;const s=[];for(let r=0,a=e.length;r<a;r++)if(Hm=e[r],aA=Hm.slice(1),Mc=Hm[0],t=[Mc],i=aA.match(PF),i!==null){for(let o=0,l=i.length;o<l;o++)oA=i[o],Gm=parseFloat(oA),Number.isNaN(Gm)||t.push(Gm);if(Tc=EF[Mc],t.length-1>Tc){let o;for(let l=1,h=t.length;l<h;l+=Tc){o=[Mc];for(let d=l,u=l+Tc;d<u;d++)o.push(t[d]);s.push(o)}}else s.push(t)}else s.push(t);return s}var ot;(function(n){n[n.NONE=0]="NONE",n[n.UPDATE_BOUNDS=1]="UPDATE_BOUNDS",n[n.UPDATE_SHAPE=2]="UPDATE_SHAPE",n[n.CLEAR_SHAPE=253]="CLEAR_SHAPE",n[n.UPDATE_SHAPE_AND_BOUNDS=3]="UPDATE_SHAPE_AND_BOUNDS",n[n.INIT=179]="INIT",n[n.CLEAR_BOUNDS=254]="CLEAR_BOUNDS",n[n.UPDATE_GLOBAL_MATRIX=32]="UPDATE_GLOBAL_MATRIX",n[n.CLEAR_GLOBAL_MATRIX=223]="CLEAR_GLOBAL_MATRIX",n[n.UPDATE_LOCAL_MATRIX=16]="UPDATE_LOCAL_MATRIX",n[n.CLEAR_LOCAL_MATRIX=239]="CLEAR_LOCAL_MATRIX",n[n.UPDATE_GLOBAL_LOCAL_MATRIX=48]="UPDATE_GLOBAL_LOCAL_MATRIX",n[n.UPDATE_LAYOUT=128]="UPDATE_LAYOUT",n[n.CLEAR_LAYOUT=127]="CLEAR_LAYOUT"})(ot||(ot={}));var Hd;(function(n){n[n.GLOBAL=1]="GLOBAL",n[n.LOCAL=16]="LOCAL",n[n.GLOBAL_ACCURATE=3]="GLOBAL_ACCURATE",n[n.LOCAL_ACCURATE=48]="LOCAL_ACCURATE"})(Hd||(Hd={}));var kt;(function(n){n[n.INIT=0]="INIT",n[n.DEFAULT=1]="DEFAULT",n[n.STATE=2]="STATE",n[n.ANIMATE_BIND=10]="ANIMATE_BIND",n[n.ANIMATE_PLAY=11]="ANIMATE_PLAY",n[n.ANIMATE_START=12]="ANIMATE_START",n[n.ANIMATE_UPDATE=13]="ANIMATE_UPDATE",n[n.ANIMATE_END=14]="ANIMATE_END",n[n.TRANSLATE=20]="TRANSLATE",n[n.TRANSLATE_TO=21]="TRANSLATE_TO",n[n.SCALE=22]="SCALE",n[n.SCALE_TO=23]="SCALE_TO",n[n.ROTATE=24]="ROTATE",n[n.ROTATE_TO=25]="ROTATE_TO"})(kt||(kt={}));var Oi;(function(n){n[n.INITIAL=0]="INITIAL",n[n.RUNNING=1]="RUNNING",n[n.PAUSED=2]="PAUSED",n[n.END=3]="END"})(Oi||(Oi={}));var ql;(function(n){n[n.NORMAL=0]="NORMAL",n[n.SET_ATTR_IMMEDIATELY=1]="SET_ATTR_IMMEDIATELY"})(ql||(ql={}));var Go;(function(n){n.wait="wait",n.from="from",n.to="to",n.customAnimate="customAnimate"})(Go||(Go={}));var _t;(function(n){n[n.ROW=1]="ROW",n[n.COLUMN=2]="COLUMN"})(_t||(_t={}));var zf;(function(n){n[n.CubicBezierCurve=0]="CubicBezierCurve",n[n.QuadraticBezierCurve=1]="QuadraticBezierCurve",n[n.ArcCurve=2]="ArcCurve",n[n.LineCurve=3]="LineCurve",n[n.EllipseCurve=4]="EllipseCurve",n[n.MoveCurve=5]="MoveCurve"})(zf||(zf={}));var ui;(function(n){n[n.beforeFillStroke=0]="beforeFillStroke",n[n.afterFillStroke=1]="afterFillStroke"})(ui||(ui={}));function OF(n,e,t,i,s,r,a,o,l){const h=st(a),d=Math.sin(h),u=Math.cos(h),c=u*(o-n)*.5+d*(l-e)*.5,f=u*(l-e)*.5-d*(o-n)*.5;let p=c*c/((t=Math.abs(t))*t)+f*f/((i=Math.abs(i))*i);p>1&&(p=Math.sqrt(p),t*=p,i*=p);const g=u/t,_=d/t,m=-d/i,y=u/i,b=g*o+_*l,v=m*o+y*l,x=g*n+_*e,S=m*n+y*e;let A=1/((x-b)*(x-b)+(S-v)*(S-v))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===s&&(k=-k);const w=.5*(b+x)-k*(S-v),M=.5*(v+S)+k*(x-b),T=Math.atan2(v-M,b-w);let E=Math.atan2(S-M,x-w)-T;E<0&&r===1?E+=ei:E>0&&r===0&&(E-=ei);const O=Math.ceil(Math.abs(E/(zn+.001))),B=[];for(let R=0;R<O;++R){const L=T+R*E/O,I=T+(R+1)*E/O;B[R]=[w,M,L,I,t,i,d,u]}return B}function BF(n){const e=n[0],t=n[1],i=n[2],s=n[3],r=n[4],a=n[5],o=n[6],l=n[7],h=l*r,d=-o*a,u=o*r,c=l*a,f=Math.cos(i),p=Math.sin(i),g=Math.cos(s),_=Math.sin(s),m=.5*(s-i),y=Math.sin(.5*m),b=8/3*y*y/Math.sin(m),v=e+f-b*p,x=t+p+b*f,S=e+g,A=t+_,k=S+b*_,w=A-b*g;return[h*v+d*x,u*v+c*x,h*k+d*w,u*k+c*w,h*S+d*A,u*S+c*A]}function lA(n,e,t,i){const s=OF(i[5],i[6],i[0],i[1],i[3],i[4],i[2],e,t);for(let r=0;r<s.length;++r){const a=BF(s[r]);n.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5])}}const hf=(n,e,t,i,s,r,a)=>{const o=Math.abs(t-e),l=4*Math.tan(o/4)/3,h=t<e?-1:1,d=Math.cos(e),u=Math.sin(e),c=Math.cos(t),f=Math.sin(t),p=d*r+i,g=u*a+s,_=c*r+i,m=f*a+s,y=r*l*h,b=a*l*h;n.push(p-y*u,g+b*d,_+y*f,m-b*c,_,m)},LF=[(n,e,t,i,s,r,a)=>e.arc(n[1]*s+t,n[2]*r+i,n[3]*(s+r)/2,n[4],n[5],n[6],a),(n,e,t,i,s,r,a)=>e.arcTo(n[1]*s+t,n[2]*r+i,n[3]*s+t,n[4]*r+i,n[5]*(s+r)/2,a),(n,e,t,i,s,r,a)=>e.bezierCurveTo(n[1]*s+t,n[2]*r+i,n[3]*s+t,n[4]*r+i,n[5]*s+t,n[6]*r+i,a),(n,e,t,i)=>e.closePath(),(n,e,t,i,s,r)=>e.ellipse(n[1]*s+t,n[2]*r+i,n[3]*s,n[4]*r,n[5],n[6],n[7],n[8]),(n,e,t,i,s,r,a)=>e.lineTo(n[1]*s+t,n[2]*r+i,a),(n,e,t,i,s,r,a)=>e.moveTo(n[1]*s+t,n[2]*r+i,a),(n,e,t,i,s,r,a)=>e.quadraticCurveTo(n[1]*s+t,n[2]*r+i,n[3]*s+t,n[4]*r+i,a),(n,e,t,i,s,r,a)=>e.rect(n[1]*s+t,n[2]*r+i,n[3]*s,n[4]*r,a)];function lr(n,e,t=0,i=0,s=1,r=1,a){for(let o=0;o<n.length;o++){const l=n[o];LF[l[0]](l,e,t,i,s,r,a)}}class EP{getLength(e){return e!=null?this.calcProjLength(e):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function IF(n,e){let t=0;const i=n.length;for(let s=0;s<i;s++){const r=n[s],a=e[s],o=n[(s+1)%i],l=e[(s+1)%i];t+=wt.distanceNN(r,a,o,l)}return t/2}function DF(n,e,t,i,s){return IF([n.x,e.x,t.x,i.x],[n.y,e.y,t.y,i.y])}function hA(n,e,t,i,s){const r=1-s;return r*r*r*n+3*e*s*r*r+3*t*s*s*r+i*s*s*s}function RP(n,e,t,i,s){const r=hA(n.x,e.x,t.x,i.x,s),a=hA(n.y,e.y,t.y,i.y,s);return new Et(r,a)}function rb(n,e){const{p0:t,p1:i,p2:s,p3:r}=n,a=RP(t,i,s,r,e),o=wt.pointAtPP(t,i,e),l=wt.pointAtPP(i,s,e),h=wt.pointAtPP(s,r,e),d=wt.pointAtPP(o,l,e),u=wt.pointAtPP(l,h,e);return[new ab(t,o,d,a),new ab(a,u,h,r)]}class ab extends EP{constructor(e,t,i,s){super(),this.type=zf.CubicBezierCurve,this.p0=e,this.p1=t,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(e){if(this.defined!==!1)return RP(this.p0,this.p1,this.p2,this.p3,e);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?DF(this.p0,this.p1,this.p2,this.p3):60}calcProjLength(e){return e===_t.ROW?Ve(this.p0.x-this.p3.x):e===_t.COLUMN?Ve(this.p0.y-this.p3.y):0}getAngleAt(e){const t=Ji(e-.01,0),i=gi(e+.01,1),s=this.getPointAt(t),r=this.getPointAt(i);return it(r.y-s.y,r.x-s.x)}}function dA(n,e){const{p0:t,p1:i}=n,s=wt.pointAtPP(t,i,e);return[new ob(t,s),new ob(s,i)]}class ob extends EP{constructor(e,t){super(),this.type=zf.LineCurve,this.p0=e,this.p1=t}getPointAt(e){if(this.defined!==!1)return wt.pointAtPP(this.p0,this.p1,e);throw new Error("defined为false的点不能getPointAt")}getAngleAt(e){return this.angle==null&&(this.angle=it(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()?wt.distancePP(this.p0,this.p1):60}calcProjLength(e){return e===_t.ROW?Ve(this.p0.x-this.p1.x):e===_t.COLUMN?Ve(this.p0.y-this.p1.y):0}}class wx{get endX(){return this._lastX}get endY(){return this._lastY}constructor(e,t){this.init(e,t)}init(e,t){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=e,this.direction=t,this.curves=[]}bezierCurveTo(e,t,i,s,r,a,o,l){const h=new ab(new Et(this._lastX,this._lastY),new Et(e,t),new Et(i,s),new Et(r,a));h.originP1=this._lastOriginP,h.originP2=l,h.defined=o,this.curves.push(h),this._lastX=r,this._lastY=a,this._lastOriginP=l}closePath(){if(this.curves.length<2)return;const e=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,e.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(e,t,i,s){const r=this.addLinearCurve(e,t,i,this._lastOriginP,s);this.curves.push(r),this._lastX=e,this._lastY=t,this._lastOriginP=s}moveTo(e,t,i){return this._lastX=this._startX=e,this._lastY=this._startY=t,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(e,t,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(e){return this.getLength(e)}addLinearCurve(e,t,i,s,r){const a=new ob(new Et(this._lastX,this._lastY),new Et(e,t));return a.originP1=s,a.originP2=r,a.defined=i,a}getPointAt(e){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(e){var t,i;if(e===_t.COLUMN){if(!this.curves.length)return 0;const s=this.curves[0],r=this.curves[this.curves.length-1],a=(t=r.p3)!==null&&t!==void 0?t:r.p1;return Ve(s.p0.y-a.y)}if(e===_t.ROW){if(!this.curves.length)return 0;const s=this.curves[0],r=this.curves[this.curves.length-1],a=(i=r.p3)!==null&&i!==void 0?i:r.p1;return Ve(s.p0.x-a.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce((s,r)=>s+r.getLength(),0)),this.length}}class FF extends wx{bezierCurveTo(e,t,i,s,r,a,o,l){return super.bezierCurveTo(t,e,s,i,a,r,o,l)}lineTo(e,t,i,s){return super.lineTo(t,e,i,s)}moveTo(e,t,i){return super.moveTo(t,e,i)}clear(){return super.clear()}}function vh(n,e,t=1){let i=!1;for(let s=0,r=e.length;s<=r;s++)s>=r===i&&((i=!i)?n.lineStart():n.lineEnd()),i&&n.point(e[s])}function zu(n,e,t){const i=e??(Ve(t[t.length-1].x-t[0].x)>Ve(t[t.length-1].y-t[0].y)?_t.ROW:_t.COLUMN);return n==="monotoneY"?new FF(n,i):new wx(n,i)}class OP{constructor(e,t){this.context=e,t&&(this.startPoint=t)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this.context.closePath(),this._line=1-this._line}point(e){const t=e.x,i=e.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(t,i,this._lastDefined!==!1&&e.defined!==!1,e):this.context.moveTo(t,i,e);break;case 1:this._point=2;default:this.context.lineTo(t,i,this._lastDefined!==!1&&e.defined!==!1,e)}this._lastDefined=e.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function ju(n,e={}){const{direction:t,startPoint:i}=e;if(n.length<2-+!!i)return null;const s=zu("linear",t,n);return zF(new OP(s,i),n),s}function zF(n,e){return vh(n,e,1)}function uA(n,e,t,i,s){n.context.bezierCurveTo((2*n._x0+n._x1)/3,(2*n._y0+n._y1)/3,(n._x0+2*n._x1)/3,(n._y0+2*n._y1)/3,(n._x0+4*n._x1+e)/6,(n._y0+4*n._y1+t)/6,i,n.lastPoint1)}class jF{constructor(e,t){this.context=e,this.startPoint=t}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(){this._point===2&&uA(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),this._lastDefined1!==!1&&this._lastDefined2!==!1,this.lastPoint1),(this._line||this._line!==0&&this._point===1)&&this.context.closePath(),this._line=1-this._line}point(e){const t=e.x,i=e.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(t,i,this._lastDefined1!==!1&&this._lastDefined2!==!1,e):this.context.moveTo(t,i,e);break;case 1:this._point=2;break;default:uA(this,t,i,this._lastDefined1!==!1&&this._lastDefined2!==!1)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=e.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=e}tryUpdateLength(){return this.context.tryUpdateLength()}}function HF(n,e){return vh(n,e,2)}function BP(n,e={}){const{direction:t,startPoint:i}=e;if(n.length<2-+!!i)return null;if(n.length<3-+!!i)return ju(n,e);const s=zu("basis",t,n);return HF(new jF(s,i),n),s}function cA(n){return n<0?-1:1}function fA(n,e,t){const i=n._x1-n._x0,s=e-n._x1,r=(n._y1-n._y0)/(i||Number(s<0&&-0)),a=(t-n._y1)/(s||Number(i<0&&-0)),o=(r*s+a*i)/(i+s);return(cA(r)+cA(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function pA(n,e){const t=n._x1-n._x0;return t?(3*(n._y1-n._y0)/t-e)/2:e}function Wm(n,e,t,i,s){const r=n._x0,a=n._y0,o=n._x1,l=n._y1,h=(o-r)/3;n.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*t,o,l,i,n.lastPoint1)}class LP{constructor(e,t){this.context=e,this.startPoint=t}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,this._lastDefined1!==!1&&this._lastDefined2!==!1,this.lastPoint1);break;case 3:Wm(this,this._t0,pA(this,this._t0),this._lastDefined1!==!1&&this._lastDefined2!==!1,this.lastPoint1)}(this._line||this._line!==0&&this._point===1)&&this.context.closePath(),this._line=1-this._line}point(e){let t=NaN;const i=e.x,s=e.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,this._lastDefined1!==!1&&this._lastDefined2!==!1,e):this.context.moveTo(i,s,e);break;case 1:this._point=2;break;case 2:this._point=3,Wm(this,pA(this,t=fA(this,i,s)),t,this._lastDefined1!==!1&&this._lastDefined2!==!1);break;default:Wm(this,this._t0,t=fA(this,i,s),this._lastDefined1!==!1&&this._lastDefined2!==!1)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=t,this._lastDefined1=this._lastDefined2,this._lastDefined2=e.defined!==!1,this.lastPoint0=this.lastPoint1,this.lastPoint1=e}tryUpdateLength(){return this.context.tryUpdateLength()}}class GF extends LP{constructor(e,t){super(e,t)}point(e){return super.point({y:e.x,x:e.y,defined:e.defined})}}function WF(n,e){return vh(n,e,2)}function IP(n,e={}){const{direction:t,startPoint:i}=e;if(n.length<2-+!!i)return null;if(n.length<3-+!!i)return ju(n,e);const s=zu("monotoneX",t,n);return WF(new LP(s,i),n),s}function VF(n,e){return vh(n,e,2)}function DP(n,e={}){const{direction:t,startPoint:i}=e;if(n.length<2-+!!i)return null;if(n.length<3-+!!i)return ju(n,e);const s=zu("monotoneY",t,n);return VF(new GF(s,i),n),s}let NF=class{constructor(e,t=.5,i){this.context=e,this._t=t,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&&this._point===2&&this.context.lineTo(this._x,this._y,this._lastDefined!==!1,this.lastPoint),(this._line||this._line!==0&&this._point===1)&&this.context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)}point(e){const t=e.x,i=e.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(t,i,this._lastDefined!==!1&&e.defined!==!1,e):this.context.moveTo(t,i,e);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,this._lastDefined!==!1&&e.defined!==!1,this.lastPoint),this.context.lineTo(t,i,this._lastDefined!==!1&&e.defined!==!1,e);else{const s=this._x*(1-this._t)+t*this._t;this.context.lineTo(s,this._y,this._lastDefined!==!1&&e.defined!==!1,this.lastPoint),this.context.lineTo(s,i,this._lastDefined!==!1&&e.defined!==!1,e)}}this._lastDefined=e.defined,this._x=t,this._y=i,this.lastPoint=e}tryUpdateLength(){return this.context.tryUpdateLength()}};function Rl(n,e,t={}){const{direction:i,startPoint:s}=t;if(n.length<2-+!!s)return null;const r=new wx("step",i??(Ve(n[n.length-1].x-n[0].x)>Ve(n[n.length-1].y-n[0].y)?_t.ROW:_t.COLUMN));return UF(new NF(r,e,s),n),r}function UF(n,e){return vh(n,e,1)}class $F extends OP{lineEnd(){this.context.closePath()}}function FP(n,e={}){const{direction:t,startPoint:i}=e;if(n.length<2-+!!i)return null;const s=zu("linear",t,n);return YF(new $F(s,i),n),s}function YF(n,e){return vh(n,e,1)}function lb(n,e,t){switch(e){case"linear":default:return ju(n,t);case"basis":return BP(n,t);case"monotoneX":return IP(n,t);case"monotoneY":return DP(n,t);case"step":return Rl(n,.5,t);case"stepBefore":return Rl(n,0,t);case"stepAfter":return Rl(n,1,t);case"linearClosed":return FP(n,t)}}class Xt extends CF{constructor(e){super(),this.commandList=[],e&&(this._ctx=e),this._boundsContext=new PP(this.bounds)}setCtx(e){this._ctx=e}moveTo(e,t){return this.commandList.push([Oe.M,e,t]),this._ctx&&this._ctx.moveTo(e,t),this}lineTo(e,t){return this.commandList.push([Oe.L,e,t]),this._ctx&&this._ctx.lineTo(e,t),this}quadraticCurveTo(e,t,i,s){return this.commandList.push([Oe.Q,e,t,i,s]),this._ctx&&this._ctx.quadraticCurveTo(e,t,i,s),this}bezierCurveTo(e,t,i,s,r,a){return this.commandList.push([Oe.C,e,t,i,s,r,a]),this._ctx&&this._ctx.bezierCurveTo(e,t,i,s,r,a),this}arcTo(e,t,i,s,r){return this.commandList.push([Oe.AT,e,t,i,s,r]),this._ctx&&this._ctx.arcTo(e,t,i,s,r),this}ellipse(e,t,i,s,r,a,o,l){return this.commandList.push([Oe.E,e,t,i,s,r,a,o,l]),this._ctx&&this._ctx.ellipse(e,t,i,s,r,a,o,l),this}rect(e,t,i,s){return this.commandList.push([Oe.R,e,t,i,s]),this._ctx&&this._ctx.rect(e,t,i,s),this}arc(e,t,i,s,r,a){return this.commandList.push([Oe.A,e,t,i,s,r,a]),this._ctx&&this._ctx.arc(e,t,i,s,r,a),this}closePath(){return this.commandList.push([Oe.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(e){this.curves.push(e)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}toString(){if(!this.toStringCbList){const i=[];i[Oe.M]=s=>`M${s[1]} ${s[2]}`,i[Oe.L]=s=>`L${s[1]} ${s[2]}`,i[Oe.Q]=s=>`Q${s[1]} ${s[2]} ${s[3]} ${s[4]}`,i[Oe.C]=s=>`C${s[1]} ${s[2]} ${s[3]} ${s[4]} ${s[5]} ${s[6]}`,i[Oe.A]=s=>{const r=[];hf(r,s[4],s[5],s[1],s[2],s[3],s[3]);let a="";for(let o=0;o<r.length;o+=6)a+=`C${r[o]} ${r[o+1]} ${r[o+2]} ${r[o+3]} ${r[o+4]} ${r[o+5]}`;return a},i[Oe.Z]=s=>"Z",this.toStringCbList=i}const e=this.toStringCbList;let t="";return this.commandList.forEach(i=>{t+=e[i[0]](i)}),t}fromString(e,t,i,s,r){this.clear();const a=RF(e);return this._runCommandStrList(a,t,i,s,r),this._updateBounds(),this}fromLine(e){const{points:t,curveType:i,clipRangeByDimension:s}=e.attribute;if(!t)return;const r=lb(t,i);s==="x"?this.direction=_t.ROW:s==="y"?this.direction=_t.COLUMN:s==="auto"&&(this.direction=r.direction),this.curves=r.curves}fromCustomPath2D(e,t,i,s,r){return this.clear(),this._runCommandList(e.commandList,t,i,s,r),this._updateBounds(),this}transform(e,t,i,s){const r=this.commandList;if(!this.transformCbList){const a=[];a[Oe.M]=this.moveToTransform,a[Oe.L]=this.lineToTransform,a[Oe.Q]=this.quadraticCurveToTransform,a[Oe.C]=this.bezierCurveToTransform,a[Oe.AT]=this.arcToTransform,a[Oe.E]=this.ellipseTransform,a[Oe.R]=this.rectTransform,a[Oe.A]=this.arcTransform,a[Oe.Z]=this.closePathTransform,this.transformCbList=a}r.forEach(a=>{this.transformCbList[a[0]](a,e,t,i,s)}),this._updateBounds()}moveToTransform(e,t,i,s,r){e[1]=e[1]*s+t,e[2]=e[2]*r+i}lineToTransform(e,t,i,s,r){e[1]=e[1]*s+t,e[2]=e[2]*r+i}quadraticCurveToTransform(e,t,i,s,r){e[1]=e[1]*s+t,e[2]=e[2]*r+i,e[3]=e[3]*s+t,e[4]=e[4]*r+i}bezierCurveToTransform(e,t,i,s,r){e[1]=e[1]*s+t,e[2]=e[2]*r+i,e[3]=e[3]*s+t,e[4]=e[4]*r+i,e[5]=e[5]*s+t,e[6]=e[6]*r+i}arcToTransform(e,t,i,s,r){e[1]=e[1]*s+t,e[2]=e[2]*r+i,e[3]=e[3]*s+t,e[4]=e[4]*r+i,e[5]=e[5]*(s+r)/2}ellipseTransform(e,t,i,s,r){e[1]=e[1]*s+t,e[2]=e[2]*r+i,e[3]=e[3]*s,e[4]=e[4]*r}rectTransform(e,t,i,s,r){e[1]=e[1]*s+t,e[2]=e[2]*r+i,e[3]=e[3]*s,e[4]=e[4]*r}arcTransform(e,t,i,s,r){e[1]=e[1]*s+t,e[2]=e[2]*r+i,e[3]=e[3]*(s+r)/2}closePathTransform(){}_runCommandStrList(e,t=0,i=0,s=1,r=1){let a,o,l,h,d,u=null,c=0,f=0,p=0,g=0;for(let _=0,m=e.length;_<m;++_){switch(a=e[_],s===1&&r===1||(a=XF(a,s,r)),a[0]){case"l":c+=a[1],f+=a[2],this.lineTo(c+t,f+i);break;case"L":c=a[1],f=a[2],this.lineTo(c+t,f+i);break;case"h":c+=a[1],this.lineTo(c+t,f+i);break;case"H":c=a[1],this.lineTo(c+t,f+i);break;case"v":f+=a[1],this.lineTo(c+t,f+i);break;case"V":f=a[1],this.lineTo(c+t,f+i);break;case"m":c+=a[1],f+=a[2],this.moveTo(c+t,f+i);break;case"M":c=a[1],f=a[2],this.moveTo(c+t,f+i);break;case"c":o=c+a[5],l=f+a[6],p=c+a[3],g=f+a[4],this.bezierCurveTo(c+a[1]+t,f+a[2]+i,p+t,g+i,o+t,l+i),c=o,f=l;break;case"C":c=a[5],f=a[6],p=a[3],g=a[4],this.bezierCurveTo(a[1]+t,a[2]+i,p+t,g+i,c+t,f+i);break;case"s":o=c+a[3],l=f+a[4],p=2*c-p,g=2*f-g,this.bezierCurveTo(p+t,g+i,c+a[1]+t,f+a[2]+i,o+t,l+i),p=c+a[1],g=f+a[2],c=o,f=l;break;case"S":o=a[3],l=a[4],p=2*c-p,g=2*f-g,this.bezierCurveTo(p+t,g+i,a[1]+t,a[2]+i,o+t,l+i),c=o,f=l,p=a[1],g=a[2];break;case"q":o=c+a[3],l=f+a[4],p=c+a[1],g=f+a[2],this.quadraticCurveTo(p+t,g+i,o+t,l+i),c=o,f=l;break;case"Q":o=a[3],l=a[4],this.quadraticCurveTo(a[1]+t,a[2]+i,o+t,l+i),c=o,f=l,p=a[1],g=a[2];break;case"t":o=c+a[1],l=f+a[2],u[0].match(/[QqTt]/)===null?(p=c,g=f):u[0]==="t"?(p=2*c-h,g=2*f-d):u[0]==="q"&&(p=2*c-p,g=2*f-g),h=p,d=g,this.quadraticCurveTo(p+t,g+i,o+t,l+i),c=o,f=l,p=c+a[1],g=f+a[2];break;case"T":o=a[1],l=a[2],p=2*c-p,g=2*f-g,this.quadraticCurveTo(p+t,g+i,o+t,l+i),c=o,f=l;break;case"a":lA(this,c+t,f+i,[a[1],a[2],a[3],a[4],a[5],a[6]+c+t,a[7]+f+i]),c+=a[6],f+=a[7];break;case"A":lA(this,c+t,f+i,[a[1],a[2],a[3],a[4],a[5],a[6]+t,a[7]+i]),c=a[6],f=a[7];break;case"z":case"Z":this.closePath()}u=a}}_runCommandList(e,t=0,i=0,s=1,r=1){if(t!==0||i!==0||s!==1||r!==1)for(let a=0,o=e.length;a<o;++a){const l=e[a].slice();switch(l[0]){case Oe.L:this.lineToTransform(l,t,i,s,r);break;case Oe.M:this.moveToTransform(l,t,i,s,r);break;case Oe.C:this.bezierCurveToTransform(l,t,i,s,r);break;case Oe.Q:this.quadraticCurveToTransform(l,t,i,s,r);break;case Oe.A:this.arcToTransform(l,t,i,s,r);break;case Oe.E:this.ellipseTransform(l,t,i,s,r);break;case Oe.R:this.rectTransform(l,t,i,s,r);break;case Oe.AT:this.arcToTransform(l,t,i,s,r);break;case Oe.Z:this.closePath()}}else this.commandList=e.map(a=>a.slice())}_updateBounds(){this.bounds.clear(),lr(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===_t.COLUMN){if(!this.curves.length)return 0;const e=this.curves[0],t=this.curves[this.curves.length-1];return Ve(e.p0.y-t.p1.y)}if(this.direction===_t.ROW){if(!this.curves.length)return 0;const e=this.curves[0],t=this.curves[this.curves.length-1];return Ve(e.p0.x-t.p1.x)}return this.curves.reduce((e,t)=>e+t.getLength(),0)}getAttrAt(e){if(!this.curves)return{pos:{x:0,y:0},angle:0};let t,i=0;for(let r=0;r<this.curves.length;r++){t=this.curves[r];const a=t.getLength(this.direction);if(i+a>=e)break;i+=a}const s=(e-i)/t.getLength(this.direction);return{pos:t.getPointAt(s),angle:t.getAngleAt(s)}}}const Pn=["l",0,0,0,0,0,0,0];function XF(n,e,t){const i=Pn[0]=n[0];if(i==="a"||i==="A")Pn[1]=e*n[1],Pn[2]=t*n[2],Pn[3]=n[3],Pn[4]=n[4],Pn[5]=n[5],Pn[6]=e*n[6],Pn[7]=t*n[7];else if(i==="h"||i==="H")Pn[1]=e*n[1];else if(i==="v"||i==="V")Pn[1]=t*n[1];else for(let s=1,r=n.length;s<r;++s)Pn[s]=(s%2==1?e:t)*n[s];return Pn}const KF={alignSelf:"auto"},ni={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 Ft},zP={fillOpacity:1,fill:!1,shadowBlur:0,shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0},Vm={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},jP=Object.assign({outerBorder:Object.assign(Object.assign({},Vm),{distance:0}),innerBorder:Object.assign(Object.assign({},Vm),{distance:0})},Vm),fr={text:"",maxLineWidth:1/0,textAlign:"left",textBaseline:"alphabetic",fontSize:16,fontFamily:`PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,
  14. 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",disableAutoClipedPoptip:void 0},qF={pickStrokeBuffer:0},ZF=Object.assign(Object.assign(Object.assign(Object.assign({opacity:1,background:null,texture:null,textureColor:"black",textureSize:10,texturePadding:2,backgroundMode:"no-repeat",backgroundFit:!0,blur:0,cursor:null,html:null},zP),jP),KF),qF),HP={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},JF={_debug_bounds:!1},Mt=Object.assign(Object.assign(Object.assign({strokeSeg:null,pickable:!0,childrenPickable:!0,fillPickable:!0,strokePickable:!0,visible:!0,zIndex:0,layout:null,boundsPadding:0,pickMode:"accurate",customPickShape:null,boundsMode:"accurate",keepDirIn3d:!0,shadowRootIdx:1,globalZIndex:1,globalCompositeOperation:"",overflow:"hidden"},JF),ZF),ni),QF=Object.assign(Object.assign({},Mt),{startAngle:0,endAngle:Be,innerRadius:0,outerRadius:1,cornerRadius:0,padRadius:0,padAngle:0,cap:!1,forceShowCap:!1}),e3=Object.assign(Object.assign(Object.assign({},Mt),HP),{points:[],segments:[],curveType:"linear",clipRange:1,closePath:!1}),t3=Object.assign(Object.assign({},Mt),{radius:1,startAngle:0,endAngle:Be}),i3=Object.assign(Object.assign({},Mt),{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"}),n3=Object.assign(Object.assign({},Mt),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),s3=Object.assign(Object.assign(Object.assign({},Mt),HP),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default",closePath:!1}),r3=Object.assign(Object.assign({},Mt),{path:new Xt,customPath:()=>{De.getInstance().warn("空函数")}}),a3=Object.assign(Object.assign({},Mt),{points:[],cornerRadius:0,closePath:!0}),o3=Object.assign(Object.assign({},Mt),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0}),l3=Object.assign(Object.assign({},Mt),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0}),h3=Object.assign(Object.assign({},Mt),{symbolType:"circle",size:10,keepDirIn3d:!0}),GP=Object.assign(Object.assign(Object.assign({},Mt),fr),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Ms=Object.assign(Object.assign({},Mt),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Gd=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Mt),{fill:!0,cornerRadius:0}),d3=Object.assign(Object.assign({},Gd),{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 u3{}const Q=new u3,Mx={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},WP={fontSize:16,fontFamily:"sans-serif",fill:!0,stroke:!1,fontWeight:"normal",lineHeight:"normal",fontStyle:"normal",textDecoration:"none",textAlign:"left",script:"normal"},gA=/\w|\(|\)|-/,c3=/[.?!,;:/,。?!、;:]/,f3=/\S/;function p3(n,e){const t=e&&e.fill||WP.fill;if(!t)return void(n.globalAlpha=0);n.globalAlpha=1,n.fillStyle=t;let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}n.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily||"sans-serif"})}function g3(n,e){const t=e&&e.stroke||WP.stroke;if(!t)return void(n.globalAlpha=0);n.globalAlpha=1,n.lineWidth=e&&typeof e.lineHeight=="number"?e.lineHeight:1,n.strokeStyle=t;let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}n.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily||"sans-serif"})}function hb(n,e,t,i,s){if(!e||e<=0)return 0;const r=Q.graphicUtil.textMeasure;let a=i,o=n.slice(0,a),l=Math.floor(r.measureText(o,t).width),h=n.slice(0,a+1),d=Math.floor(r.measureText(h,t).width);for(;l>e||d<=e;){if(l>e?a--:a++,a>n.length){a=n.length;break}if(a<0){a=0;break}o=n.slice(0,a),l=Math.floor(r.measureText(o,t).width),h=n.slice(0,a+1),d=Math.floor(r.measureText(h,t).width)}return s&&(a=df(n,a)),a}function df(n,e){let t=e;for(;gA.test(n[t-1])&&gA.test(n[t])||c3.test(n[t]);)if(t--,t<=0)return e;return t}function Wo(n,e){const t=Q.graphicUtil.textMeasure.measureText(n,e),i={ascent:0,height:0,descent:0,width:0};return typeof t.actualBoundingBoxAscent!="number"||typeof t.actualBoundingBoxDescent!="number"?(i.width=Math.floor(t.width),i.height=e.fontSize||0,i.ascent=i.height,i.descent=0):(i.width=Math.floor(t.width),i.height=Math.floor(t.actualBoundingBoxAscent+t.actualBoundingBoxDescent),i.ascent=Math.floor(t.actualBoundingBoxAscent),i.descent=i.height-i.ascent),i}var _3=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};let db=class{configure(n,e){this.canvas=n.canvas,this.context=n.context,n.bindTextMeasure(this)}measureTextWidth(n,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(n).width):this.estimate(n,e).width}estimate(n,{fontSize:e=GP.fontSize}){let t=0,i=0;for(let s=0;s<n.length;s++)n.charCodeAt(s)<128?t++:i++;return{width:~~(.8*t*e+i*e),height:e}}measureTextPixelHeight(n,e){var t;if(!this.context)return(t=e.fontSize)!==null&&t!==void 0?t:fr.fontSize;this.context.setTextStyleWithoutAlignBaseline(e);const i=this.context.measureText(n);return Math.abs(i.actualBoundingBoxAscent-i.actualBoundingBoxDescent)}measureTextBoundHieght(n,e){var t;if(!this.context)return(t=e.fontSize)!==null&&t!==void 0?t:fr.fontSize;this.context.setTextStyleWithoutAlignBaseline(e);const i=this.context.measureText(n);return Math.abs(i.fontBoundingBoxAscent-i.fontBoundingBoxDescent)}measureText(n,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(n)):this.estimate(n,e)}clipTextVertical(n,e,t,i){if(n.length===0)return{verticalList:n,width:0};const{fontSize:s=12}=e;n.forEach(l=>{l.width=l.direction===0?s:this.measureTextWidth(l.text,e)});const r=[];let a=0,o=0;for(;o<n.length&&a+n[o].width<t;o++)a+=n[o].width,r.push(n[o]);if(n[o]&&n[o].text.length>1){const l=this._clipText(n[o].text,e,t-a,0,n[o].text.length-1,"end",!1);if(i&&l.str!==n[o].text){let h="",d=0;for(let f=0;f<o;f++){const p=n[f];h+=p.text,d+=p.text.length}h+=n[o].text;const u=d+l.str.length;let c=df(h,u);c-=d,c!==l.str.length-1&&(l.str=l.str.substring(0,c),l.width=this.measureTextWidth(l.str,e))}r.push(Object.assign(Object.assign({},n[o]),{text:l.str,width:l.width})),a+=l.width}return{verticalList:r,width:a}}clipText(n,e,t,i){if(n.length===0)return{str:"",width:0};let s=this.measureTextWidth(n,e);if(s<=t)return{str:n,width:s};if(s=this.measureTextWidth(n[0],e),s>t)return{str:"",width:0};const r=this._clipText(n,e,t,0,n.length-1,"end",!1);if(i&&r.str!==n){const a=df(n,r.str.length);a!==r.str.length&&(r.str=n.substring(0,a),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(n,e,t,i,s,r,a){let o;if(r==="start")o=this._clipTextStart(n,e,t,i,s),a&&(o.result=a+o.str);else if(r==="middle"){const l=this._clipTextMiddle(n,e,t,"","",0,0,1);o={str:"none",width:l.width,result:l.left+a+l.right}}else o=this._clipTextEnd(n,e,t,i,s),a&&(o.result=o.str+a);return o}_clipTextEnd(n,e,t,i,s){const r=Math.floor((i+s)/2),a=n.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>t){if(a.length<=1)return{str:"",width:0};const h=n.substring(0,r);return l=this.measureTextWidth(h,e),l<=t?{str:h,width:l}:this._clipTextEnd(n,e,t,i,r)}if(o<t){if(r>=n.length-1)return{str:n,width:this.measureTextWidth(n,e)};const h=n.substring(0,r+2);return l=this.measureTextWidth(h,e),l>=t?{str:a,width:o}:this._clipTextEnd(n,e,t,r,s)}return{str:a,width:o}}_clipTextStart(n,e,t,i,s){const r=Math.ceil((i+s)/2),a=n.substring(r-1,n.length-1),o=this.measureTextWidth(a,e);let l;if(o>t){if(a.length<=1)return{str:"",width:0};const h=n.substring(r,n.length-1);return l=this.measureTextWidth(h,e),l<=t?{str:h,width:l}:this._clipTextStart(n,e,t,r,n.length-1)}if(o<t){if(r<=0)return{str:n,width:this.measureTextWidth(n,e)};const h=n.substring(r-2,n.length-1);return l=this.measureTextWidth(h,e),l>=t?{str:a,width:o}:this._clipTextStart(n,e,t,i,r)}return{str:a,width:o}}_clipTextMiddle(n,e,t,i,s,r,a,o){const l=n.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>t)return{left:i,right:s,width:r+a};const d=n.substring(n.length-o,n.length),u=this.measureTextWidth(d,e);return h+u>t?{left:l,right:s,width:h+a}:this._clipTextMiddle(n,e,t,l,d,h,u,o+1)}clipTextWithSuffixVertical(n,e,t,i,s,r){if(i==="")return this.clipTextVertical(n,e,t,s);if(n.length===0)return{verticalList:n,width:0};const a=this.clipTextVertical(n,e,t,s);if(a.verticalList.length===n.length&&a.verticalList[a.verticalList.length-1].width===n[n.length-1].width)return a;const o=this.measureTextWidth(i,e);if(o>t)return a;let l;if(t-=o,r==="start"){const h=this.revertVerticalList(n);l=this.clipTextVertical(h,e,t,s);const d=this.revertVerticalList(l.verticalList);d.unshift({text:i,direction:1,width:o}),l.verticalList=d}else if(r==="middle"){const h=this.clipTextVertical(n,e,t/2,s),d=this.revertVerticalList(n),u=this.clipTextVertical(d,e,t/2,s);h.verticalList.push({text:i,direction:1,width:o}),this.revertVerticalList(u.verticalList).forEach(c=>h.verticalList.push(c)),l={verticalList:h.verticalList,width:h.width+u.width}}else l=this.clipTextVertical(n,e,t,s),l.verticalList.push({text:i,direction:1,width:o});return l.width+=o,l}revertVerticalList(n){return n.reverse().map(e=>{const t=e.text.split("").reverse().join("");return Object.assign(Object.assign({},e),{text:t})})}clipTextWithSuffix(n,e,t,i,s,r){if(i==="")return this.clipText(n,e,t,s);if(n.length===0)return{str:"",width:0};const a=this.measureTextWidth(n,e);if(a<=t)return{str:n,width:a};const o=this.measureTextWidth(i,e);if(o>t)return{str:"",width:0};t-=o;const l=this._clipText(n,e,t,0,n.length-1,r,i);if(s&&l.str!==n){const h=df(n,l.str.length);h!==l.str.length&&(l.str=n.substring(0,h),l.width=this.measureTextWidth(l.str,e))}return l.str=l.result,l.width+=o,l}};db=_3([ue()],db);var m3=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};const ub=Symbol.for("TextMeasureContribution");let cb=class extends db{};cb=m3([ue()],cb);const we=new SF,VP=Symbol.for("CanvasFactory"),y3=Symbol.for("Context2dFactory");function jf(n){return we.getNamed(VP,Q.global.env)(n)}function b3(n){return typeof n=="number"&&Number.isFinite(n)}class v3{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(e){if(!this.pools.length){const i=jf(Object.assign({nativeCanvas:Q.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const t=this.pools.pop();return t.resize(e.width,e.height),t.dpr=e.dpr,t}allocateByObj(e){if(!this.pools.length){const i={width:e.width/e.dpr,height:e.height/e.dpr,dpr:e.dpr},s=jf(Object.assign({nativeCanvas:Q.global.createCanvas(i)},i));return this.allocatedCanvas.push(s),s}const t=this.pools.pop();return t.width=e.width,t.height=e.height,t}free(e){this.pools.push(e)}get length(){return this.pools.length}release(...e){this.pools=[]}}const Zl=new v3;var x3=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},S3=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};const Hf=Symbol.for("VWindow"),Tx=Symbol.for("WindowHandlerContribution");let fb=class{get width(){if(this._handler){const n=this._handler.getWH();return this._width=n.width}return this._width}get height(){if(this._handler){const n=this._handler.getWH();return this._height=n.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new _n(["x","y","width","height"])},this._uid=Nt.GenAutoIncrementId(),this.global=Q.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",()=>{this.active()}),this.active()}active(){const n=this.global;!n.env||this.actived||(we.getNamed(Tx,n.env).configure(this,n),this.actived=!0)}get style(){return this._handler.getStyle()}set style(n){this._handler.setStyle(n)}create(n){this._handler.createWindow(n);const e=this._handler.getWH();this._width=e.width,this._height=e.height,this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(n){this._handler=n}setDpr(n){return this._handler.setDpr(n)}resize(n,e){return this._handler.resizeWindow(n,e)}configure(){throw new Error("暂不支持")}release(){return this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(n){return this._handler.getImageBuffer?this._handler.getImageBuffer(n):null}addEventListener(n,e,t){return this._handler.addEventListener(n,e,t)}removeEventListener(n,e,t){return this._handler.removeEventListener(n,e,t)}dispatchEvent(n){return this._handler.dispatchEvent(n)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(n,e){this._handler.clearViewBox(n,e)}isVisible(n){return this._handler.isVisible(n)}onVisibleChange(n){return this._handler.onVisibleChange(n)}getTopLeft(n){return this._handler.getTopLeft(n)}};fb=x3([ue(),S3("design:paramtypes",[])],fb);var NP=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},UP=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},_A=function(n,e){return function(t,i){e(t,i,n)}};let pb=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(n){this.contributions=n,this.configured=!1,this.global=Q.global,this.global.hooks.onSetEnv.tap("graphic-util",(e,t,i)=>{this.configured=!1,this.configure(i,t)})}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(n,e){this.configured||(this.contributions.getContributions().forEach(t=>{t.configure(this,e)}),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const n=Zl.shareCanvas();this._canvas=n,this._context=n.getContext("2d")}}bindTextMeasure(n){this._textMeasure=n}measureText(n,e,t="native"){var i;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=t;const r={width:this._textMeasure.measureTextWidth(n,e),height:(i=e.fontSize)!==null&&i!==void 0?i:fr.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(n,e,t){return this.configure(this.global,this.global.env),new si(Object.assign({defaultFontParams:{fontFamily:fr.fontFamily,fontSize:fr.fontSize},getCanvasForMeasure:t||(()=>this.canvas),getTextBounds:void 0,specialCharSet:`-/: .,@%'"~`+si.ALPHABET_CHAR_SET+si.ALPHABET_CHAR_SET.toUpperCase()},e??{}),n)}drawGraphicToCanvas(n,e,t){if(!e.defaultLayer)return null;const i=we.get(Hf),s=n.AABBBounds,r=s.width(),a=s.height();i.create({width:r,height:a,canvas:t,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const o=-s.x1,l=-s.y1,h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(i,[n],{x:o,y:l,width:r,height:a,stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const d=i.getNativeHandler();return d.nativeCanvas?d.nativeCanvas:null}};pb=NP([ue(),_A(0,Ee(Kt)),_A(0,di(ub)),UP("design:paramtypes",[Object])],pb);var Dr;(function(n){n[n.transform=0]="transform",n[n.matrix=1]="matrix"})(Dr||(Dr={}));const $t=new Ft;let gb=class{constructor(){this.matrix=new Ft}init(n){return this.mode=Dr.transform,this.originTransform=n,this.matrix.reset(),this}fromMatrix(n,e){return this.mode=Dr.matrix,this.outSourceMatrix=n,this.outTargetMatrix=e,this}scaleMatrix(n,e,t){const i=this.outSourceMatrix;if($t.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),t){const{x:s,y:r}=t;this.outTargetMatrix.translate(s,r),this.outTargetMatrix.scale(n,e),this.outTargetMatrix.translate(-s,-r)}else this.outTargetMatrix.scale(n,e);return this.outTargetMatrix.multiply($t.a,$t.b,$t.c,$t.d,$t.e,$t.f),this}rotateMatrix(n,e){const t=this.outSourceMatrix;if($t.setValue(t.a,t.b,t.c,t.d,t.e,t.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(n),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(n);return this.outTargetMatrix.multiply($t.a,$t.b,$t.c,$t.d,$t.e,$t.f),this}scale(n,e,t){return this.mode===Dr.matrix?this.scaleMatrix(n,e,t):this}rotate(n,e){return this.mode===Dr.matrix?this.rotateMatrix(n,e):this}translateMatrix(n,e){const t=this.outSourceMatrix;return $t.setValue(t.a,t.b,t.c,t.d,t.e,t.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(n,e),this.outTargetMatrix.multiply($t.a,$t.b,$t.c,$t.d,$t.e,$t.f),this}translate(n,e){return this.mode===Dr.matrix?this.translateMatrix(n,e):this}simplify(n){return this.mode===Dr.matrix?this.simplifyMatrix(n):this}simplifyMatrix(n){return this}};gb=NP([ue(),UP("design:paramtypes",[])],gb);const Ri={arc:QF,area:e3,circle:t3,line:s3,path:r3,symbol:h3,text:GP,rect:o3,rect3d:l3,polygon:a3,richtext:Ms,richtextIcon:d3,image:Gd,group:i3,glyph:n3},Nm=Object.keys(Ri);function A3(){return{arc:Object.assign({},Ri.arc),area:Object.assign({},Ri.area),circle:Object.assign({},Ri.circle),line:Object.assign({},Ri.line),path:Object.assign({},Ri.path),symbol:Object.assign({},Ri.symbol),text:Object.assign({},Ri.text),rect:Object.assign({},Ri.rect),rect3d:Object.assign({},Ri.rect3d),polygon:Object.assign({},Ri.polygon),richtext:Object.assign({},Ri.richtext),richtextIcon:Object.assign({},Ri.richtextIcon),image:Object.assign({},Ri.image),group:Object.assign({},Ri.group),glyph:Object.assign({},Ri.glyph)}}function Cc(n,e){Object.keys(e).forEach(t=>{n[t]=e[t]})}const mA=A3();class Wd{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Nm.forEach(e=>{this._defaultTheme[e]=Object.create(mA[e])}),this.combinedTheme=this._defaultTheme}getTheme(e){if(!e)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let t={};const i=this.getParentWithTheme(e);return i&&(t=i.theme),this.applyTheme(e,t),this.combinedTheme}getParentWithTheme(e){for(;e.parent;)if((e=e.parent).theme)return e;return null}applyTheme(e,t,i=!1){if(this.dirty){const s=this.getParentWithTheme(e);if(s){const r=s.theme;(r.dirty||i)&&r.applyTheme(s,t,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,De.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(e){const t=this.userTheme,i=this.combinedTheme;Nm.forEach(s=>{const r=Object.create(mA[s]);e&&e[s]&&Cc(r,e[s]),i[s]&&Cc(r,i[s]),t[s]&&Cc(r,t[s]),this.combinedTheme[s]=r}),t.common&&Nm.forEach(s=>{Cc(this.combinedTheme[s],t.common)}),this.dirty=!1}setTheme(e,t){let i=this.userTheme;i?Object.keys(e).forEach(s=>{i[s]?Object.assign(i[s],e[s]):i[s]=Object.assign({},e[s])}):i=e,this.userTheme=i,this.dirty=!0,this.dirtyChildren(t)}resetTheme(e,t){this.userTheme=e,this.dirty=!0,this.dirtyChildren(t)}dirtyChildren(e){e.forEachChildren(t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))})}}const $P=new Wd;function se(n,e){return n.glyphHost?se(n.glyphHost):e?(n.isContainer,e):k3(n)||$P.getTheme()}function k3(n){let e;if(e=n.isContainer?n:n.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):$P.getTheme()}return null}var w3=function(n,e,t,i){return new(t||(t=Promise))(function(s,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?s(h.value):(d=h.value,d instanceof t?d:new t(function(u){u(d)})).then(a,o)}l((i=i.apply(n,e||[])).next())})};class M3 extends po{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=Nt.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(e,t=!1){if(t){let i=this._lastChild,s=0;for(;i;){if(e(i,s++))return;i=i._prev}}else{let i=this._firstChild,s=0;for(;i;){if(e(i,s++))return;i=i._next}}}forEachChildrenAsync(e,t=!1){return w3(this,void 0,void 0,function*(){if(t){let i=this._lastChild,s=0;for(;i;){let r=e(i,s++);if(r.then&&(r=yield r),r)return;i=i._prev}}else{let i=this._firstChild,s=0;for(;i;){let r=e(i,s++);if(r.then&&(r=yield r),r)return;i=i._next}}})}forEach(e){return this.forEachChildren(e)}appendChild(e,t=!0){if(this._uid===e._uid)return null;if(!t&&e.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return e.parent&&e.parent.removeChild(e),e.parent=this,this._lastChild?(this._lastChild._next=e,e._prev=this._lastChild,this._lastChild=e):(this._firstChild=this._lastChild=e,e._prev=e._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(e._uid,e),this.setCount(e.count),this._structEdit=!0,e}appendChildArrHighPerformance(e,t=!1){return console.error("暂不支持该函数"),e}insertBefore(e,t){if(!t)return this.appendChild(e);if(this._uid===e._uid)return null;if(e.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return t.parent!==this?null:(e.parent&&e.parent.removeChild(e),e.parent=this,e._prev=t._prev,t._prev?t._prev._next=e:this._firstChild=e,t._prev=e,e._next=t,this._idMap||(this._idMap=new Map),this._idMap.set(e._uid,e),this._structEdit=!0,this.setCount(e.count),e)}insertAfter(e,t){if(!t)return this.appendChild(e);if(this._uid===e._uid)return null;if(e.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return t.parent!==this?null:(e.parent&&e.parent.removeChild(e),e.parent=this,t._next?(t._next._prev=e,e._next=t._next):this._lastChild=e,t._next=e,e._prev=t,this._idMap||(this._idMap=new Map),this._idMap.set(e._uid,e),this._structEdit=!0,this.setCount(e.count),e)}insertInto(e,t){if(!this._ignoreWarn&&this._nodeList&&De.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),t>=this.childrenCount)return this.appendChild(e);if(this._uid===e._uid)return null;if(e.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(e.parent&&e.parent.removeChild(e),e.parent=this,t===0)e._next=this._firstChild,this._firstChild&&(this._firstChild._prev=e),e._prev=null,this._firstChild=e;else{let i=this._firstChild;for(let s=0;s<t;s++){if(!i)return null;s>0&&(i=i._next)}if(!i)return null;e._next=i._next,e._prev=i,i._next=e,e._next&&(e._next._prev=e)}return this._idMap||(this._idMap=new Map),this._idMap.set(e._uid,e),this._structEdit=!0,this.setCount(e.count),e}insertIntoKeepIdx(e,t){if(this._nodeList||(this._nodeList=this.children),this._nodeList[t]){const r=this._nodeList[t];return this._nodeList.splice(t,0,e),this.insertBefore(e,r)}let i;this._nodeList[t]=e;for(let r=t-1;r>=0&&(i=this._nodeList[r],!i);r--);if(i)return i._next?this.insertBefore(e,i._next):this.appendChild(e);this._ignoreWarn=!0;const s=this.insertInto(e,0);return this._ignoreWarn=!1,s}removeChild(e){if(!this._idMap||!this._idMap.has(e._uid))return null;if(this._idMap.delete(e._uid),this._nodeList){const t=this._nodeList.findIndex(i=>i===e);t>0&&this._nodeList.splice(t,1)}return e._prev?e._prev._next=e._next:this._firstChild=e._next,e._next?e._next._prev=e._prev:this._lastChild=e._prev,e.parent=null,e._prev=null,e._next=null,this._structEdit=!0,this.setCount(-e.count),e}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(){if(!this._idMap)return;let e=this._firstChild;for(;e;)e.parent=null,e._prev=null,e._next=null,e=e._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(e,t){throw new Error("暂不支持")}find(e,t=!1){let i=null;return this.forEachChildren((s,r)=>!(s===this||!e(s,r))&&(i=s,!0)),t&&this.forEachChildren(s=>{if(s.isContainer){const r=s.find(e,!0);if(r)return i=r,!0}return!1}),i}findAll(e,t=!1){let i=[];return this.forEachChildren((s,r)=>{s!==this&&e(s,r)&&i.push(s)}),t&&this.forEachChildren(s=>{if(s.isContainer){const r=s.findAll(e,!0);r.length&&(i=i.concat(r))}}),i}getElementById(e){return this.find(t=>t.id===e,!0)}findChildById(e){return this.getElementById(e)}findChildByUid(e){return this._idMap&&this._idMap.get(e)||null}getElementsByName(e){return this.findAll(t=>t.name===e,!0)}findChildrenByName(e){return this.getElementsByName(e)}getElementsByType(e){return this.findAll(t=>t.type===e,!0)}getChildByName(e,t=!1){return this.find(i=>i.name===e,t)}getChildAt(e){let t=this._firstChild;if(!t)return null;for(let i=0;i<e;i++){if(!t._next)return null;t=t._next}return t}at(e){return this.getChildAt(e)}containNode(e){if(!this._idMap)return!1;if(this._idMap.has(e._uid))return!0;let t=this._firstChild;for(;t;){if(t.containNode(e))return!0;t=t._next}return!1}getRootNode(){let e=this.parent;for(;e!=null&&e.parent;)e=e.parent;return e||this}hasChildNodes(){return this._firstChild!==null}addChild(e){return this.appendChild(e)}add(e){return this.appendChild(e)}getChildren(){const e=[];let t=this._firstChild;for(;t;)e.push(t),t=t._next;return e}isChildOf(e){return!!this.parent&&this.parent._uid===e._uid}isParentOf(e){return e.isChildOf(this)}isDescendantsOf(e){let t=this.parent;if(!t)return!1;do{if(t._uid===e._uid)return!0;t=t.parent}while(t!==null);return!1}isAncestorsOf(e){return e.isDescendantsOf(this)}getAncestor(e){throw new Error("暂不支持")}setAllDescendantsProps(e,t){let i=this._firstChild;for(;i;)i[e]=t,i.setAllDescendantsProps(e,t),i=i._next}setCount(e){this._count+=e;let t=this.parent;if(t)do t._count+=e,t=t.parent;while(t!==null)}clone(){throw new Error("暂不支持")}cloneTo(e){throw new Error("暂不支持")}getParent(){return this.parent}del(e){return this.removeChild(e)}addEventListener(e,t,i){const s=ht(i,!0)&&i||He(i)&&i.capture,r=He(i)&&i.once,a=Y(t)?void 0:t;return e=s?`${e}capture`:e,t=Y(t)?t:t.handleEvent,r?super.once(e,t,a):super.on(e,t,a),this}on(e,t,i){return this.addEventListener(e,t,i)}removeEventListener(e,t,i){const s=ht(i,!0)&&i||He(i)&&i.capture,r=Y(t)?void 0:t;e=s?`${e}capture`:e,t=Y(t)?t:t.handleEvent;const a=He(i)&&i.once;return super.off(e,t,r,a),this}off(e,t,i){return this.removeEventListener(e,t,i)}once(e,t,i){return He(i)?(i.once=!0,this.addEventListener(e,t,i)):this.addEventListener(e,t,{once:!0})}removeAllEventListeners(){return super.removeAllListeners(),this}removeAllListeners(){return this.removeAllEventListeners()}dispatchEvent(e,...t){return super.emit(e.type,e,...t),!e.defaultPrevented}emit(e,t){return this.dispatchEvent(e,t)}release(){this.removeAllListeners()}}class Hu{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(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Hu.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=e}composedPath(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.stopPropagation(),this.propagationStopped=!0}initEvent(){}initUIEvent(){}clone(){throw new Error("Method not implemented.")}}class Gf extends Hu{constructor(){super(...arguments),this.client={x:0,y:0},this.movement={x:0,y:0},this.offset={x:0,y:0},this.global={x:0,y:0},this.screen={x:0,y:0}}get clientX(){return this.client.x}get clientY(){return this.client.y}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,t,i,s,r,a,o,l,h,d,u,c,f,p,g){throw new Error("Method not implemented.")}}class pn extends Gf{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}clone(){var e,t,i;const s=new pn(this.manager);return s.eventPhase=s.NONE,s.currentTarget=null,s.path=[],s.target=null,s.nativeEvent=this.nativeEvent,s.originalEvent=this.originalEvent,(e=this.manager)===null||e===void 0||e.copyPointerData(this,s),(t=this.manager)===null||t===void 0||t.copyMouseData(this,s),(i=this.manager)===null||i===void 0||i.copyData(this,s),s.target=this.target,s.path=this.composedPath().slice(),s.type=this.type,s}}class aa extends Gf{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}clone(){var e,t,i;const s=new aa(this.manager);return s.eventPhase=s.NONE,s.currentTarget=null,s.path=[],s.target=null,s.nativeEvent=this.nativeEvent,s.originalEvent=this.originalEvent,(e=this.manager)===null||e===void 0||e.copyWheelData(this,s),(t=this.manager)===null||t===void 0||t.copyMouseData(this,s),(i=this.manager)===null||i===void 0||i.copyData(this,s),s.target=this.target,s.path=this.composedPath().slice(),s.type=this.type,s}}aa.DOM_DELTA_PIXEL=0,aa.DOM_DELTA_LINE=1,aa.DOM_DELTA_PAGE=2;class Cx extends Hu{constructor(e,t){super(),this.type=e,this.detail=t}}const YP="*",Na=typeof performance=="object"&&performance.now?performance:Date;function Pr(n){return n==="mouse"||n==="pen"}class T3{constructor(e,t){this.dispatch=new po,this.cursorTarget=null,this.mappingState={trackingData:{}},this.eventPool=new Map,this.onPointerDown=(i,s)=>{if(!(i instanceof pn))return void De.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.createPointerEvent(i,i.type,s);if(this.dispatchEvent(r,"pointerdown"),r.pointerType==="touch")this.dispatchEvent(r,"touchstart");else if(Pr(r.pointerType)){const a=r.button===2;this.dispatchEvent(r,a?"rightdown":"mousedown")}this.trackingData(i.pointerId).pressTargetsByButton[i.button]=r.composedPath(),this.freeEvent(r)},this.onPointerMove=(i,s)=>{var r,a;if(!(i instanceof pn))return void De.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const o=this.createPointerEvent(i,i.type,s),l=Pr(o.pointerType),h=this.trackingData(i.pointerId),d=this.findMountedTarget(h.overTargets);if(h.overTargets&&d&&d!==this.rootTarget&&d!==o.target){const u=i.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(i,u,d||void 0);if(this.dispatchEvent(c,"pointerout"),l&&this.dispatchEvent(c,"mouseout"),!o.composedPath().includes(d)){const f=this.createPointerEvent(i,"pointerleave",d||void 0);for(f.eventPhase=f.AT_TARGET;f.target&&!o.composedPath().includes(f.target);)f.currentTarget=f.target,this.notifyTarget(f),l&&this.notifyTarget(f,"mouseleave"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(c)}if(d!==o.target){const u=i.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(o,u);this.dispatchEvent(c,"pointerover"),l&&this.dispatchEvent(c,"mouseover");let f=d==null?void 0:d.parent;for(;f&&f!==this.rootTarget.parent&&f!==o.target;)f=f.parent;if(!f||f===this.rootTarget.parent){const p=this.clonePointerEvent(o,"pointerenter");for(p.eventPhase=p.AT_TARGET;p.target&&p.target!==d&&p.target!==this.rootTarget.parent;)p.currentTarget=p.target,this.notifyTarget(p),l&&this.notifyTarget(p,"mouseenter"),p.target=p.target.parent;this.freeEvent(p)}this.freeEvent(c)}this.dispatchEvent(o,"pointermove"),o.pointerType==="touch"&&this.dispatchEvent(o,"touchmove"),l&&(this.dispatchEvent(o,"mousemove"),this.cursorTarget=o.target,this.cursor=((a=(r=o.target)===null||r===void 0?void 0:r.attribute)===null||a===void 0?void 0:a.cursor)||this.rootTarget.getCursor()),h.overTargets=o.composedPath(),this.freeEvent(o)},this.onPointerOver=(i,s)=>{var r,a;if(!(i instanceof pn))return void De.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const o=this.trackingData(i.pointerId),l=this.createPointerEvent(i,i.type,s),h=Pr(l.pointerType);this.dispatchEvent(l,"pointerover"),h&&this.dispatchEvent(l,"mouseover"),l.pointerType==="mouse"&&(this.cursorTarget=l.target,this.cursor=((a=(r=l.target)===null||r===void 0?void 0:r.attribute)===null||a===void 0?void 0:a.cursor)||this.rootTarget.getCursor());const d=this.clonePointerEvent(l,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),h&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;o.overTargets=l.composedPath(),this.freeEvent(l),this.freeEvent(d)},this.onPointerOut=(i,s)=>{if(!(i instanceof pn))return void De.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.trackingData(i.pointerId);if(r.overTargets){const a=Pr(i.pointerType),o=this.findMountedTarget(r.overTargets),l=this.createPointerEvent(i,"pointerout",o||void 0);this.dispatchEvent(l),a&&this.dispatchEvent(l,"mouseout");const h=this.createPointerEvent(i,"pointerleave",o||void 0);for(h.eventPhase=h.AT_TARGET;h.target&&h.target!==this.rootTarget.parent;)h.currentTarget=h.target,this.notifyTarget(h),a&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;r.overTargets=[],this.freeEvent(l),this.freeEvent(h)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(i,s)=>{var r;if(!(i instanceof pn))return void De.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const a=Na.now(),o=this.createPointerEvent(i,i.type,s);if(this.dispatchEvent(o,"pointerup"),o.pointerType==="touch")this.dispatchEvent(o,"touchend");else if(Pr(o.pointerType)){const u=o.button===2;this.dispatchEvent(o,u?"rightup":"mouseup")}const l=this.trackingData(i.pointerId),h=this.findMountedTarget(l.pressTargetsByButton[i.button]);let d=h;if(h&&!o.composedPath().includes(h)){let u=h;for(;u&&!o.composedPath().includes(u);){if(o.currentTarget=u,this.notifyTarget(o,"pointerupoutside"),o.pointerType==="touch")this.notifyTarget(o,"touchendoutside");else if(Pr(o.pointerType)){const c=o.button===2;this.notifyTarget(o,c?"rightupoutside":"mouseupoutside")}u=u.parent}delete l.pressTargetsByButton[i.button],d=u}if(d){const u=this.clonePointerEvent(o,"click");u.target=d,u.path=[],l.clicksByButton[i.button]||(l.clicksByButton[i.button]={clickCount:0,target:u.target,timeStamp:a});const c=l.clicksByButton[i.button];c.target===u.target&&a-c.timeStamp<((r=this._config.clickInterval)!==null&&r!==void 0?r:200)?++c.clickCount:c.clickCount=1,c.target=u.target,c.timeStamp=a,u.detail=c.clickCount,Pr(u.pointerType)?(this.dispatchEvent(u,"click"),c.clickCount===2&&this.dispatchEvent(u,"dblclick")):u.pointerType==="touch"&&(this.dispatchEvent(u,"tap"),c.clickCount===2&&this.dispatchEvent(u,"dbltap")),this.dispatchEvent(u,"pointertap"),this.freeEvent(u)}this.freeEvent(o)},this.onPointerUpOutside=(i,s)=>{if(!(i instanceof pn))return void De.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.trackingData(i.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[i.button]),o=this.createPointerEvent(i,i.type,s);if(a){let l=a;for(;l;)o.currentTarget=l,this.notifyTarget(o,"pointerupoutside"),o.pointerType==="touch"?this.notifyTarget(o,"touchendoutside"):Pr(o.pointerType)&&this.notifyTarget(o,o.button===2?"rightupoutside":"mouseupoutside"),l=l.parent;delete r.pressTargetsByButton[i.button]}this.freeEvent(o)},this.onWheel=(i,s)=>{if(!(i instanceof aa))return void De.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const r=this.createWheelEvent(i,s);this.dispatchEvent(r),this.freeEvent(r)},this.rootTarget=e,this.mappingTable={},this._config=Object.assign({clickInterval:200},t),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((i,s)=>i.priority-s.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){var t,i,s,r,a,o,l;if(!this.rootTarget)return;const h=this.mappingTable[e.type];let d;const u=`${e.canvasX}-${e.canvasY}`;if(!((t=this._prePointTargetCache)===null||t===void 0)&&t[u]&&(!((s=(i=this._prePointTargetCache)===null||i===void 0?void 0:i[u])===null||s===void 0)&&s.stage)&&((a=(r=this._prePointTargetCache)===null||r===void 0?void 0:r[u])===null||a===void 0?void 0:a.stage.renderCount)===((o=this._prePointTargetCache)===null||o===void 0?void 0:o.stageRenderCount)?d=this._prePointTargetCache[u]:(d=this.pickTarget(e.canvasX,e.canvasY,e),e.pickParams||(this._prePointTargetCache={[u]:d,stageRenderCount:(l=d==null?void 0:d.stage.renderCount)!==null&&l!==void 0?l:-1})),h)for(let c=0,f=h.length;c<f;c++)h[c].fn(e,d);else De.getInstance().warn(`[EventManager]: Event mapping not defined for ${e.type}`)}propagate(e,t){if(!e.target)return;const i=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(let s=0,r=i.length-1;s<r;s++)if(e.currentTarget=i[s],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,t),!e.propagationStopped&&!e.propagationImmediatelyStopped){e.eventPhase=e.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(e.currentTarget=i[s],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}propagationPath(e){const t=[e];for(let i=0;i<2048&&e!==this.rootTarget&&e.parent;i++){if(!e.parent)throw new Error("Cannot find propagation path to disconnected target");t.push(e.parent),e=e.parent}return t.reverse(),t}notifyTarget(e,t){t=t??e.type;const i=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${t}capture`:t;this.notifyListeners(e,i),e.eventPhase===e.AT_TARGET&&this.notifyListeners(e,t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let i=1;i<e.length&&e[i].parent===t;i++)t=e[i];return t}createPointerEvent(e,t,i){const s=this.allocateEvent(pn);return this.copyPointerData(e,s),this.copyMouseData(e,s),this.copyData(e,s),s.nativeEvent=e.nativeEvent,s.originalEvent=e,s.target=i||this.pickTarget(s.global.x,s.global.y,s),typeof t=="string"&&(s.type=t),s}createWheelEvent(e,t){const i=this.allocateEvent(aa);return this.copyWheelData(e,i),this.copyMouseData(e,i),this.copyData(e,i),i.nativeEvent=e.nativeEvent,i.originalEvent=e,i.target=t||this.pickTarget(i.global.x,i.global.y,i),i}clonePointerEvent(e,t){const i=this.allocateEvent(pn);return i.nativeEvent=e.nativeEvent,i.originalEvent=e.originalEvent,this.copyPointerData(e,i),this.copyMouseData(e,i),this.copyData(e,i),i.target=e.target,i.path=e.composedPath().slice(),i.type=t??i.type,i}copyWheelData(e,t){t.deltaMode=e.deltaMode,t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ}copyPointerData(e,t){e instanceof pn&&t instanceof pn&&(t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist)}copyMouseData(e,t){e instanceof Gf&&t instanceof Gf&&(t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.ctrlKey=e.ctrlKey,t.shiftKey=e.shiftKey,t.metaKey=e.metaKey,["client","movement","canvas","screen","global","offset","viewport"].forEach(i=>{t[i].x=e[i].x,t[i].y=e[i].y}))}copyData(e,t){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=Na.now(),t.type=e.type,t.detail=e.detail,t.view=e.view,t.which=e.which,t.layer.x=e.layer.x,t.layer.y=e.layer.y,t.page.x=e.page.x,t.page.y=e.page.y,t.pickParams=e.pickParams}trackingData(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}allocateEvent(e){var t;this.eventPool.has(e)||this.eventPool.set(e,[]);const i=((t=this.eventPool.get(e))===null||t===void 0?void 0:t.pop())||new e(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.target=null,i}freeEvent(e){var t;if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=e.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),(t=this.eventPool.get(i))===null||t===void 0||t.push(e)}notifyListeners(e,t){const i=e.currentTarget._events[t];if(i)if("fn"in i)i.once&&e.currentTarget.removeEventListener(t,i.fn,{once:!0}),i.fn.call(i.context,e);else for(let s=0,r=i.length;s<r&&!e.propagationImmediatelyStopped;s++)i[s].once&&e.currentTarget.removeEventListener(t,i[s].fn,{once:!0}),i[s].fn.call(i[s].context,e);this.emitDelegation(e,t)}emitDelegation(e,t){const i=e.currentTarget._events[YP];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,r=i.length;s<r&&!e.propagationImmediatelyStopped;s++)i[s].fn.call(i[s].context,e,t)}pickTarget(e,t,i){let s;const r=this.rootTarget.pick(e,t);return s=r&&r.graphic?r.graphic:r&&r.group?r.group:this.rootTarget.AABBBounds.contains(e,t)?this.rootTarget:null,i&&(i.pickParams=r.params),s}}const C3={pickable:!0,visible:!0,dispatchEvent(n){var e;if(!(n instanceof Hu))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return n.defaultPrevented=!1,n.path=[],n.target=this,(e=n==null?void 0:n.manager)===null||e===void 0||e.dispatchEvent(n),!n.defaultPrevented},emit(n,e){return this.dispatchEvent(new Cx(n,e))}},P3={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class E3{constructor(e){this.resolution=1,this.onPointerDown=u=>{if(this.supportsTouchEvents&&u.pointerType==="touch")return;const c=this.normalizeToPointerData(u);this.autoPreventDefault&&c[0].isNormalized&&(u.cancelable||!("cancelable"in u))&&u.preventDefault();for(let f=0,p=c.length;f<p;f++){const g=c[f],_=this.bootstrapEvent(this.rootPointerEvent,g);this.manager.mapEvent(_)}this.setCursor(this.manager.cursor,this.manager.cursorTarget)},this.onPointerMove=u=>{if(this.supportsTouchEvents&&u.pointerType==="touch"||this.isEventOutsideOfTargetElement(u))return;const c=this.normalizeToPointerData(u);for(let f=0,p=c.length;f<p;f++){const g=this.bootstrapEvent(this.rootPointerEvent,c[f]);this.manager.mapEvent(g)}this.setCursor(this.manager.cursor,this.manager.cursorTarget)},this.onPointerUp=u=>{if(this.supportsTouchEvents&&u.pointerType==="touch")return;const c=this.isEventOutsideOfTargetElement(u)?"outside":"",f=this.normalizeToPointerData(u);for(let p=0,g=f.length;p<g;p++){const _=this.bootstrapEvent(this.rootPointerEvent,f[p]);_.type+=c,this.manager.mapEvent(_)}this.setCursor(this.manager.cursor,this.manager.cursorTarget)},this.onPointerOverOut=u=>{if(this.supportsTouchEvents&&u.pointerType==="touch")return;const c=this.normalizeToPointerData(u);for(let f=0,p=c.length;f<p;f++){const g=this.bootstrapEvent(this.rootPointerEvent,c[f]);this.manager.mapEvent(g)}this.setCursor(this.manager.cursor,this.manager.cursorTarget)},this.onWheel=u=>{const c=this.normalizeWheelEvent(u);this.manager.mapEvent(c)};const{targetElement:t,resolution:i,rootNode:s,global:r,viewport:a,autoPreventDefault:o=!1,clickInterval:l,supportsTouchEvents:h=r.supportsTouchEvents,supportsPointerEvents:d=r.supportsPointerEvents}=e;this.manager=new T3(s,{clickInterval:l}),this.globalObj=r,this.supportsPointerEvents=d,this.supportsTouchEvents=h,this.supportsMouseEvents=r.supportsMouseEvents,this.applyStyles=r.applyStyles,this.autoPreventDefault=o,this.eventsAdded=!1,this.viewport=a,this.rootPointerEvent=new pn,this.rootWheelEvent=new aa,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(t)}release(){this.setTargetElement(null)}setCursor(e,t){if(!t&&!this.manager.rootTarget.window._handler.canvas.controled)return;e||(e="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===e)return;this.currentCursor=e;const r=this.cursorStyles[e];r?typeof r=="string"&&i?s.style.cursor=r:typeof r=="function"?r(e):typeof r=="object"&&i&&Object.assign(s.style,r):i&&ae(e)&&!Fn(this.cursorStyles,e)&&(s.style.cursor=e)}setTargetElement(e){this.removeEvents(),this.domElement=e,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:e,domElement:t}=this;this.supportsPointerEvents?(e.getDocument()?(e.getDocument().addEventListener("pointermove",this.onPointerMove,!0),e.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)),t.addEventListener("pointerdown",this.onPointerDown,!0),t.addEventListener("pointerleave",this.onPointerOverOut,!0),t.addEventListener("pointerover",this.onPointerOverOut,!0)):(e.getDocument()?(e.getDocument().addEventListener("mousemove",this.onPointerMove,!0),e.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)),t.addEventListener("mousedown",this.onPointerDown,!0),t.addEventListener("mouseout",this.onPointerOverOut,!0),t.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(t.addEventListener("touchstart",this.onPointerDown,!0),t.addEventListener("touchend",this.onPointerUp,!0),t.addEventListener("touchmove",this.onPointerMove,!0)),t.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:e,domElement:t}=this;this.supportsPointerEvents?(e.getDocument()?(e.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),e.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)),t.removeEventListener("pointerdown",this.onPointerDown,!0),t.removeEventListener("pointerleave",this.onPointerOverOut,!0),t.removeEventListener("pointerover",this.onPointerOverOut,!0)):(e.getDocument()?(e.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),e.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)),t.removeEventListener("mousedown",this.onPointerDown,!0),t.removeEventListener("mouseout",this.onPointerOverOut,!0),t.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(t.removeEventListener("touchstart",this.onPointerDown,!0),t.removeEventListener("touchend",this.onPointerUp,!0),t.removeEventListener("touchmove",this.onPointerMove,!0)),t.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(e){const t=this.viewport,{x:i,y:s}=e;return{x:i-t.x,y:s-t.y}}mapToCanvasPoint(e){var t;const i=(t=this.globalObj)===null||t===void 0?void 0:t.mapToCanvasPoint(e,this.domElement);if(i)return i;const{clientX:s,clientY:r}=e,a=this.domElement.getBoundingClientRect();return{x:s-a.left,y:r-a.top}}normalizeToPointerData(e){const t=[];if(this.supportsTouchEvents&&e.changedTouches&&e.changedTouches.length)for(let i=0,s=e.changedTouches.length;i<s;i++){const r=e.changedTouches[i];bt(r.button)&&(r.button=0),bt(r.buttons)&&(r.buttons=1),bt(r.isPrimary)&&(r.isPrimary=e.touches.length===1&&e.type==="touchstart"),bt(r.width)&&(r.width=r.radiusX||1),bt(r.height)&&(r.height=r.radiusY||1),bt(r.tiltX)&&(r.tiltX=0),bt(r.tiltY)&&(r.tiltY=0),bt(r.pointerType)&&(r.pointerType="touch"),bt(r.pointerId)&&(r.pointerId=r.identifier||0),bt(r.pressure)&&(r.pressure=r.force||.5),bt(r.twist)&&(r.twist=0),bt(r.tangentialPressure)&&(r.tangentialPressure=0),bt(r.layerX)&&(r.layerX=r.offsetX=r.clientX),bt(r.layerY)&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,r.type=e.type,t.push(r)}else if(this.globalObj.supportsMouseEvents&&(!(e instanceof MouseEvent)||this.supportsPointerEvents&&e instanceof PointerEvent))t.push(e);else{const i=e;bt(i.isPrimary)&&(i.isPrimary=!0),bt(i.width)&&(i.width=1),bt(i.height)&&(i.height=1),bt(i.tiltX)&&(i.tiltX=0),bt(i.tiltY)&&(i.tiltY=0),bt(i.pointerType)&&(i.pointerType="mouse"),bt(i.pointerId)&&(i.pointerId=1),bt(i.pressure)&&(i.pressure=.5),bt(i.twist)&&(i.twist=0),bt(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,t.push(i)}return t}normalizeWheelEvent(e){const t=this.rootWheelEvent;this.transferMouseData(t,e),t.deltaMode=e.deltaMode,t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ;const{x:i,y:s}=this.mapToCanvasPoint(e);t.canvas.x=i,t.canvas.y=s,t.global.x=i,t.global.y=s,t.offset.x=i,t.offset.y=s;const{x:r,y:a}=this.mapToViewportPoint(t);return t.viewport.x=r,t.viewport.y=a,t.nativeEvent=e,t.type=e.type,t}bootstrapEvent(e,t){e.originalEvent=null,e.nativeEvent=t,e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist,this.transferMouseData(e,t);const{x:i,y:s}=this.mapToCanvasPoint(t);e.canvas.x=i,e.canvas.y=s,e.global.x=i,e.global.y=s,e.offset.x=i,e.offset.y=s;const{x:r,y:a}=this.mapToViewportPoint(e);return e.viewport.x=r,e.viewport.y=a,e.isTrusted=t.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=P3[e.type]||e.type),e}transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Na.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.shiftKey=t.shiftKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null}isEventOutsideOfTargetElement(e){let t=e.target;return e.composedPath&&e.composedPath().length>0&&(t=e.composedPath()[0]),t!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class Wf{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return Wf.Avaliable()}tick(e,t){this.time=Math.max(0,e+this.time),t(this,{once:!0})}tickTo(e,t){this.time=Math.max(0,e),t(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class Vf{static Avaliable(){return!0}avaliable(){return Vf.Avaliable()}tick(e,t){this.timerId=setTimeout(()=>{t(this)},e)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class ud{static Avaliable(){return!!Q.global.getRequestAnimationFrame()}avaliable(){return ud.Avaliable()}tick(e,t){Q.global.getRequestAnimationFrame()(()=>{this.released||t(this)})}release(){this.released=!0}getTime(){return Date.now()}}var On;(function(n){n[n.INITIAL=0]="INITIAL",n[n.RUNNING=1]="RUNNING",n[n.PAUSE=2]="PAUSE"})(On||(On={}));class R3{set mode(e){this._mode!==e&&(this._mode=e,this.setupTickHandler())}get mode(){return this._mode}constructor(e=[]){this.handleTick=(t,i)=>{const{once:s=!1}=i??{};this.ifCanStop()?this.stop():(this._handlerTick(t),s||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const i=this.tickerHandler.getTime();let s=0;this.lastFrameTime>=0&&(s=i-this.lastFrameTime),this.lastFrameTime=i,this.status===On.RUNNING&&(this.tickCounts++,this.timelines.forEach(r=>{r.tick(s)}))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=e,this.autoStop=!0}init(){this.interval=NaN,this.status=On.INITIAL,Q.global.hooks.onSetEnv.tap("default-ticker",()=>{this.initHandler()}),Q.global.env&&this.initHandler()}addTimeline(e){this.timelines.push(e)}remTimeline(e){this.timelines=this.timelines.filter(t=>t!==e)}initHandler(){if(this._mode)return null;const e=[{mode:"raf",cons:ud},{mode:"timeout",cons:Vf},{mode:"manual",cons:Wf}];for(let t=0;t<e.length;t++)if(e[t].cons.Avaliable()){this.mode=e[t].mode;break}return null}setupTickHandler(){let e;switch(this._mode){case"raf":e=new ud;break;case"timeout":e=new Vf;break;case"manual":e=new Wf;break;default:De.getInstance().warn("非法的计时器模式"),e=new ud}return!!e.avaliable()&&(this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0)}setInterval(e){this.interval=e}getInterval(){return this.interval}setFPS(e){this.setInterval(1e3/e)}getFPS(){return 1e3/this.interval}tick(e){this.tickerHandler.tick(e,t=>{this.handleTick(t,{once:!0})})}tickTo(e){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(e,t=>{this.handleTick(t,{once:!0})})}pause(){return this.status!==On.INITIAL&&(this.status=On.PAUSE,!0)}resume(){return this.status!==On.INITIAL&&(this.status=On.RUNNING,!0)}ifCanStop(){return!!(this.autoStop&&(!this.timelines.length||this.timelines.reduce((e,t)=>e+t.animateCount,0)===0))}start(e=!1){return this.status===On.RUNNING||!this.tickerHandler||!e&&(this.status===On.PAUSE||!this.timelines.length||this.timelines.reduce((t,i)=>t+i.animateCount,0)===0)?!1:(this.status=On.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0)}stop(){this.status=On.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}}class ze{constructor(){}static linear(e){return e}static none(){return this.linear}static get(e){return e<-1?e=-1:e>1&&(e=1),function(t){return e===0?t:e<0?t*(t*-e+1+e):t*((2-t)*e+(1-e))}}static getPowIn(e){return function(t){return Math.pow(t,e)}}static getPowOut(e){return function(t){return 1-Math.pow(1-t,e)}}static getPowInOut(e){return function(t){return(t*=2)<1?.5*Math.pow(t,e):1-.5*Math.abs(Math.pow(2-t,e))}}static getBackIn(e){return function(t){return t*t*((e+1)*t-e)}}static getBackOut(e){return function(t){return--t*t*((e+1)*t+e)+1}}static getBackInOut(e){return e*=1.525,function(t){return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}}static sineIn(e){return 1-Math.cos(e*Math.PI/2)}static sineOut(e){return Math.sin(e*Math.PI/2)}static sineInOut(e){return-(Math.cos(Math.PI*e)-1)/2}static expoIn(e){return e===0?0:Math.pow(2,10*e-10)}static expoOut(e){return e===1?1:1-Math.pow(2,-10*e)}static expoInOut(e){return e===0?0:e===1?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2}static circIn(e){return-(Math.sqrt(1-e*e)-1)}static circOut(e){return Math.sqrt(1- --e*e)}static circInOut(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}static bounceOut(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}static bounceIn(e){return 1-ze.bounceOut(1-e)}static bounceInOut(e){return e<.5?.5*ze.bounceIn(2*e):.5*ze.bounceOut(2*e-1)+.5}static getElasticIn(e,t){return function(i){if(i===0||i===1)return i;const s=t/Be*Math.asin(1/e);return-e*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Be/t)}}static getElasticOut(e,t){return function(i){if(i===0||i===1)return i;const s=t/Be*Math.asin(1/e);return e*Math.pow(2,-10*i)*Math.sin((i-s)*Be/t)+1}}static getElasticInOut(e,t){return function(i){const s=t/Be*Math.asin(1/e);return(i*=2)<1?e*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Be/t)*-.5:e*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Be/t)*.5+1}}}ze.quadIn=ze.getPowIn(2),ze.quadOut=ze.getPowOut(2),ze.quadInOut=ze.getPowInOut(2),ze.cubicIn=ze.getPowIn(3),ze.cubicOut=ze.getPowOut(3),ze.cubicInOut=ze.getPowInOut(3),ze.quartIn=ze.getPowIn(4),ze.quartOut=ze.getPowOut(4),ze.quartInOut=ze.getPowInOut(4),ze.quintIn=ze.getPowIn(5),ze.quintOut=ze.getPowOut(5),ze.quintInOut=ze.getPowInOut(5),ze.backIn=ze.getBackIn(1.7),ze.backOut=ze.getBackOut(1.7),ze.backInOut=ze.getBackInOut(1.7),ze.elasticIn=ze.getElasticIn(1,.3),ze.elasticOut=ze.getElasticOut(1,.3),ze.elasticInOut=ze.getElasticInOut(1,.3*1.5);class XP{constructor(){this.id=Nt.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(e){this.animateTail?(this.animateTail.nextAnimate=e,e.prevAnimate=this.animateTail,this.animateTail=e,e.nextAnimate=null):(this.animateHead=e,this.animateTail=e),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(e){if(this.paused)return;let t=this.animateHead;for(this.animateCount=0;t;)t.status===Oi.END?this.removeAnimate(t):t.status===Oi.RUNNING||t.status===Oi.INITIAL?(this.animateCount++,t.advance(e)):t.status===Oi.PAUSED&&this.animateCount++,t=t.nextAnimate}clear(){let e=this.animateHead;for(;e;)e.release(),e=e.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(e,t=!0){e._onRemove&&e._onRemove.forEach(i=>i()),e===this.animateHead?(this.animateHead=e.nextAnimate,e===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):e===this.animateTail?(this.animateTail=e.prevAnimate,this.animateTail.nextAnimate=null):(e.prevAnimate.nextAnimate=e.nextAnimate,e.nextAnimate.prevAnimate=e.prevAnimate),t&&e.release()}}const KP=new XP;class nn{constructor(e,t,i,s,r){this.from=e,this.to=t,this.duration=i,this.easing=s,this.params=r,this.updateCount=0}bind(e,t){this.target=e,this.subAnimate=t,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var e;const t=this.getEndProps();return t?this._endProps===t?this._mergedEndProps:(this._endProps=t,void(this._mergedEndProps=Object.assign({},(e=this.step.prev.getLastProps())!==null&&e!==void 0?e:{},t))):this.step.prev?this.step.prev.getLastProps():t}update(e,t,i){if(this.updateCount===0){this.onFirstRun();const s=this.step.getLastProps();Object.keys(s).forEach(r=>{this.subAnimate.animate.validAttr(r)&&(i[r]=s[r])})}this.updateCount+=1,this.onUpdate(e,t,i),e&&this.onEnd()}}class O3 extends nn{constructor(e){super(null,null,0,"linear"),this.cb=e}onUpdate(e,t,i){}onStart(){this.cb()}}let Nf=class Zh{constructor(e=Nt.GenAutoIncrementId(),t=KP){this.id=e,this.timeline=t,this.status=Oi.INITIAL,this.tailAnimate=new yA(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(e){e!==this.timeline&&(this.timeline.removeAnimate(this,!1),e.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce((e,t)=>e+t.totalDuration,0)}after(e){const t=e.getDuration();return this._startTime=t,this}afterAll(e){let t=-1/0;return e.forEach(i=>{t=Ji(i.getDuration(),t)}),this._startTime=t,this}parallel(e){return this._startTime=e.getStartTime(),this}static AddInterpolate(e,t){Zh.interpolateMap.set(e,t)}play(e){if(this.tailAnimate.play(e),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this.subAnimates.length===1&&this.tailAnimate.duration===e.duration&&this.trySetAttribute(e.getFromProps(),e.mode),this}trySetAttribute(e,t=Zh.mode){e&&t&ql.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:kt.ANIMATE_PLAY})}runCb(e){const t=new O3(()=>{e(this,t.step.prev)});return this.tailAnimate.play(t),this}customInterpolate(e,t,i,s,r,a){const o=Zh.interpolateMap.get(e)||Zh.interpolateMap.get("");return!!o&&o(e,t,i,s,r,a)}pause(){this.status===Oi.RUNNING&&(this.status=Oi.PAUSED)}resume(){this.status===Oi.PAUSED&&(this.status=Oi.RUNNING)}to(e,t,i,s){if(this.tailAnimate.to(e,t,i,s),this.target){const r=this.target.stage;r&&r.renderNextFrame()}return this}from(e,t,i,s){if(this.tailAnimate.from(e,t,i,s),this.target){const r=this.target.stage;r&&r.renderNextFrame()}return this}wait(e){if(this.tailAnimate.wait(e),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(e){if(this.tailAnimate.startAt(e),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(e){if(this.tailAnimate.loop=e,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(e){if(this.tailAnimate.reversed=e,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(e){if(this.tailAnimate.bounce=e,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const e=new yA(this,this.tailAnimate);return this.tailAnimate=e,this.subAnimates.push(e),e.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(e){this._preventAttrs&&this._preventAttrs.delete(e)}preventAttr(e){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(e)}preventAttrs(e){e.forEach(t=>this.preventAttr(t))}validAttr(e){return!this._preventAttrs||!this._preventAttrs.has(e)}bind(e){return this.target=e,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach(t=>{t.bind(e)}),this}advance(e){if(this._duringTime<this._startTime){if(this._duringTime+e*this.timeScale<this._startTime)return void(this._duringTime+=e*this.timeScale);e=this._duringTime+e*this.timeScale-this._startTime,this._duringTime=this._startTime}this.status===Oi.INITIAL&&(this.status=Oi.RUNNING,this._onStart&&this._onStart.forEach(t=>t())),this.setPosition(this.rawPosition+e*this.timeScale)&&this.status===Oi.RUNNING&&(this.status=Oi.END,this._onEnd&&this._onEnd.forEach(t=>t()))}setPosition(e){let t,i=0;const s=this.rawPosition,r=this.subAnimates.reduce((o,l)=>o+l.totalDuration,0);e<0&&(e=0);const a=e>=r;if(a&&(e=r),e===s)return a;for(let o=0;o<this.subAnimates.length&&(t=this.subAnimates[o],!(i+t.totalDuration>=e));o++)i+=t.totalDuration,t=void 0;return this.rawPosition=e,t.setPosition(e-i),a}onStart(e){this._onStart||(this._onStart=[]),this._onStart.push(e)}onEnd(e){this._onEnd||(this._onEnd=[]),this._onEnd.push(e)}onRemove(e){this._onRemove||(this._onRemove=[]),this._onRemove.push(e)}onFrame(e){this._onFrame||(this._onFrame=[]),this._onFrame.push(e)}release(){this.status=Oi.END}stop(e){e||this.target.onStop(),e==="start"?this.target.onStop(this.getStartProps()):e==="end"?this.target.onStop(this.getEndProps()):this.target.onStop(e),this.release()}};Nf.mode=ql.NORMAL,Nf.interpolateMap=new Map;class yA{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(e,t){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=e,this.stepHead=new bA(0,0,t?Object.assign({},t.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(e){return this.target=e,this}play(e){let t=e.duration;(t==null||t<0)&&(t=0);const i=e.easing,s=typeof i=="string"?ze[i]:i,r=this._addStep(t,null,s);return r.type=Go.customAnimate,this._appendProps(e.getEndProps(),r,!1),this._appendCustomAnimate(e,r),this}to(e,t,i,s){(t==null||t<0)&&(t=0);const r=typeof i=="string"?ze[i]:i,a=this._addStep(t,null,r);return a.type=Go.to,this._appendProps(e,a,!!s&&s.tempProps),a.propKeys||(a.propKeys=Object.keys(a.props)),s&&s.noPreventAttrs||this.target.animates.forEach(o=>{o.id!==this.animate.id&&o.preventAttrs(a.propKeys)}),this}from(e,t,i,s){this.to(e,0,i,s);const r={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach(a=>{r[a]=this.getLastPropByName(a,this.stepTail)}),this.to(r,t,i,s),this.stepTail.type=Go.from}startAt(e){return e<0&&(e=0),this._startAt=e,this}getStartProps(){var e;return(e=this.stepHead)===null||e===void 0?void 0:e.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(e){if(e>0){const t=this._addStep(+e,null);t.type=Go.wait,t.prev.customAnimate?t.props=t.prev.customAnimate.getEndProps():t.props=t.prev.props,this.target.onAddStep&&this.target.onAddStep(t)}return this}_addStep(e,t,i){const s=new bA(this.duration,e,t,i);return this.duration+=e,this.stepTail.append(s),this.stepTail=s,s}_appendProps(e,t,i){t.props=i?e:Object.assign({},e);let s=t.prev;const r=t.props;for(t.propKeys||(t.propKeys=Object.keys(t.props)),t.propKeys.forEach(o=>{t.props[o]===void 0&&(t.props[o]=this.target.getDefaultAttribute(o))});s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach(o=>{r[o]===void 0&&(r[o]=s.props[o])})),t.propKeys=Object.keys(t.props),s=s.prev;const a=this.stepHead.props;t.propKeys||(t.propKeys=Object.keys(r)),t.propKeys.forEach(o=>{if(a[o]===void 0){const l=this.animate.getStartProps();a[o]=l[o]=this.target.getComputedAttribute(o)}}),this.target.onAddStep&&this.target.onAddStep(t)}_appendCustomAnimate(e,t){t.customAnimate=e,e.step=t,e.bind(this.target,this)}setPosition(e){var t;const i=this.duration,s=this.loop,r=this.rawPosition;let a,o,l=!1;const h=(t=this._startAt)!==null&&t!==void 0?t:0;if(e<0&&(e=0),e<h)return this.rawPosition=e,!1;if(e-=h,i<=0)return l=!0,l;if(a=Math.floor(e/i),o=e-a*i,l=e>=s*i+i,l&&(o=i,a=s,e=o*a+i),e===r)return l;const d=!this.reversed!=!(this.bounce&&a%2);return d&&(o=i-o),this._deltaPosition=o-this.position,this.position=o,this.rawPosition=e+h,this.updatePosition(l,d),l}updatePosition(e,t){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,r=this.duration;if(this.target&&i){let a=i.next;for(;a&&a.position<=s;)i=a,a=i.next;let o=e?r===0?1:s/r:(s-i.position)/i.duration;i.easing&&(o=i.easing(o)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(t?this.stepTail:this.stepHead),t),this.updateTarget(i,o,e),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach(l=>l(i,o))}}tryCallCustomAnimateLifeCycle(e,t,i){if(e!==t)if(i){let s=t.prev;for(;s&&s!==e;)s.customAnimate&&(s.customAnimate.onStart&&s.customAnimate.onStart(),s.customAnimate.onEnd&&s.customAnimate.onEnd()),s=e.prev;t&&t.customAnimate&&t.customAnimate.onEnd&&t.customAnimate.onEnd(),e&&e.customAnimate&&e.customAnimate.onStart&&e.customAnimate.onStart()}else{let s=t.next;for(;s&&s!==e;)s.customAnimate&&(s.customAnimate.onStart&&s.customAnimate.onStart(),s.customAnimate.onEnd&&s.customAnimate.onEnd()),s=s.next;t&&t.customAnimate&&t.customAnimate.onEnd&&t.customAnimate.onEnd(),e&&e.customAnimate&&e.customAnimate.onStart&&e.customAnimate.onStart()}}getLastPropByName(e,t){let i=t.prev;for(;i;){if(i.props&&i.props[e]!==void 0)return i.props[e];if(i.customAnimate){const s=i.customAnimate.getEndProps()[e];if(s!==void 0)return s}i=i.prev}return De.getInstance().warn("未知错误,step中找不到属性"),t.props[e]}updateTarget(e,t,i){e.props==null&&e.customAnimate==null||this.target.onStep(this,this.animate,e,t,i)}}class bA{constructor(e,t,i,s){this.duration=t,this.position=e,this.props=i,this.easing=s}append(e){e.prev=this,e.next=this.next,this.next=e}getLastProps(){let e=this.prev;for(;e;){if(e.props)return e.props;if(e.customAnimate)return e.customAnimate.getMergedEndProps();e=e.prev}return null}}const vA={duration:200,easing:"cubicOut"},Vo={duration:1e3,easing:"quadInOut"};var xA;(function(n){n[n.Top=1]="Top",n[n.Right=2]="Right",n[n.Bottom=4]="Bottom",n[n.Left=8]="Left",n[n.ALL=15]="ALL"})(xA||(xA={}));const Ys=[!1,!1,!1,!1],B3=n=>{var e;let t=!0;if(ht(n,!0)){for(let i=0;i<4;i++)Ys[i]=n,t&&(t=!((e=Ys[i])!==null&&e!==void 0&&!e));t=n}else if(Array.isArray(n))for(let i=0;i<4;i++)Ys[i]=!!n[i],t&&(t=!!Ys[i]);else Ys[0]=!1,Ys[1]=!1,Ys[2]=!1,Ys[3]=!1;return{isFullStroke:t,stroke:Ys}},Rh=[0,0,0,0],mi=n=>n?W(n)?n.length===0?0:n.length===1?n[0]:n.length===2?(Rh[0]=n[0],Rh[2]=n[0],Rh[1]=n[1],Rh[3]=n[1],Rh):n:n:0,ko=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Pc=[1,2,3,0,1,2,3,0];function Um(n,e,t,i){for(;n>=Be;)n-=Be;for(;n<0;)n+=Be;for(;n>e;)e+=Be;ko[0].x=t,ko[1].y=t,ko[2].x=-t,ko[3].y=-t;const s=Math.ceil(n/zn)%4,r=Math.ceil(e/zn)%4;if(i.add(nt(n)*t,Ze(n)*t),i.add(nt(e)*t,Ze(e)*t),s!==r||e-n>et){let a=!1;for(let o=0;o<Pc.length;o++)if(a||s!==Pc[o]){if(a&&r===Pc[o])break;if(a){const l=ko[Pc[o]];i.add(l.x,l.y)}}else{a=!0;const l=ko[s];i.add(l.x,l.y)}}}function _b(n,e,t){const{x:i,y:s}=AS(n.x,n.y,e.x,e.y,t),{x:r,y:a}=AS(n.x1,n.y1,e.x1,e.y1,t),o=new Et(i,s,r,a);return o.defined=e.defined,o}function Px(n,e,t){if(!n||!e)return[];Array.isArray(n)||(n=[n]),Array.isArray(e)||(e=[e]);let i=[];if(n.length>e.length){i=e.map(s=>{const r=new Et(s.x,s.y,s.x1,s.y1);return r.defined=s.defined,r});for(let s=0;s<e.length;s++)i[s]=_b(n[s],e[s],t)}else{i=e.map(s=>{const r=new Et(s.x,s.y,s.x1,s.y1);return r.defined=s.defined,r});for(let s=0;s<n.length;s++)i[s]=_b(n[s],e[s],t)}return i}const L3=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],I3=n=>L3.includes(n);function Ec(n,e){if(W(n)){let t;for(let i=0;i<n.length&&t===void 0;i++)t=n[i][e];return t}return n[e]}class g_{constructor(){this.durations=[],this.timeout=g_.TimeOut,this.lastDate=0,this.durationsListThreshold=30}call(e){return this.lastDate=Date.now(),setTimeout(()=>{this.appendDuration(Date.now()-this.lastDate),e(0)},this.timeout,!0)}clear(e){clearTimeout(e)}appendDuration(e){this.durations.push(e),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce((t,i)=>t+i,0)/this.durations.length,1e3/60),1e3/30)}}g_.TimeOut=1e3/60;const SA=new g_,Bs=(n,e)=>ae(n)&&n[n.length-1]==="%"?e*(Number.parseFloat(n.substring(0,n.length-1))/100):n;class D3 extends nn{constructor(e,t,i,s,r){super(e,t,i,s,r)}getEndProps(){return this.valid===!1?{}:{text:this.to}}onBind(){var e,t,i,s,r,a,o,l;this.fromNumber=oe((e=this.from)===null||e===void 0?void 0:e.text)?(t=this.from)===null||t===void 0?void 0:t.text:Number.parseFloat((i=this.from)===null||i===void 0?void 0:i.text),this.toNumber=oe((s=this.to)===null||s===void 0?void 0:s.text)?(r=this.to)===null||r===void 0?void 0:r.text:Number.parseFloat((a=this.to)===null||a===void 0?void 0:a.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),this.valid!==!1&&(this.decimalLength=(l=(o=this.params)===null||o===void 0?void 0:o.fixed)!==null&&l!==void 0?l:Math.max(Ul(this.fromNumber),Ul(this.toNumber)))}onEnd(){}onUpdate(e,t,i){this.valid!==!1&&(i.text=e?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*t).toFixed(this.decimalLength))}}var AA;(function(n){n[n.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",n[n.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",n[n.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",n[n.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",n[n.STROKE=4]="STROKE"})(AA||(AA={}));class qP extends nn{constructor(e,t,i,s,r){super(e,t,i,s,r),this.newPointAnimateType=(r==null?void 0:r.newPointAnimateType)==="appear"?"appear":"grow"}onBind(){var e,t;const i=(e=this.from)===null||e===void 0?void 0:e.points,s=(t=this.to)===null||t===void 0?void 0:t.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=s?Array.isArray(s)?s:[s]:[];const r=new Map;this.fromPoints.forEach(u=>{u.context&&r.set(u.context,u)});let a,o,l=1/0,h=-1/0;for(let u=0;u<this.toPoints.length;u+=1)if(r.has(this.toPoints[u].context)){l=u,a=r.get(this.toPoints[u].context);break}for(let u=this.toPoints.length-1;u>=0;u-=1)if(r.has(this.toPoints[u].context)){h=u,o=r.get(this.toPoints[u].context);break}let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map((u,c)=>{const f=r.get(u.context);return f?(d=f,[f,u]):this.newPointAnimateType==="appear"?[u,u]:c<l&&a?[a,u]:c>h&&o?[o,u]:[d,u]}),this.points=this.interpolatePoints.map(u=>{const c=u[0],f=u[1],p=new Et(c.x,c.y,c.x1,c.y1);return p.defined=f.defined,p.context=f.context,p})}onUpdate(e,t,i){this.points=this.points.map((s,r)=>{const a=_b(this.interpolatePoints[r][0],this.interpolatePoints[r][1],t);return a.context=s.context,a}),i.points=this.points}}class ZP extends nn{constructor(e,t,i,s,r){super(null,null,i,s,r),this.clipFromAttribute=e,this.clipToAttribute=t,this._group=r==null?void 0:r.group,this._clipGraphic=r==null?void 0:r.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:kt.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:kt.ANIMATE_END})}onUpdate(e,t,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach(r=>{s[r]=this.clipFromAttribute[r]+(this.clipToAttribute[r]-this.clipFromAttribute[r])*t}),this._clipGraphic.setAttributes(s,!1,{type:kt.ANIMATE_UPDATE,animationState:{ratio:t,end:e}})}}class F3 extends ZP{constructor(e,t,i,s,r){var a,o,l,h,d,u,c,f,p,g,_,m;const y=(o=(a=r==null?void 0:r.group)===null||a===void 0?void 0:a.attribute)!==null&&o!==void 0?o:{},b=(l=y.width)!==null&&l!==void 0?l:0,v=(h=y.height)!==null&&h!==void 0?h:0,x=(d=r==null?void 0:r.animationType)!==null&&d!==void 0?d:"in",S=(u=r==null?void 0:r.startAngle)!==null&&u!==void 0?u:0,A=(c=r==null?void 0:r.orient)!==null&&c!==void 0?c:"clockwise";let k=0,w=0;A==="anticlockwise"?(w=x==="in"?S+2*Math.PI:S,w=S+2*Math.PI):(k=S,w=x==="out"?S+2*Math.PI:S);const M=Q.graphicService.creator.arc({x:(p=(f=r==null?void 0:r.center)===null||f===void 0?void 0:f.x)!==null&&p!==void 0?p:b/2,y:(_=(g=r==null?void 0:r.center)===null||g===void 0?void 0:g.y)!==null&&_!==void 0?_:v/2,outerRadius:(m=r==null?void 0:r.radius)!==null&&m!==void 0?m:(b+v)/2,innerRadius:0,startAngle:k,endAngle:w,fill:!0});let T,E;A==="anticlockwise"?(T={startAngle:S+2*Math.PI},E={startAngle:S}):(T={endAngle:S},E={endAngle:S+2*Math.PI}),super(x==="in"?T:E,x==="in"?E:T,i,s,{group:r==null?void 0:r.group,clipGraphic:M})}}class kA extends ZP{constructor(e,t,i,s,r){var a,o,l,h,d,u,c,f,p;const g=(o=(a=r==null?void 0:r.group)===null||a===void 0?void 0:a.attribute)!==null&&o!==void 0?o:{},_=(h=(l=r==null?void 0:r.width)!==null&&l!==void 0?l:g.width)!==null&&h!==void 0?h:0,m=(u=(d=r==null?void 0:r.height)!==null&&d!==void 0?d:g.height)!==null&&u!==void 0?u:0,y=(c=r==null?void 0:r.animationType)!==null&&c!==void 0?c:"in",b=(f=r==null?void 0:r.direction)!==null&&f!==void 0?f:"x",v=(p=r==null?void 0:r.orient)!==null&&p!==void 0?p:"positive",x=Q.graphicService.creator.rect({x:0,y:0,width:y==="in"&&b==="x"?0:_,height:y==="in"&&b==="y"?0:m,fill:!0});let S={},A={};b==="y"?v==="negative"?(S={y:m,height:0},A={y:0,height:m}):(S={height:0},A={height:m}):v==="negative"?(S={x:_,width:0},A={x:0,width:_}):(S={width:0},A={width:_}),super(y==="in"?S:A,y==="in"?A:S,i,s,{group:r==null?void 0:r.group,clipGraphic:x})}}class z3 extends nn{onStart(){const{center:e,r:t}=typeof this.params=="function"?this.params():this.params,i=this.target.getComputedAttribute("x"),s=this.target.getComputedAttribute("y"),r=this.target.getComputedAttribute("z"),a=Math.acos((s-e.y)/t);let o=Math.acos((i-e.x)/t/Math.sin(a));r-e.z<0&&(o=Be-o),this.theta=o,this.phi=a}onBind(){}onEnd(){}onUpdate(e,t,i){if(this.phi==null||this.theta==null)return;const{center:s,r,cb:a}=typeof this.params=="function"?this.params():this.params,o=2*Math.PI*t,l=this.theta+o,h=this.phi,d=r*Math.sin(h)*Math.cos(l)+s.x,u=r*Math.cos(h)+s.y,c=r*Math.sin(h)*Math.sin(l)+s.z;for(i.x=d,i.y=u,i.z=c,i.alpha=l+et/2;i.alpha>Be;)i.alpha-=Be;i.alpha=Be-i.alpha,i.zIndex=-1e4*i.z,a&&a(i)}}class j3 extends nn{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(e,t,i){this.target.setTheme({common:{opacity:1-t}})}}class H3 extends nn{constructor(e,t){super(null,null,e,"linear"),this.customAnimates=t}initAnimates(){this.customAnimates.forEach(e=>{e.step=this.step,e.subAnimate=this.subAnimate,e.target=this.target})}getEndProps(){const e={};return this.customAnimates.forEach(t=>{Object.assign(e,t.getEndProps())}),e}onBind(){this.initAnimates(),this.customAnimates.forEach(e=>{e.onBind()})}onEnd(){this.customAnimates.forEach(e=>{e.onEnd()})}onStart(){this.customAnimates.forEach(e=>{e.onStart()})}onUpdate(e,t,i){this.updating||(this.updating=!0,this.customAnimates.forEach(s=>{const r=s.easing;t=(typeof r=="string"?ze[r]:r)(t),s.onUpdate(e,t,i)}),this.updating=!1)}}function wA(n,e,t,i,s,r){const a=(e-n)*s+n,o=(t-e)*s+e,l=(i-t)*s+t,h=(o-a)*s+a,d=(l-o)*s+o,u=(d-h)*s+h;r[0]=n,r[1]=a,r[2]=h,r[3]=u,r[4]=u,r[5]=d,r[6]=l,r[7]=i}function G3(n,e){const t=n.length,i=e.length;if(t===i)return[n,e];const s=[],r=[],a=t<i?n:e,o=Math.min(t,i),l=Math.abs(i-t)/6,h=(o-2)/6,d=Math.ceil(l/h),u=[a[0],a[1]];let c=l;for(let f=2;f<o;f+=6){let p=a[f-2],g=a[f-1],_=a[f],m=a[f+1],y=a[f+2],b=a[f+3];const v=a[f+4],x=a[f+5];if(c<=0){u.push(_,m,y,b,v,x);continue}const S=Math.min(c,d)+1;for(let A=1;A<=S;A++){const k=A/S;wA(p,_,y,v,k,s),wA(g,m,b,x,k,r),p=s[3],g=r[3],u.push(s[1],r[1],s[2],r[2],p,g),_=s[5],m=r[5],y=s[6],b=r[6]}c-=S-1}return a===n?[u,e]:[n,u]}function MA(n,e){const t=n||e,i=t.length,s=t[i-2],r=t[i-1],a=[];for(let o=0;o<e.length;o+=2)a[o]=s,a[o+1]=r;return a}function W3(n){const e=[],t=n.length;for(let i=0;i<t;i+=2)e[i]=n[t-i-2],e[i+1]=n[t-i-1];return e}function TA(n){let e=0,t=0,i=0;const s=n.length;for(let r=0,a=s-2;r<s;a=r,r+=2){const o=n[a],l=n[a+1],h=n[r],d=n[r+1],u=o*d-h*l;e+=u,t+=(o+h)*u,i+=(l+d)*u}return e===0?[n[0]||0,n[1]||0,0]:[t/e/3,i/e/3,e]}function V3(n,e,t,i){const s=(n.length-2)/6;let r=1/0,a=0;const o=n.length,l=o-2;for(let h=0;h<s;h++){const d=6*h;let u=0;for(let c=0;c<o;c+=2){const f=c===0?d:(d+c-2)%l+2,p=n[f]-t[0],g=n[f+1]-t[1],_=e[c]-i[0]-p,m=e[c+1]-i[1]-g;u+=_*_+m*m}u<r&&(r=u,a=h)}return a}function N3(n,e,t,i){const s=[];let r;for(let a=0;a<n.length;a++){let o=n[a];const l=e[a],h=TA(o),d=TA(l);r==null&&(r=h[2]<0!=d[2]<0);const u=[],c=[];let f=0,p=1/0;const g=[],_=o.length;r&&(o=W3(o));const m=6*V3(o,l,h,d),y=_-2;for(let b=0;b<y;b+=2){const v=(m+b)%y+2;u[b+2]=o[v]-h[0],u[b+3]=o[v+1]-h[1]}if(u[0]=o[m]-h[0],u[1]=o[m+1]-h[1],t>0){const b=i/t;for(let v=-i/2;v<=i/2;v+=b){const x=Math.sin(v),S=Math.cos(v);let A=0;for(let k=0;k<o.length;k+=2){const w=u[k],M=u[k+1],T=l[k]-d[0],E=l[k+1]-d[1],O=T*S-E*x,B=T*x+E*S;g[k]=O,g[k+1]=B;const R=O-w,L=B-M;A+=R*R+L*L}if(A<p){p=A,f=v;for(let k=0;k<g.length;k++)c[k]=g[k]}}}s.push({from:u,to:c,fromCp:h,toCp:d,rotation:-f})}return s}function U3(n,e){let t,i;const s=[],r=[];for(let a=0;a<Math.max(n.length,e.length);a++){const o=n[a],l=e[a];let h,d;o?l?([h,d]=G3(o,l),t=h,i=d):(d=MA(i,o),h=o):(h=MA(t,l),d=l),s.push(h),r.push(d)}return[s,r]}const Xs=(n,e,t,i,s)=>{Qi(e,i)&&Qi(t,s)||n.push(e,t,i,s,i,s)};function mb(n){const e=n.commandList,t=[];let i,s=0,r=0,a=0,o=0;const l=(f,p)=>{i&&i.length>2&&t.push(i),i=[f,p]};let h,d,u,c;for(let f=0,p=e.length;f<p;f++){const g=e[f],_=f===0;switch(_&&(a=s=g[1],o=r=g[2],[Oe.L,Oe.C,Oe.Q].includes(g[0])&&(i=[a,o])),g[0]){case Oe.M:s=a=g[1],r=o=g[2],l(a,o);break;case Oe.L:h=g[1],d=g[2],Xs(i,s,r,h,d),s=h,r=d;break;case Oe.C:i.push(g[1],g[2],g[3],g[4],s=g[5],r=g[6]);break;case Oe.Q:h=g[1],d=g[2],u=g[3],c=g[4],i.push(s+2/3*(h-s),r+2/3*(d-r),u+2/3*(h-u),c+2/3*(d-c),u,c),s=u,r=c;break;case Oe.A:{const m=g[1],y=g[2],b=g[3],v=b,x=g[4],S=g[5],A=!!g[6];h=Math.cos(x)*b+m,d=Math.sin(x)*b+y,_?(a=h,o=d,l(a,o)):Xs(i,s,r,h,d),s=Math.cos(S)*b+m,r=Math.sin(S)*b+y;const k=(A?-1:1)*Math.PI/2;for(let w=x;A?w>S:w<S;w+=k){const M=A?Math.max(w+k,S):Math.min(w+k,S);hf(i,w,M,m,y,b,v)}break}case Oe.E:{const m=g[1],y=g[2],b=g[3],v=g[4],x=g[5],S=g[6],A=g[7]+S,k=!!g[8],w=!Qi(x,0),M=Math.cos(x),T=Math.sin(x);let E=Math.cos(S)*b,O=Math.sin(S)*v;w?(h=E*M-O*T+m,d=E*T+O*M+y):(h=E+m,d=O+y),_?(a=h,o=d,l(a,o)):Xs(i,s,r,h,d),E=Math.cos(A)*b,O=Math.sin(A)*v,w?(s=E*M-O*T+m,r=E*T+O*M+y):(s=E+m,r=O+y);const B=(k?-1:1)*Math.PI/2;for(let R=S;k?R>A:R<A;R+=B){const L=k?Math.max(R+B,A):Math.min(R+B,A);if(hf(i,R,L,m,y,b,v),w){const I=i.length;for(let F=I-6;F<=I-1;F+=2)E=i[F],O=i[F+1],i[F]=(E-m)*M-(O-y)*T+m,i[F+1]=(E-m)*T+(O-y)*M+y}}break}case Oe.R:a=s=g[1],o=r=g[2],h=a+g[3],d=o+g[4],l(h,o),Xs(i,h,o,h,d),Xs(i,h,d,a,d),Xs(i,a,d,a,o),Xs(i,a,o,h,o);break;case Oe.AT:{const m=g[1],y=g[2],b=g[3],v=g[4],x=g[5],S=wt.distancePP({x:s,y:r},{x:m,y}),A=wt.distancePP({x:b,y:v},{x:m,y}),k=((s-m)*(b-m)+(r-y)*(v-y))/(S*A),w=x/Math.sin(k/2),M=(s+b-2*m)/2,T=(r+v-2*y)/2,E=wt.distancePP({x:M,y:T},{x:0,y:0}),O=m+w*M/E,B=b+w*T/E,R=Math.sqrt(w*w-x*x);a=m+R*(s-m)/S,o=y+R*(r-y)/S,Xs(i,s,r,a,o),s=m+R*(b-m)/A,r=y+R*(v-y)/A;const L=Af({x:O,y:B},{x:a,y:o}),I=Af({x:O,y:B},{x:s,y:r});hf(i,L,I,O,B,x,x);break}case Oe.Z:i&&Xs(i,s,r,a,o),s=a,r=o}}return i&&i.length>2&&t.push(i),t}function CA(n,e){for(let t=0;t<n.length;t++){const i=n[t];for(let s=0;s<i.length;s+=2){const r=i[s],a=i[s+1],o={x:r,y:a};e.transformPoint({x:r,y:a},o),i[s]=o.x,i[s+1]=o.y}}}function $3(n){const e=new Xt;for(let t=0;t<n.length;t++){const i=n[t];if(i.length>2){e.moveTo(i[0],i[1]);for(let s=2;s<i.length;s+=6)e.bezierCurveTo(i[s],i[s+1],i[s+2],i[s+3],i[s+4],i[s+5])}}return e}const JP=n=>{if(!n)return{x:0,y:0,width:0,height:0};let e=C(n.width)?n.x1-n.x:n.width,t=C(n.height)?n.y1-n.y:n.height,i=0,s=0;return e<0?(i=e,e=-e):Number.isNaN(e)&&(e=0),t<0?(s=t,t=-t):Number.isNaN(t)&&(t=0),{x:i,y:s,width:e,height:t}};function Ex(n,e,t){const i=n/e;let s,r;n>=e?(r=Math.ceil(Math.sqrt(t*i)),s=Math.floor(t/r),s===0&&(s=1,r=t)):(s=Math.ceil(Math.sqrt(t/i)),r=Math.floor(t/s),r===0&&(r=1,s=t));const a=[];for(let l=0;l<s;l++)a.push(r);const o=t-s*r;if(o>0)for(let l=0;l<o;l+=r)l+r<o?a.push(r):a.push(o-l);return a}const Y3=(n,e)=>{const{width:t,height:i}=JP(n.attribute),s=Ex(t,i,e),r=[],a=i/s.length;for(let o=0,l=s.length;o<l;o++){const h=s[o],d=t/h;for(let u=0;u<h;u++)r.push({x:0+u*d,y:0+o*a,width:d,height:a})}return r},X3=(n,e)=>{const t=n.getParsedAngle(),i=t.startAngle,s=t.endAngle,r=n.getComputedAttribute("innerRadius"),a=n.getComputedAttribute("outerRadius"),o=Math.abs(i-s),l=Math.abs(a-r),h=Ex(o*(r+a)/2,l,e),d=[],u=l/h.length,c=a>=r?1:-1,f=s>=i?1:-1;for(let p=0,g=h.length;p<g;p++){const _=h[p],m=o/_;for(let y=0;y<_;y++)d.push({innerRadius:a-u*p*c,outerRadius:a-u*(p+1)*c,startAngle:i+m*y*f,endAngle:i+m*(y+1)*f})}return d},K3=(n,e)=>{const t=n.getComputedAttribute("startAngle"),i=n.getComputedAttribute("endAngle"),s=n.getComputedAttribute("radius"),r=Math.abs(t-i),a=Ex(r*s,s,e),o=[],l=r/a[0],h=s/a.length,d=i>=t?1:-1;for(let u=0,c=a.length;u<c;u++)for(let f=0,p=a[u];f<p;f++)o.push({innerRadius:h*u,outerRadius:h*(u+1),startAngle:t+l*f*d,endAngle:t+l*(f+1)*d});return o},PA=(n,e)=>{const t=n.filter(o=>o.defined!==!1&&oe(o.x)&&oe(o.y));if(t.length===0)return[];if(t.length===1)return new Array(e).fill(0).map(o=>t[0]);const i=[];if(e<=t.length){const o=t.length/e;let l=0,h=0;for(;l<e;)i.push(t[Math.floor(h)]),h+=o,l++;return i}const s=e-t.length,r=1/(s/(t.length-1)+1);let a=0;for(let o=0,l=n.length;o<l;o++)if(i.push(n[o]),o<l-1){let h=r;const d=n[o].x,u=n[o].y,c=n[o+1].x,f=n[o+1].y;for(;h<1&&a<s;)i.push({x:d+(c-d)*h,y:u+(f-u)*h}),h+=r,a+=1}return i},q3=(n,e)=>{var t,i;const s=n.attribute;let r=s.points;const a=s.segments;r||(r=a.reduce((d,u)=>{var c;return d.concat((c=u.points)!==null&&c!==void 0?c:[])},[]));const o=r.filter(d=>d.defined!==!1&&oe(d.x)&&oe(d.y));if(!o.length)return[];const l=[];o.forEach(d=>{l.push({x:d.x,y:d.y})});for(let d=o.length-1;d>=0;d--){const u=o[d];l.push({x:(t=u.x1)!==null&&t!==void 0?t:u.x,y:(i=u.y1)!==null&&i!==void 0?i:u.y})}const h=[];return Vd(r,e,h),h},Z3=(n,e)=>{const t=n.attribute,i=t.points;if(i)return PA(i,e);if(t.segments){const s=t.segments.reduce((r,a)=>{var o;return r.concat((o=a.points)!==null&&o!==void 0?o:[])},[]);return PA(s,e)}return[]};function J3(n,e){return n[0]*e[1]-n[1]*e[0]}const yb=n=>n.map(e=>({x:e.x,y:e.y})),EA=(n,e,t)=>{const i=n.length,s=[];for(let u=0;u<i;u++){const c=n[u],f=u===i-1?n[0]:n[u+1],p=MC([e.x,e.y],[t.x,t.y],[c.x,c.y],[f.x,f.y]);p&&typeof p!="boolean"&&s.push({dot:J3([p[0]-e.x,p[1]-e.x],[t.x-e.x,t.y-e.x]),point:{x:p[0],y:p[1]},edgeIndex:u})}if(s.length<2)return[yb(n),yb(n)];s.sort((u,c)=>u.dot-c.dot);let r=s[0],a=s[s.length-1];r.edgeIndex>a.edgeIndex&&([r,a]=[a,r]);const o=r.point,l=a.point,h=[{x:o.x,y:o.y}];for(let u=r.edgeIndex+1;u<=a.edgeIndex;u++)h.push({x:n[u].x,y:n[u].y});h.push({x:l.x,y:l.y});const d=[{x:l.x,y:l.y}];for(let u=a.edgeIndex+1,c=r.edgeIndex+i;u<=c;u++){const f=n[u%i];d.push({x:f.x,y:f.y})}return d.push({x:o.x,y:o.y}),[h,d]},Q3=n=>{const e=new _i;n.forEach(r=>{e.add(r.x,r.y)});const t=e.width(),i=e.height();if(t>=i){const r=e.x1+t/2;return EA(n,{x:r,y:e.y1},{x:r,y:e.y2})}const s=e.y1+i/2;return EA(n,{x:e.x1,y:s},{x:e.x2,y:s})},Vd=(n,e,t)=>{if(e===1)t.push({points:n});else{const i=Math.floor(e/2),s=Q3(n);Vd(s[0],i,t),Vd(s[1],e-i,t)}},ez=(n,e)=>{const t=n.attribute.points;if(!t||!t.length)return[];if(e===1)return[{points:yb(t)}];const i=[];return Vd(t,e,i),i},tz=(n,e)=>{const t=n.getParsedPathShape(),i=mb(t);if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const l=[],h=Math.floor(i.length/e);for(let d=0;d<e;d++){const u=i.slice(d*h,d===e-1?s:(d+1)*h);l.push({path:$3(u)})}return l}const r=[],a=Math.floor(e/s);let o=e;for(let l=0;l<s;l++){const h=[];for(let d=2,u=i[l].length;d<u;d+=2)h.push({x:i[0][d],y:i[0][d+1]});Vd(h,l===s-1?o:a,r),o-=a}return r};var Vi;(function(n){n[n.Color255=0]="Color255",n[n.Color1=1]="Color1"})(Vi||(Vi={}));class vt{static Get(e,t=Vi.Color1,i=[0,0,0,1]){if(t===Vi.Color1){const a=vt.store1[e];if(a)return i[0]=a[0],i[1]=a[1],i[2]=a[2],i[3]=a[3],i;const o=Gt.parseColorString(e);if(o){const l=[o.r/255,o.g/255,o.b/255,o.opacity];vt.store1[e]=l,vt.store255[e]=[o.r,o.g,o.b,o.opacity],i[0]=l[0],i[1]=l[1],i[2]=l[2],i[3]=l[3]}return i}const s=vt.store255[e];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const r=Gt.parseColorString(e);return r&&(vt.store1[e]=[r.r/255,r.g/255,r.b/255,r.opacity],vt.store255[e]=[r.r,r.g,r.b,r.opacity],i[0]=r.r,i[1]=r.g,i[2]=r.b,i[3]=r.opacity),i}static Set(e,t,i){if(t===Vi.Color1){if(vt.store1[e])return;vt.store1[e]=i,vt.store255[e]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(vt.store255[e])return;vt.store255[e]=i,vt.store1[e]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}vt.store255={},vt.store1={};function Rc(n,e=!1){return Array.isArray(n)?e?`rgb(${Math.round(n[0])},${Math.round(n[1])},${Math.round(n[2])},${n[3].toFixed(2)})`:`rgb(${Math.round(n[0])},${Math.round(n[1])},${Math.round(n[2])})`:n}function Ya(n,e,t,i,s){if(!n||!e)return n&&Rc(n)||e&&Rc(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(n)?r=n:typeof n=="string"?r=vt.Get(n,Vi.Color255):o=!0,Array.isArray(e)?a=e:typeof e=="string"?a=vt.Get(e,Vi.Color255):l=!0,o!==l){const h=o?n:e,d=o?e:n,u=Object.assign(Object.assign({},h),{stops:h.stops.map(c=>Object.assign(Object.assign({},c),{color:Rc(d)}))});return o?Ya(h,u,t,i,s):Ya(u,h,t,i,s)}if(o){if(n.gradient===e.gradient){const h=n,d=e,u=h.stops,c=d.stops;if(u.length!==c.length)return!1;if(h.gradient==="linear")return iz(h,d,t);if(h.gradient==="radial")return nz(h,d,t);if(h.gradient==="conical")return sz(h,d,t)}return!1}return s&&s(r,a),Rc(rz(r,a,t),i)}function iz(n,e,t){const i=n.stops,s=e.stops;return{gradient:"linear",x0:n.x0+(e.x0-n.x0)*t,x1:n.x1+(e.x1-n.x1)*t,y0:n.y0+(e.y0-n.y0)*t,y1:n.y1+(e.y1-n.y1)*t,stops:new Array(i.length).fill(0).map((r,a)=>({color:Rx(i[a].color,s[a].color,t),offset:i[a].offset+(s[a].offset-i[a].offset)*t}))}}function nz(n,e,t){const i=n.stops,s=e.stops;return{gradient:"radial",x0:n.x0+(e.x0-n.x0)*t,x1:n.x1+(e.x1-n.x1)*t,y0:n.y0+(e.y0-n.y0)*t,y1:n.y1+(e.y1-n.y1)*t,r0:n.r0+(e.r0-n.r0)*t,r1:n.r1+(e.r1-n.r1)*t,stops:new Array(i.length).fill(0).map((r,a)=>({color:Rx(i[a].color,s[a].color,t),offset:i[a].offset+(s[a].offset-i[a].offset)*t}))}}function sz(n,e,t){const i=n.stops,s=e.stops;return{gradient:"conical",startAngle:n.startAngle+(e.startAngle-n.startAngle)*t,endAngle:n.endAngle+(e.endAngle-n.endAngle)*t,x:n.x+(e.x-n.x)*t,y:n.y+(e.y-n.y)*t,stops:new Array(i.length).fill(0).map((r,a)=>({color:Rx(i[a].color,s[a].color,t),offset:i[a].offset+(s[a].offset-i[a].offset)*t}))}}function rz(n,e,t){return[n[0]+(e[0]-n[0])*t,n[1]+(e[1]-n[1])*t,n[2]+(e[2]-n[2])*t,n[3]+(e[3]-n[3])*t]}const Ks=[0,0,0,0],Oh=[0,0,0,0];function Rx(n,e,t){return vt.Get(n,Vi.Color255,Ks),vt.Get(e,Vi.Color255,Oh),`rgba(${Math.round(Ks[0]+(Oh[0]-Ks[0])*t)},${Math.round(Ks[1]+(Oh[1]-Ks[1])*t)},${Math.round(Ks[2]+(Oh[2]-Ks[2])*t)},${Ks[3]+(Oh[3]-Ks[3])*t})`}const QP=(n,e,t)=>{n.forEach(i=>{if(Number.isFinite(i.to))e[i.key]=i.from+(i.to-i.from)*t;else if(i.key==="fill"||i.key==="stroke"){const s=Ya(i.from,i.to,t,!1);s&&(e[i.key]=s)}})},eE=(n,e,t)=>{const i=[],s=[];e.clear();for(let r=0;r<n.length;r++){const a=n[r],o=a.from,l=a.to,h=a.rotation*t,d=a.fromCp,u=a.toCp,c=Math.sin(h),f=Math.cos(h);s[0]=d[0]+(u[0]-d[0])*t,s[1]=d[1]+(u[1]-d[1])*t;for(let _=0;_<o.length;_+=2){const m=o[_],y=o[_+1],b=m*(1-t)+l[_]*t,v=y*(1-t)+l[_+1]*t;i[_]=b*f-v*c+s[0],i[_+1]=b*c+v*f+s[1]}let p=i[0],g=i[1];e.moveTo(p,g);for(let _=2;_<o.length;_+=6){const m=i[_],y=i[_+1],b=i[_+2],v=i[_+3],x=i[_+4],S=i[_+5];p===m&&g===y&&b===x&&v===S?e.lineTo(x,S):e.bezierCurveTo(m,y,b,v,x,S),p=x,g=S}}},tE=(n,e,t)=>{const i=n?mb(n):[],s=mb(e);t&&i&&(t.fromTransform&&CA(i,t.fromTransform.clone().getInverse()),CA(i,t.toTransfrom));const[r,a]=U3(i,s);return n?N3(r,a,10,Math.PI):a.map((o,l)=>({from:r[l],to:o,fromCp:[0,0],toCp:[0,0],rotation:0}))},az=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],iE=(n,e)=>{if(!n||!e)return null;const t=[];let i=!1;return Object.keys(n).forEach(s=>{if(!az.includes(s))return;const r=e[s];C(r)||C(n[s])||r===n[s]||(s==="fill"||s==="stroke"?t.push({from:typeof n[s]=="string"?vt.Get(n[s],Vi.Color255):n[s],to:typeof r=="string"?vt.Get(r,Vi.Color255):r,key:s}):t.push({from:n[s],to:r,key:s}),i=!0)}),i?t:null};class nE extends nn{constructor(e,t,i){super(0,1,t,i),this.morphingData=e.morphingData,this.otherAttrs=e.otherAttrs,this.saveOnEnd=e.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(e,t,i){const s=this.target,r=typeof s.pathProxy=="function"?s.pathProxy(s.attribute):s.pathProxy;eE(this.morphingData,r,t),this.otherAttrs&&this.otherAttrs.length&&QP(this.otherAttrs,i,t),e&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const sE=(n,e,t,i)=>{var s,r,a;if(n&&(!n.valid||!n.toCustomPath))return __DEV__&&console.error(n," is not validate"),null;if(!e.valid||!e.toCustomPath)return __DEV__&&console.error(e," is not validate"),null;let o=n==null?void 0:n.globalTransMatrix;i&&o&&(o=i.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=tE((s=n==null?void 0:n.toCustomPath)===null||s===void 0?void 0:s.call(n),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=iE(n==null?void 0:n.attribute,e.attribute),d=e.animate(t);return t!=null&&t.delay&&d.wait(t.delay),d.play(new nE({morphingData:l,otherAttrs:h},(r=t==null?void 0:t.duration)!==null&&r!==void 0?r:Vo.duration,(a=t==null?void 0:t.easing)!==null&&a!==void 0?a:Vo.easing)),d},oz=(n,e,t)=>{var i;const s=e.filter(h=>h&&h.toCustomPath&&h.valid);s.length||__DEV__&&console.error(s," is not validate"),n.valid&&n.toCustomPath||__DEV__&&console.error(n," is not validate");const r=((t==null?void 0:t.splitPath)==="clone"?aE:(i=t==null?void 0:t.splitPath)!==null&&i!==void 0?i:oE)(n,s.length,!1),a=t==null?void 0:t.onEnd;let o=s.length;const l=()=>{o--,o===0&&a&&a()};s.forEach((h,d)=>{var u;const c=r[d],f=((u=t==null?void 0:t.delay)!==null&&u!==void 0?u:0)+(t!=null&&t.individualDelay?t.individualDelay(d,s.length,c,h):0);sE(c,h,Object.assign({},t,{onEnd:l,delay:f}),n.globalTransMatrix)})};class lz extends nn{constructor(e,t,i){super(0,1,t,i),this.morphingData=e.morphingData,this.otherAttrs=e.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren(e=>{e.createPathProxy()}),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren(e=>{e.pathProxy=null})}onEnd(){}onUpdate(e,t,i){this.target.shadowRoot.forEachChildren((s,r)=>{var a;eE(this.morphingData[r],typeof s.pathProxy=="function"?s.pathProxy(s.attribute):s.pathProxy,t),!((a=this.otherAttrs)===null||a===void 0)&&a[r]&&this.otherAttrs[r].length&&QP(this.otherAttrs[r],s.attribute,t)}),e&&(this.clearPathProxy(),this.morphingData=null)}}const Ox=n=>{const e={};return Object.keys(n).forEach(t=>{I3(t)||(e[t]=n[t])}),e},rE=(n,e,t)=>{const i=Ox(n.attribute),s=n.attachShadow();if(e.length)s.setTheme({[e[0].type]:i}),e.forEach(r=>{s.appendChild(r)});else{const r=n.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:i}),new Array(t).fill(0).forEach(l=>{const h=Q.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(h),e.push(h)})}},aE=(n,e,t)=>{const i=[],s=t?null:Ox(n.attribute),r=n.toCustomPath();for(let a=0;a<e;a++){const o={path:new Xt().fromCustomPath2D(r)};i.push(Q.graphicService.creator.path(t?o:Object.assign({},s,o)))}return t&&rE(n,i,e),i},oE=(n,e,t)=>{const i=[],s=t?null:Ox(n.attribute);if(n.type==="rect")Y3(n,e).forEach(r=>{i.push(Q.graphicService.creator.rect(t?r:Object.assign({},s,r)))});else if(n.type==="arc")X3(n,e).forEach(r=>{i.push(Q.graphicService.creator.arc(t?r:Object.assign({},s,r)))});else if(n.type==="circle")K3(n,e).forEach(r=>{i.push(Q.graphicService.creator.arc(t?r:Object.assign({},s,r)))});else if(n.type==="line"){const r=Z3(n,e),a={size:10,symbolType:"circle"};r.forEach(o=>{i.push(Q.graphicService.creator.symbol(t?Object.assign({},o,a):Object.assign({},s,o,a)))})}else n.type==="polygon"?ez(n,e).forEach(r=>{i.push(Q.graphicService.creator.polygon(t?r:Object.assign({},s,r)))}):n.type==="area"?q3(n,e).forEach(r=>{i.push(Q.graphicService.creator.polygon(t?r:Object.assign({},s,r)))}):n.type==="path"&&tz(n,e).forEach(r=>{"path"in r?i.push(Q.graphicService.creator.path(t?r:Object.assign({},s,r))):i.push(Q.graphicService.creator.polygon(t?r:Object.assign({},s,r)))});return t&&rE(n,i,e),i},hz=(n,e,t)=>{var i,s,r;const a=n.filter(u=>u.toCustomPath&&u.valid);a.length||__DEV__&&console.error(n," is not validate"),e.valid&&e.toCustomPath||__DEV__&&console.error(e," is not validate");const o=((t==null?void 0:t.splitPath)==="clone"?aE:(i=t==null?void 0:t.splitPath)!==null&&i!==void 0?i:oE)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map((u,c)=>tE(u.toCustomPath(),o[c].toCustomPath(),{fromTransform:u.globalTransMatrix,toTransfrom:o[c].globalTransMatrix})),d=a.map((u,c)=>iE(u.attribute,l));if(t!=null&&t.individualDelay){const u=t.onEnd;let c=a.length;const f=()=>{c--,c===0&&(e.setAttributes({visible:!0,ratio:null},!1,{type:kt.ANIMATE_END}),e.detachShadow(),u&&u())};o.forEach((p,g)=>{var _,m,y;const b=((_=t.delay)!==null&&_!==void 0?_:0)+t.individualDelay(g,a.length,n[g],p),v=p.animate(Object.assign({},t,{onEnd:f}));v.wait(b),v.play(new nE({morphingData:h[g],saveOnEnd:!0,otherAttrs:d[g]},(m=t.duration)!==null&&m!==void 0?m:Vo.duration,(y=t.easing)!==null&&y!==void 0?y:Vo.easing))})}else{const u=t==null?void 0:t.onEnd,c=Object.assign({},t);c.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:kt.ANIMATE_END}),e.detachShadow(),u&&u()};const f=e.animate(c);t!=null&&t.delay&&f.wait(t.delay),f.play(new lz({morphingData:h,otherAttrs:d},(s=t==null?void 0:t.duration)!==null&&s!==void 0?s:Vo.duration,(r=t==null?void 0:t.easing)!==null&&r!==void 0?r:Vo.easing))}};class Ps{static GetImage(e,t){var i;let s=Ps.cache.get(e);s?s.loadState==="fail"?Q.global.getRequestAnimationFrame()(()=>{t.imageLoadFail(e)}):s.loadState==="init"||s.loadState==="loading"?(i=s.waitingMark)===null||i===void 0||i.push(t):t&&t.imageLoadSuccess(e,s.data):(s={type:"image",loadState:"init"},Ps.cache.set(e,s),s.dataPromise=Q.global.loadImage(e),s.dataPromise?(s.waitingMark=[t],s.dataPromise.then(r=>{var a;s.loadState=r!=null&&r.data?"success":"fail",s.data=r==null?void 0:r.data,(a=s.waitingMark)===null||a===void 0||a.map((o,l)=>{r!=null&&r.data?(s.loadState="success",s.data=r.data,o.imageLoadSuccess(e,r.data)):(s.loadState="fail",o.imageLoadFail(e))})})):(s.loadState="fail",t.imageLoadFail(e)))}static GetSvg(e,t){var i;let s=Ps.cache.get(e);s?s.loadState==="fail"?Q.global.getRequestAnimationFrame()(()=>{t.imageLoadFail(e)}):s.loadState==="init"||s.loadState==="loading"?(i=s.waitingMark)===null||i===void 0||i.push(t):t&&Q.global.getRequestAnimationFrame()(()=>{t.imageLoadSuccess(e,s.data)}):(s={type:"image",loadState:"init"},Ps.cache.set(e,s),s.dataPromise=Q.global.loadSvg(e),s.dataPromise?(s.waitingMark=[t],s.dataPromise.then(r=>{var a;s.loadState=r!=null&&r.data?"success":"fail",s.data=r==null?void 0:r.data,(a=s.waitingMark)===null||a===void 0||a.map((o,l)=>{r!=null&&r.data?(s.loadState="success",s.data=r.data,o.imageLoadSuccess(e,r.data)):(s.loadState="fail",o.imageLoadFail(e))})})):(s.loadState="fail",t.imageLoadFail(e)))}static GetFile(e,t){let i=Ps.cache.get(e);return i?i.loadState==="init"||i.loadState==="fail"?Promise.reject():i.loadState==="loading"?i.dataPromise.then(s=>s.data):Promise.resolve(i.data):(i={type:t,loadState:"init"},Ps.cache.set(e,i),t==="arrayBuffer"?i.dataPromise=Q.global.loadArrayBuffer(e):t==="blob"?i.dataPromise=Q.global.loadBlob(e):t==="json"&&(i.dataPromise=Q.global.loadJson(e)),i.dataPromise.then(s=>s.data))}}Ps.cache=new Map;const dz=new Ft,RA=new St,Sn=["lineWidth","scaleX","scaleY","angle","anchor","visible"],OA=["x","y"],BA=["scaleX","scaleY"],LA=["angle"],Bh=new Et,Ci={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d: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 Ni extends M3{static mixin(e){const t=Object.keys(e);for(let i=0;i<t.length;++i){const s=t[i];Object.defineProperty(Ni.prototype,s,Object.getOwnPropertyDescriptor(e,s))}}get AABBBounds(){return this.tryUpdateAABBBounds(this.attribute.boundsMode==="imprecise")}get OBBBounds(){return this.tryUpdateOBBBounds()}get globalAABBBounds(){return this.tryUpdateGlobalAABBBounds()}get transMatrix(){return this.tryUpdateLocalTransMatrix(!0)}get globalTransMatrix(){return this.tryUpdateGlobalTransMatrix(!0)}constructor(e={}){var t;super(),this._AABBBounds=new St,this._updateTag=ot.INIT,this.attribute=e,this.valid=this.isValid(),e.background&&this.loadImage((t=e.background.background)!==null&&t!==void 0?t:e.background,!0)}setMode(e){e==="3d"?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(e,t=!1){var i,s;const{dx:r=e.dx,dy:a=e.dy}=this.attribute;if(t&&this.parent){const o=this.parent.attribute;Bh.x=r+((i=o.scrollX)!==null&&i!==void 0?i:0),Bh.y=a+((s=o.scrollY)!==null&&s!==void 0?s:0)}else Bh.x=r,Bh.y=a;return Bh}onAnimateBind(e){this._emitCustomEvent("animate-bind",e)}tryUpdateAABBBounds(e){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Q.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.doUpdateAABBBounds(e);return this.addUpdateLayoutTag(),Q.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),t}combindShadowAABBBounds(e){if(this.shadowRoot){const t=this.shadowRoot.AABBBounds.clone();e.union(t)}}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.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(e=!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(e=!0){return this._transMatrix||(this._transMatrix=new Ft),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),e&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&ot.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&ot.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&ot.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&ot.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&ot.UPDATE_LOCAL_MATRIX)}isValid(){var e,t;const i=this.attribute;return Number.isFinite(((e=i.x)!==null&&e!==void 0?e:0)+((t=i.y)!==null&&t!==void 0?t:0))}_validNumber(e){return e==null||Number.isFinite(e)}shouldUpdateShape(){return!!(this._updateTag&ot.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=ot.CLEAR_SHAPE}containsPoint(e,t,i,s){if(!s)return!1;if(i===Hd.GLOBAL){const r=new Et(e,t);this.parent&&this.parent.globalTransMatrix.transformPoint(r,r),e=r.x,t=r.y}return s.containsPoint(this,{x:e,y:t})}setAttributes(e,t=!1,i){(e=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(e,this.attribute,null,i)||e).background&&this.loadImage(e.background,!0),this._setAttributes(e,t,i)}_setAttributes(e,t=!1,i){const s=Object.keys(e);for(let r=0;r<s.length;r++){const a=s[r];this.attribute[a]=e[a]}this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!t&&!this.needUpdateTags(s)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i)}setAttribute(e,t,i,s){var r;const a=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[e]:t},this.attribute,e,s);a?this._setAttributes(a,i,s):C((r=this.normalAttrs)===null||r===void 0?void 0:r[e])?(this.attribute[e]=t,this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(e)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(s)):this.normalAttrs[e]=t,e==="background"&&this.loadImage(t,!0)}needUpdateTags(e,t=Sn){for(let i=0;i<t.length;i++){const s=t[i];if(e.indexOf(s)!==-1)return!0}return!1}needUpdateTag(e,t=Sn){for(let i=0;i<t.length;i++)if(e===t[i])return!0;return!1}initAttributes(e){const t={type:kt.INIT};e=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(e,this.attribute,null,t)||e,this.attribute=e,e.background&&this.loadImage(e.background,!0),this._updateTag=ot.INIT,this.valid=this.isValid(),this.onAttributeUpdate(t)}translate(e,t){var i,s;if(e===0&&t===0)return this;const r={type:kt.TRANSLATE},a=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:e,y:t},this.attribute,OA,r);a&&(e=a.x,t=a.y,delete a.x,delete a.y,this._setAttributes(a));const o=this.attribute,l=o.postMatrix;return l?Q.transformUtil.fromMatrix(l,l).translate(e,t):(o.x=((i=o.x)!==null&&i!==void 0?i:ni.x)+e,o.y=((s=o.y)!==null&&s!==void 0?s:ni.y)+t),this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this}translateTo(e,t){const i=this.attribute;if(i.x===e&&i.y===t)return this;const s={type:kt.TRANSLATE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:e,y:t},this.attribute,OA,s);return r?(this._setAttributes(r,!1,s),this):(i.x=e,i.y=t,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(s),this)}scale(e,t,i){var s,r;if(e===1&&t===1)return this;const a={type:kt.SCALE},o=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:e,scaleY:t,scaleCenter:i},this.attribute,BA,a);o&&(e=o.scaleX,t=o.scaleY,delete o.scaleX,delete o.scaleY,this._setAttributes(o));const l=this.attribute;if(i){let{postMatrix:h}=this.attribute;h||(h=new Ft,l.postMatrix=h),Q.transformUtil.fromMatrix(h,h).scale(e,t,i)}else l.scaleX=((s=l.scaleX)!==null&&s!==void 0?s:ni.scaleX)*e,l.scaleY=((r=l.scaleY)!==null&&r!==void 0?r:ni.scaleY)*t;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(a),this}scaleTo(e,t){const i=this.attribute;if(i.scaleX===e&&i.scaleY===t)return this;const s={type:kt.SCALE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:e,scaleY:t},this.attribute,BA,s);return r?(this._setAttributes(r,!1,s),this):(i.scaleX=e,i.scaleY=t,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(s),this)}rotate(e,t){var i;if(e===0)return this;const s={type:kt.ROTATE},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({angle:e,rotateCenter:t},this.attribute,LA,s);r&&(delete r.angle,this._setAttributes(r,!1,s));const a=this.attribute;if(t){let{postMatrix:o}=this.attribute;o||(o=new Ft,a.postMatrix=o),Q.transformUtil.fromMatrix(o,o).rotate(e,t)}else a.angle=((i=a.angle)!==null&&i!==void 0?i:ni.angle)+e;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(s),this}rotateTo(e){const t=this.attribute;if(t.angle===e)return this;const i={type:kt.ROTATE_TO},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(e,this.attribute,LA,i);return s?(this._setAttributes(s,!1,i),this):(t.angle=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i),this)}skewTo(e,t){return this}animate(e){this.animates||(this.animates=new Map);const t=new Nf(e==null?void 0:e.id).bind(this);if(e){const{onStart:i,onFrame:s,onEnd:r,onRemove:a}=e;i!=null&&t.onStart(i),s!=null&&t.onFrame(s),r!=null&&t.onEnd(r),a!=null&&t.onRemove(a),t.interpolateFunc=e.interpolate}return this.animates.set(t.id,t),t.onRemove(()=>{this.animates.delete(t.id)}),t}onAttributeUpdate(e){e&&e.skipUpdateCallback||(Q.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",e))}update(e){e?(e.bounds&&this.tryUpdateAABBBounds(this.attribute.boundsMode==="imprecise"),e.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds(this.attribute.boundsMode==="imprecise"),this.tryUpdateLocalTransMatrix())}hasState(e){return!(!this.currentStates||!this.currentStates.length)&&(!!C(e)||this.currentStates.includes(e))}getState(e){var t;return(t=this.states)===null||t===void 0?void 0:t[e]}applyStateAttrs(e,t,i,s){var r,a,o,l;if(i){const h=Object.keys(e),d=this.getNoWorkAnimateAttr(),u={};let c;s?h.forEach(p=>{d[p]?(c||(c={}),c[p]=e[p]):u[p]=e[p]===void 0?this.getDefaultAttribute(p):e[p]}):h.forEach(p=>{d[p]?(c||(c={}),c[p]=e[p]):u[p]=e[p]});const f=this.animate();f.stateNames=t,f.to(u,(a=(r=this.stateAnimateConfig)===null||r===void 0?void 0:r.duration)!==null&&a!==void 0?a:vA.duration,(l=(o=this.stateAnimateConfig)===null||o===void 0?void 0:o.easing)!==null&&l!==void 0?l:vA.easing),c&&this.setAttributes(c,!1,{type:kt.STATE})}else this.setAttributes(e,!1,{type:kt.STATE})}updateNormalAttrs(e){const t={};this.normalAttrs?(Object.keys(e).forEach(i=>{i in this.normalAttrs?(t[i]=this.normalAttrs[i],delete this.normalAttrs[i]):t[i]=this.getNormalAttribute(i)}),Object.keys(this.normalAttrs).forEach(i=>{e[i]=this.normalAttrs[i]})):Object.keys(e).forEach(i=>{t[i]=this.getNormalAttribute(i)}),this.normalAttrs=t}getNormalAttribute(e){let t=this.attribute[e];return this.animates&&this.animates.forEach(i=>{if(i.stateNames){const s=i.getEndProps();Fn(s,e)&&(t=s[e])}}),t}clearStates(e){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,e,!0)):this.currentStates=[],this.normalAttrs=null}removeState(e,t){if((this.currentStates?this.currentStates.indexOf(e):-1)>=0){const i=this.currentStates.filter(s=>s!==e);this.useStates(i,t)}}toggleState(e,t){if(this.hasState(e))this.removeState(e,t);else if((this.currentStates?this.currentStates.indexOf(e):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(e),this.useStates(i,t)}}addState(e,t,i){var s;if(this.currentStates&&this.currentStates.includes(e)&&(t||this.currentStates.length===1))return;const r=t&&(!((s=this.currentStates)===null||s===void 0)&&s.length)?this.currentStates.concat([e]):[e];this.useStates(r,i)}useStates(e,t){var i;if(!e.length)return void this.clearStates(t);if(!(((i=this.currentStates)===null||i===void 0?void 0:i.length)!==e.length||e.some((r,a)=>this.currentStates[a]!==r)))return;const s={};e.forEach(r=>{var a;const o=this.stateProxy?this.stateProxy(r,e):(a=this.states)===null||a===void 0?void 0:a[r];o&&Object.assign(s,o)}),this.updateNormalAttrs(s),this.currentStates=e,this.applyStateAttrs(s,e,t)}addUpdateBoundTag(){this._updateTag|=ot.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=ot.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=ot.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&ot.UPDATE_SHAPE_AND_BOUNDS)===ot.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=ot.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=ot.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=ot.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=ot.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=ot.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=ot.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=ot.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&ot.UPDATE_LAYOUT)}getAnchor(e,t){const i=[0,0],s=()=>{if(t.b)return t.b;const{scaleX:r,scaleY:a,angle:o}=this.attribute;return RA.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),t.b=this.AABBBounds.clone(),this._AABBBounds.copy(RA),this.setAttributes({scaleX:r,scaleY:a,angle:o}),t.b};if(typeof e[0]=="string"){const r=parseFloat(e[0])/100,a=s();i[0]=a.x1+(a.x2-a.x1)*r}else i[0]=e[0];if(typeof e[1]=="string"){const r=parseFloat(e[1])/100,a=s();i[1]=a.y1+(a.y2-a.y1)*r}else i[1]=e[1];return i}doUpdateLocalMatrix(){const{x:e=ni.x,y:t=ni.y,scaleX:i=ni.scaleX,scaleY:s=ni.scaleY,angle:r=ni.angle,scaleCenter:a,anchor:o,postMatrix:l}=this.attribute;let h=[0,0];const d={};if(o&&(h=this.getAnchor(o,d)),!a||i===1&&s===1)xD(this._transMatrix,this._transMatrix.reset(),e,t,i,s,r,o&&h);else{const c=this._transMatrix;c.reset(),c.translate(h[0],h[1]),c.rotate(r),c.translate(-h[0],-h[1]),c.translate(e,t),h=this.getAnchor(a,d),Q.transformUtil.fromMatrix(c,c).scale(i,s,{x:h[0],y:h[1]})}const u=this.getOffsetXY(ni);if(this._transMatrix.e+=u.x,this._transMatrix.f+=u.y,l){const c=dz.setValue(l.a,l.b,l.c,l.d,l.e,l.f),f=this._transMatrix;c.multiply(f.a,f.b,f.c,f.d,f.e,f.f),f.setValue(c.a,c.b,c.c,c.d,c.e,c.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:e=0,scrollY:t=0}=this.parent.attribute;this._globalTransMatrix.translate(e,t)}}setStage(e,t){if(this.stage!==e){if(this.stage=e,this.layer=t,this.setStageToShadowRoot(e,t),this.animates&&this.animates.size){const i=e.getTimeline();this.animates.forEach(s=>{s.setTimeline(i)})}this._onSetStage&&this._onSetStage(this,e,t),Q.graphicService.onSetStage(this,e)}}setStageToShadowRoot(e,t){this.shadowRoot&&this.shadowRoot.setStage(e,t)}onAddStep(e){}onStop(e){e&&this.setAttributes(e,!1,{type:kt.ANIMATE_END})}onStep(e,t,i,s,r){const a={};if(i.customAnimate)i.customAnimate.update(r,s,a);else{const o=i.props,l=i.parsedProps,h=i.propKeys;this.stepInterpolate(e,t,a,i,s,r,o,void 0,l,h)}this.setAttributes(a,!1,{type:kt.ANIMATE_UPDATE,animationState:{ratio:s,end:r,step:i,isFirstFrameOfStep:e.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(e,t,i,s,r,a,o,l,h,d){d||(d=Object.keys(o),s.propKeys=d),a?s.propKeys.forEach(u=>{t.validAttr(u)&&(i[u]=o[u])}):d.forEach(u=>{var c;if(!t.validAttr(u))return;const f=o[u],p=(c=l&&l[u])!==null&&c!==void 0?c:e.getLastPropByName(u,s);if(f==null||p==null)return void(i[u]=f);let g;g=t.interpolateFunc&&t.interpolateFunc(u,r,p,f,i),g||(g=t.customInterpolate(u,r,p,f,this,i),g||this.defaultInterpolate(f,p,u,i,h,r)||this._interpolate(u,r,p,f,i))}),s.parsedProps=h}defaultInterpolate(e,t,i,s,r,a){if(Number.isFinite(e))return s[i]=t+(e-t)*a,!0;if(i==="fill"){r||(r={});const o=r.fillColorArray,l=Ya(t,o??e,a,!1,(h,d)=>{r.fillColorArray=d});return l&&(s[i]=l),!0}if(i==="stroke"){r||(r={});const o=r.strokeColorArray,l=Ya(t,o??e,a,!1,(h,d)=>{r.strokeColorArray=d});return l&&(s[i]=l),!0}if(i==="shadowColor"){r||(r={});const o=r.shadowColorArray,l=Ya(t,o??e,a,!0,(h,d)=>{r.shadowColorArray=d});return l&&(s[i]=l),!0}return!1}_interpolate(e,t,i,s,r){}getDefaultAttribute(e){return se(this)[this.type][e]}getComputedAttribute(e){var t;return(t=this.attribute[e])!==null&&t!==void 0?t:this.getDefaultAttribute(e)}onSetStage(e,t=!1){this._onSetStage=e,t&&this.stage&&e(this,this.stage)}attachShadow(e){return e&&(e.shadowHost=this),this.shadowRoot=e??Q.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map(e=>e.toJson())}}createPathProxy(e){return ae(e,!0)?this.pathProxy=new Xt().fromString(e):this.pathProxy=new Xt,this.pathProxy}loadImage(e,t=!1){if(!e||t&&uz(e))return;const i=e;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),typeof e=="string"?(s.state="loading",e.startsWith("<svg")?(Ps.GetSvg(e,this),this.backgroundImg=this.backgroundImg||t):(pC(e)||e.includes("/")||gC(e))&&(Ps.GetImage(e,this),this.backgroundImg=this.backgroundImg||t)):(s.state="success",s.data=e,this.backgroundImg=this.backgroundImg||t)}imageLoadSuccess(e,t,i){if(!this.resources)return;const s=this.resources.get(e);s&&(s.state="success",s.data=t,i&&i(),this.addUpdateBoundTag(),this.stage&&this.stage.renderNextFrame())}imageLoadFail(e,t){if(!this.resources)return;const i=this.resources.get(e);i&&(i.state="fail",t&&t())}_stopAnimates(e){e&&e.forEach(t=>{t.stop()})}stopAnimates(e=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&e&&this.forEachChildren(t=>{t.stopAnimates(e)})}release(){this.releaseStatus="released",Q.graphicService.onRelease(this)}_emitCustomEvent(e,t){var i,s;if(this._events&&e in this._events){const r=new Cx(e,t);r.bubbles=!1,r.manager=(s=(i=this.stage)===null||i===void 0?void 0:i.eventSystem)===null||s===void 0?void 0:s.manager,this.dispatchEvent(r)}}}function uz(n){return!(!n.fill&&!n.stroke)}Ni.mixin(C3);function cz(n,e){const t=[];let i=e.exec(n);for(;i;){const s=[];s.startIndex=e.lastIndex-i[0].length;const r=i.length;for(let a=0;a<r;a++)s.push(i[a]);t.push(s),i=e.exec(n)}return t}class $m{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}function IA(n,e,t,i){const s=n.indexOf(e,t);if(s===-1)throw new Error(i);return s+e.length-1}function fz(n,e,t=">"){let i,s="";for(let r=e;r<n.length;r++){let a=n[r];if(i)a===i&&(i="");else if(a==='"'||a==="'")i=a;else if(a===t[0]){if(!t[1])return{data:s,index:r};if(n[r+1]===t[1])return{data:s,index:r}}else a===" "&&(a=" ");s+=a}}function DA(n,e,t,i=">"){const s=fz(n,e+1,i);if(!s)return;let r=s.data;const a=s.index,o=r.search(/\s/);let l=r,h=!0;return o!==-1&&(l=r.substr(0,o).replace(/\s\s*$/,""),r=r.substr(o+1)),{tagName:l,tagExp:r,closeIndex:a,attrExpPresent:h,rawTagName:l}}const pz=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");class gz{constructor(e){this.currentNode=null,this.options=e,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(e,t,i){const s=t.tagname;typeof s=="string"&&(t.tagname=s),e.addChild(t)}buildAttributesMap(e,t,i){const s={};if(!e)return;const r=cz(e,pz),a=r.length;for(let o=0;o<a;o++){const l=r[o][1],h=r[o][4],d=l;l&&(s[d]=h===void 0||(isNaN(h)?h:Number(h)))}return s}parseXml(e){e=e.replace(/\r\n?/g,`
  15. `);const t=new $m("!xml");let i=t,s="",r="";for(let a=0;a<e.length;a++)if(e[a]==="<")if(e[a+1]==="/"){const o=IA(e,">",a,"Closing Tag is not closed."),l=r.lastIndexOf(".");r=r.substring(0,l),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",a=o}else if(e[a+1]==="?")a=DA(e,a,!1,"?>").closeIndex+1;else if(e.substr(a+1,3)==="!--")a=IA(e,"-->",a+4,"Comment is not closed.");else{const o=DA(e,a);let l=o.tagName,h=o.tagExp;const d=o.attrExpPresent,u=o.closeIndex;if(l!==t.tagname&&(r+=r?"."+l:l),h.length>0&&h.lastIndexOf("/")===h.length-1){l[l.length-1]==="/"?(l=l.substr(0,l.length-1),r=r.substr(0,r.length-1),h=l):h=h.substr(0,h.length-1);const c=new $m(l);l!==h&&d&&(c[":@"]=this.buildAttributesMap(h,r,l)),this.addChild(i,c,r),r=r.substr(0,r.lastIndexOf("."))}else{const c=new $m(l);this.tagsNodeStack.push(i),l!==h&&d&&(c[":@"]=this.buildAttributesMap(h,r,l)),this.addChild(i,c,r),i=c}s="",a=u}else s+=e[a];return t.child}}function _z(n,e){return lE(n)}function lE(n,e){const t={};for(let i=0;i<n.length;i++){const s=n[i],r=mz(s);if(r!==void 0&&s[r]){const a=lE(s[r]);bz(a),s[":@"]&&yz(a,s[":@"]),t[r]!==void 0&&t.hasOwnProperty(r)?(Array.isArray(t[r])||(t[r]=[t[r]]),t[r].push(a)):t[r]=a}}return t}function mz(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const i=e[t];if(i!==":@")return i}}function yz(n,e,t){if(e){const i=Object.keys(e),s=i.length;for(let r=0;r<s;r++){const a=i[r];n[a]=e[a]}}}function bz(n){return Object.keys(n).length===0}class __{constructor(e){this.options=Object.assign({},__.defaultOptions,e)}valid(e){return e.startsWith("<")}parse(e){if(!this.valid)return!1;const t=new gz(this.options).parseXml(e);return _z(t,this.options)}}__.defaultOptions={};function vz(n){return n.startsWith("<svg")||n.startsWith("<?xml")}var xz=function(n,e,t,i){return new(t||(t=Promise))(function(s,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?s(h.value):(d=h.value,d instanceof t?d:new t(function(u){u(d)})).then(a,o)}l((i=i.apply(n,e||[])).next())})};function Sz(n){return xz(this,void 0,void 0,function*(){const e=[],t=n.getChildren();yield new Promise(i=>{Q.global.getRequestAnimationFrame()(()=>{i(null)})}),t.forEach(i=>{i.subLayers.size&&i.subLayers.forEach(s=>{s.drawContribution&&s.drawContribution.hooks&&s.drawContribution.rendering&&e.push(new Promise(r=>{s.drawContribution.hooks.completeDraw.tap("outWait",()=>{s.drawContribution.hooks.completeDraw.taps=s.drawContribution.hooks.completeDraw.taps.filter(a=>a.name!=="outWait"),r(null)})}))})}),yield Promise.all(e)})}function uf(n,e,t,i=0){return n.expand(e+(i/2+(t?Az(t,e):0))),n}function Az(n,e){return n?e:0}let kz=0;function Ui(){return kz++}var Xa;(function(n){n[n.HORIZONTAL=0]="HORIZONTAL",n[n.VERTICAL=1]="VERTICAL"})(Xa||(Xa={}));function FA(n){const e=[];let t=0,i="";for(let s=0;s<n.length;s++)Tz(n[s])?t?i+=n[s]:(t=1,i=n[s]):(t&&(e.push({text:i,direction:Xa.VERTICAL}),i="",t=0),e.push({text:n[s],direction:Xa.HORIZONTAL}));return i&&e.push({text:i,direction:Xa.VERTICAL}),e}const wz=["…","(",")","—","【","】","「","」","《","》"],hE=new Map;wz.forEach(n=>hE.set(n,!0));const Mz=[""],dE=new Map;function Tz(n){if(hE.has(n))return!0;if(dE.has(n))return!1;let e=!1;return n.codePointAt(0)<256&&(e=!0),e}Mz.forEach(n=>dE.set(n,!0));const m_=Ui(),Gu=Ui(),Wu=Ui(),y_=Ui(),b_=Ui(),Bx=Ui(),v_=Ui(),Vu=Ui(),x_=Ui(),S_=Ui(),Lx=Ui(),A_=Ui(),Ix=Ui(),Dx=Ui(),k_=Ui(),w_=Ui(),uE=Symbol.for("GraphicService"),cE=Symbol.for("GraphicCreator"),fE={"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"},Cz=Object.keys(fE);var zA;(function(n){n[n.LESS_GROUP=0]="LESS_GROUP",n[n.MORE_GROUP=1]="MORE_GROUP"})(zA||(zA={}));let xh=class bb extends Ni{constructor(e){super(e),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Bx,this._childUpdateTag=ot.UPDATE_BOUNDS}setMode(e){e==="3d"?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(e){return this.theme||(this.theme=new Wd),this.theme.setTheme(e,this)}createTheme(){this.theme||(this.theme=new Wd)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren(e=>{e.isContainer&&e.hideAll?e.hideAll():e.setAttribute("visible",!1)})}showAll(){this.setAttribute("visible",!0),this.forEachChildren(e=>{e.isContainer&&e.showAll?e.showAll():e.setAttribute("visible",!0)})}containsPoint(e,t,i){if(i===Hd.GLOBAL){const s=new Et(e,t);return this.parent&&this.parent.globalTransMatrix.transformPoint(s,s),this.AABBBounds.contains(s.x,s.y)}return this.AABBBounds.contains(e,t)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&ot.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Q.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.shouldSelfChangeUpdateAABBBounds(),t=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Q.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,e),t}doUpdateLocalMatrix(){const{x:e=ni.x,y:t=ni.y,dx:i=ni.dx,dy:s=ni.dy,scaleX:r=ni.scaleX,scaleY:a=ni.scaleY,angle:o=ni.angle,postMatrix:l}=this.attribute;if(e!==0||t!==0||i!==0||s!==0||r!==1||a!==1||o!==0||l)return super.doUpdateLocalMatrix();this._transMatrix.reset()}doUpdateAABBBounds(){const e=this.attribute,t=se(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=Q.graphicService.updateGroupAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,r=mi(s);return r&&i.expand(r),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=ot.CLEAR_BOUNDS,this._childUpdateTag&=ot.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=ot.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&ot.UPDATE_BOUNDS||(this._childUpdateTag|=ot.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(e){const t=super.appendChild(e);return this.stage&&t&&(t.stage=this.stage,t.layer=this.layer),this.addUpdateBoundTag(),Q.graphicService.onAddIncremental(e,this,this.stage),t}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Q.graphicService.onClearIncremental(this,this.stage)}appendChild(e,t=!0){const i=super.appendChild(e);return t&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(e,t){const i=super.insertBefore(e,t);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(e,t){const i=super.insertAfter(e,t);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(e,t){const i=super.insertInto(e,t);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(e){const t=super.removeChild(e);return e.stage=null,Q.graphicService.onRemove(e),this.addUpdateBoundTag(),t}removeAllChild(){this.forEachChildren(e=>{Q.graphicService.onRemove(e)}),super.removeAllChild(),this.addUpdateBoundTag()}setStage(e,t){this.stage!==e&&(this.stage=e,this.layer=t,this.setStageToShadowRoot(e,t),this._onSetStage&&this._onSetStage(this,e,t),Q.graphicService.onSetStage(this,e),this.forEachChildren(i=>{i.setStage(e,this.layer)}))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren(e=>{e.isContainer&&e.addUpdateGlobalPositionTag()})}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren(e=>{e.isContainer&&e.addUpdateGlobalPositionTag()})}tryUpdateGlobalTransMatrix(e=!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(),e&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&ot.UPDATE_GLOBAL_MATRIX)}_getChildByName(e,t){return this.find(i=>i.name===e,t)}createOrUpdateChild(e,t,i){let s=this._getChildByName(e);return s?s.setAttributes(t):(s=Q.graphicService.creator[i](t),s.name=e,this.add(s)),s}clone(){return new bb(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return bb.NOWORK_ANIMATE_ATTR}};xh.NOWORK_ANIMATE_ATTR=Ci;function Fx(n){return new xh(n)}class Pz extends xh{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(e,t,i,s){var r;super({}),this.stage=e,this.global=t,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:(r=s.zIndex)!==null&&r!==void 0?r:0}),this.layer=this,this.subLayers=new Map,this.theme=new Wd,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(e=!0){const t=Array.from(this.subLayers.values()).sort((i,s)=>i.zIndex-s.zIndex);this.layerHandler.merge(t.map(i=>(i.layer.subLayers.size&&i.layer.combineSubLayer(e),i.layer.getNativeHandler()))),e&&t.forEach(i=>{i.group&&(i.group.incremental=0)}),t.forEach(i=>{Q.layerService.releaseLayer(this.stage,i.layer)}),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(e,t){super.setStage(e,this)}pick(e,t){throw new Error("暂不支持")}tryRenderSecondaryLayer(e,t){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach(i=>{i.layer.renderCount=this.renderCount,i.layer.render(e,t)})}render(e,t){var i;const s=this.stage;this.layerHandler.render([this],{renderService:e.renderService,x:s.x,y:s.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:(i=e.background)!==null&&i!==void 0?i:this.background,updateBounds:e.updateBounds},t),this.afterDrawCbs.forEach(r=>r(this)),this.tryRenderSecondaryLayer(e,t)}resize(e,t){this.layerHandler.resize(e,t)}resizeView(e,t){this.layerHandler.resizeView(e,t)}setDpr(e){this.layerHandler.setDpr(e)}afterDraw(e){this.afterDrawCbs.push(e)}startAnimate(e){throw new Error("暂不支持")}setToFrame(e){throw new Error("暂不支持")}prepare(e,t){}combineTo(e,t){var i,s,r;this.offscreen&&(this.layerHandler.drawTo(e,[this],Object.assign({background:(i=t.background)!==null&&i!==void 0?i:this.background,renderService:t.renderService,x:(s=t.x)!==null&&s!==void 0?s:this.stage.x,y:(r=t.y)!==null&&r!==void 0?r:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},t)),this.afterDrawCbs.forEach(a=>a(this)))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach(e=>{Q.layerService.releaseLayer(this.stage,e.layer)})}drawTo(e,t){var i,s,r;this.layerHandler.drawTo(e,[this],Object.assign({background:(i=t.background)!==null&&i!==void 0?i:this.background,renderService:t.renderService,x:(s=t.x)!==null&&s!==void 0?s:this.stage.x,y:(r=t.y)!==null&&r!==void 0?r:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},t)),this.afterDrawCbs.forEach(a=>a(this))}}const pE=Symbol.for("TransformUtil"),gE=Symbol.for("GraphicUtil"),zx=Symbol.for("LayerService"),_E=Symbol.for("StaticLayerHandlerContribution"),mE=Symbol.for("DynamicLayerHandlerContribution"),yE=Symbol.for("VirtualLayerHandlerContribution");var Jh,Ez=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},Rz=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};let Qh=Jh=class{static GenerateLayerId(){return`${Jh.idprefix}_${Jh.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Q.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(n){return this.layerMap.get(n)}getRecommendedLayerType(n){return n||(this.staticLayerCountInEnv!==0?"static":this.dynamicLayerCountInEnv!==0?"dynamic":"virtual")}getLayerHandler(n){let e;return e=n==="static"?we.get(_E):n==="dynamic"?we.get(mE):we.get(yE),e}createLayer(n,e={main:!1}){var t;this.tryInit();let i=this.getRecommendedLayerType(e.layerMode);i=e.main||e.canvasId?"static":i;const s=this.getLayerHandler(i),r=new Pz(n,this.global,n.window,Object.assign(Object.assign({main:!1},e),{layerMode:i,canvasId:(t=e.canvasId)!==null&&t!==void 0?t:Jh.GenerateLayerId(),layerHandler:s})),a=this.layerMap.get(n)||[];return a.push(r),this.layerMap.set(n,a),this.staticLayerCountInEnv--,r}prepareStageLayer(n){let e;n.forEachChildren(t=>{const i=t.getNativeHandler();i.type==="virtual"?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])})}releaseLayer(n,e){e.release();const t=this.layerMap.get(n)||[];this.layerMap.set(n,t.filter(i=>i!==e))}layerCount(n){return(this.layerMap.get(n)||[]).length}restLayerCount(n){return this.global.env==="browser"?10:0}};Qh.idprefix="visactor_layer",Qh.prefix_count=0,Qh=Jh=Ez([ue(),Rz("design:paramtypes",[])],Qh);const Oz=new Me(n=>{n(kx).to(sb).inSingletonScope(),n(Hf).to(fb),n(gE).to(pb).inSingletonScope(),n(pE).to(gb).inSingletonScope(),n(zx).to(Qh).inSingletonScope()});function go(n,e){return!(!n&&!e)}function Sh(n,e){let t;return t=W(n)?n.some(i=>i||i===void 0):!!n,t&&e>0}function Jl(n,e,t){return t&&n*e>0}function jx(n,e,t,i,s){return s&&n*e>0&&t!==0&&i!==0}function Hx(n,e){return n*e>0}function Gx(n,e,t,i){return n*e>0&&t!==0&&i!==0}function Bz(n,e,t,i,s,r,a,o){if(!n.pathProxy)return!1;const l=se(n,r==null?void 0:r.theme)[n.type],{fill:h=l.fill,stroke:d=l.stroke,opacity:u=l.opacity,fillOpacity:c=l.fillOpacity,lineWidth:f=l.lineWidth,strokeOpacity:p=l.strokeOpacity,visible:g=l.visible}=n.attribute,_=Jl(u,c,h),m=Hx(u,p),y=go(h),b=Sh(d,f);if(!g||!y&&!b||!(_||m||a||o))return!0;e.beginPath();const v=typeof n.pathProxy=="function"?n.pathProxy(n.attribute):n.pathProxy;return lr(v.commandList,e,t,i),e.setShadowBlendStyle&&e.setShadowBlendStyle(n,n.attribute,l),b&&m&&(e.setStrokeStyle(n,n.attribute,t,i,l),e.stroke()),y&&_&&(e.setCommonStyle(n,n.attribute,t,i,l),e.fill()),!0}function bE(n,e,t,i,s,r,a,o){const l=t-n,h=i-e,d=a-s,u=o-r;let c=u*l-d*h;return c*c<Qe?[]:(c=(d*(e-r)-u*(n-s))/c,[n+c*l,e+c*h])}function Ur(n,e,t,i,s,r,a){const o=n-t,l=e-i,h=(a?r:-r)/Math.sqrt(o*o+l*l),d=h*l,u=-h*o,c=n+d,f=e+u,p=t+d,g=i+u,_=(c+p)/2,m=(f+g)/2,y=p-c,b=g-f,v=y*y+b*b,x=s-r,S=c*g-p*f,A=(b<0?-1:1)*Math.sqrt(Math.max(0,x*x*v-S*S));let k=(S*b-y*A)/v,w=(-S*y-b*A)/v;const M=(S*b+y*A)/v,T=(-S*y+b*A)/v,E=k-_,O=w-m,B=M-_,R=T-m;return E*E+O*O>B*B+R*R&&(k=M,w=T),{cx:k,cy:w,x01:-d,y01:-u,x11:k*(s/x-1),y11:w*(s/x-1)}}function Uf(n,e,t,i,s,r,a){const{startAngle:o,endAngle:l}=n.getParsedAngle(),h=Ve(l-o),d=l>o;let u=!1;if(s<r){const c=s;s=r,r=c}if(s<=Qe)e.moveTo(t,i);else if(h>=Be-Qe)e.moveTo(t+s*nt(o),i+s*Ze(o)),e.arc(t,i,s,o,l,!d),r>Qe&&(e.moveTo(t+r*nt(l),i+r*Ze(l)),e.arc(t,i,r,l,o,d));else{const c=n.getParsedCornerRadius(),{outerDeltaAngle:f,innerDeltaAngle:p,outerStartAngle:g,outerEndAngle:_,innerEndAngle:m,innerStartAngle:y}=n.getParsePadAngle(o,l),b=c,v=c,x=c,S=c,A=Math.max(v,b),k=Math.max(x,S);let w=A,M=k;const T=s*nt(g),E=s*Ze(g),O=r*nt(m),B=r*Ze(m);let R,L,I,F;if((k>Qe||A>Qe)&&(R=s*nt(_),L=s*Ze(_),I=r*nt(y),F=r*Ze(y),h<et)){const H=bE(T,E,I,F,R,L,O,B);if(H){const G=T-H[0],U=E-H[1],$=R-H[0],Z=L-H[1],q=1/Ze(SC((G*$+U*Z)/(en(G*G+U*U)*en($*$+Z*Z)))/2),ie=en(H[0]*H[0]+H[1]*H[1]);M=gi(k,(r-ie)/(q-1)),w=gi(A,(s-ie)/(q+1))}}if(f<.001)a&&(a[3]||a[1])&&e.moveTo(t+T,i+E),u=!0;else if(w>Qe){const H=gi(b,w),G=gi(v,w),U=Ur(I,F,T,E,s,H,Number(d)),$=Ur(R,L,O,B,s,G,Number(d));w<A&&H===G?!a||a[0]?(e.moveTo(t+U.cx+U.x01,i+U.cy+U.y01),e.arc(t+U.cx,i+U.cy,w,it(U.y01,U.x01),it($.y01,$.x01),!d)):e.moveTo(t+U.cx+w*nt(it($.y01,$.x01)),i+U.cy+w*Ze(it($.y01,$.x01))):!a||a[0]?(e.moveTo(t+U.cx+U.x01,i+U.cy+U.y01),H>0&&e.arc(t+U.cx,i+U.cy,H,it(U.y01,U.x01),it(U.y11,U.x11),!d),e.arc(t,i,s,it(U.cy+U.y11,U.cx+U.x11),it($.cy+$.y11,$.cx+$.x11),!d),G>0&&e.arc(t+$.cx,i+$.cy,G,it($.y11,$.x11),it($.y01,$.x01),!d)):G>0?e.moveTo(t+$.cx+G*nt(it($.y01,$.x01)),i+$.cy+G*Ze(it($.y01,$.x01))):e.moveTo(t+R,i+s*Ze(_))}else!a||a[0]?(e.moveTo(t+T,i+E),e.arc(t,i,s,g,_,!d)):e.moveTo(t+s*nt(_),i+s*Ze(_));if(!(r>Qe)||p<.001)!a||a[1]?e.lineTo(t+O,i+B):e.moveTo(t+O,i+B),u=!0;else if(M>Qe){const H=gi(S,M),G=gi(x,M),U=Ur(O,B,R,L,r,-G,Number(d)),$=Ur(T,E,I,F,r,-H,Number(d));if(!a||a[1]?e.lineTo(t+U.cx+U.x01,i+U.cy+U.y01):e.moveTo(t+U.cx+U.x01,i+U.cy+U.y01),M<k&&H===G){const Z=it($.y01,$.x01);!a||a[2]?e.arc(t+U.cx,i+U.cy,M,it(U.y01,U.x01),Z,!d):e.moveTo(t+U.cx+nt(Z),i+U.cy+Ze(Z))}else!a||a[2]?(G>0&&e.arc(t+U.cx,i+U.cy,G,it(U.y01,U.x01),it(U.y11,U.x11),!d),e.arc(t,i,r,it(U.cy+U.y11,U.cx+U.x11),it($.cy+$.y11,$.cx+$.x11),d),H>0&&e.arc(t+$.cx,i+$.cy,H,it($.y11,$.x11),it($.y01,$.x01),!d)):H>0?e.moveTo(t+$.cx+H*nt(it($.y01,$.x01)),i+$.cy+H*Ze(it($.y01,$.x01))):e.moveTo(t+I,i+F)}else!a||a[1]?e.lineTo(t+O,i+B):e.moveTo(t+O,i+B),!a||a[2]?e.arc(t,i,r,m,y,d):e.moveTo(t+r*nt(y),i+r*Ze(y))}return a?a[3]&&e.lineTo(t+s*nt(o),i+s*Ze(o)):e.closePath(),u}class In{static GetCanvas(){try{return In.canvas||(In.canvas=Q.global.createCanvas({})),In.canvas}catch{return null}}static GetCtx(){if(!In.ctx){const e=In.GetCanvas();In.ctx=e.getContext("2d")}return In.ctx}}class Wa extends SD{static getInstance(){return Wa._instance||(Wa._instance=new Wa),Wa._instance}constructor(e=[],t=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=In.GetCanvas(),s=In.GetCtx();if(i.width=t,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const r=s.createLinearGradient(0,0,t,0);e.forEach(a=>{r.addColorStop(a[0],a[1])}),s.fillStyle=r,s.fillRect(0,0,t,1),this.rgbaSet=s.getImageData(0,0,t,1).data}getColor(e){const t=this.rgbaSet.slice(4*e,4*e+4);return`rgba(${t[0]}, ${t[1]}, ${t[2]}, ${t[3]/255})`}GetOrCreate(e,t,i,s,r=[],a=100){let o=`${e}${t}${i}${s}`;r.forEach(h=>o+=h.join()),o+=a;let l=this.dataMap.get(o);return l||(l={data:new Wa(r,a),timestamp:[]},this.addLimitedTimestamp(l,Date.now(),{}),this.dataMap.set(o,l)),this.clearCache(this.dataMap,this.cacheParams),l.data}}class Li{static GetSize(e){for(let t=0;t<Li.ImageSize.length;t++)if(Li.ImageSize[t]>=e)return Li.ImageSize[t];return e}static Get(e,t,i,s,r,a,o){const l=Li.GenKey(e,t,i,s,r),h=Li.cache[l];if(!h||h.length===0)return null;for(let d=0;d<h.length;d++)if(h[d].width>=a&&h[d].height>=o)return h[d].pattern;return null}static Set(e,t,i,s,r,a,o,l){const h=Li.GenKey(e,t,i,s,r);Li.cache[h]?Li.cache[h].push({width:o,height:l,pattern:a}):Li.cache[h]=[{width:o,height:l,pattern:a}]}static GenKey(e,t,i,s,r){return`${t},${i},${s},${r},${e.join()}`}}Li.cache={},Li.ImageSize=[20,40,80,160,320,640,1280,2560];function Lz(n,e,t,i){const{stops:s,startAngle:r,endAngle:a}=i;for(;t<0;)t+=Be;for(;t>Be;)t-=Be;if(t<r||t>a)return s[0].color;let o,l,h=(t-r)/(a-r);for(let d=0;d<s.length;d++)if(s[d].offset>=h){o=s[d-1],l=s[d];break}return h=(h-o.offset)/(l.offset-o.offset),Ya(o.color,l.color,h,!1)}function Iz(n,e,t,i,s,r,a,o,l){const h=Math.floor(180*s/Math.PI),d=In.GetCanvas(),u=In.GetCtx();if(!u)return null;const c=Li.GetSize(o),f=Li.GetSize(l);let p=Li.Get(e,t,i,r,a,c,f);if(p)return p;const g=Math.sqrt(Math.max(Math.max(Math.pow(t,2)+Math.pow(i,2),Math.pow(c-t,2)+Math.pow(i,2)),Math.max(Math.pow(c-t,2)+Math.pow(f-i,2),Math.pow(t,2)+Math.pow(f-i,2)))),_=h+1,m=s/Math.max(1,_-1),y=Wa.getInstance().GetOrCreate(t,i,c,f,e,_),b=2*Math.PI*g/360;d.width=c,d.height=f,u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,c,f),u.translate(t,i),u.rotate(r);for(let x=0,S=_-1;x<S&&!(r+x*m>a);x++){const A=y.getColor(x);u.beginPath(),u.rotate(m),u.moveTo(0,0),u.lineTo(g,-2*b),u.lineTo(g,0),u.fillStyle=A,u.closePath(),u.fill()}const v=u.getImageData(0,0,c,f);return d.width=v.width,d.height=v.height,u.putImageData(v,0,0),p=n.createPattern(d,"no-repeat"),p&&Li.Set(e,t,i,r,a,p,c,f),p}const vb=Symbol.for("ArcRenderContribution"),xb=Symbol.for("AreaRenderContribution"),Sb=Symbol.for("CircleRenderContribution"),vE=Symbol.for("GroupRenderContribution"),Ab=Symbol.for("ImageRenderContribution"),kb=Symbol.for("PathRenderContribution"),wb=Symbol.for("PolygonRenderContribution"),ed=Symbol.for("RectRenderContribution"),Mb=Symbol.for("SymbolRenderContribution"),Tb=Symbol.for("TextRenderContribution"),Wx=Symbol.for("InteractiveSubRenderContribution"),jA=["radius","startAngle","endAngle",...Sn];class Nd extends Ni{constructor(e={radius:1}){super(e),this.type="circle",this.numberType=y_}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:e,endAngle:t,radius:i}=this.attribute;return this._validNumber(e)&&this._validNumber(t)&&this._validNumber(i)}doUpdateAABBBounds(e){const t=se(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,s=Q.graphicService.updateCircleAABBBounds(i,se(this).circle,this._AABBBounds,e,this),{boundsPadding:r=t.boundsPadding}=i,a=mi(r);return a&&s.expand(a),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(e){return se(this).circle[e]}needUpdateTags(e){return super.needUpdateTags(e,jA)}needUpdateTag(e){return super.needUpdateTag(e,jA)}toCustomPath(){var e,t,i;const s=this.attribute,r=(e=s.radius)!==null&&e!==void 0?e:this.getDefaultAttribute("radius"),a=(t=s.startAngle)!==null&&t!==void 0?t:this.getDefaultAttribute("startAngle"),o=(i=s.endAngle)!==null&&i!==void 0?i:this.getDefaultAttribute("endAngle"),l=new Xt;return l.arc(0,0,r,a,o),l}clone(){return new Nd(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Nd.NOWORK_ANIMATE_ATTR}}Nd.NOWORK_ANIMATE_ATTR=Ci;function Dz(n){return new Nd(n)}function Cb(n,e={},t){t||(t=1);const{fontStyle:i=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=n;return(i?i+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*t+"px "+(o||"sans-serif")}function ir(n,e){return n==="end"||n==="right"?-e:n==="center"?-e/2:0}function nr(n,e,t,i=0){return n==="middle"?-e/2:n==="top"?0:n==="bottom"?i-e:n&&n!=="alphabetic"?0:(t||(t=e),-(e-t)/2-.79*t)}class Pb{constructor(e,t,i){this.fontFamily=e,this.textOptions=t,this.textMeasure=i}LayoutBBox(e,t,i){if(t==="left"||t==="start")e.xOffset=0;else if(t==="center")e.xOffset=e.width/-2;else{if(t!=="right"&&t!=="end")throw new Error("非法的textAlign");e.xOffset=-e.width}return e.yOffset=i==="top"?0:i==="middle"?e.height/-2:i==="alphabetic"?-.79*e.height:-e.height,e}GetLayout(e,t,i,s,r,a,o,l,h){const d=[],u=[t,i],c=[0,0];for(;e.length>0;){const{str:p}=this.textMeasure.clipTextWithSuffix(e,this.textOptions,t,o,l,h);d.push({str:p,width:this.textMeasure.measureTextWidth(p,this.textOptions)}),e=e.substring(p.length)}s==="left"||s==="start"||(s==="center"?c[0]=u[0]/-2:s!=="right"&&s!=="end"||(c[0]=-u[0])),r==="top"||(r==="middle"?c[1]=u[1]/-2:r==="bottom"&&(c[1]=-u[1]));const f={xOffset:c[0],yOffset:c[1],width:u[0],height:u[1]};return this.layoutWithBBox(f,d,s,r,a)}GetLayoutByLines(e,t,i,s,r="",a,o,l="end"){e=e.map(c=>c.toString());const h=[],d=[0,0];if(typeof o=="number"&&o!==1/0){let c;for(let f=0,p=e.length;f<p;f++)c=Math.min(this.textMeasure.measureTextWidth(e[f],this.textOptions),o),h.push({str:this.textMeasure.clipTextWithSuffix(e[f],this.textOptions,c,r,a,l).str,width:c});d[0]=o}else{let c,f;o=0;for(let p=0,g=e.length;p<g;p++)f=e[p],c=this.textMeasure.measureTextWidth(f,this.textOptions),o=Math.max(o,c),h.push({str:f,width:c});d[0]=o}d[1]=h.length*s,d[0]=h.reduce((c,f)=>Math.max(c,f.width),0);const u={xOffset:0,yOffset:0,width:d[0],height:d[1]};return this.LayoutBBox(u,t,i),this.layoutWithBBox(u,h,t,i,s)}layoutWithBBox(e,t,i,s,r){const a=[0,0],o=t.length*r;s==="top"||(s==="middle"?a[1]=(e.height-o)/2:s==="bottom"&&(a[1]=e.height-o));for(let l=0;l<t.length;l++)this.lineOffset(e,t[l],i,s,r,a);return{bbox:e,lines:t,fontFamily:this.fontFamily,fontSize:this.textOptions.fontSize,fontWeight:this.textOptions.fontWeight,lineHeight:r,textAlign:i,textBaseline:s}}lineOffset(e,t,i,s,r,a){return i==="left"||i==="start"?t.leftOffset=0:i==="center"?t.leftOffset=(e.width-t.width)/2:i!=="right"&&i!=="end"||(t.leftOffset=e.width-t.width),t.topOffset=(r-this.textOptions.fontSize)/2+.79*this.textOptions.fontSize+a[1],a[1]+=r,t}}const HA=["text","maxLineWidth","heightLimit","lineClamp","fontSize","fontFamily","fontWeight","ellipsis","lineHeight","direction","wordBreak","heightLimit","lineClamp",...Sn];let cd=class Js extends Ni{get font(){const e=se(this).text;return this._font||(this._font=Cb(this.attribute,e)),this._font}get clipedText(){var e;const t=this.attribute,i=se(this).text;if(!this.isSimplify())return;const{maxLineWidth:s=i.maxLineWidth}=t;return Number.isFinite(s)?(this.tryUpdateAABBBounds(),this.cache.clipedText):((e=t.text)!==null&&e!==void 0?e:i.text).toString()}get clipedWidth(){if(this.isSimplify())return this.tryUpdateAABBBounds(),this.cache.clipedWidth}get cliped(){const e=se(this).text,t=this.attribute;if(this.isMultiLine)return;const{maxLineWidth:i=e.maxLineWidth}=t;return!!Number.isFinite(i)&&(this.tryUpdateAABBBounds(),t.direction==="vertical"&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map(s=>s.text).join("")!==t.text.toString():this.clipedText!=null&&this.clipedText!==t.text.toString())}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&this.attribute.direction!=="vertical"}get isMultiLine(){return Array.isArray(this.attribute.text)||this.attribute.whiteSpace==="normal"}constructor(e={text:"",fontSize:16}){super(e),this.type="text",this.numberType=w_,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:e}=this.attribute;return W(e)?!e.every(t=>t==null||t===""):e!=null&&e!==""}doUpdateAABBBounds(){const e=se(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=this.attribute,i=Q.graphicService.updateTextAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=this.attribute,r=mi(s);return r&&i.expand(r),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(e){var t,i,s,r;const a=se(this).text,{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:d=a.fontSize,ellipsis:u=a.ellipsis,maxLineWidth:c,stroke:f=a.stroke,lineWidth:p=a.lineWidth,wordBreak:g=a.wordBreak,fontWeight:_=a.fontWeight,ignoreBuf:m=a.ignoreBuf,suffixPosition:y=a.suffixPosition,heightLimit:b=0,lineClamp:v}=this.attribute,x=(t=Bs(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))!==null&&t!==void 0?t:this.attribute.fontSize||a.fontSize,S=m?0:2;if(!this.shouldUpdateShape()&&(!((i=this.cache)===null||i===void 0)&&i.layoutData)){const R=this.cache.layoutData.bbox;return this._AABBBounds.set(R.xOffset,R.yOffset,R.xOffset+R.width,R.yOffset+R.height),f&&this._AABBBounds.expand(p/2),this._AABBBounds}const A=Q.graphicUtil.textMeasure,k=new Pb(o,{fontSize:d,fontWeight:_,fontFamily:o},A),w=W(e)?e.map(R=>R.toString()):[e.toString()],M=[],T=[0,0];let E=1/0;if(b>0&&(E=Math.max(Math.floor(b/x),1)),v&&(E=Math.min(E,v)),typeof c=="number"&&c!==1/0){if(c>0)for(let L=0;L<w.length;L++){const I=w[L];let F=!0;if(L===E-1){const G=k.textMeasure.clipTextWithSuffix(I,k.textOptions,c,u,!1,y);M.push({str:G.str,width:G.width});break}const H=k.textMeasure.clipText(I,k.textOptions,c,g==="break-word");if(I!==""&&H.str===""){if(u){const G=k.textMeasure.clipTextWithSuffix(I,k.textOptions,c,u,!1,y);H.str=(s=G.str)!==null&&s!==void 0?s:"",H.width=(r=G.width)!==null&&r!==void 0?r:0}else H.str="",H.width=0;F=!1}if(M.push({str:H.str,width:H.width}),H.str.length!==I.length){if(F){const G=I.substring(H.str.length);w.splice(L+1,0,G)}}}let R=0;M.forEach(L=>{R=Math.max(R,L.width)}),T[0]=R}else{let R,L,I=0;for(let F=0,H=w.length;F<H;F++){if(F===E-1){const G=k.textMeasure.clipTextWithSuffix(w[F],k.textOptions,c,u,!1,y);M.push({str:G.str,width:G.width}),I=Math.max(I,G.width);break}L=w[F],R=k.textMeasure.measureTextWidth(L,k.textOptions,g==="break-word"),I=Math.max(I,R),M.push({str:L,width:R})}T[0]=I}T[1]=M.length*(x+S);const O={xOffset:0,yOffset:0,width:T[0],height:T[1]};k.LayoutBBox(O,l,h);const B=k.layoutWithBBox(O,M,l,h,x);return this.cache.layoutData=B,this.clearUpdateShapeTag(),this._AABBBounds.set(O.xOffset,O.yOffset,O.xOffset+O.width,O.yOffset+O.height),f&&this._AABBBounds.expand(p/2),this._AABBBounds}updateSingallineAABBBounds(e){const t=se(this).text,{direction:i=t.direction}=this.attribute;return i==="horizontal"?this.updateHorizontalSinglelineAABBBounds(e):this.updateVerticalSinglelineAABBBounds(e)}updateMultilineAABBBounds(e){const t=se(this).text,{direction:i=t.direction}=this.attribute;return i==="horizontal"?this.updateHorizontalMultilineAABBBounds(e):this.updateVerticalMultilineAABBBounds(e)}updateHorizontalSinglelineAABBBounds(e){var t,i;const s=se(this).text,{wrap:r=s.wrap}=this.attribute;if(r)return this.updateWrapAABBBounds([e]);const a=Q.graphicUtil.textMeasure;let o,l;const h=this.attribute,{maxLineWidth:d=s.maxLineWidth,ellipsis:u=s.ellipsis,textAlign:c=s.textAlign,textBaseline:f=s.textBaseline,fontFamily:p=s.fontFamily,fontSize:g=s.fontSize,fontWeight:_=s.fontWeight,stroke:m=s.stroke,lineWidth:y=s.lineWidth,ignoreBuf:b=s.ignoreBuf,whiteSpace:v=s.whiteSpace,suffixPosition:x=s.suffixPosition}=h;if(v==="normal")return this.updateWrapAABBBounds(e);const S=b?0:Math.max(2,.075*g),A=h.fontSize||s.fontSize,k=(t=Bs(h.lineHeight,A))!==null&&t!==void 0?t:A+S;if(!this.shouldUpdateShape()&&this.cache){o=(i=this.cache.clipedWidth)!==null&&i!==void 0?i:0;const E=ir(c,o),O=nr(f,k,g);return this._AABBBounds.set(E,O,E+o,O+k),m&&this._AABBBounds.expand(y/2),this._AABBBounds}if(Number.isFinite(d)){if(u){const E=u===!0?s.ellipsis:u,O=a.clipTextWithSuffix(e.toString(),{fontSize:g,fontWeight:_,fontFamily:p},d,E,!1,x);l=O.str,o=O.width}else{const E=a.clipText(e.toString(),{fontSize:g,fontWeight:_,fontFamily:p},d,!1);l=E.str,o=E.width}this.cache.clipedText=l,this.cache.clipedWidth=o}else o=a.measureTextWidth(e.toString(),{fontSize:g,fontWeight:_,fontFamily:p}),this.cache.clipedText=e.toString(),this.cache.clipedWidth=o;this.clearUpdateShapeTag();const w=ir(c,o);let M=k;Q.global&&Q.global.isSafari()&&(M+=.2*g);const T=nr(f,M,g,S);return this._AABBBounds.set(w,T,w+o,T+M),m&&this._AABBBounds.expand(y/2),this._AABBBounds}getBaselineMapAlign(){return Js.baselineMapAlign}getAlignMapBaseline(){return Js.alignMapBaseline}updateVerticalSinglelineAABBBounds(e){var t,i,s;const r=se(this).text,a=Q.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,d=h?0:2,{maxLineWidth:u=r.maxLineWidth,ellipsis:c=r.ellipsis,fontSize:f=r.fontSize,fontWeight:p=r.fontWeight,fontFamily:g=r.fontFamily,stroke:_=r.stroke,lineWidth:m=r.lineWidth,verticalMode:y=r.verticalMode,suffixPosition:b=r.suffixPosition}=l,v=(t=Bs(l.lineHeight,l.fontSize||r.fontSize))!==null&&t!==void 0?t:(l.fontSize||r.fontSize)+d;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!y){const M=x;x=(i=Js.baselineMapAlign[S])!==null&&i!==void 0?i:"left",S=(s=Js.alignMapBaseline[M])!==null&&s!==void 0?s:"top"}if(!this.shouldUpdateShape()&&this.cache){o=this.cache.clipedWidth;const M=ir(x,o),T=nr(S,v,f);return this._AABBBounds.set(T,M,T+v,M+o),_&&this._AABBBounds.expand(m/2),this._AABBBounds}let A=[FA(e.toString())];if(Number.isFinite(u)){if(c){const M=c===!0?r.ellipsis:c,T=a.clipTextWithSuffixVertical(A[0],{fontSize:f,fontWeight:p,fontFamily:g},u,M,!1,b);A=[T.verticalList],o=T.width}else{const M=a.clipTextVertical(A[0],{fontSize:f,fontWeight:p,fontFamily:g},u,!1);A=[M.verticalList],o=M.width}this.cache.verticalList=A,this.cache.clipedWidth=o}else o=0,A[0].forEach(M=>{const T=M.direction===Xa.HORIZONTAL?f:a.measureTextWidth(M.text,{fontSize:f,fontWeight:p,fontFamily:g});o+=T,M.width=T}),this.cache.verticalList=A,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const k=ir(x,o),w=nr(S,v,f);return this._AABBBounds.set(w,k,w+v,k+o),_&&this._AABBBounds.expand(m/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(e){var t,i;const s=se(this).text,{wrap:r=s.wrap}=this.attribute;if(r)return this.updateWrapAABBBounds(e);const a=this.attribute,{fontFamily:o=s.fontFamily,textAlign:l=s.textAlign,textBaseline:h=s.textBaseline,fontSize:d=s.fontSize,fontWeight:u=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:f,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:_=s.whiteSpace,suffixPosition:m=s.suffixPosition}=a,y=(t=Bs(a.lineHeight,a.fontSize||s.fontSize))!==null&&t!==void 0?t:a.fontSize||s.fontSize;if(_==="normal")return this.updateWrapAABBBounds(e);if(!this.shouldUpdateShape()&&(!((i=this.cache)===null||i===void 0)&&i.layoutData)){const S=this.cache.layoutData.bbox;return this._AABBBounds.set(S.xOffset,S.yOffset,S.xOffset+S.width,S.yOffset+S.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=Q.graphicUtil.textMeasure,v=new Pb(o,{fontSize:d,fontWeight:u,fontFamily:o},b).GetLayoutByLines(e,l,h,y,c===!0?s.ellipsis:c||void 0,!1,f,m),{bbox:x}=v;return this.cache.layoutData=v,this.clearUpdateShapeTag(),this._AABBBounds.set(x.xOffset,x.yOffset,x.xOffset+x.width,x.yOffset+x.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var t,i,s;const r=se(this).text,a=Q.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,d=h?0:2,{maxLineWidth:u=r.maxLineWidth,ellipsis:c=r.ellipsis,fontFamily:f=r.fontFamily,fontSize:p=r.fontSize,fontWeight:g=r.fontWeight,stroke:_=r.stroke,lineWidth:m=r.lineWidth,verticalMode:y=r.verticalMode,suffixPosition:b=r.suffixPosition}=l,v=(t=Bs(l.lineHeight,l.fontSize||r.fontSize))!==null&&t!==void 0?t:(l.fontSize||r.fontSize)+d;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!y){const T=x;x=(i=Js.baselineMapAlign[S])!==null&&i!==void 0?i:"left",S=(s=Js.alignMapBaseline[T])!==null&&s!==void 0?s:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach(B=>{const R=B.reduce((L,I)=>L+I.width,0);o=Ji(R,o)});const T=ir(x,o),E=this.cache.verticalList.length*v,O=nr(S,E,p);return this._AABBBounds.set(O,T,O+E,T+o),_&&this._AABBBounds.expand(m/2),this._AABBBounds}const A=e.map(T=>FA(T.toString()));A.forEach((T,E)=>{if(Number.isFinite(u))if(c){const O=c===!0?r.ellipsis:c,B=a.clipTextWithSuffixVertical(T,{fontSize:p,fontWeight:g,fontFamily:f},u,O,!1,b);A[E]=B.verticalList,o=B.width}else{const O=a.clipTextVertical(T,{fontSize:p,fontWeight:g,fontFamily:f},u,!1);A[E]=O.verticalList,o=O.width}else o=0,T.forEach(O=>{const B=O.direction===Xa.HORIZONTAL?p:a.measureTextWidth(O.text,{fontSize:p,fontWeight:g,fontFamily:f});o+=B,O.width=B})}),this.cache.verticalList=A,this.clearUpdateShapeTag(),this.cache.verticalList.forEach(T=>{const E=T.reduce((O,B)=>O+B.width,0);o=Ji(E,o)});const k=ir(x,o),w=this.cache.verticalList.length*v,M=nr(S,w,p);return this._AABBBounds.set(M,k,M+w,k+o),_&&this._AABBBounds.expand(m/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(e){return se(this).text[e]}needUpdateTags(e,t=HA){return super.needUpdateTags(e,t)}needUpdateTag(e,t=HA){return super.needUpdateTag(e,t)}clone(){return new Js(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Js.NOWORK_ANIMATE_ATTR}};cd.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ci),cd.baselineMapAlign={top:"left",bottom:"right",middle:"center"},cd.alignMapBaseline={left:"top",right:"bottom",center:"middle"};function no(n){return new cd(n)}const Oc=["heightLimit","lineClamp"];class Vx extends cd{constructor(e){super(Object.assign(Object.assign({},e),{wrap:!0}))}_isValid(){const{text:e}=this.attribute;return W(e)?!e.every(t=>t==null||t===""):e!=null&&e!==""}updateMultilineAABBBounds(e){var t,i,s,r;const a=se(this).text,{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:d=a.fontSize,ellipsis:u=a.ellipsis,maxLineWidth:c,stroke:f=a.stroke,lineWidth:p=a.lineWidth,wordBreak:g=a.wordBreak,fontWeight:_=a.fontWeight,ignoreBuf:m=a.ignoreBuf,heightLimit:y=0,suffixPosition:b=a.suffixPosition,lineClamp:v}=this.attribute,x=(t=Bs(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))!==null&&t!==void 0?t:this.attribute.fontSize||a.fontSize,S=m?0:2;if(!this.shouldUpdateShape()&&(!((i=this.cache)===null||i===void 0)&&i.layoutData)){const R=this.cache.layoutData.bbox;return this._AABBBounds.set(R.xOffset,R.yOffset,R.xOffset+R.width,R.yOffset+R.height),f&&this._AABBBounds.expand(p/2),this._AABBBounds}const A=Q.graphicUtil.textMeasure,k=new Pb(o,{fontSize:d,fontWeight:_,fontFamily:o},A),w=e.map(R=>R.toString()),M=[],T=[0,0];let E=1/0;if(y>0&&(E=Math.max(Math.floor(y/x),1)),v&&(E=Math.min(E,v)),typeof c=="number"&&c!==1/0){if(c>0)for(let L=0;L<w.length;L++){const I=w[L];let F=!0;if(L===E-1){const G=k.textMeasure.clipTextWithSuffix(I,k.textOptions,c,u,!1,b);M.push({str:G.str,width:G.width});break}const H=k.textMeasure.clipText(I,k.textOptions,c,g==="break-word");if(I!==""&&H.str===""){if(u){const G=k.textMeasure.clipTextWithSuffix(I,k.textOptions,c,u,!1,b);H.str=(s=G.str)!==null&&s!==void 0?s:"",H.width=(r=G.width)!==null&&r!==void 0?r:0}else H.str="",H.width=0;F=!1}if(M.push({str:H.str,width:H.width}),H.str.length!==I.length){if(F){const G=I.substring(H.str.length);w.splice(L+1,0,G)}}}let R=0;M.forEach(L=>{R=Math.max(R,L.width)}),T[0]=R}else{let R,L,I=0;for(let F=0,H=w.length;F<H;F++){if(F===E-1){const G=k.textMeasure.clipTextWithSuffix(w[F],k.textOptions,c,u,!1,b);M.push({str:G.str,width:G.width}),I=Math.max(I,G.width);break}L=w[F],R=k.textMeasure.measureTextWidth(L,k.textOptions,g==="break-word"),I=Math.max(I,R),M.push({str:L,width:R})}T[0]=I}T[1]=M.length*(x+S);const O={xOffset:0,yOffset:0,width:T[0],height:T[1]};k.LayoutBBox(O,l,h);const B=k.layoutWithBBox(O,M,l,h,x);return this.cache.layoutData=B,this.clearUpdateShapeTag(),this._AABBBounds.set(O.xOffset,O.yOffset,O.xOffset+O.width,O.yOffset+O.height),f&&this._AABBBounds.expand(p/2),this._AABBBounds}needUpdateTags(e){for(let t=0;t<Oc.length;t++){const i=Oc[t];if(e.indexOf(i)!==-1)return!0}return super.needUpdateTags(e)}needUpdateTag(e){for(let t=0;t<Oc.length;t++)if(e===Oc[t])return!0;return super.needUpdateTag(e)}getNoWorkAnimateAttr(){return Vx.NOWORK_ANIMATE_ATTR}}function Fz(n){return new Vx(n)}class qt{bounds(e,t){if(oe(e)){const i=e/2;t.x1=-i,t.x2=i,t.y1=-i,t.y2=i}else t.x1=-e[0]/2,t.x2=e[0]/2,t.y1=-e[1]/2,t.y2=e[1]/2}}function GA(n,e,t,i,s){return s?n.arc(t,i,e,0,ei,!1,s):n.arc(t,i,e,0,ei),!1}class zz extends qt{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(e,t,i,s,r){return GA(e,t/2,i,s,r)}drawOffset(e,t,i,s,r,a){return GA(e,t/2+r,i,s,a)}drawToSvgPath(e,t,i,s){const r=e/2;return`M ${t-r}, ${i} a ${r},${r} 0 1,0 ${2*r},0 a ${r},${r} 0 1,0 -${2*r},0`}}const jz=new zz;function Hz(n,e,t,i,s){return n.moveTo(-3*e+t,-e+i,s),n.lineTo(-e+t,-e+i,s),n.lineTo(-e+t,-3*e+i,s),n.lineTo(e+t,-3*e+i,s),n.lineTo(e+t,-e+i,s),n.lineTo(3*e+t,-e+i,s),n.lineTo(3*e+t,e+i,s),n.lineTo(e+t,e+i,s),n.lineTo(e+t,3*e+i,s),n.lineTo(-e+t,3*e+i,s),n.lineTo(-e+t,e+i,s),n.lineTo(-3*e+t,e+i,s),n.closePath(),!0}function Gz(n,e,t,i,s,r){return n.moveTo(-3*e+t-s,-e+i-s,r),n.lineTo(-e+t-s,-e+i-s,r),n.lineTo(-e+t-s,-3*e+i-s,r),n.lineTo(e+t+s,-3*e+i-s,r),n.lineTo(e+t+s,-e+i-s,r),n.lineTo(3*e+t+s,-e+i-s,r),n.lineTo(3*e+t+s,e+i+s,r),n.lineTo(e+t+s,e+i+s,r),n.lineTo(e+t+s,3*e+i+s,r),n.lineTo(-e+t-s,3*e+i+s,r),n.lineTo(-e+t-s,e+i+s,r),n.lineTo(-3*e+t-s,e+i+s,r),n.closePath(),!0}class Wz extends qt{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(e,t,i,s,r){return Hz(e,t/6,i,s,r)}drawOffset(e,t,i,s,r,a){return Gz(e,t/6,i,s,r,a)}}const Vz=new Wz;function Ym(n,e,t,i,s){return n.moveTo(t,i-e,s),n.lineTo(e+t,i,s),n.lineTo(t,i+e,s),n.lineTo(t-e,i,s),n.closePath(),!0}class Nz extends qt{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(e,t,i,s,r){return Ym(e,t/2,i,s,r)}drawFitDir(e,t,i,s,r){return Ym(e,t/2,i,s,r)}drawOffset(e,t,i,s,r,a){return Ym(e,t/2+r,i,s,a)}}const Uz=new Nz;function WA(n,e,t,i){const s=2*e;return n.rect(t-e,i-e,s,s),!1}class $z extends qt{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(e,t,i,s){return WA(e,t/2,i,s)}drawOffset(e,t,i,s,r){return WA(e,t/2+r,i,s)}}const Yz=new $z;function Xz(n,e,t,i){return n.moveTo(t+e,e+i),n.lineTo(t-e,e+i),n.lineTo(t,i-e),n.closePath(),!0}function Kz(n,e,t,i,s){return n.moveTo(t+e+2*s,e+i+s),n.lineTo(t-e-2*s,e+i+s),n.lineTo(t,i-e-2*s),n.closePath(),!0}class Nx extends qt{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(e,t,i,s){return Xz(e,t/2,i,s)}drawOffset(e,t,i,s,r){return Kz(e,t/2,i,s,r)}}const qz=new Nx;class Zz extends Nx{constructor(){super(...arguments),this.type="triangle"}}const Jz=new Zz,xE=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Qz=Math.sin(ei/10)*xE,ej=-Math.cos(ei/10)*xE;function VA(n,e,t,i){const s=Qz*e,r=ej*e;n.moveTo(t,-e+i),n.lineTo(s+t,r+i);for(let a=1;a<5;++a){const o=ei*a/5,l=Math.cos(o),h=Math.sin(o);n.lineTo(h*e+t,-l*e+i),n.lineTo(l*s-h*r+t,h*s+l*r+i)}return n.closePath(),!0}class tj extends qt{constructor(){super(...arguments),this.type="star",this.pathStr="M4.51351666838205,0A4.51351666838205,4.51351666838205,0,1,1,-4.51351666838205,0A4.51351666838205,4.51351666838205,0,1,1,4.51351666838205,0"}draw(e,t,i,s){return VA(e,t/2,i,s)}drawOffset(e,t,i,s,r){return VA(e,t/2+r,i,s)}}const ij=new tj,nj=en(3);function NA(n,e,t,i){const s=e,r=s/nj,a=r/5,o=e;return n.moveTo(0+t,-s+i),n.lineTo(r/2+t,i),n.lineTo(a/2+t,i),n.lineTo(a/2+t,o+i),n.lineTo(-a/2+t,o+i),n.lineTo(-a/2+t,i),n.lineTo(-r/2+t,i),n.closePath(),!0}class sj extends qt{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(e,t,i,s){return NA(e,t/2,i,s)}drawOffset(e,t,i,s,r){return NA(e,t/2+r,i,s)}}const rj=new sj;function UA(n,e,t,i){const s=2*e;return n.moveTo(t,-e+i),n.lineTo(s/3/2+t,e+i),n.lineTo(-s/3/2+t,e+i),n.closePath(),!0}class aj extends qt{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(e,t,i,s){return UA(e,t/2,i,s)}drawOffset(e,t,i,s,r){return UA(e,t/2+r,i,s)}}const oj=new aj;function $A(n,e,t,i){return n.moveTo(-e+t,i),n.lineTo(t,e+i),!1}class lj extends qt{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(e,t,i,s){return $A(e,t/2,i,s)}drawOffset(e,t,i,s,r){return $A(e,t/2+r,i,s)}}const hj=new lj,En=-.5,Rn=en(3)/2,YA=1/en(12);function XA(n,e,t,i){const s=e/2,r=e*YA,a=s,o=e*YA+e,l=-a,h=o;return n.moveTo(s+t,r+i),n.lineTo(a+t,o+i),n.lineTo(l+t,h+i),n.lineTo(En*s-Rn*r+t,Rn*s+En*r+i),n.lineTo(En*a-Rn*o+t,Rn*a+En*o+i),n.lineTo(En*l-Rn*h+t,Rn*l+En*h+i),n.lineTo(En*s+Rn*r+t,En*r-Rn*s+i),n.lineTo(En*a+Rn*o+t,En*o-Rn*a+i),n.lineTo(En*l+Rn*h+t,En*h-Rn*l+i),n.closePath(),!1}class dj extends qt{constructor(){super(...arguments),this.type="wye",this.pathStr="M4.51351666838205,0A4.51351666838205,4.51351666838205,0,1,1,-4.51351666838205,0A4.51351666838205,4.51351666838205,0,1,1,4.51351666838205,0"}draw(e,t,i,s){return XA(e,t/2,i,s)}drawOffset(e,t,i,s,r){return XA(e,t/2+r,i,s)}}const uj=new dj;function cj(n,e,t,i){return n.moveTo(-e+t,i),n.lineTo(e+t,e+i),n.lineTo(e+t,i-e),n.closePath(),!0}function fj(n,e,t,i,s){return n.moveTo(-e+t-2*s,i),n.lineTo(e+t+s,e+i+2*s),n.lineTo(e+t+s,i-e-2*s),n.closePath(),!0}class pj extends qt{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(e,t,i,s){return cj(e,t/2,i,s)}drawOffset(e,t,i,s,r){return fj(e,t/2,i,s,r)}}const gj=new pj;function _j(n,e,t,i){return n.moveTo(t-e,e+i),n.lineTo(e+t,i),n.lineTo(t-e,i-e),n.closePath(),!0}function mj(n,e,t,i,s){return n.moveTo(t-e-s,e+i+2*s),n.lineTo(e+t+2*s,i),n.lineTo(t-e-s,i-e-2*s),n.closePath(),!0}class yj extends qt{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(e,t,i,s){return _j(e,t/2,i,s)}drawOffset(e,t,i,s,r){return mj(e,t/2,i,s,r)}}const bj=new yj;function vj(n,e,t,i){return n.moveTo(t-e,i-e),n.lineTo(t+e,i-e),n.lineTo(t,i+e),n.closePath(),!0}function xj(n,e,t,i,s){return n.moveTo(t-e-2*s,i-e-s),n.lineTo(t+e+2*s,i-e-s),n.lineTo(t,i+e+2*s),n.closePath(),!0}class Sj extends qt{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(e,t,i,s){return vj(e,t/2,i,s)}drawOffset(e,t,i,s,r){return xj(e,t/2,i,s,r)}}const Aj=new Sj,Eb=en(3);function KA(n,e,t,i){const s=e*Eb;return n.moveTo(t,i+-s/3*2),n.lineTo(e+t,i+s),n.lineTo(t-e,i+s),n.closePath(),!0}class kj extends Nx{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(e,t,i,s){return KA(e,t/2/Eb,i,s)}drawOffset(e,t,i,s,r){return KA(e,t/2/Eb+r,i,s)}}const wj=new kj;function qA(n,e,t,i){const s=2*e;return n.moveTo(e+t,i-s),n.lineTo(t-e,i),n.lineTo(e+t,s+i),!0}class Mj extends qt{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(e,t,i,s){return qA(e,t/4,i,s)}drawOffset(e,t,i,s,r){return qA(e,t/4+r,i,s)}}const Tj=new Mj;function ZA(n,e,t,i){const s=2*e;return n.moveTo(t-e,i-s),n.lineTo(t+e,i),n.lineTo(t-e,s+i),!0}class Cj extends qt{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(e,t,i,s){return ZA(e,t/4,i,s)}drawOffset(e,t,i,s,r){return ZA(e,t/4+r,i,s)}}const Pj=new Cj;function JA(n,e,t,i){const s=2*e;return n.moveTo(t-s,i+e),n.lineTo(t,i-e),n.lineTo(t+s,i+e),!0}class Ej extends qt{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(e,t,i,s){return JA(e,t/4,i,s)}drawOffset(e,t,i,s,r){return JA(e,t/4+r,i,s)}}const Rj=new Ej;function QA(n,e,t,i){const s=2*e;return n.moveTo(t-s,i-e),n.lineTo(t,i+e),n.lineTo(t+s,i-e),!0}class Oj extends qt{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(e,t,i,s){return QA(e,t/4,i,s)}drawOffset(e,t,i,s,r){return QA(e,t/4+r,i,s)}}const Bj=new Oj;function e1(n,e,t,i,s){return n.moveTo(t,i-e),n.lineTo(t,i+e),!0}class Lj extends qt{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(e,t,i,s,r){return e1(e,t/2,i,s)}drawOffset(e,t,i,s,r,a){return e1(e,t/2+r,i,s)}drawToSvgPath(e,t,i,s){const r=e/2;return`M ${t}, ${i-r} L ${t},${i+r}`}}const Ij=new Lj;function t1(n,e,t,i,s){return n.moveTo(t-e,i),n.lineTo(t+e,i),!0}class Dj extends qt{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(e,t,i,s,r){return t1(e,t/2,i,s)}drawOffset(e,t,i,s,r,a){return t1(e,t/2+r,i,s)}drawToSvgPath(e,t,i,s){const r=e/2;return`M ${t-r}, ${i} L ${t+r},${i}`}}const Fj=new Dj;function i1(n,e,t,i,s){return n.moveTo(t-e,i-e),n.lineTo(t+e,i+e),n.moveTo(t+e,i-e),n.lineTo(t-e,i+e),!0}class zj extends qt{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(e,t,i,s,r){return i1(e,t/2,i,s)}drawOffset(e,t,i,s,r,a){return i1(e,t/2+r,i,s)}drawToSvgPath(e,t,i,s){const r=e/2;return`M ${t-r}, ${i-r} L ${t+r},${i+r} M ${t+r}, ${i-r} L ${t-r},${i+r}`}}const jj=new zj;function n1(n,e,t,i){return n.rect(t-e[0]/2,i-e[1]/2,e[0],e[1]),!1}function s1(n,e,t,i){const s=e,r=e/2;return n.rect(t-s/2,i-r/2,s,r),!1}class Hj extends qt{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(e,t,i,s){return oe(t)?s1(e,t,i,s):n1(e,t,i,s)}drawOffset(e,t,i,s,r){return oe(t)?s1(e,t+2*r,i,s):n1(e,[t[0]+2*r,t[1]+2*r],i,s)}}const Gj=new Hj,Lh=new St;class r1{constructor(e,t,i=!1){this.pathStr="",this.type=e,W(t)?this.svgCache=t:this.path=t,this.isSvg=i}drawOffset(e,t,i,s,r,a,o){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach(l=>{e.beginPath(),lr(l.path.commandList,e,i,s,t,t),o&&o(l.path,l.attribute)}),!1):(lr(this.path.commandList,e,i,s,t+r,t+r),!1)}draw(e,t,i,s,r,a){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach(o=>{e.beginPath(),lr(o.path.commandList,e,i,s,t,t),a&&a(o.path,o.attribute)}),!1):(lr(this.path.commandList,e,i,s,t,t),!1)}bounds(e,t){if(this.isSvg)return this.svgCache?(t.clear(),void this.svgCache.forEach(({path:i})=>{Lh.x1=i.bounds.x1*e,Lh.y1=i.bounds.y1*e,Lh.x2=i.bounds.x2*e,Lh.y2=i.bounds.y2*e,t.union(Lh)})):void 0;this.path.bounds&&(t.x1=this.path.bounds.x1*e,t.y1=this.path.bounds.y1*e,t.x2=this.path.bounds.x2*e,t.y2=this.path.bounds.y2*e)}}const Wj=[jz,Vz,Uz,Yz,wj,Jz,ij,rj,oj,hj,uj,gj,bj,qz,Aj,Tj,Pj,Rj,Bj,Gj,Ij,Fj,jj],$f={};Wj.forEach(n=>{$f[n.type]=n});const Vj={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"},Bc=new St,a1=["symbolType","size",...Sn];let Ud=class Bo extends Ni{constructor(e={symbolType:"circle"}){super(e),this.type="symbol",this.numberType=k_}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:e}=this.attribute;return W(e)?e.length===2&&e.every(this._validNumber):this._validNumber(e)}doUpdateParsedPath(){const e=se(this).symbol;let{symbolType:t=e.symbolType}=this.attribute,i=$f[t];if(i)return this._parsedPath=i,i;if(i=Bo.userSymbolMap[t],i)return this._parsedPath=i,i;if(t=Vj[t]||t,vz(t)===!0){const l=new __,{svg:h}=l.parse(t);if(!h)return null;const d=W(h.path)?h.path:[h.path];Bc.clear();const u=[];d.forEach(g=>{const _=new Xt().fromString(g.d),m={};Cz.forEach(y=>{g[y]&&(m[fE[y]]=g[y])}),u.push({path:_,attribute:m}),Bc.union(_.bounds)});const c=Bc.width(),f=Bc.height(),p=1/Ji(c,f);return u.forEach(g=>g.path.transform(0,0,p,p)),this._parsedPath=new r1(t,u,!0),Bo.userSymbolMap[t]=this._parsedPath,this._parsedPath}const s=new Xt().fromString(t),r=s.bounds.width(),a=s.bounds.height(),o=1/Ji(r,a);return s.transform(0,0,o,o),this._parsedPath=new r1(t,s),Bo.userSymbolMap[t]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(e){const t=se(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,s=Q.graphicService.updateSymbolAABBBounds(i,se(this).symbol,this._AABBBounds,e,this),{boundsPadding:r=t.boundsPadding}=i,a=mi(r);return a&&s.expand(a),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(e){return se(this).symbol[e]}needUpdateTags(e){return super.needUpdateTags(e,a1)}needUpdateTag(e){return super.needUpdateTag(e,a1)}toCustomPath(){const e=this.getParsedPath(),t=this.attribute.size,i=W(t)?t:[t,t];return e.path?new Xt().fromCustomPath2D(e.path,0,0,i[0],i[1]):new Xt().fromString(e.pathStr,0,0,i[0],i[1])}clone(){return new Bo(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Bo.NOWORK_ANIMATE_ATTR}};Ud.userSymbolMap={},Ud.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ci);function M_(n){return new Ud(n)}const o1=["segments","points","curveType",...Sn];let SE=class Rb extends Ni{constructor(e={}){super(e),this.type="line",this.numberType=Vu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:e,segments:t}=this.attribute;return t?t.length!==0:!!e&&!(e.length<=1)}_interpolate(e,t,i,s,r){e==="points"&&(r.points=Px(i,s,t))}doUpdateAABBBounds(){const e=se(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=this.attribute,i=Q.graphicService.updateLineAABBBounds(t,se(this).line,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,r=mi(s);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(e){return se(this).line[e]}needUpdateTags(e){return super.needUpdateTags(e,o1)}needUpdateTag(e){return super.needUpdateTag(e,o1)}toCustomPath(){const e=this.attribute,t=new Xt,i=e.segments,s=r=>{if(r&&r.length){let a=!0;r.forEach(o=>{o.defined!==!1&&(a?t.moveTo(o.x,o.y):t.lineTo(o.x,o.y),a=!1)})}};return i&&i.length?i.forEach(r=>{s(r.points)}):e.points&&s(e.points),t}clone(){return new Rb(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Rb.NOWORK_ANIMATE_ATTR}};SE.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ci);function Ux(n){return new SE(n)}const l1=["width","x1","y1","height","cornerRadius",...Sn];class Ql extends Ni{constructor(e){super(e),this.type="rect",this.numberType=A_}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const e=se(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=this.attribute,i=Q.graphicService.updateRectAABBBounds(t,se(this).rect,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,r=mi(s);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(e){return se(this).rect[e]}needUpdateTags(e){return super.needUpdateTags(e,l1)}needUpdateTag(e){return super.needUpdateTag(e,l1)}toCustomPath(){const e=this.attribute,{x:t,y:i,width:s,height:r}=JP(e),a=new Xt;return a.moveTo(t,i),a.rect(t,i,s,r),a}clone(){return new Ql(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ql.NOWORK_ANIMATE_ATTR}}Ql.NOWORK_ANIMATE_ATTR=Ci;function eh(n){return new Ql(n)}const h1=[[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 T_ extends Ql{constructor(e){super(e),this.type="rect3d",this.numberType=Ix}findFace(){const e={polygons:[],vertices:[],edges:[]},t=se(this).rect3d,{x1:i,y1:s,x:r,y:a,length:o=gi(t.width,t.height)}=this.attribute;let{width:l,height:h}=this.attribute;l=l??i-r,h=h??s-a;for(let d=0;d<h1.length;d++){const u=h1[d];e.vertices.push([u[0]*l,u[1]*h,u[2]*o])}return e.polygons.push({polygon:[0,1,5,4],normal:[0,-1,0]}),e.polygons.push({polygon:[2,3,7,6],normal:[0,1,0]}),e.polygons.push({polygon:[4,7,3,0],normal:[-1,0,0]}),e.polygons.push({polygon:[1,2,6,5],normal:[1,0,0]}),e.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),e.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),e.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]],e}getNoWorkAnimateAttr(){return T_.NOWORK_ANIMATE_ATTR}}T_.NOWORK_ANIMATE_ATTR=Ci;function AE(n){return new T_(n)}class $d extends Ni{constructor(e){super(e),this.type="glyph",this.numberType=b_,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(e){this.detachSubGraphic(),this.subGraphic=e,e.forEach(t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)}),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach(e=>{e.glyphHost=null,Object.setPrototypeOf(e.attribute,{})})}getSubGraphic(){return this.subGraphic}onInit(e){this._onInit=e}onUpdate(e){this._onUpdate=e}isValid(){return!0}setAttribute(e,t,i,s){super.setAttribute(e,t,i,s),this.subGraphic.forEach(r=>{r.addUpdateShapeAndBoundsTag(),r.addUpdatePositionTag()})}setAttributes(e,t=!1,i){super.setAttributes(e,t,i),this.subGraphic.forEach(s=>{s.addUpdateShapeAndBoundsTag(),s.addUpdatePositionTag()})}translate(e,t){return super.translate(e,t),this.subGraphic.forEach(i=>{i.addUpdatePositionTag(),i.addUpdateBoundTag()}),this}translateTo(e,t){return super.translateTo(e,t),this.subGraphic.forEach(i=>{i.addUpdatePositionTag(),i.addUpdateBoundTag()}),this}scale(e,t,i){return super.scale(e,t,i),this.subGraphic.forEach(s=>{s.addUpdatePositionTag(),s.addUpdateBoundTag()}),this}scaleTo(e,t){return super.scaleTo(e,t),this.subGraphic.forEach(i=>{i.addUpdatePositionTag(),i.addUpdateBoundTag()}),this}rotate(e){return super.rotate(e),this.subGraphic.forEach(t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()}),this}rotateTo(e){return super.rotate(e),this.subGraphic.forEach(t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()}),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=Q.graphicService.updateGlyphAABBBounds(this.attribute,se(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),e}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(e){return!1}needUpdateTag(e){return!1}useStates(e,t){var i;if(!e.length)return void this.clearStates(t);if(!(((i=this.currentStates)===null||i===void 0?void 0:i.length)!==e.length||e.some((a,o)=>this.currentStates[o]!==a)))return;const s={},r=this.subGraphic.map(()=>({}));e.forEach(a=>{var o;const l=this.glyphStateProxy?this.glyphStateProxy(a,e):this.glyphStates[a];l&&(Object.assign(s,l.attributes),!((o=l.subAttributes)===null||o===void 0)&&o.length&&r.forEach((h,d)=>{Object.assign(h,l.subAttributes[d])}))}),this.subGraphic.forEach((a,o)=>{a.updateNormalAttrs(r[o]),a.applyStateAttrs(r[o],e,t)}),this.updateNormalAttrs(s),this.currentStates=e,this.applyStateAttrs(s,e,t)}clearStates(e){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach(t=>{t.applyStateAttrs(t.normalAttrs,this.currentStates,e,!0),t.normalAttrs=null}),this.applyStateAttrs(this.normalAttrs,this.currentStates,e,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const e=new $d(Object.assign({},this.attribute));return e.setSubGraphic(this.subGraphic.map(t=>t.clone())),e}getNoWorkAnimateAttr(){return $d.NOWORK_ANIMATE_ATTR}}$d.NOWORK_ANIMATE_ATTR=Ci;function kE(n){return new $d(n)}class Nj{constructor(e,t,i,s,r,a,o,l,h,d,u,c,f,p){this.left=e,this.top=t,this.width=i,this.height=s,this.actualHeight=0,this.bottom=t+s,this.right=e+i,this.ellipsis=r,this.wordBreak=a,this.verticalDirection=o,this.lines=[],this.globalAlign=l,this.globalBaseline=h,this.layoutDirection=d,this.directionKey=Mx[this.layoutDirection],this.isWidthMax=u,this.isHeightMax=c,this.singleLine=f,p?(p.clear(),this.icons=p):this.icons=new Map}draw(e,t){const{width:i,height:s}=this.getActualSize(),r=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let a=this.isHeightMax?Math.min(this.height,s):this.height||s||0;a=Math.min(a,s);let o=0;switch(this.globalBaseline){case"top":o=0;break;case"middle":o=-a/2;break;case"bottom":o=-a}let l=0;switch(this.globalAlign){case"left":l=0;break;case"center":l=-r/2;break;case"right":l=-r}let h=this[this.directionKey.height];this.singleLine&&(h=this.lines[0].height+1);let d=!1;if(this.verticalDirection==="middle")if(this.actualHeight>=h&&h!==0)for(let u=0;u<this.lines.length;u++){const{top:c,height:f}=this.lines[u];if(c+f<this[this.directionKey.top]||c+f>this[this.directionKey.top]+h)return d;let p=!1;this.ellipsis&&this.lines[u+1]&&this.lines[u+1].top+this.lines[u+1].height>this[this.directionKey.top]+h&&(p=!0,d=!0),this.lines[u].draw(e,p,this.lines[u][this.directionKey.left]+l,this.lines[u][this.directionKey.top]+o,t)}else{const u=Math.floor((h-this.actualHeight)/2);this.layoutDirection==="vertical"?l+=u:o+=u;for(let c=0;c<this.lines.length;c++)this.lines[c].draw(e,!1,this.lines[c][this.directionKey.left]+l,this.lines[c][this.directionKey.top]+o,t)}else if(this.verticalDirection==="bottom"&&this.layoutDirection!=="vertical")for(let u=0;u<this.lines.length;u++){const{top:c,height:f}=this.lines[u],p=h-this.lines[u].top-this.lines[u].height;if(h===0)this.lines[u].draw(e,!1,l,p+o,t);else{if(p+f>this[this.directionKey.top]+h||p<this[this.directionKey.top])return d;{let g=!1;this.ellipsis&&this.lines[u+1]&&p-this.lines[u+1].height<this[this.directionKey.top]&&(g=!0,d=!0),this.lines[u].draw(e,g,l,p+o,t)}}}else{this.verticalDirection==="bottom"&&this.layoutDirection==="vertical"&&this.singleLine&&this.isWidthMax&&(l+=this.lines[0].height+1);for(let u=0;u<this.lines.length;u++){this.verticalDirection==="bottom"&&this.layoutDirection==="vertical"&&(l-=this.lines[u].height+this.lines[u].top);const{top:c,height:f}=this.lines[u];if(h===0)this.lines[u].draw(e,!1,this.lines[u][this.directionKey.left]+l,this.lines[u][this.directionKey.top]+o,t);else{if(c+f<this[this.directionKey.top]||c+f>this[this.directionKey.top]+h)return d;{let p=!1;this.ellipsis&&this.lines[u+1]&&this.lines[u+1].top+this.lines[u+1].height>this[this.directionKey.top]+h&&(p=!0,d=!0),this.lines[u].draw(e,p,this.lines[u][this.directionKey.left]+l,this.lines[u][this.directionKey.top]+o,t)}}}}return d}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let e=0,t=0;for(let i=0;i<this.lines.length;i++){const s=this.lines[i];s.actualWidth>e&&(e=s.actualWidth),t+=s.height}return{width:this.layoutDirection==="vertical"?t:e,height:this.layoutDirection==="vertical"?e:t}}getActualSizeWidthEllipsis(){let e=0,t=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let r=this[this.directionKey.height];if(this.singleLine&&(r=this.lines[0].height+1),this.verticalDirection==="middle")if(this.actualHeight>=r&&r!==0)for(let a=0;a<this.lines.length;a++){const{top:o,height:l}=this.lines[a];if(!(o+l<this[this.directionKey.top]||o+l>this[this.directionKey.top]+r))if(this.ellipsis&&this.lines[a+1]&&this.lines[a+1].top+this.lines[a+1].height>this[this.directionKey.top]+r){const h=this.lines[a].getWidthWithEllips();h>e&&(e=h),t+=this.lines[a].height}else this.lines[a].actualWidth>e&&(e=this.lines[a].actualWidth),t+=this.lines[a].height}else{Math.floor((r-this.actualHeight)/2);for(let a=0;a<this.lines.length;a++)this.lines[a].actualWidth>e&&(e=this.lines[a].actualWidth),t+=this.lines[a].height}else if(this.verticalDirection==="bottom")for(let a=0;a<this.lines.length;a++){const{top:o,height:l}=this.lines[a],h=r-this.lines[a].top-this.lines[a].height;if(r===0)this.lines[a].actualWidth>e&&(e=this.lines[a].actualWidth),t+=this.lines[a].height;else if(!(h+l>this[this.directionKey.top]+r||h<this[this.directionKey.top]))if(this.ellipsis&&this.lines[a+1]&&h-this.lines[a+1].height<this[this.directionKey.top]){const d=this.lines[a].getWidthWithEllips();d>e&&(e=d),t+=this.lines[a].height}else this.lines[a].actualWidth>e&&(e=this.lines[a].actualWidth),t+=this.lines[a].height}else for(let a=0;a<this.lines.length;a++){const{top:o,height:l}=this.lines[a];if(r===0)this.lines[a].actualWidth>e&&(e=this.lines[a].actualWidth),t+=this.lines[a].height;else if(!(o+l<this[this.directionKey.top]||o+l>this[this.directionKey.top]+r))if(this.ellipsis&&this.lines[a+1]&&this.lines[a+1].top+this.lines[a+1].height>this[this.directionKey.top]+r){const h=this.lines[a].getWidthWithEllips();h>e&&(e=h),t+=this.lines[a].height}else this.lines[a].actualWidth>e&&(e=this.lines[a].actualWidth),t+=this.lines[a].height}return{width:this.layoutDirection==="vertical"?t:e,height:this.layoutDirection==="vertical"?e:t}}}class Yd{constructor(e,t,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Bs(i.lineHeight,this.fontSize);this.lineHeight=typeof s=="number"?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:r,height:a,descent:o,width:l}=Wo(e,i);let h=0,d=0,u=0;this.height>a&&(h=(this.height-a)/2,d=Math.ceil(h),u=Math.floor(h)),this.textBaseline==="top"?(this.ascent=h,this.descent=a-h):this.textBaseline==="bottom"?(this.ascent=a-h,this.descent=h):this.textBaseline==="middle"?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=r+d,this.descent=o+u),this.length=e.length,this.width=l||0,this.text=e||"",this.newLine=t||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,i.direction==="vertical"&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:e}=Wo(this.text,this.character);this.width=e,this.direction==="vertical"&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(e,t,i,s,r){let a=this.text,o=this.left+i;t+=this.top;let l=this.direction;if(this.verticalEllipsis)a="...",l="vertical",t-=this.ellipsisWidth/2;else{if(this.ellipsis==="hide")return;if(this.ellipsis==="add")a+="...",r==="right"&&(o-=this.ellipsisWidth);else if(this.ellipsis==="replace"){const h=hb(a,(l==="vertical"?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,a.length-1);if(a=a.slice(0,h),a+="...",r==="right"){const{width:d}=Wo(this.text.slice(h),this.character);l==="vertical"||(o-=this.ellipsisWidth-d)}}}switch(this.character.script){case"super":t-=this.ascent*(1/3);break;case"sub":t+=this.descent/2}l==="vertical"&&(e.save(),e.rotateAbout(Math.PI/2,o,t),e.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),e.translate(o,t),o=0,t=0),this.character.stroke&&(g3(e,this.character),e.strokeText(a,o,t)),p3(e,this.character),this.character.fill&&e.fillText(a,o,t),this.character.fill&&(typeof this.character.lineThrough=="boolean"||typeof this.character.underline=="boolean"?(this.character.underline&&e.fillRect(o,1+t,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&e.fillRect(o,1+t-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):this.character.textDecoration==="underline"?e.fillRect(o,1+t,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):this.character.textDecoration==="line-through"&&e.fillRect(o,1+t-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),l==="vertical"&&e.restore()}getWidthWithEllips(e){let t=this.text;const i=e==="vertical"?this.height:this.width;if(this.ellipsis==="hide")return i;if(this.ellipsis==="add")return i+this.ellipsisWidth;if(this.ellipsis==="replace"){const s=hb(t,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,t.length-1);t=t.slice(0,s),t+="...";const{width:r}=Wo(this.text.slice(s),this.character);return i+this.ellipsisWidth-r}return i}}function Uj(n,e){const t=n.text.slice(0,e),i=n.text.slice(e);return[new Yd(t,n.newLine,n.character),new Yd(i,!0,n.character)]}const d1=["width","height","image",...Sn];class th extends Ni{constructor(e){super(e),this.type="image",this.numberType=v_,this.loadImage(this.attribute.image)}get width(){var e;return(e=this.attribute.width)!==null&&e!==void 0?e:0}set width(e){this.attribute.width===e&&(this.attribute.width=e,this.addUpdateShapeAndBoundsTag())}get height(){var e;return(e=this.attribute.height)!==null&&e!==void 0?e:0}set height(e){this.attribute.height===e&&(this.attribute.height=e,this.addUpdateShapeAndBoundsTag())}get repeatX(){var e;return(e=this.attribute.repeatX)!==null&&e!==void 0?e:"no-repeat"}set repeatX(e){this.attribute.repeatX===e&&(this.attribute.repeatX=e)}get repeatY(){var e;return(e=this.attribute.repeatY)!==null&&e!==void 0?e:"no-repeat"}set repeatY(e){this.attribute.repeatY===e&&(this.attribute.repeatY=e)}get image(){return this.attribute.image}set image(e){e!==this.attribute.image&&(this.attribute.image=e,this.loadImage(this.attribute.image))}imageLoadSuccess(e,t,i){super.imageLoadSuccess(e,t,()=>{this.successCallback&&this.successCallback()})}imageLoadFail(e,t){super.imageLoadFail(e,()=>{this.failCallback&&this.failCallback()})}setAttributes(e,t,i){return e.image&&this.loadImage(e.image),super.setAttributes(e,t,i)}setAttribute(e,t,i,s){return e==="image"&&this.loadImage(t),super.setAttribute(e,t,i,s)}doUpdateAABBBounds(){const e=se(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=this.attribute,i=Q.graphicService.updateImageAABBBounds(t,se(this).image,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,r=mi(s);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(e){return Gd[e]}needUpdateTags(e){return super.needUpdateTags(e,d1)}needUpdateTag(e){return super.needUpdateTag(e,d1)}clone(){return new th(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return th.NOWORK_ANIMATE_ATTR}}th.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Ci);function $x(n){return new th(n)}class sr extends th{constructor(e){if(super(e),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],e.backgroundShowMode==="always"&&(this._hovered=!0),e.margin){const t=mi(e.margin);this._marginArray=typeof t=="number"?[t,t,t,t]:t}this.onBeforeAttributeUpdate=(t,i,s)=>{if(W(s)&&s.indexOf("margin")!==-1||s==="margin")if(i.margin){const r=mi(i.margin);this._marginArray=typeof r=="number"?[r,r,r,r]:r}else this._marginArray=[0,0,0,0]}}get width(){var e;return((e=this.attribute.width)!==null&&e!==void 0?e:0)+this._marginArray[1]+this._marginArray[3]}get height(){var e;return((e=this.attribute.height)!==null&&e!==void 0?e:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:e=Gd.width,height:t=Gd.height}=this.attribute,{backgroundWidth:i=e,backgroundHeight:s=t}=this.attribute,r=(i-e)/2,a=(s-t)/2;return this._AABBBounds.expand([0,2*r,2*a,0]),this._AABBBounds}setHoverState(e){this.attribute.backgroundShowMode==="hover"&&this._hovered!==e&&(this._hovered=e)}}class $j{constructor(e,t,i,s,r,a,o,l){this.left=e,this.width=t,this.baseline=i,this.ascent=s,this.descent=r,this.top=i-s,this.paragraphs=a.map(d=>d),this.textAlign=(this.paragraphs[0]instanceof sr?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=o,this.directionKey=Mx[this.direction],this.actualWidth=0;let h=0;this.paragraphs.forEach((d,u)=>{if(u===0&&d instanceof Yd){const c=f3.exec(d.text);(c==null?void 0:c.index)!==0&&(d.text=d.text.slice(c==null?void 0:c.index),d.updateWidth())}this.actualWidth+=d[this.directionKey.width],h=Math.max(d[this.directionKey.height],h)}),this.height=h,this.blankWidth=l?0:this.width-this.actualWidth,this.calcOffset(t,l)}calcOffset(e,t){const i=this.directionKey,s=this.height;let r=this.left,a=0;if(this.actualWidth<e&&!t)switch(this.textAlign){case"right":r=e-this.actualWidth;break;case"center":r=(e-this.actualWidth)/2;break;case"justify":this.paragraphs.length<2?r=(e-this.actualWidth)/2:a=(e-this.actualWidth)/(this.paragraphs.length-1)}this.paragraphs.map(function(o){o instanceof sr?(o["_"+i.x]=r,r+=o[i.width]+a,o["_"+i.y]=o.attribute.textBaseline==="top"?0:o.attribute.textBaseline==="bottom"?s-o.height:(s-o.height)/2):(o[i.left]=r,r+=o[i.width]+a)})}draw(e,t,i,s,r){if(t){let a=0;for(let o=this.paragraphs.length-1;o>=0;o--){const l=this.paragraphs[o];if(l instanceof sr)break;if(this.direction==="vertical"&&l.direction!=="vertical"){l.verticalEllipsis=!0;break}const{width:h}=Wo("...",l.character),d=h||0;if(d<=this.blankWidth+a){l.ellipsis="add";break}if(d<=this.blankWidth+a+l.width){l.ellipsis="replace",l.ellipsisWidth=d,l.ellipsisOtherParagraphWidth=this.blankWidth+a;break}l.ellipsis="hide",a+=l.width}}this.paragraphs.map((a,o)=>{if(a instanceof sr)return a.setAttributes({x:i+a._x,y:s+a._y}),void r(a,e,i+a._x,s+a._y,this.ascent);a.draw(e,s+this.ascent,i,o===0,this.textAlign)})}getWidthWithEllips(){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof sr)break;const{width:r}=Wo("...",s.character),a=r||0;if(a<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=a;break}if(a<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=a,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let t=0;return this.paragraphs.map((i,s)=>{t+=i instanceof sr?i.width:i.getWidthWithEllips(this.direction)}),t}}class Yj{constructor(e){this.frame=e,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=e.layoutDirection,this.directionKey=Mx[this.direction]}store(e){if(e instanceof sr){this.frame.icons.set(e.richtextId,e),this.lineBuffer.push(e),this.lineWidth+=e[this.directionKey.width];let t=0,i=0;e.attribute.textBaseline==="top"?(t=0,i=e.height):e.attribute.textBaseline==="bottom"?(t=e.height,i=0):(t=e.height/2,i=e.height/2),this.maxAscent=Math.max(this.maxAscent,t),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(e),e.text.length!==0?(this.lineWidth+=e[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,e.ascent),this.maxDescent=Math.max(this.maxDescent,e.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,e.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,e.descent))}send(){if(this.lineBuffer.length===0)return;const e=this.maxAscent===0?this.maxAscentForBlank:this.maxAscent,t=this.maxDescent===0?this.maxDescentForBlank:this.maxDescent,i=new $j(this.frame.left,this[this.directionKey.width],this.y+e,e,t,this.lineBuffer,this.direction,this.direction==="horizontal"?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(e){e instanceof sr?this.direction==="horizontal"&&this.width===0||this.direction==="vertical"&&this.height===0||this.lineWidth+e[this.directionKey.width]<=this[this.directionKey.width]?this.store(e):this.lineBuffer.length===0?(this.store(e),this.send()):(this.send(),this.deal(e)):typeof this.width!="number"||this.width<0||(e.newLine&&this.send(),e.text.length!==0&&(this.direction==="horizontal"&&this.width===0||this.direction==="vertical"&&this.height===0||this.lineWidth+e[this.directionKey.width]<=this[this.directionKey.width]?this.store(e):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(e)):this.cut(e)))}cut(e){const t=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(t/e[this.directionKey.width]*e.length)||0,s=hb(e.text,t,e.character,i,this.frame.wordBreak==="break-word");if(s!==0){const[r,a]=Uj(e,s);this.store(r),this.deal(a)}else this.lineBuffer.length!==0&&(this.send(),this.deal(e))}}const u1=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Sn];class Xd extends Ni{constructor(e){super(e),this.type="richtext",this._currentHoverIcon=null,this.numberType=Dx}get width(){var e;return(e=this.attribute.width)!==null&&e!==void 0?e:Ms.width}set width(e){this.attribute.width!==e&&(this.attribute.width=e,this.addUpdateShapeAndBoundsTag())}get height(){var e;return(e=this.attribute.height)!==null&&e!==void 0?e:Ms.height}set height(e){this.attribute.height!==e&&(this.attribute.height=e,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(e){this.attribute.maxWidth!==e&&(this.attribute.maxWidth=e,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(e){this.attribute.maxHeight!==e&&(this.attribute.maxHeight=e,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var e;return(e=this.attribute.ellipsis)!==null&&e!==void 0?e:Ms.ellipsis}set ellipsis(e){this.attribute.ellipsis!==e&&(this.attribute.ellipsis=e,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var e;return(e=this.attribute.wordBreak)!==null&&e!==void 0?e:Ms.wordBreak}set wordBreak(e){this.attribute.wordBreak!==e&&(this.attribute.wordBreak=e,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var e;return(e=this.attribute.verticalDirection)!==null&&e!==void 0?e:Ms.verticalDirection}set verticalDirection(e){this.attribute.verticalDirection!==e&&(this.attribute.verticalDirection=e,this.addUpdateShapeAndBoundsTag())}get textAlign(){var e;return(e=this.attribute.textAlign)!==null&&e!==void 0?e:Ms.textAlign}set textAlign(e){this.attribute.textAlign!==e&&(this.attribute.textAlign=e,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var e;return(e=this.attribute.textBaseline)!==null&&e!==void 0?e:Ms.textBaseline}set textBaseline(e){this.attribute.textBaseline!==e&&(this.attribute.textBaseline=e,this.addUpdateShapeAndBoundsTag())}get textConfig(){var e;return(e=this.attribute.textConfig)!==null&&e!==void 0?e:Ms.textConfig}set textConfig(e){this.attribute.textConfig=e,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const e=se(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=this.attribute,i=Q.graphicService.updateRichTextAABBBounds(t,se(this).richtext,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,r=mi(s);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(e){return Ms[e]}needUpdateTags(e){return super.needUpdateTags(e,u1)}needUpdateTag(e){return super.needUpdateTag(e,u1)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}doUpdateFrameCache(){var e;const{textConfig:t=[],maxWidth:i,maxHeight:s,width:r,height:a,ellipsis:o,wordBreak:l,verticalDirection:h,textAlign:d,textBaseline:u,layoutDirection:c,singleLine:f}=this.attribute,p=[];for(let x=0;x<t.length;x++)if("image"in t[x]){const S=t[x],A=S.id&&this._frameCache&&this._frameCache.icons&&this._frameCache.icons.get(S.id);if(A)p.push(A);else{const k=new sr(S);k.successCallback=()=>{var w;this.addUpdateBoundTag(),(w=this.stage)===null||w===void 0||w.renderNextFrame()},k.richtextId=S.id,p.push(k)}}else if(t[x].text.includes(`
  16. `)){const S=t[x].text.split(`
  17. `);for(let A=0;A<S.length;A++)p.push(new Yd(S[A],A!==0,t[x]))}else p.push(new Yd(t[x].text,!1,t[x]));const g=typeof i=="number"&&Number.isFinite(i)&&i>0,_=typeof s=="number"&&Number.isFinite(s)&&s>0,m=typeof r=="number"&&Number.isFinite(r)&&r>0&&(!g||r<=i),y=typeof a=="number"&&Number.isFinite(a)&&a>0&&(!_||a<=s),b=new Nj(0,0,(m?r:g?i:0)||0,(y?a:_?s:0)||0,o,l,h,d,u,c||"horizontal",!m&&g,!y&&_,f||!1,(e=this._frameCache)===null||e===void 0?void 0:e.icons),v=new Yj(b);for(let x=0;x<p.length;x++)v.deal(p[x]);if(v.send(),!(b.layoutDirection==="horizontal"?m:y)){const x=b.getActualSizeWidthEllipsis();let S=b.layoutDirection==="horizontal"?x.width:x.height;(b.layoutDirection==="horizontal"?g:_)&&(S=Math.min(S,b.layoutDirection==="horizontal"?i:s)),b.lines.forEach(function(A){A.calcOffset(S,!1)})}this._frameCache=b}clone(){return new Xd(Object.assign({},this.attribute))}setStage(e,t){super.setStage(e,t),this.getFrameCache().icons.forEach(i=>{i.setStage(e,t)})}bindIconEvent(){this.addEventListener("pointermove",e=>{var t,i,s,r,a;const o=this.pickIcon(e.global);o&&o===this._currentHoverIcon||(o?((t=this._currentHoverIcon)===null||t===void 0||t.setHoverState(!1),this._currentHoverIcon=o,this._currentHoverIcon.setHoverState(!0),(i=this.stage)===null||i===void 0||i.setCursor(o.attribute.cursor),(s=this.stage)===null||s===void 0||s.renderNextFrame()):!o&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,(r=this.stage)===null||r===void 0||r.setCursor(),(a=this.stage)===null||a===void 0||a.renderNextFrame()))}),this.addEventListener("pointerleave",e=>{var t,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,(t=this.stage)===null||t===void 0||t.setCursor(),(i=this.stage)===null||i===void 0||i.renderNextFrame())})}pickIcon(e){const t=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let r;return t.icons.forEach(a=>{var o,l;a.AABBBounds.containsPoint({x:e.x-i,y:e.y-s})&&(r=a,r.globalX=((o=r.attribute.x)!==null&&o!==void 0?o:0)+i,r.globalY=((l=r.attribute.y)!==null&&l!==void 0?l:0)+s)}),r}getNoWorkAnimateAttr(){return Xd.NOWORK_ANIMATE_ATTR}}Xd.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ci);function wE(n){return new Xd(n)}const c1=["path","customPath",...Sn];class Kd extends Ni{constructor(e){super(e),this.type="path",this.numberType=x_}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:e}=this.attribute;return e!=null&&e!==""}getParsedPathShape(){const e=se(this).path;if(!this.valid)return e.path;const t=this.attribute;return t.path instanceof Xt?t.path:(C(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Xt?this.cache:e.path)}doUpdateAABBBounds(){const e=se(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=this.attribute,i=Q.graphicService.updatePathAABBBounds(t,se(this).path,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,r=mi(s);return r&&i.expand(r),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const e=this.attribute;ae(e.path,!0)?this.cache=new Xt().fromString(e.path):e.customPath&&(this.cache=new Xt,e.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(e){return se(this).path[e]}needUpdateTags(e){return super.needUpdateTags(e,c1)}needUpdateTag(e){return super.needUpdateTag(e,c1)}toCustomPath(){return new Xt().fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Kd(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kd.NOWORK_ANIMATE_ATTR}}Kd.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ci);function ME(n){return new Kd(n)}const f1=["segments","points","curveType",...Sn];class qd extends Ni{constructor(e){super(e),this.type="area",this.numberType=Wu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:e,segments:t}=this.attribute;return t?t.length!==0:!!e&&e.length!==0}doUpdateAABBBounds(){const e=se(this).area;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=this.attribute,i=Q.graphicService.updateAreaAABBBounds(t,se(this).area,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,r=mi(s);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(e,t,i,s,r){e==="points"&&(r.points=Px(i,s,t))}getDefaultAttribute(e){return se(this).area[e]}needUpdateTags(e){return super.needUpdateTags(e,f1)}needUpdateTag(e){return super.needUpdateTag(e,f1)}toCustomPath(){const e=new Xt,t=this.attribute,i=t.segments,s=r=>{if(r&&r.length){let a=!0;const o=[];if(r.forEach(l=>{var h,d;l.defined!==!1&&(a?e.moveTo(l.x,l.y):e.lineTo(l.x,l.y),o.push({x:(h=l.x1)!==null&&h!==void 0?h:l.x,y:(d=l.y1)!==null&&d!==void 0?d:l.y}),a=!1)}),o.length){for(let l=o.length-1;l>=0;l--)e.lineTo(o[l].x,o[l].y);e.closePath()}}};return t.points?s(t.points):i&&i.length&&i.forEach(r=>{s(r.points)}),e}clone(){return new qd(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return qd.NOWORK_ANIMATE_ATTR}}qd.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ci);function TE(n){return new qd(n)}const p1=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Sn];class ih extends Ni{constructor(e){super(e),this.type="arc",this.numberType=m_}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:e,endAngle:t,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(e)&&this._validNumber(t)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const e=se(this).arc,{cornerRadius:t=e.cornerRadius,outerRadius:i=e.outerRadius,innerRadius:s=e.innerRadius}=this.attribute;if(t===0||t==="0%")return 0;const r=Math.abs(i-s);return Math.min(oe(t,!0)?t:r*parseFloat(t)/100,r/2)}getParsedAngle(){const e=se(this).arc;let{startAngle:t=e.startAngle,endAngle:i=e.endAngle}=this.attribute;const{cap:s=e.cap}=this.attribute,r=i-t>=0?1:-1,a=i-t;if(t=vD(t),i=t+a,s&&Ve(a)<Be-Qe){let o=1,l=1;s.length&&(o=Number(s[0]),l=Number(s[1]));const{outerRadius:h=e.outerRadius,innerRadius:d=e.innerRadius}=this.attribute,u=Math.abs(h-d)/2,c=u/h;if(u>Qe&&h>Qe)return{startAngle:t-r*c*o,endAngle:i+r*c*l,sc:r*c*o,ec:r*c*l}}return{startAngle:t,endAngle:i}}getParsePadAngle(e,t){const i=se(this).arc,{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius,padAngle:a=i.padAngle}=this.attribute,{padRadius:o=en(s*s+r*r)}=this.attribute,l=Ve(t-e);let h=e,d=t,u=e,c=t;const f=a/2;let p=l,g=l;if(f>Qe&&o>Qe){const _=t>e?1:-1;let m=SS(Number(o)/r*Ze(f)),y=SS(Number(o)/s*Ze(f));return(p-=2*m)>Qe?(m*=_,u+=m,c-=m):(p=0,u=c=(e+t)/2),(g-=2*y)>Qe?(y*=_,h+=y,d-=y):(g=0,h=d=(e+t)/2),{outerStartAngle:h,outerEndAngle:d,innerStartAngle:u,innerEndAngle:c,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:h,outerEndAngle:d,innerStartAngle:u,innerEndAngle:c,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(e){const t=se(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,s=Q.graphicService.updateArcAABBBounds(i,se(this).arc,this._AABBBounds,e,this),{boundsPadding:r=t.boundsPadding}=i,a=mi(r);return a&&s.expand(a),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(e){return super.needUpdateTags(e,p1)}needUpdateTag(e){return super.needUpdateTag(e,p1)}getDefaultAttribute(e){return se(this).arc[e]}toCustomPath(){const e=this.attribute,{startAngle:t,endAngle:i}=this.getParsedAngle();let s=e.innerRadius,r=e.outerRadius;const a=Ve(i-t),o=i>t;if(r<s){const h=r;r=s,s=h}const l=new Xt;if(r<=Qe)l.moveTo(0,0);else if(a>=Be-Qe)l.moveTo(0+r*nt(t),0+r*Ze(t)),l.arc(0,0,r,t,i,!o),s>Qe&&(l.moveTo(0+s*nt(i),0+s*Ze(i)),l.arc(0,0,s,i,t,o));else{const h=r*nt(t),d=r*Ze(t),u=s*nt(i),c=s*Ze(i);l.moveTo(0+h,0+d),l.arc(0,0,r,t,i,!o),l.lineTo(0+u,0+c),l.arc(0,0,s,i,t,o),l.closePath()}return l}clone(){return new ih(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ih.NOWORK_ANIMATE_ATTR}}ih.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ci);function Yx(n){return new ih(n)}class C_ extends ih{constructor(e){super(e),this.type="arc3d",this.numberType=Gu}doUpdateAABBBounds(){const e=se(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=this.attribute,i=Q.graphicService.updateArc3dAABBBounds(t,se(this).polygon,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,r=mi(s);return r&&i.expand(r),this.clearUpdateBoundTag(),this._AABBBounds}getNoWorkAnimateAttr(){return C_.NOWORK_ANIMATE_ATTR}}C_.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ci);function CE(n){return new C_(n)}const g1=["points","cornerRadius",...Sn];class nh extends Ni{constructor(e){super(e),this.type="polygon",this.numberType=S_}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:e}=this.attribute;return e&&e.length>=2}doUpdateAABBBounds(){const e=se(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=this.attribute,i=Q.graphicService.updatePolygonAABBBounds(t,se(this).polygon,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,r=mi(s);return r&&i.expand(r),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(e,t,i,s,r){e==="points"&&(r.points=Px(i,s,t))}getDefaultAttribute(e){return se(this).polygon[e]}needUpdateTags(e){return super.needUpdateTags(e,g1)}needUpdateTag(e){return super.needUpdateTag(e,g1)}toCustomPath(){const e=this.attribute.points,t=new Xt;return e.forEach((i,s)=>{s===0?t.moveTo(i.x,i.y):t.lineTo(i.x,i.y)}),t.closePath(),t}clone(){return new nh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nh.NOWORK_ANIMATE_ATTR}}nh.NOWORK_ANIMATE_ATTR=Ci;function PE(n){return new nh(n)}class P_ extends nh{constructor(e){super(e),this.type="pyramid3d",this.numberType=Lx}doUpdateAABBBounds(){const e=se(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=this.attribute,i=Q.graphicService.updatePyramid3dAABBBounds(t,se(this).polygon,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,r=mi(s);return r&&i.expand(r),this.clearUpdateBoundTag(),this._AABBBounds}findFace(){const{points:e}=this.attribute,t=e.map((o,l)=>{const h=l===3?e[0]:e[l+1],d=o.x-h.x;return d===0?0:(o.y-h.y)/d}),i=e.map(o=>({p:o,d:0}));let s=!1,r=0;for(let o=0;o<t.length-1;o++){for(let l=o+1;l<t.length;l++){if(t[o]===t[l]){s=!0;const h=wt.distancePP(i[o].p,i[o+1].p);i[o].d=h,i[o+1].d=h,r=Ji(r,h);const d=wt.distancePP(i[l].p,i[l+1].p);i[l].d=d,i[l+1].d=d,r=Ji(r,d)}if(s)break}if(s)break}for(let o=e.length-1;o>=0;o--){const l=e[o];i.unshift({p:l,d:0})}for(let o=0;o<e.length;o++){const l=(r-i[o+e.length].d)/2;i[o].d+=l,i[o+e.length].d+=l}const a={polygons:[],vertices:[],edges:[]};return i.forEach(o=>{a.vertices.push([o.p.x,o.p.y,o.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()&&this.attribute.points.length===4}getNoWorkAnimateAttr(){return P_.NOWORK_ANIMATE_ATTR}}P_.NOWORK_ANIMATE_ATTR=Ci;function EE(n){return new P_(n)}class Xj extends xh{constructor(e){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=e}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(e=!0){if(this.shouldUpdateGlobalMatrix()){const t=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f):this._globalTransMatrix=t.clone(),this.doUpdateGlobalMatrix(),e&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const e=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(e.a,e.b,e.c,e.d,e.e,e.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 Kj(n){return new Xj(n)}class td{updateBounds(e,t,i,s){const{outerBorder:r,shadowBlur:a=t.shadowBlur}=e;if(r){const o=t.outerBorder,{distance:l=o.distance,lineWidth:h=o.lineWidth}=r;i.expand(l+(a+h)/2)}return i}}class qj extends td{updateBounds(e,t,i,s){const{outerBorder:r,shadowBlur:a=t.shadowBlur,strokeBoundsBuffer:o=t.strokeBoundsBuffer}=e;if(r){const l=t.outerBorder,{distance:h=l.distance,lineWidth:d=l.lineWidth}=r;uf(i,h+(a+d)/2,!0,o)}return i}}function _1(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}class Zj{constructor(){this.pools=[]}allocate(e,t,i,s,r,a){if(!this.pools.length)return new Ft(e,t,i,s,r,a);const o=this.pools.pop();return o.a=e,o.b=t,o.c=i,o.d=s,o.e=r,o.f=a,o}allocateByObj(e){if(!this.pools.length)return new Ft(e.a,e.b,e.c,e.d,e.e,e.f);const t=this.pools.pop();return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f,t}free(e){this.pools.push(e)}get length(){return this.pools.length}release(...e){this.pools=[]}}class E_{constructor(){this.pools=[]}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}allocate(){if(!this.pools.length)return _1();const e=this.pools.pop();return E_.identity(e),e}allocateByObj(e){let t;t=this.pools.length?this.pools.pop():_1();for(let i=0;i<t.length;i++)t[i]=e[i];return t}free(e){e&&this.pools.push(e)}get length(){return this.pools.length}release(...e){this.pools=[]}}const Vn=new Zj,lt=new E_;var Jj=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},Qj=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},eH=function(n,e){return function(t,i){e(t,i,n)}};function tH(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function iH(n,e,t){const i=Math.sin(t),s=Math.cos(t),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],d=e[9],u=e[10],c=e[11];return e!==n&&(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[4]=r*s+h*i,n[5]=a*s+d*i,n[6]=o*s+u*i,n[7]=l*s+c*i,n[8]=h*s-r*i,n[9]=d*s-a*i,n[10]=u*s-o*i,n[11]=c*s-l*i,n}function nH(n,e,t){const i=Math.sin(t),s=Math.cos(t),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],d=e[9],u=e[10],c=e[11];return e!==n&&(n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[0]=r*s-h*i,n[1]=a*s-d*i,n[2]=o*s-u*i,n[3]=l*s-c*i,n[8]=r*i+h*s,n[9]=a*i+d*s,n[10]=o*i+u*s,n[11]=l*i+c*s,n}function sH(n,e,t){const i=Math.sin(t),s=Math.cos(t),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],d=e[5],u=e[6],c=e[7];return e!==n&&(n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[0]=r*s+h*i,n[1]=a*s+d*i,n[2]=o*s+u*i,n[3]=l*s+c*i,n[4]=h*s-r*i,n[5]=d*s-a*i,n[6]=u*s-o*i,n[7]=c*s-l*i,n}function Ih(n,e,t){const i=t[0],s=t[1],r=t[2];let a,o,l,h,d,u,c,f,p,g,_,m;return e===n?(n[12]=e[0]*i+e[4]*s+e[8]*r+e[12],n[13]=e[1]*i+e[5]*s+e[9]*r+e[13],n[14]=e[2]*i+e[6]*s+e[10]*r+e[14],n[15]=e[3]*i+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],d=e[4],u=e[5],c=e[6],f=e[7],p=e[8],g=e[9],_=e[10],m=e[11],n[0]=a,n[1]=o,n[2]=l,n[3]=h,n[4]=d,n[5]=u,n[6]=c,n[7]=f,n[8]=p,n[9]=g,n[10]=_,n[11]=m,n[12]=a*i+d*s+p*r+e[12],n[13]=o*i+u*s+g*r+e[13],n[14]=l*i+c*s+_*r+e[14],n[15]=h*i+f*s+m*r+e[15]),n}function Ob(n,e){n[0]=e.a,n[1]=e.b,n[2]=0,n[3]=0,n[4]=e.c,n[5]=e.d,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=e.e,n[13]=e.f,n[14]=0,n[15]=1}function rH(n,e,t){const i=t[0],s=t[1],r=t[2];return n[0]=e[0]*i,n[1]=e[1]*i,n[2]=e[2]*i,n[3]=e[3]*i,n[4]=e[4]*s,n[5]=e[5]*s,n[6]=e[6]*s,n[7]=e[7]*s,n[8]=e[8]*r,n[9]=e[9]*r,n[10]=e[10]*r,n[11]=e[11]*r,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}function Nu(n,e,t){const i=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],d=e[7],u=e[8],c=e[9],f=e[10],p=e[11],g=e[12],_=e[13],m=e[14],y=e[15];let b=t[0],v=t[1],x=t[2],S=t[3];return n[0]=b*i+v*o+x*u+S*g,n[1]=b*s+v*l+x*c+S*_,n[2]=b*r+v*h+x*f+S*m,n[3]=b*a+v*d+x*p+S*y,b=t[4],v=t[5],x=t[6],S=t[7],n[4]=b*i+v*o+x*u+S*g,n[5]=b*s+v*l+x*c+S*_,n[6]=b*r+v*h+x*f+S*m,n[7]=b*a+v*d+x*p+S*y,b=t[8],v=t[9],x=t[10],S=t[11],n[8]=b*i+v*o+x*u+S*g,n[9]=b*s+v*l+x*c+S*_,n[10]=b*r+v*h+x*f+S*m,n[11]=b*a+v*d+x*p+S*y,b=t[12],v=t[13],x=t[14],S=t[15],n[12]=b*i+v*o+x*u+S*g,n[13]=b*s+v*l+x*c+S*_,n[14]=b*r+v*h+x*f+S*m,n[15]=b*a+v*d+x*p+S*y,n}function RE(n,e,t){var i;const{x:s=t.x,y:r=t.y,z:a=t.z,dx:o=t.dx,dy:l=t.dy,dz:h=t.dz,scaleX:d=t.scaleX,scaleY:u=t.scaleY,scaleZ:c=t.scaleZ,alpha:f=t.alpha,beta:p=t.beta,angle:g=t.angle,anchor3d:_=e.attribute.anchor,anchor:m}=e.attribute,y=[0,0,0];if(_){if(typeof _[0]=="string"){const b=parseFloat(_[0])/100,v=e.AABBBounds;y[0]=v.x1+(v.x2-v.x1)*b}else y[0]=_[0];if(typeof _[1]=="string"){const b=parseFloat(_[1])/100,v=e.AABBBounds;y[1]=v.x1+(v.x2-v.x1)*b}else y[1]=_[1];y[2]=(i=_[2])!==null&&i!==void 0?i:0}if(tH(n),Ih(n,n,[s+o,r+l,a+h]),Ih(n,n,[y[0],y[1],y[2]]),iH(n,n,p),nH(n,n,f),Ih(n,n,[-y[0],-y[1],y[2]]),rH(n,n,[d,u,c]),g){const b=lt.allocate(),v=[0,0];if(m){if(typeof _[0]=="string"){const x=parseFloat(_[0])/100,S=e.AABBBounds;v[0]=S.x1+(S.x2-S.x1)*x}else v[0]=_[0];if(typeof _[1]=="string"){const x=parseFloat(_[1])/100,S=e.AABBBounds;v[1]=S.x1+(S.x2-S.x1)*x}else v[1]=_[1]}Ih(b,b,[v[0],v[1],0]),sH(b,b,g),Ih(b,b,[-v[0],-v[1],0]),Nu(n,n,b)}}function aH(n){const{alpha:e,beta:t}=n.attribute;return e||t}let Bb=class{constructor(n){this.creator=n,this.hooks={onAttributeUpdate:new _n(["graphic"]),onSetStage:new _n(["graphic","stage"]),onRemove:new _n(["graphic"]),onRelease:new _n(["graphic"]),onAddIncremental:new _n(["graphic","group","stage"]),onClearIncremental:new _n(["graphic","group","stage"]),beforeUpdateAABBBounds:new _n(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new _n(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new St,this.tempAABBBounds2=new St,this._rectBoundsContribitions=[new td],this._symbolBoundsContribitions=[new qj],this._circleBoundsContribitions=[new td],this._arcBoundsContribitions=[new td],this._pathBoundsContribitions=[new td]}onAttributeUpdate(n){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(n)}onSetStage(n,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(n,e)}onRemove(n){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(n)}onRelease(n){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(n)}onAddIncremental(n,e,t){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(n,e,t)}onClearIncremental(n,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(n,e)}beforeUpdateAABBBounds(n,e,t,i){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(n,e,t,i)}afterUpdateAABBBounds(n,e,t,i,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(n,e,t,i,s)}updatePathProxyAABBBounds(n,e){const t=typeof e.pathProxy=="function"?e.pathProxy(e.attribute):e.pathProxy;if(!t)return!1;const i=new PP(n);return lr(t.commandList,i,0,0),!0}updateRectAABBBounds(n,e,t,i){if(!this._validCheck(n,e,t,i))return t;if(!this.updatePathProxyAABBBounds(t,i)){let{width:a,height:o}=n;const{x1:l,y1:h,x:d,y:u}=n;a=a??l-d,o=o??h-u,t.set(0,0,a||0,o||0)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(t.x1,t.y1,t.x2,t.y2),r.setValue(t.x1,t.y1,t.x2,t.y2),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach(a=>{a.updateBounds(n,e,s,i),t.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}),this.transformAABBBounds(n,t,e,!1,i),t}updateGroupAABBBounds(n,e,t,i){const{width:s,height:r,path:a,clip:o=e.clip}=n;a&&a.length?a.forEach(d=>{t.union(d.AABBBounds)}):s!=null&&r!=null&&t.set(0,0,s,r),o||i.forEachChildren(d=>{t.union(d.AABBBounds)});const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(t.x1,t.y1,t.x2,t.y2),h.setValue(t.x1,t.y1,t.x2,t.y2),this.transformAABBBounds(n,t,e,!1,i),t}updateGlyphAABBBounds(n,e,t,i){return this._validCheck(n,e,t,i)&&i.getSubGraphic().forEach(s=>{t.union(s.AABBBounds)}),t}updateRichTextAABBBounds(n,e,t,i){if(!this._validCheck(n,e,t,i)||!i)return t;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=n;if(s>0&&r>0)t.set(0,0,s,r);else{const p=i.getFrameCache(),{width:g,height:_}=p.getActualSize();let m=s||g||0,y=r||_||0;y=typeof o=="number"&&y>o?o:y||0,m=typeof a=="number"&&m>a?a:m||0,t.set(0,0,m,y)}let d=0;switch(h){case"top":d=0;break;case"middle":d=-t.height()/2;break;case"bottom":d=-t.height()}let u=0;switch(l){case"left":u=0;break;case"center":u=-t.width()/2;break;case"right":u=-t.width()}t.translate(u,d);const c=this.tempAABBBounds1,f=this.tempAABBBounds2;return c.setValue(t.x1,t.y1,t.x2,t.y2),f.setValue(t.x1,t.y1,t.x2,t.y2),this.transformAABBBounds(n,t,e,!1,i),t}updateTextAABBBounds(n,e,t,i){if(!this._validCheck(n,e,t,i)||!i)return t;const{text:s=e.text}=i.attribute;Array.isArray(s)?i.updateMultilineAABBBounds(s):i.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(t.x1,t.y1,t.x2,t.y2),a.setValue(t.x1,t.y1,t.x2,t.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:d=e.strokeBoundsBuffer}=n;if(h){const u=h/Math.abs(o+l);uf(r,u,!0,d),t.union(r)}return this.combindShadowAABBBounds(t,i),jy(t,t,i.transMatrix),t}updatePathAABBBounds(n,e,t,i){if(!this._validCheck(n,e,t,i))return t;this.updatePathProxyAABBBounds(t,i)||this.updatePathAABBBoundsImprecise(n,e,t,i);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(t.x1,t.y1,t.x2,t.y2),r.setValue(t.x1,t.y1,t.x2,t.y2),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach(o=>{o.updateBounds(n,e,s,i),t.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)});const{lineJoin:a=e.lineJoin}=n;return this.transformAABBBounds(n,t,e,a==="miter",i),t}updatePathAABBBoundsImprecise(n,e,t,i){if(!i)return t;const s=i.getParsedPathShape();return t.union(s.getBounds()),t}updatePyramid3dAABBBounds(n,e,t,i){if(!i)return t;const s=i.stage;if(!s||!s.camera)return t;i.findFace().vertices.forEach(o=>{const l=o[0],h=o[1];t.add(l,h)});const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(t.x1,t.y1,t.x2,t.y2),a.setValue(t.x1,t.y1,t.x2,t.y2),this.transformAABBBounds(n,t,e,!1,i),t}updateArc3dAABBBounds(n,e,t,i){if(!i)return t;const s=i.stage;if(!s||!s.camera)return t;const{outerRadius:r=e.outerRadius,height:a=0}=n,o=r+a;t.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(t.x1,t.y1,t.x2,t.y2),h.setValue(t.x1,t.y1,t.x2,t.y2),this.transformAABBBounds(n,t,e,!1,i),t}updatePolygonAABBBounds(n,e,t,i){if(!this._validCheck(n,e,t,i))return t;this.updatePathProxyAABBBounds(t,i)||this.updatePolygonAABBBoundsImprecise(n,e,t,i);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(t.x1,t.y1,t.x2,t.y2),r.setValue(t.x1,t.y1,t.x2,t.y2);const{lineJoin:a=e.lineJoin}=n;return this.transformAABBBounds(n,t,e,a==="miter",i),t}updatePolygonAABBBoundsImprecise(n,e,t,i){const{points:s=e.points}=n;return s.forEach(r=>{t.add(r.x,r.y)}),t}updateLineAABBBounds(n,e,t,i){if(!this._validCheck(n,e,t,i))return t;this.updatePathProxyAABBBounds(t,i)||(n.segments?this.updateLineAABBBoundsBySegments(n,e,t,i):this.updateLineAABBBoundsByPoints(n,e,t,i));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(t.x1,t.y1,t.x2,t.y2),r.setValue(t.x1,t.y1,t.x2,t.y2);const{lineJoin:a=e.lineJoin}=n;return this.transformAABBBounds(n,t,e,a==="miter",i),t}updateLineAABBBoundsByPoints(n,e,t,i){const{points:s=e.points}=n,r=t;return s.forEach(a=>{r.add(a.x,a.y)}),r}updateLineAABBBoundsBySegments(n,e,t,i){const{segments:s=e.segments}=n,r=t;return s.forEach(a=>{a.points.forEach(o=>{r.add(o.x,o.y)})}),r}updateAreaAABBBounds(n,e,t,i){if(!this._validCheck(n,e,t,i))return t;this.updatePathProxyAABBBounds(t,i)||(n.segments?this.updateAreaAABBBoundsBySegments(n,e,t,i):this.updateAreaAABBBoundsByPoints(n,e,t,i));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(t.x1,t.y1,t.x2,t.y2),r.setValue(t.x1,t.y1,t.x2,t.y2);const{lineJoin:a=e.lineJoin}=n;return this.transformAABBBounds(n,t,e,a==="miter",i),t}updateAreaAABBBoundsByPoints(n,e,t,i){const{points:s=e.points}=n,r=t;return s.forEach(a=>{var o,l;r.add(a.x,a.y),r.add((o=a.x1)!==null&&o!==void 0?o:a.x,(l=a.y1)!==null&&l!==void 0?l:a.y)}),r}updateAreaAABBBoundsBySegments(n,e,t,i){const{segments:s=e.segments}=n,r=t;return s.forEach(a=>{a.points.forEach(o=>{var l,h;r.add(o.x,o.y),r.add((l=o.x1)!==null&&l!==void 0?l:o.x,(h=o.y1)!==null&&h!==void 0?h:o.y)})}),r}updateCircleAABBBounds(n,e,t,i,s){if(!this._validCheck(n,e,t,s))return t;this.updatePathProxyAABBBounds(t,s)||(i?this.updateCircleAABBBoundsImprecise(n,e,t,s):this.updateCircleAABBBoundsAccurate(n,e,t,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(t.x1,t.y1,t.x2,t.y2),a.setValue(t.x1,t.y1,t.x2,t.y2),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach(o=>{o.updateBounds(n,e,r,s),t.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}),this.transformAABBBounds(n,t,e,!1,s),t}updateCircleAABBBoundsImprecise(n,e,t,i){const{radius:s=e.radius}=n;return t.set(-s,-s,s,s),t}updateCircleAABBBoundsAccurate(n,e,t,i){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=n;return r-s>Be-Qe?t.set(-a,-a,a,a):Um(s,r,a,t),t}updateArcAABBBounds(n,e,t,i,s){if(!this._validCheck(n,e,t,s))return t;this.updatePathProxyAABBBounds(t,s)||(i?this.updateArcAABBBoundsImprecise(n,e,t,s):this.updateArcAABBBoundsAccurate(n,e,t,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(t.x1,t.y1,t.x2,t.y2),a.setValue(t.x1,t.y1,t.x2,t.y2),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach(l=>{l.updateBounds(n,e,r,s),t.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)});const{lineJoin:o=e.lineJoin}=n;return this.transformAABBBounds(n,t,e,o==="miter",s),t}updateArcAABBBoundsImprecise(n,e,t,i){const{innerRadius:s=e.innerRadius}=n;let{outerRadius:r=e.outerRadius}=n;return r<s&&(r=s),t.set(-r,-r,r,r),t}updateArcAABBBoundsAccurate(n,e,t,i){let{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=n;if(s<r){const l=s;s=r,r=l}let{endAngle:a=e.endAngle,startAngle:o=e.startAngle}=n;if(o>a){const l=o;o=a,a=l}return s<=Qe?t.set(0,0,0,0):Math.abs(a-o)>Be-Qe?t.set(-s,-s,s,s):(Um(o,a,s,t),Um(o,a,r,t)),t}updateSymbolAABBBounds(n,e,t,i,s){if(!this._validCheck(n,e,t,s))return t;this.updatePathProxyAABBBounds(t,s)||(i?this.updateSymbolAABBBoundsImprecise(n,e,t,s):this.updateSymbolAABBBoundsAccurate(n,e,t,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(t.x1,t.y1,t.x2,t.y2),a.setValue(t.x1,t.y1,t.x2,t.y2),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach(l=>{l.updateBounds(n,e,r,s),t.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)});const{lineJoin:o=e.lineJoin}=n;return this.transformAABBBounds(n,t,e,o==="miter",s),t}updateSymbolAABBBoundsImprecise(n,e,t,i){const{size:s=e.size}=n;if(W(s))t.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const r=s/2;t.set(-r,-r,r,r)}return t}updateSymbolAABBBoundsAccurate(n,e,t,i){if(!i)return t;const{size:s=e.size}=n;return i.getParsedPath().bounds(s,t),t}updateImageAABBBounds(n,e,t,i){if(!this._validCheck(n,e,t,i))return t;if(!this.updatePathProxyAABBBounds(t,i)){const{width:a=e.width,height:o=e.height}=n;t.set(0,0,a,o)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(t.x1,t.y1,t.x2,t.y2),r.setValue(t.x1,t.y1,t.x2,t.y2),this.transformAABBBounds(n,t,e,!1,i),t}combindShadowAABBBounds(n,e){if(e&&e.shadowRoot){const t=e.shadowRoot.AABBBounds;n.union(t)}}transformAABBBounds(n,e,t,i,s){const{scaleX:r=t.scaleX,scaleY:a=t.scaleY,stroke:o=t.stroke,shadowBlur:l=t.shadowBlur,lineWidth:h=t.lineWidth,pickStrokeBuffer:d=t.pickStrokeBuffer,strokeBoundsBuffer:u=t.strokeBoundsBuffer}=n,c=this.tempAABBBounds1,f=this.tempAABBBounds2;if(o&&h){const _=(h+d)/Math.abs(r+a);uf(c,_,i,u),e.union(c),c.setValue(f.x1,f.y1,f.x2,f.y2)}if(l){const{shadowOffsetX:_=t.shadowOffsetX,shadowOffsetY:m=t.shadowOffsetY}=n,y=l/Math.abs(r+a)*2;uf(c,y,!1,u+1),c.translate(_,m),e.union(c)}this.combindShadowAABBBounds(e,s);let p=!0;const g=s.transMatrix;s&&s.isContainer&&(p=!(g.a===1&&g.b===0&&g.c===0&&g.d===1&&g.e===0&&g.f===0)),p&&jy(e,e,g)}_validCheck(n,e,t,i){if(!i)return!0;if(!i.valid)return t.clear(),!1;const{visible:s=e.visible}=n;return!!s||(t.clear(),!1)}};Bb=Jj([ue(),eH(0,Ee(cE)),Qj("design:paramtypes",[Object])],Bb);class oH{constructor(){this.store=new Map}RegisterGraphicCreator(e,t){this.store.set(e,t),this[e]=t}CreateGraphic(e,t){const i=this.store.get(e);return i?i(t):null}}const ce=new oH;let Lc,Ic;function Uu(n){return Lc||(Lc=ce.CreateGraphic("text",{})),Lc.initAttributes(n),Lc.AABBBounds}function lH(n){return Ic||(Ic=ce.CreateGraphic("richtext",{})),Ic.setAttributes(n),Ic.AABBBounds}const jt={x:0,y:0,z:0,lastModelMatrix:null};class sn{init(e){e&&(this._renderContribitions=e.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach(t=>this._renderContribitions.push(t)),this._renderContribitions.length&&(this._renderContribitions.sort((t,i)=>i.order-t.order),this._beforeRenderContribitions=this._renderContribitions.filter(t=>t.time===ui.beforeFillStroke),this._afterRenderContribitions=this._renderContribitions.filter(t=>t.time===ui.afterFillStroke))}beforeRenderStep(e,t,i,s,r,a,o,l,h,d,u,c,f){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach(p=>{p.drawShape(e,t,i,s,r,a,o,l,h,d,u,c,f)})}afterRenderStep(e,t,i,s,r,a,o,l,h,d,u,c,f){this._afterRenderContribitions&&this._afterRenderContribitions.forEach(p=>{p.drawShape(e,t,i,s,r,a,o,l,h,d,u,c,f)})}valid(e,t,i,s){const{fill:r=t.fill,background:a,stroke:o=t.stroke,opacity:l=t.opacity,fillOpacity:h=t.fillOpacity,lineWidth:d=t.lineWidth,strokeOpacity:u=t.strokeOpacity,visible:c=t.visible}=e.attribute,f=Jl(l,h,r),p=Hx(l,u),g=go(r,a),_=Sh(o,d);return!(!e.valid||!c)&&!(!g&&!_)&&!!(f||p||i||s||a)&&{fVisible:f,sVisible:p,doFill:g,doStroke:_}}transform(e,t,i,s=!1){const{x:r=t.x,y:a=t.y,z:o=t.z,scaleX:l=t.scaleX,scaleY:h=t.scaleY,angle:d=t.angle,postMatrix:u}=e.attribute,c=i.modelMatrix,f=i.camera;jt.x=r,jt.y=a,jt.z=o,jt.lastModelMatrix=c;const p=f&&(s||aH(e)),g=p?e.transMatrix.onlyTranslate()&&!u:l===1&&h===1&&d===0&&!u;if(p){const _=lt.allocate(),m=lt.allocate();RE(m,e,t),Nu(_,c||_,m),jt.x=0,jt.y=0,jt.z=0,i.modelMatrix=_,i.setTransform(1,0,0,1,0,0,!0),lt.free(m)}if(g&&!c){const _=e.getOffsetXY(t);jt.x+=_.x,jt.y+=_.y,jt.z=o,i.setTransformForCurrent()}else if(p)jt.x=0,jt.y=0,jt.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(f&&i.project){const _=e.getOffsetXY(t);jt.x+=_.x,jt.y+=_.y,this.transformWithoutTranslate(i,jt.x,jt.y,jt.z,l,h,d)}else i.transformFromMatrix(e.transMatrix,!0),jt.x=0,jt.y=0,jt.z=0;return jt}transformUseContext2d(e,t,i,s){const r=s.camera;if(this.camera=r,r){const a=e.AABBBounds,o=a.x2-a.x1,l=a.y2-a.y1,h=s.project(0,0,i),d=s.project(o,0,i),u=s.project(o,l,i),c={x:0,y:0},f={x:o,y:0},p={x:o,y:l};s.camera=null;const g=1/(c.x*(p.y-f.y)-f.x*p.y+p.x*f.y+(f.x-p.x)*c.y),_=-(c.y*(u.x-d.x)-f.y*u.x+p.y*d.x+(f.y-p.y)*h.x)*g,m=(f.y*u.y+c.y*(d.y-u.y)-p.y*d.y+(p.y-f.y)*h.y)*g,y=(c.x*(u.x-d.x)-f.x*u.x+p.x*d.x+(f.x-p.x)*h.x)*g,b=-(f.x*u.y+c.x*(d.y-u.y)-p.x*d.y+(p.x-f.x)*h.y)*g,v=(c.x*(p.y*d.x-f.y*u.x)+c.y*(f.x*u.x-p.x*d.x)+(p.x*f.y-f.x*p.y)*h.x)*g,x=(c.x*(p.y*d.y-f.y*u.y)+c.y*(f.x*u.y-p.x*d.y)+(p.x*f.y-f.x*p.y)*h.y)*g;s.setTransform(_,m,y,b,v,x,!0)}}restoreTransformUseContext2d(e,t,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(e,t,i,s,r,a,o){const l=e.project(t,i,s);e.translate(l.x,l.y,!1),e.scale(r,a,!1),e.rotate(o,!1),e.translate(-l.x,-l.y,!1),e.setTransformForCurrent()}_draw(e,t,i,s,r){const{context:a}=s;if(!a)return;a.highPerformanceSave();const o=this.transform(e,t,a,i),{x:l,y:h,z:d,lastModelMatrix:u}=o;this.z=d,Bz(e,a,l,h,s,r)||(this.drawShape(e,a,l,h,s,r),this.z=0,a.modelMatrix!==u&&lt.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}const hH=function(){const n={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 t(v){const x=new Error(e+": "+v);throw x.source=e,x}function i(){const v=f(s);return e.length>0&&t("Invalid input not EOF"),v}function s(){return r("linear",n.linearGradient,a)||r("radial",n.radialGradient,l)||r("conic",n.conicGradient,o)}function r(v,x,S){return function(A,k){const w=y(A);if(w){y(n.startCall)||t("Missing (");const M=k(w);return y(n.endCall)||t("Missing )"),M}}(x,function(A){const k=S();return k&&(y(n.comma)||t("Missing comma before color stops")),{type:v,orientation:k,colorStops:f(p)}})}function a(){return m("directional",n.sideOrCorner,1)||m("angular",n.angleValue,1)}function o(){return m("angular",n.fromAngleValue,1)}function l(){let v,x,S=h();return S&&(v=[],v.push(S),x=e,y(n.comma)&&(S=h(),S?v.push(S):e=x)),v}function h(){let v=function(){const x=m("shape",/^(circle)/i,0);return x&&(x.style=_()||d()),x}()||function(){const x=m("shape",/^(ellipse)/i,0);return x&&(x.style=g()||d()),x}();if(v)v.at=u();else{const x=d();if(x){v=x;const S=u();S&&(v.at=S)}else{const S=c();S&&(v={type:"default-radial",at:S})}}return v}function d(){return m("extent-keyword",n.extentKeywords,1)}function u(){if(m("position",/^at/,0)){const v=c();return v||t("Missing positioning value"),v}}function c(){const v={x:g(),y:g()};if(v.x||v.y)return{type:"position",value:v}}function f(v){let x=v();const S=[];if(x)for(S.push(x);y(n.comma);)x=v(),x?S.push(x):t("One extra comma");return S}function p(){const v=m("hex",n.hexColor,1)||m("rgba",n.rgbaColor,1)||m("rgb",n.rgbColor,1)||m("literal",n.literalColor,0);return v||t("Expected color definition"),v.length=g(),v}function g(){return m("%",n.percentageValue,1)||m("position-keyword",n.positionKeywords,1)||_()}function _(){return m("px",n.pixelValue,1)||m("em",n.emValue,1)}function m(v,x,S){const A=y(x);if(A)return{type:v,value:A[S]}}function y(v){const x=/^[\n\r\t\s]+/.exec(e);x&&b(x[0].length);const S=v.exec(e);return S&&b(S[0].length),S}function b(v){e=e.substr(v)}return function(v){return e=v.toString(),i()}}();class No{static IsGradient(e){return!(typeof e=="string"&&e.length<10)}static IsGradientStr(e){return typeof e=="string"&&e.length>10}static Parse(e){if(No.IsGradientStr(e))try{const t=hH(e)[0];if(t){if(t.type==="linear")return No.ParseLinear(t);if(t.type==="radial")return No.ParseRadial(t);if(t.type==="conic")return No.ParseConic(t)}}catch{return e}return e}static ParseConic(e){const{orientation:t,colorStops:i=[]}=e,s=et/2,r=parseFloat(t.value)/180*et-s;return{gradient:"conical",x:.5,y:.5,startAngle:r,endAngle:r+Be,stops:i.map(a=>({color:a.value,offset:parseFloat(a.length.value)/100}))}}static ParseRadial(e){const{colorStops:t=[]}=e;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:t.map(i=>({color:i.value,offset:parseFloat(i.length.value)/100}))}}static ParseLinear(e){const{orientation:t,colorStops:i=[]}=e,s=et/2;let r=t.type==="angular"?parseFloat(t.value)/180*et:0;for(;r<0;)r+=Be;for(;r>Be;)r-=Be;let a=0,o=0,l=0,h=0;return r<s?(a=0,o=1,l=Math.sin(r),h=Math.cos(r)):r<et?(a=0,o=0,l=Math.cos(r-s),h=Math.sin(r-s)):r<et+s?(a=1,o=0,l=a-Math.sin(r-et),h=Math.cos(r-et)):(a=1,l=a-Math.cos(r-s-et),h-=Math.sin(r-s-et)),{gradient:"linear",x0:a,y0:o,x1:l,y1:h,stops:i.map(d=>({color:d.value,offset:parseFloat(d.length.value)/100}))}}}function Mi(n,e,t){let i=e;const{a:s,b:r,c:a,d:o}=n.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(i=i/Math.abs(l+h)*2*t,i)}function Lb(n,e,t,i,s){if(!e||e===!0)return"black";let r,a;if(W(e))for(let o=0;o<e.length&&(a=e[o],!a);o++);else a=e;return a=No.Parse(a),typeof a=="string"?a:(a.gradient==="linear"?r=dH(n,a,t,i,s):a.gradient==="conical"?r=cH(n,a,t,i,s):a.gradient==="radial"&&(r=uH(n,a,t,i,s)),r||"orange")}function dH(n,e,t,i=0,s=0){var r,a,o,l;const h=t.AABBBounds;if(!h)return;let d=h.x2-h.x1,u=h.y2-h.y1,c=h.x1-i,f=h.y1-s;if(t.attribute){const{scaleX:g=1,scaleY:_=1}=t.attribute;if(g*_==0)return;d/=g,u/=_,c/=g,f/=_}const p=n.createLinearGradient(c+((r=e.x0)!==null&&r!==void 0?r:0)*d,f+((a=e.y0)!==null&&a!==void 0?a:0)*u,c+((o=e.x1)!==null&&o!==void 0?o:1)*d,f+((l=e.y1)!==null&&l!==void 0?l:0)*u);return e.stops.forEach(g=>{p.addColorStop(g.offset,g.color)}),p}function uH(n,e,t,i=0,s=0){var r,a,o,l,h,d;const u=t.AABBBounds;if(!u)return;let c=u.x2-u.x1,f=u.y2-u.y1,p=u.x1-i,g=u.y1-s;if(t.attribute){const{scaleX:m=1,scaleY:y=1}=t.attribute;if(m*y==0)return;p/=m,g/=y,c/=m,f/=y}const _=n.createRadialGradient(p+((r=e.x0)!==null&&r!==void 0?r:.5)*c,g+((a=e.y0)!==null&&a!==void 0?a:.5)*f,Math.max(c,f)*((o=e.r0)!==null&&o!==void 0?o:0),p+((l=e.x1)!==null&&l!==void 0?l:.5)*c,g+((h=e.y1)!==null&&h!==void 0?h:.5)*f,Math.max(c,f)*((d=e.r1)!==null&&d!==void 0?d:.5));return e.stops.forEach(m=>{_.addColorStop(m.offset,m.color)}),_}function cH(n,e,t,i=0,s=0){var r,a;const o=t.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,d=o.x1-i,u=o.y1-s;if(t.attribute){const{scaleX:f=1,scaleY:p=1}=t.attribute;if(f*p==0)return;l/=f,h/=p,d/=f,u/=p}const c=n.createConicGradient(d+((r=e.x)!==null&&r!==void 0?r:0)*l,u+((a=e.y)!==null&&a!==void 0?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach(f=>{c.addColorStop(f.offset,f.color)}),c.GetPattern(l+d,h+u,void 0)}var fH=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},pH=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},m1=function(n,e){return function(t,i){e(t,i,n)}};class $u{constructor(){this.time=ui.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(e,t,i,s,r,a,o,l,h,d,u,c,f){const{background:p,backgroundMode:g=h.backgroundMode,backgroundFit:_=h.backgroundFit}=e.attribute;if(p)if(e.backgroundImg&&e.resources){const m=e.resources.get(p);if(m.state!=="success"||!m.data)return;if(t.save(),e.parent&&!e.transMatrix.onlyTranslate()){const b=se(e.parent).group,{scrollX:v=b.scrollX,scrollY:x=b.scrollY}=e.parent.attribute;t.setTransformFromMatrix(e.parent.globalTransMatrix,!0),t.translate(v,x)}t.clip();const y=e.AABBBounds;t.setCommonStyle(e,e.attribute,i,s,h),this.doDrawImage(t,m.data,y,g,_),t.restore(),e.transMatrix.onlyTranslate()||t.setTransformForCurrent()}else t.highPerformanceSave(),t.setCommonStyle(e,e.attribute,i,s,h),t.fillStyle=p,t.fill(),t.highPerformanceRestore()}doDrawImage(e,t,i,s,r){if(s==="no-repeat")e.drawImage(t,i.x1,i.y1,i.width(),i.height());else{const a=i.width(),o=i.height();let l=a,h=o;if(r&&s!=="repeat"&&(t.width||t.height)){const c=t.width,f=t.height;s==="repeat-x"?(l=c*(o/f),h=o):s==="repeat-y"&&(h=f*(a/c),l=a);const p=e.dpr,g=Zl.allocate({width:l,height:h,dpr:p}),_=g.getContext("2d");_&&(_.inuse=!0,_.clearMatrix(),_.setTransformForCurrent(!0),_.clearRect(0,0,l,h),_.drawImage(t,0,0,l,h),t=g.nativeCanvas),Zl.free(g)}const d=e.dpr,u=e.createPattern(t,s);u.setTransform&&u.setTransform(new DOMMatrix([1/d,0,0,1/d,0,0])),e.fillStyle=u,e.translate(i.x1,i.y1),e.fillRect(0,0,a,o),e.translate(-i.x1,-i.y1)}}}const _o=new $u;let Kn=class{constructor(n){this.subRenderContribitions=n,this.time=ui.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(n,e,t,i,s,r,a,o,l,h,d,u,c){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach(f=>{f.render(n,e,t,i,s,r,a,o,l,h,d,u,c)})}};Kn=fH([ue(),m1(0,Ee(Kt)),m1(0,di(Wx)),pH("design:paramtypes",[Object])],Kn);class Xx{constructor(){this.time=ui.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(e,t,i,s,r){const a=(e-2*t)/2,o=s.dpr,l=Zl.allocate({width:e,height:e,dpr:o}),h=l.getContext("2d");if(!h)return null;h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,e,e),r(a,h);const d=s.createPattern(l.nativeCanvas,"repeat");return d.setTransform&&d.setTransform(new DOMMatrix([1/o,0,0,1/o,0,0])),Zl.free(l),d}createCirclePattern(e,t,i,s){return this.createCommonPattern(e,t,i,s,(r,a)=>{a.fillStyle=i,a.arc(r,r,r,0,Be),a.fill()})}createDiamondPattern(e,t,i,s){return this.createCommonPattern(e,t,i,s,(r,a)=>{const o=e/2,l=o;a.fillStyle=i,a.moveTo(o,l-r),a.lineTo(r+o,l),a.lineTo(o,l+r),a.lineTo(o-r,l),a.closePath(),a.fill()})}createRectPattern(e,t,i,s){return this.createCommonPattern(e,t,i,s,(r,a)=>{const o=t,l=o;a.fillStyle=i,a.fillRect(o,l,2*r,2*r)})}createVerticalLinePattern(e,t,i,s){return this.createCommonPattern(e,t,i,s,(r,a)=>{const o=t;a.fillStyle=i,a.fillRect(o,0,2*r,e)})}createHorizontalLinePattern(e,t,i,s){return this.createCommonPattern(e,t,i,s,(r,a)=>{const o=t;a.fillStyle=i,a.fillRect(0,o,e,2*r)})}createBiasLRLinePattern(e,t,i,s){return this.createCommonPattern(e,t,i,s,(r,a)=>{a.strokeStyle=i,a.lineWidth=r,a.moveTo(0,0),a.lineTo(e,e);const o=e/2,l=-o;a.moveTo(o,l),a.lineTo(o+e,l+e),a.moveTo(-o,-l),a.lineTo(-o+e,-l+e),a.stroke()})}createBiasRLLinePattern(e,t,i,s){return this.createCommonPattern(e,t,i,s,(r,a)=>{a.strokeStyle=i,a.lineWidth=r,a.moveTo(e,0),a.lineTo(0,e);const o=e/2,l=o;a.moveTo(e+o,l),a.lineTo(o,l+e),a.moveTo(e-o,-l),a.lineTo(-o,-l+e),a.stroke()})}createGridPattern(e,t,i,s){return this.createCommonPattern(e,t,i,s,(r,a)=>{const o=t,l=o;a.fillStyle=i,a.fillRect(o,l,r,r),a.fillRect(o+r,l+r,r,r)})}initTextureMap(e,t){this.textureMap=new Map}drawShape(e,t,i,s,r,a,o,l,h,d,u,c,f){this.textureMap||this.initTextureMap(t,e.stage);const{texture:p=h.texture,textureColor:g=h.textureColor,textureSize:_=h.textureSize,texturePadding:m=h.texturePadding}=e.attribute;p&&this.drawTexture(p,e,t,i,s,h,g,_,m)}drawTexture(e,t,i,s,r,a,o,l,h){let d=this.textureMap.get(e);if(!d)switch(e){case"circle":d=this.createCirclePattern(l,h,o,i);break;case"diamond":d=this.createDiamondPattern(l,h,o,i);break;case"rect":d=this.createRectPattern(l,h,o,i);break;case"vertical-line":d=this.createVerticalLinePattern(l,h,o,i);break;case"horizontal-line":d=this.createHorizontalLinePattern(l,h,o,i);break;case"bias-lr":d=this.createBiasLRLinePattern(l,h,o,i);break;case"bias-rl":d=this.createBiasRLLinePattern(l,h,o,i);break;case"grid":d=this.createGridPattern(l,h,o,i)}d&&(i.highPerformanceSave(),i.setCommonStyle(t,t.attribute,s,r,a),i.fillStyle=d,i.fill(),i.highPerformanceRestore())}}const Ah=new Xx;class gH{constructor(){this.time=ui.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(e,t,i,s,r,a,o,l,h,d,u,c){const{outerBorder:f,innerBorder:p}=e.attribute,g=f&&f.visible!==!1,_=p&&p.visible!==!1;if(!g&&!_)return;const{innerRadius:m=h.innerRadius,outerRadius:y=h.outerRadius,startAngle:b=h.startAngle,endAngle:v=h.endAngle,opacity:x=h.opacity,x:S=h.x,y:A=h.y,scaleX:k=h.scaleX,scaleY:w=h.scaleY}=e.attribute,M=!(!f||!f.stroke),T=!(!p||!p.stroke);if(g){const{distance:E=h.outerBorder.distance}=f,O=Mi(t,E,t.dpr),B=E/y;if(e.setAttributes({outerRadius:y+O,innerRadius:m-O,startAngle:b-B,endAngle:v+B}),t.beginPath(),Uf(e,t,i,s,y+O,m-O),t.setShadowBlendStyle&&t.setShadowBlendStyle(e,e.attribute,h),c)c(t,f,h.outerBorder);else if(M){const R=h.outerBorder.opacity;h.outerBorder.opacity=x,t.setStrokeStyle(e,f,(S-i)/k,(A-s)/w,h.outerBorder),h.outerBorder.opacity=R,t.stroke()}}if(_){const{distance:E=h.innerBorder.distance}=p,O=Mi(t,E,t.dpr),B=E/y;if(e.setAttributes({outerRadius:y-O,innerRadius:m+O,startAngle:b+B,endAngle:v-B}),t.beginPath(),Uf(e,t,i,s,y-O,m+O),t.setShadowBlendStyle&&t.setShadowBlendStyle(e,e.attribute,h),c)c(t,p,h.innerBorder);else if(T){const R=h.innerBorder.opacity;h.innerBorder.opacity=x,t.setStrokeStyle(e,p,(S-i)/k,(A-s)/w,h.innerBorder),h.innerBorder.opacity=R,t.stroke()}}e.setAttributes({outerRadius:y,innerRadius:m,startAngle:b,endAngle:v})}}const _H=new gH,mH=Ah,yH=_o;class bH{constructor(){this.time=ui.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(e,t,i,s,r,a,o,l,h,d,u,c){const{outerBorder:f,innerBorder:p}=e.attribute,g=f&&f.visible!==!1,_=p&&p.visible!==!1;if(!g&&!_)return;const{radius:m=h.radius,startAngle:y=h.startAngle,endAngle:b=h.endAngle,opacity:v=h.opacity,x=h.x,y:S=h.y,scaleX:A=h.scaleX,scaleY:k=h.scaleY}=e.attribute,w=!(!f||!f.stroke),M=!(!p||!p.stroke);if(g){const{distance:T=h.outerBorder.distance}=f,E=Mi(t,T,t.dpr);if(t.beginPath(),t.arc(i,s,m+E,y,b),t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(e,e.attribute,h),c)c(t,f,h.outerBorder);else if(w){const O=h.outerBorder.opacity;h.outerBorder.opacity=v,t.setStrokeStyle(e,f,(x-i)/A,(S-s)/k,h.outerBorder),h.outerBorder.opacity=O,t.stroke()}}if(_){const{distance:T=h.innerBorder.distance}=p,E=Mi(t,T,t.dpr);if(t.beginPath(),t.arc(i,s,m-E,y,b),t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(e,e.attribute,h),c)c(t,p,h.innerBorder);else if(M){const O=h.innerBorder.opacity;h.innerBorder.opacity=v,t.setStrokeStyle(e,p,(x-i)/A,(S-s)/k,h.innerBorder),h.innerBorder.opacity=O,t.stroke()}}}}const vH=new bH,xH=Ah,SH=_o;class AH extends $u{constructor(){super(...arguments),this.time=ui.beforeFillStroke}drawShape(e,t,i,s,r,a,o,l,h,d,u,c){const{background:f,backgroundMode:p=h.backgroundMode,backgroundFit:g=h.backgroundFit}=e.attribute;if(f)if(e.backgroundImg&&e.resources){const _=e.resources.get(f);if(_.state!=="success"||!_.data)return;t.highPerformanceSave(),t.setTransformFromMatrix(e.parent.globalTransMatrix,!0);const m=e.AABBBounds;this.doDrawImage(t,_.data,m,p,g),t.highPerformanceRestore(),t.setTransformForCurrent()}else t.highPerformanceSave(),t.fillStyle=f,t.fill(),t.highPerformanceRestore()}}const kH=new AH,Dc=et/2;function so(n,e,t,i,s,r){let a;if(i<0&&(e+=i,i=-i),s<0&&(t+=s,s=-s),oe(r,!0))a=[r=Ve(r),r,r,r];else if(Array.isArray(r)){const x=r;let S,A;switch(x.length){case 0:a=[0,0,0,0];break;case 1:S=Ve(x[0]),a=[S,S,S,S];break;case 2:case 3:S=Ve(x[0]),A=Ve(x[1]),a=[S,A,S,A];break;default:a=x,a[0]=Ve(a[0]),a[1]=Ve(a[1]),a[2]=Ve(a[2]),a[3]=Ve(a[3])}}else a=[0,0,0,0];if(i<0||a[0]+a[1]+a[2]+a[3]<1e-12)return n.rect(e,t,i,s);const[o,l,h,d]=[[e,t],[e+i,t],[e+i,t+s],[e,t+s]],u=Math.min(i/2,s/2),c=[Math.min(u,a[0]),Math.min(u,a[1]),Math.min(u,a[2]),Math.min(u,a[3])],f=[o[0]+c[0],o[1]],p=[o[0],o[1]+c[0]],g=[l[0]-c[1],l[1]],_=[l[0],l[1]+c[1]],m=[h[0]-c[2],h[1]],y=[h[0],h[1]-c[2]],b=[d[0]+c[3],d[1]],v=[d[0],d[1]-c[3]];if(n.moveTo(f[0],f[1]),n.lineTo(g[0],g[1]),!dc(g,_)){const x=g[0],S=g[1]+c[1];n.arc(x,S,c[1],-Dc,0,!1)}if(n.lineTo(y[0],y[1]),!dc(m,y)){const x=y[0]-c[2],S=y[1];n.arc(x,S,c[2],0,Dc,!1)}if(n.lineTo(b[0],b[1]),!dc(b,v)){const x=b[0],S=b[1]-c[3];n.arc(x,S,c[3],Dc,et,!1)}if(n.lineTo(p[0],p[1]),!dc(f,p)){const x=f[0],S=f[1]+c[0];n.arc(x,S,c[0],et,et+Dc,!1)}return n.closePath(),n}class wH extends $u{constructor(){super(...arguments),this.time=ui.beforeFillStroke}drawShape(e,t,i,s,r,a,o,l,h,d,u,c){const{background:f,backgroundMode:p=h.backgroundMode,backgroundFit:g=h.backgroundFit}=e.attribute;if(f)if(e.backgroundImg){const _=e.resources.get(f);if(_.state!=="success"||!_.data)return;if(t.save(),e.parent&&!e.transMatrix.onlyTranslate()){const y=se(e.parent).group,{scrollX:b=y.scrollX,scrollY:v=y.scrollY}=e.parent.attribute;t.setTransformFromMatrix(e.parent.globalTransMatrix,!0),t.translate(b,v)}const m=e.AABBBounds;this.doDrawImage(t,_.data,m,p,g),t.restore(),e.transMatrix.onlyTranslate()||t.setTransformForCurrent()}else if(He(f)){const{stroke:_,fill:m,lineWidth:y=1,cornerRadius:b=0,expandX:v=0,expandY:x=0}=f;if(!_&&!m)return;t.beginPath();const{x:S,y:A,width:k,height:w}=MH(e);b?so(t,S-v,A-x,k+2*v,w+2*x,b):t.rect(S-v,A-x,k+2*v,w+2*x),t.globalAlpha=1,m&&(t.fillStyle=m,t.fill()),_&&y>0&&(t.lineWidth=y,t.strokeStyle=_,t.stroke())}else{t.beginPath();const _=e.AABBBounds;t.rect(i,s,_.width(),_.height()),t.fillStyle=f,t.globalAlpha=1,t.fill()}}}function MH(n){const e=mi(n.attribute.boundsPadding),t=n.AABBBounds;let i=t.x1,s=t.y1,r=t.width(),a=t.height();return oe(e)?(i+=e,s+=e,r-=2*e,a-=2*e):(i+=e[3],s+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:i,y:s,width:r,height:a}}const TH=new wH;var OE=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};class CH{constructor(){this.time=ui.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(e,t,i,s,r,a,o,l,h,d,u,c){const{outerBorder:f,innerBorder:p}=e.attribute,g=f&&f.visible!==!1,_=p&&p.visible!==!1;if(!g&&!_)return;const{cornerRadius:m=h.cornerRadius,opacity:y=h.opacity,x:b=h.x,y:v=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY,x1:A,y1:k}=e.attribute;let{width:w,height:M}=e.attribute;w=(w??A-i)||0,M=(M??k-s)||0;const T=!(!f||!f.stroke),E=!(!p||!p.stroke);if(g){const{distance:O=h.outerBorder.distance}=f,B=Mi(t,O,t.dpr),R=i-B,L=s-B,I=2*B;if(m===0||W(m)&&m.every(F=>F===0)?(t.beginPath(),t.rect(R,L,w+I,M+I)):(t.beginPath(),so(t,R,L,w+I,M+I,m)),t.setShadowBlendStyle&&t.setShadowBlendStyle(e,e.attribute,h),c)c(t,f,h.outerBorder);else if(T){const F=h.outerBorder.opacity;h.outerBorder.opacity=y,t.setStrokeStyle(e,f,(b-i)/x,(v-s)/S,h.outerBorder),h.outerBorder.opacity=F,t.stroke()}}if(_){const{distance:O=h.innerBorder.distance}=p,B=Mi(t,O,t.dpr),R=i+B,L=s+B,I=2*B;if(m===0||W(m)&&m.every(F=>F===0)?(t.beginPath(),t.rect(R,L,w-I,M-I)):(t.beginPath(),so(t,R,L,w-I,M-I,m)),t.setShadowBlendStyle&&t.setShadowBlendStyle(e,e.attribute,h),c)c(t,p,h.innerBorder);else if(E){const F=h.innerBorder.opacity;h.innerBorder.opacity=y,t.setStrokeStyle(e,p,(b-i)/x,(v-s)/S,h.innerBorder),h.innerBorder.opacity=F,t.stroke()}}}}let Yf=class{constructor(){this.time=ui.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(n,e,t,i,s,r,a,o,l,h,d,u,c){const{stroke:f=l.stroke}=n.attribute;Array.isArray(f)&&f.some(p=>p===!1)&&(c.doStroke=!1)}};Yf=OE([ue()],Yf);let Xf=class{constructor(){this.time=ui.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(n,e,t,i,s,r,a,o,l,h,d,u){const{width:c=l.width,height:f=l.height,stroke:p=l.stroke}=n.attribute;if(Array.isArray(p)&&p.some(g=>g===!1)){if(e.setStrokeStyle(n,n.attribute,t,i,l),e.beginPath(),e.moveTo(t,i),p[0]?e.lineTo(t+c,i):e.moveTo(t+c,i),p[1]?e.lineTo(t+c,i+f):e.moveTo(t+c,i+f),p[2]?e.lineTo(t,i+f):e.moveTo(t,i+f),p[3]){const g=p[0]?i-e.lineWidth/2:i;e.lineTo(t,g)}else e.moveTo(t,i);e.stroke()}}};Xf=OE([ue()],Xf);const PH=new CH,EH=Ah,RH=_o;class OH{constructor(){this.time=ui.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(e,t,i,s,r,a,o,l,h,d,u,c){const f=e.getParsedPath();if(!f)return;const{outerBorder:p,innerBorder:g}=e.attribute,_=p&&p.visible!==!1,m=g&&g.visible!==!1;if(!_&&!m)return;const{size:y=h.size,opacity:b=h.opacity,x:v=h.x,y:x=h.y,scaleX:S=h.scaleX,scaleY:A=h.scaleY}=e.attribute,k=!(!p||!p.stroke),w=!(!g||!g.stroke);if(_){const{distance:M=h.outerBorder.distance}=p,T=Mi(t,M,t.dpr);if(t.beginPath(),f.drawOffset(t,y,i,s,T)===!1&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(e,e.attribute,h),c)c(t,p,h.outerBorder);else if(k){const E=h.outerBorder.opacity;h.outerBorder.opacity=b,t.setStrokeStyle(e,p,(v-i)/S,(x-s)/A,h.outerBorder),h.outerBorder.opacity=E,t.stroke()}}if(m){const{distance:M=h.innerBorder.distance}=g,T=Mi(t,M,t.dpr);if(t.beginPath(),f.drawOffset(t,y,i,s,-T)===!1&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(e,e.attribute,h),c)c(t,g,h.innerBorder);else if(w){const E=h.innerBorder.opacity;h.innerBorder.opacity=b,t.setStrokeStyle(e,g,(v-i)/S,(x-s)/A,h.innerBorder),h.innerBorder.opacity=E,t.stroke()}}}}const BH=new OH,LH=Ah,IH=_o;class DH extends Xx{constructor(){super(...arguments),this.time=ui.afterFillStroke}drawShape(e,t,i,s,r,a,o,l,h,d,u,c,f){var p,g,_,m;this.textureMap||this.initTextureMap(t,e.stage);const{attribute:y=e.attribute}=f||{},{texture:b=(p=e.attribute.texture)!==null&&p!==void 0?p:Ec(h,"texture"),textureColor:v=(g=e.attribute.textureColor)!==null&&g!==void 0?g:Ec(h,"textureColor"),textureSize:x=(_=e.attribute.textureSize)!==null&&_!==void 0?_:Ec(h,"textureSize"),texturePadding:S=(m=e.attribute.texturePadding)!==null&&m!==void 0?m:Ec(h,"texturePadding")}=y;b&&this.drawTexture(b,e,t,i,s,h,v,x,S)}}var FH=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},zH=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},y1=function(n,e){return function(t,i){e(t,i,n)}};let Kf=class extends sn{constructor(n){super(),this.arcRenderContribitions=n,this.numberType=m_,this.builtinContributions=[_H,yH,mH],this.init(n)}drawArcTailCapPath(n,e,t,i,s,r,a,o){const l=o-a,h=n.getParsedAngle(),d=h.startAngle;let u=h.endAngle;u=o;const c=Ve(u-d),f=u>d;let p=!1;if(s<r){const $=s;s=r,r=$}const g=n.getParsedCornerRadius(),{outerDeltaAngle:_,innerDeltaAngle:m,outerStartAngle:y,outerEndAngle:b,innerEndAngle:v,innerStartAngle:x}=n.getParsePadAngle(d,u),S=g,A=g,k=g,w=g,M=Math.max(A,S),T=Math.max(k,w);let E=M,O=T;const B=s*nt(y),R=s*Ze(y),L=r*nt(v),I=r*Ze(v);let F,H,G,U;if((T>Qe||M>Qe)&&(F=s*nt(b),H=s*Ze(b),G=r*nt(x),U=r*Ze(x),c<et)){const $=bE(B,R,G,U,F,H,L,I);if($){const Z=B-$[0],q=R-$[1],ie=F-$[0],K=H-$[1],V=1/Ze(SC((Z*ie+q*K)/(en(Z*Z+q*q)*en(ie*ie+K*K)))/2),te=en($[0]*$[0]+$[1]*$[1]);O=gi(T,(r-te)/(V-1)),E=gi(M,(s-te)/(V+1))}}if(E>Qe){const $=gi(S,E),Z=gi(A,E),q=Ur(G,U,B,R,s,$,Number(f)),ie=Ur(F,H,L,I,s,Z,Number(f));if(E<M&&$===Z)e.moveTo(t+q.cx+q.x01,i+q.cy+q.y01),e.arc(t+q.cx,i+q.cy,E,it(q.y01,q.x01),it(ie.y01,ie.x01),!f);else{const K=u-l-.03,V=it(ie.y11,ie.x11);e.arc(t,i,s,K,V,!f),Z>0&&e.arc(t+ie.cx,i+ie.cy,Z,it(ie.y11,ie.x11),it(ie.y01,ie.x01),!f)}}else e.moveTo(t+B,i+R);if(!(r>Qe)||m<.001)e.lineTo(t+L,i+I),p=!0;else if(O>Qe){const $=gi(w,O),Z=gi(k,O),q=Ur(L,I,F,H,r,-Z,Number(f)),ie=Ur(B,R,G,U,r,-$,Number(f));if(e.lineTo(t+q.cx+q.x01,i+q.cy+q.y01),O<T&&$===Z){const K=it(ie.y01,ie.x01);e.arc(t+q.cx,i+q.cy,O,it(q.y01,q.x01),K,!f)}else{Z>0&&e.arc(t+q.cx,i+q.cy,Z,it(q.y01,q.x01),it(q.y11,q.x11),!f);const K=it(q.cy+q.y11,q.cx+q.x11),V=u-l-.03;e.arc(t,i,r,K,V,f)}}else e.lineTo(t+r*nt(x),i+r*Ze(x));return p}drawShape(n,e,t,i,s,r,a,o){const l=se(n,r==null?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:c=l.y}=n.attribute,f=this.valid(n,l,a,o);if(!f)return;const{fVisible:p,sVisible:g,doFill:_,doStroke:m}=f,{outerRadius:y=l.outerRadius,innerRadius:b=l.innerRadius,cap:v=l.cap,forceShowCap:x=l.forceShowCap}=n.attribute;let S=0;const A=(ht(v)&&v||v[0])&&h.gradient==="conical";if(A){const{sc:T,startAngle:E,endAngle:O}=n.getParsedAngle();Ve(O-E)<Be-Qe&&(S=T||0,h.startAngle-=S,h.endAngle-=S)}let k=!1;const{isFullStroke:w,stroke:M}=B3(d);if((_||w)&&(e.beginPath(),Uf(n,e,t,i,y,b),k=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(n,n.attribute,l),this.beforeRenderStep(n,e,t,i,_,m,p,g,l,s,a,o),_&&(a?a(e,n.attribute,l):p&&(e.setCommonStyle(n,n.attribute,u-t,c-i,l),e.fill())),m&&w&&(o?o(e,n.attribute,l):g&&(e.setStrokeStyle(n,n.attribute,u-t,c-i,l),e.stroke()))),!w&&m&&(e.beginPath(),Uf(n,e,t,i,y,b,M),k||this.beforeRenderStep(n,e,t,i,_,m,p,g,l,s,a,o),o?o(e,n.attribute,l):g&&(e.setStrokeStyle(n,n.attribute,t,i,l),e.stroke())),(ht(v)&&v||v[1])&&x){const{startAngle:T,endAngle:E}=n.getParsedAngle();if(Ve(E-T)>=Be-Qe){e.beginPath();const O=Math.abs(y-b)/2/y,{endAngle:B=l.endAngle,fill:R=l.fill}=n.attribute,L=B;if(this.drawArcTailCapPath(n,e,t,i,y,b,L,L+O),k||this.beforeRenderStep(n,e,t,i,_,m,p,g,l,s,a,o),_){const I=R;if(I.gradient==="conical"){const F=Lz(0,0,B,I);a||(e.setCommonStyle(n,n.attribute,t,i,l),e.fillStyle=F,e.fill())}}m&&(o||g&&(e.setStrokeStyle(n,n.attribute,t,i,l),e.stroke()))}}this.afterRenderStep(n,e,t,i,_,m,p,g,l,s,a,o),A&&(h.startAngle+=S,h.endAngle+=S)}draw(n,e,t,i){const s=se(n,i==null?void 0:i.theme).arc;this._draw(n,s,!1,t,i)}};Kf=FH([ue(),y1(0,Ee(Kt)),y1(0,di(vb)),zH("design:paramtypes",[Object])],Kf);var jH=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},HH=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},b1=function(n,e){return function(t,i){e(t,i,n)}};let qf=class extends sn{constructor(n){super(),this.circleRenderContribitions=n,this.numberType=y_,this.builtinContributions=[vH,SH,xH],this.init(n)}drawShape(n,e,t,i,s,r,a,o){const l=se(n,r==null?void 0:r.theme).circle,{radius:h=l.radius,startAngle:d=l.startAngle,endAngle:u=l.endAngle,x:c=l.x,y:f=l.y}=n.attribute,p=this.valid(n,l,a,o);if(!p)return;const{fVisible:g,sVisible:_,doFill:m,doStroke:y}=p;e.beginPath(),e.arc(t,i,h,d,u),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(n,n.attribute,l),this.beforeRenderStep(n,e,t,i,m,y,g,_,l,s,a,o),m&&(a?a(e,n.attribute,l):g&&(e.setCommonStyle(n,n.attribute,c-t,f-i,l),e.fill())),y&&(o?o(e,n.attribute,l):_&&(e.setStrokeStyle(n,n.attribute,c-t,f-i,l),e.stroke())),this.afterRenderStep(n,e,t,i,m,y,g,_,l,s,a,o)}draw(n,e,t,i){const s=se(n,i==null?void 0:i.theme).circle;this._draw(n,s,!1,t,i)}};qf=jH([ue(),b1(0,Ee(Kt)),b1(0,di(Sb)),HH("design:paramtypes",[Object])],qf);function Zf(n,e,t,i){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=i||{};if(t===1)e.p2&&e.p3?n.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):n.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[o]=rb(e,t);n.bezierCurveTo(s+o.p1.x,r+o.p1.y,s+o.p2.x,r+o.p2.y,s+o.p3.x,r+o.p3.y,a)}else{const o=e.getPointAt(t);n.lineTo(s+o.x,r+o.y,a)}}function Ib(n,e,t,i,s){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:d=!1,zeroX:u=0,zeroY:c=0}=s||{};if(d&&h==="none"||!e)return;let f=!0;const{curves:p}=e;if(t>=1){if(d){let v,x=!0;p.forEach((S,A)=>{var k;let w=S.p0;if(S.originP1!==S.originP2){if(v&&v.originP1===v.originP2&&(w=v.p0),S.defined)x||(n.lineTo(w.x+a,w.y+o,l),x=!x);else{const{originP1:M,originP2:T}=S;let E;if(M&&M.defined!==!1?E=w:M&&T.defined!==!1&&(E=(k=S.p3)!==null&&k!==void 0?k:S.p1),x){x=!x;const O=E?E.x:S.p0.x,B=E?E.y:S.p0.y;n.moveTo(O+a,B+o,l)}else E&&(x=!x,n.lineTo(E.x+a,E.y+o,l))}v=S}else v=S})}else p.forEach(v=>{v.defined?(f&&n.moveTo(v.p0.x+a,v.p0.y+o,l),Zf(n,v,1,s),f=!1):f=!0});return}if(t<=0)return;let g;i==="x"?g=_t.ROW:i==="y"?g=_t.COLUMN:i==="auto"&&(g=e.direction);const _=t*e.tryUpdateLength(g);let m=0,y=!0,b=null;for(let v=0,x=p.length;v<x;v++){const S=p[v],A=S.getLength(g),k=(_-m)/A;if(m+=A,k<0)break;if(d){let w=S.p0;if(S.originP1===S.originP2){b=S;continue}if(b&&b.originP1===b.originP2&&(w=b.p0),S.defined)y||(n.lineTo(w.x+a,w.y+o,l),y=!y);else{const{originP1:M,originP2:T}=S;let E;if(M&&M.defined!==!1?E=w:M&&T.defined!==!1&&(E=(r=S.p3)!==null&&r!==void 0?r:S.p1),y){y=!y;const O=E?E.x:S.p0.x,B=E?E.y:S.p0.y;n.moveTo(O+a,B+o,l)}else E&&(y=!y,n.lineTo(E.x+a,E.y+o,l))}b=S}else{if(!S.defined){f=!0;continue}f&&n.moveTo(S.p0.x+a,S.p0.y+o,l),Zf(n,S,gi(k,1),s),f=!1}}}function GH(n,e,t,i){const{offsetX:s=0,offsetY:r=0}=i,a=e?e.points[e.points.length-1]:t.points[0];n.moveTo(a.x+s,a.y+r),t.points.forEach(o=>{o.defined!==!1?n.lineTo(o.x+s,o.y+r):n.moveTo(o.x+s,o.y+r)})}function WH(n,e,t,i){const{offsetX:s=0,offsetY:r=0}=i,{points:a}=t,o=[];for(let l=0;l<a.length;l++)a[l].defined;o.push(a),o.forEach((l,h)=>{var d,u,c,f;const p=e&&h===0?e.points[e.points.length-1]:l[0];n.moveTo(p.x+s,p.y+r),l.forEach(g=>{g.defined!==!1?n.lineTo(g.x+s,g.y+r):n.moveTo(g.x+s,g.y+r)});for(let g=l.length-1;g>=0;g--){const _=l[g];n.lineTo((d=_.x1)!==null&&d!==void 0?d:_.x,(u=_.y1)!==null&&u!==void 0?u:_.y)}n.lineTo((c=p.x1)!==null&&c!==void 0?c:p.x,(f=p.y1)!==null&&f!==void 0?f:p.y),n.closePath()})}var VH=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};let Zd=class extends sn{constructor(){super(...arguments),this.numberType=Vu}draw(n,e,t,i){const s=se(n,i==null?void 0:i.theme).line;this._draw(n,s,!1,t,i)}drawSegmentItem(n,e,t,i,s,r,a,o,l,h,d,u,c,f,p){var g,_,m,y,b;if(!e)return;n.beginPath();const v=(g=this.z)!==null&&g!==void 0?g:0;Ib(n.camera?n:n.nativeContext,e,l,h,{offsetX:d,offsetY:u,offsetZ:v}),c.cache&&!W(c.cache)&&c.cache.curves.every(T=>T.defined)&&c.attribute.curveType&&c.attribute.curveType.includes("Closed")&&n.closePath(),n.setShadowBlendStyle&&n.setShadowBlendStyle(c,a,o);const{x=0,x:S=0}=a;t!==!1&&(f?f(n,a,o):s&&(n.setCommonStyle(c,a,x-d,S-u,o),n.fill())),i!==!1&&(p?p(n,a,o):r&&(n.setStrokeStyle(c,a,x-d,S-u,o),n.stroke()));let{connectedType:A,connectedX:k,connectedY:w,connectedStyle:M}=a;if(W(o)?(A=(_=A??o[0].connectedType)!==null&&_!==void 0?_:o[1].connectedType,k=(m=k??o[0].connectedX)!==null&&m!==void 0?m:o[1].connectedX,w=(y=w??o[0].connectedY)!==null&&y!==void 0?y:o[1].connectedY,M=(b=M??o[0].connectedStyle)!==null&&b!==void 0?b:o[1].connectedStyle):(A=A??o.connectedType,k=k??o.connectedX,w=w??o.connectedY,M=M??o.connectedStyle),A!=="connect"&&A!=="zero"&&(A="none"),A!=="none"){n.beginPath(),Ib(n.camera?n:n.nativeContext,e,l,h,{offsetX:d,offsetY:u,offsetZ:v,drawConnect:!0,mode:A,zeroX:k,zeroY:w});const T=[];W(o)?o.forEach(E=>T.push(E)):T.push(o),T.push(a),t!==!1&&(f?f(n,a,o):s&&(n.setCommonStyle(c,M,x-d,S-u,T),n.fill())),i!==!1&&(p?p(n,a,o):r&&(n.setStrokeStyle(c,M,x-d,S-u,T),n.stroke()))}return!1}drawLinearLineHighPerformance(n,e,t,i,s,r,a,o,l,h,d,u,c){var f;e.beginPath();const p=(f=this.z)!==null&&f!==void 0?f:0,{points:g}=n.attribute,_=g[0];e.moveTo(_.x+a,_.y+o,p);for(let b=1;b<g.length;b++){const v=g[b];e.lineTo(v.x+a,v.y+o,p)}e.setShadowBlendStyle&&e.setShadowBlendStyle(n,n.attribute,l);const{x:m=0,x:y=0}=n.attribute;t!==!1&&(u?u(e,n.attribute,l):s&&(e.setCommonStyle(n,n.attribute,m-a,y-o,l),e.fill())),i!==!1&&(c?c(e,n.attribute,l):r&&(e.setStrokeStyle(n,n.attribute,m-a,y-o,l),e.stroke()))}drawShape(n,e,t,i,s,r,a,o){const l=se(n,r==null?void 0:r.theme).line,{fill:h=l.fill,stroke:d=l.stroke,fillOpacity:u=l.fillOpacity,strokeOpacity:c=l.strokeOpacity,segments:f,points:p,closePath:g}=n.attribute;if(!this.valid(n,l,a,o))return;let{curveType:_=l.curveType}=n.attribute;g&&_==="linear"&&(_="linearClosed");const{clipRange:m=l.clipRange,clipRangeByDimension:y=l.clipRangeByDimension}=n.attribute;if(m===1&&!f&&!p.some(b=>b.defined===!1)&&_==="linear")return this.drawLinearLineHighPerformance(n,e,!!h,!!d,u,c,t,i,l,s,r,a,o);if(n.shouldUpdateShape()){const{points:b,segments:v}=n.attribute,x=b;if(v&&v.length){let S,A;if(n.cache=v.map((k,w)=>{if(k.points.length<=1&&w===0)return k.points[0]&&(A={endX:k.points[0].x,endY:k.points[0].y,curves:[{defined:k.points[0].defined!==!1}]}),null;w===1?S={x:A.endX,y:A.endY,defined:A.curves[A.curves.length-1].defined}:w>1&&(S.x=A.endX,S.y=A.endY,S.defined=A.curves[A.curves.length-1].defined);const M=lb(k.points,_,{startPoint:S});return A=M,M}).filter(k=>!!k),_==="linearClosed"){let k;for(let w=0;w<n.cache.length;w++){const M=n.cache[w];for(let T=0;T<M.curves.length;T++)if(M.curves[T].defined){k=M.curves[T].p0;break}if(k)break}n.cache[n.cache.length-1]&&n.cache[n.cache.length-1].lineTo(k.x,k.y,!0)}}else{if(!b||!b.length)return n.cache=null,void n.clearUpdateShapeTag();n.cache=lb(x,_)}n.clearUpdateShapeTag()}if(Array.isArray(n.cache)){const b=n.attribute.segments.filter(v=>v.points.length);if(b[0].points.length===1&&b.shift(),m===1){let v=!1;n.cache.forEach((x,S)=>{v||(v=this.drawSegmentItem(e,x,!!h,!!d,u,c,b[S],[l,n.attribute],m,y,t,i,n,a,o))})}else{const v=n.cache.reduce((k,w)=>k+w.getLength(),0),x=m*v;let S=0,A=!1;n.cache.forEach((k,w)=>{if(A)return;const M=k.getLength(),T=(x-S)/M;S+=M,T>0&&(A=this.drawSegmentItem(e,k,!!h,!!d,u,c,b[w],[l,n.attribute],gi(T,1),y,t,i,n,a,o))})}}else this.drawSegmentItem(e,n.cache,!!h,!!d,u,c,n.attribute,l,m,y,t,i,n,a,o)}};Zd=VH([ue()],Zd);function NH(n,e,t,i){var s;const{drawConnect:r=!1,mode:a="none"}=i;if(r&&a==="none")return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(t>=1){const S=[],A=[];let k=!0;if(r){let w,M,T=!0;const E=o.curves.length;o.curves.forEach((O,B)=>{const R=l.curves[E-B-1];let L=O,I=R;if(O.originP1===O.originP2)return w=O,void(M=R);if(w&&w.originP1===w.originP2&&(L=w,I=M),O.defined)T||(S.push(L),A.push(I),wo(n,S,A,i),S.length=0,A.length=0,T=!T);else{const{originP1:F,originP2:H}=O;let G,U;F&&F.defined!==!1?(G=L,U=I):F&&H.defined!==!1&&(G=O,U=R),T?(T=!T,S.push(G||O),A.push(U||R)):G&&(T=!T,S.push(G||O),A.push(U||R),wo(n,S,A,i),S.length=0,A.length=0)}w=O}),wo(n,S,A,i)}else{for(let w=0,M=o.curves.length;w<M;w++){const T=o.curves[w];k!==T.defined?(k?(Fc(n,S,A,i),S.length=0,A.length=0):(S.push(T),A.push(l.curves[M-w-1])),k=!k):k&&(S.push(T),A.push(l.curves[M-w-1]))}Fc(n,S,A,i)}return}if(t<=0)return;let{direction:h}=i;const{curves:d}=o,u=(s=d[d.length-1].p3)!==null&&s!==void 0?s:d[d.length-1].p1,c=Ve(u.x-d[0].p0.x),f=Ve(u.y-d[0].p0.y);h=h??(c>f?_t.ROW:_t.COLUMN),Number.isFinite(c)||(h=_t.COLUMN),Number.isFinite(f)||(h=_t.ROW);const p=t*(h===_t.ROW?c:f);let g=0,_=!0;const m=[],y=[];let b,v,x=!0;for(let S=0,A=o.curves.length;S<A;S++){const k=o.curves[S],w=k.getLength(h),M=(p-g)/w;if(M<0)break;if(g+=w,r){const T=l.curves[A-S-1];let E=k,O=T;if(k.originP1===k.originP2){b=k,v=T;continue}if(b&&b.originP1===b.originP2&&(E=b,O=v),k.defined)x||(m.push(E),y.push(O),wo(n,m,y,i),m.length=0,y.length=0,x=!x);else{const{originP1:B,originP2:R}=k;let L,I;B&&B.defined!==!1?(L=E,I=O):B&&R.defined!==!1&&(L=k,I=T),x?(x=!x,m.push(L||k),y.push(I||T)):L&&(x=!x,m.push(L||k),y.push(I||T),wo(n,m,y,i),m.length=0,y.length=0)}b=k}else{let T=null,E=null;_!==k.defined?(_?(Fc(n,m,y,i),m.length=0,y.length=0):(T=k,E=l.curves[A-S-1]),_=!_):_&&(T=k,E=l.curves[A-S-1]),T&&E&&(M<1&&(T=T.p2&&T.p3?rb(T,M)[0]:dA(T,M)[0],E=E.p2&&E.p3?rb(E,1-M)[1]:dA(E,1-M)[1]),T.defined=_,E.defined=_,m.push(T),y.push(E)),T=null,E=null}}r?wo(n,m,y,i):Fc(n,m,y,i)}function wo(n,e,t,i){if(e.length<2)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0,mode:o}=i;let l=e[0];n.moveTo(l.p0.x+s,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;n.lineTo(h.x+s,h.y+r,a),l=t[t.length-1],n.lineTo(l.p0.x+s,l.p0.y+r,a),l=t[0],h=l.p3||l.p1,n.lineTo(h.x+s,h.y+r,a),n.closePath()}function Fc(n,e,t,i){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=i;let o=!0;e.forEach(l=>{l.defined?(o&&n.moveTo(l.p0.x+s,l.p0.y+r,a),Zf(n,l,1,i),o=!1):o=!0}),o=!0;for(let l=t.length-1;l>=0;l--){const h=t[l];h.defined?(o&&n.lineTo(h.p0.x+s,h.p0.y+r,a),Zf(n,h,1,i),o=!1):o=!0}n.closePath()}const UH=new DH,$H=_o;var YH=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},XH=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},v1=function(n,e){return function(t,i){e(t,i,n)}};function zc(n,e,t){switch(e){case"linear":default:return ju(n,t);case"basis":return BP(n,t);case"monotoneX":return IP(n,t);case"monotoneY":return DP(n,t);case"step":return Rl(n,.5,t);case"stepBefore":return Rl(n,0,t);case"stepAfter":return Rl(n,1,t);case"linearClosed":return FP(n,t)}}let Jd=class extends sn{constructor(n){super(),this.areaRenderContribitions=n,this.numberType=Wu,this.builtinContributions=[UH,$H],this.init(n)}drawLinearAreaHighPerformance(n,e,t,i,s,r,a,o,l,h,d,u,c){var f,p,g,_,m;e.beginPath();const y=(f=this.z)!==null&&f!==void 0?f:0,{points:b}=n.attribute,v=b[0];e.moveTo(v.x+a,v.y+o,y);for(let A=1;A<b.length;A++){const k=b[A];e.lineTo(k.x+a,k.y+o,y)}for(let A=b.length-1;A>=0;A--){const k=b[A];e.lineTo(((p=k.x1)!==null&&p!==void 0?p:k.x)+a,((g=k.y1)!==null&&g!==void 0?g:k.y)+o,y)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(n,n.attribute,l),this.beforeRenderStep(n,e,a,o,!!s,!1,t,!1,l,h,u,null,{attribute:n.attribute});const{x=0,x:S=0}=n.attribute;if(t!==!1&&(u?u(e,n.attribute,l):s&&(e.setCommonStyle(n,n.attribute,x-a,S-o,l),e.fill())),this.afterRenderStep(n,e,a,o,!!s,!1,t,!1,l,h,u,null,{attribute:n.attribute}),i){const{stroke:A=l&&l.stroke}=n.attribute;if(W(A)&&(A[0]||A[2])&&A[1]===!1){if(e.beginPath(),A[0]){e.moveTo(v.x+a,v.y+o,y);for(let k=1;k<b.length;k++){const w=b[k];e.lineTo(w.x+a,w.y+o,y)}}else if(A[2]){const k=b[b.length-1];e.moveTo(k.x+a,k.y+o,y);for(let w=b.length-2;w>=0;w--){const M=b[w];e.lineTo(((_=M.x1)!==null&&_!==void 0?_:M.x)+a,((m=M.y1)!==null&&m!==void 0?m:M.y)+o,y)}}}c?c(e,n.attribute,l):(e.setStrokeStyle(n,n.attribute,x-a,S-o,l),e.stroke())}}drawShape(n,e,t,i,s,r,a,o){var l,h,d,u,c,f;const p=se(n,r==null?void 0:r.theme).area,{fill:g=p.fill,stroke:_=p.stroke,fillOpacity:m=p.fillOpacity,z:y=p.z,strokeOpacity:b=p.strokeOpacity}=n.attribute,v=this.valid(n,p,a,o);if(!v)return;const{doFill:x,doStroke:S}=v,{clipRange:A=p.clipRange,closePath:k,points:w,segments:M}=n.attribute;let{curveType:T=p.curveType}=n.attribute;if(k&&T==="linear"&&(T="linearClosed"),A===1&&!M&&!w.some(E=>E.defined===!1)&&T==="linear")return this.drawLinearAreaHighPerformance(n,e,!!g,S,m,b,t,i,p,s,r,a,o);if(n.shouldUpdateShape()){if(M&&M.length){let E,O;const B=M.map((I,F)=>{if(I.points.length<=1&&F===0)return I.points[0]&&(O={endX:I.points[0].x,endY:I.points[0].y}),null;F===1?E={x:O.endX,y:O.endY}:F>1&&(E.x=O.endX,E.y=O.endY);const H=zc(I.points,T,{startPoint:E});return O=H,H}).filter(I=>!!I);let R;const L=[];for(let I=M.length-1;I>=0;I--){const F=M[I].points,H=[];for(let G=F.length-1;G>=0;G--)H.push({x:(l=F[G].x1)!==null&&l!==void 0?l:F[G].x,y:(h=F[G].y1)!==null&&h!==void 0?h:F[G].y});if(I!==0){const G=M[I-1].points,U=G[G.length-1];U&&H.push({x:(d=U.x1)!==null&&d!==void 0?d:U.x,y:(u=U.y1)!==null&&u!==void 0?u:U.y})}H.length>1&&(R=zc(H,T==="stepBefore"?"stepAfter":T==="stepAfter"?"stepBefore":T),L.unshift(R))}n.cacheArea=L.map((I,F)=>({top:B[F],bottom:I}))}else{if(!w||!w.length)return n.cacheArea=null,void n.clearUpdateShapeTag();{const E=w,O=[];for(let L=w.length-1;L>=0;L--)O.push({x:(c=w[L].x1)!==null&&c!==void 0?c:w[L].x,y:(f=w[L].y1)!==null&&f!==void 0?f:w[L].y});const B=zc(E,T),R=zc(O,T==="stepBefore"?"stepAfter":T==="stepAfter"?"stepBefore":T);n.cacheArea={top:B,bottom:R}}}n.clearUpdateShapeTag()}if(Array.isArray(n.cacheArea)){const E=n.attribute.segments.filter(O=>O.points.length);if(E[0].points.length===1&&E.shift(),A===1){let O=!1;n.cacheArea.forEach((B,R)=>{O||(O=this.drawSegmentItem(e,B,x,m,S,b,E[R],[p,n.attribute],A,t,i,y,n,s,a,o))})}else{const O=n.cacheArea.reduce((I,F)=>I+F.top.getLength(),0),B=A*O;let R=0,L=!1;n.cacheArea.forEach((I,F)=>{if(L)return;const H=I.top.getLength(),G=(B-R)/H;R+=H,G>0&&(L=this.drawSegmentItem(e,I,x,m,S,b,E[F],[p,n.attribute],gi(G,1),t,i,y,n,s,a,o))})}}else this.drawSegmentItem(e,n.cacheArea,x,m,S,b,n.attribute,p,A,t,i,y,n,s,a,o)}draw(n,e,t,i){const s=se(n,i==null?void 0:i.theme).area;this._draw(n,s,!1,t,i)}drawSegmentItem(n,e,t,i,s,r,a,o,l,h,d,u,c,f,p,g){let _=!1;return _=_||this._drawSegmentItem(n,e,t,i,s,r,a,o,l,h,d,u,c,f,!1,p,g),_=_||this._drawSegmentItem(n,e,t,i,s,r,a,o,l,h,d,u,c,f,!0,p,g),_}_drawSegmentItem(n,e,t,i,s,r,a,o,l,h,d,u,c,f,p,g,_){var m,y,b,v;let{connectedType:x,connectedX:S,connectedY:A,connectedStyle:k}=a;const w=[];if(p&&(W(o)?(x=(m=x??o[0].connectedType)!==null&&m!==void 0?m:o[1].connectedType,S=(y=S??o[0].connectedX)!==null&&y!==void 0?y:o[1].connectedX,A=(b=A??o[0].connectedY)!==null&&b!==void 0?b:o[1].connectedY,k=(v=k??o[0].connectedStyle)!==null&&v!==void 0?v:o[1].connectedStyle):(x=x??o.connectedType,S=S??o.connectedX,A=A??o.connectedY,k=k??o.connectedStyle),x!=="connect"&&x!=="zero"&&(x="none"),W(o)?o.forEach(I=>w.push(I)):w.push(o),w.push(a)),p&&x==="none")return!1;if(!e)return;n.beginPath();const{points:M,segments:T}=c.attribute;let E,O,B=_t.ROW;if(T){const I=T[T.length-1];O=T[0].points[0],E=I.points[I.points.length-1]}else O=M[0],E=M[M.length-1];B=Ve(E.x-O.x)>Ve(E.y-O.y)?_t.ROW:_t.COLUMN,NH(n.camera?n:n.nativeContext,e,l,{offsetX:h,offsetY:d,offsetZ:u,direction:B,drawConnect:p,mode:x,zeroX:S,zeroY:A}),this.beforeRenderStep(c,n,h,d,!!i,!1,t,!1,o,f,g,null,{attribute:a}),n.setShadowBlendStyle&&n.setShadowBlendStyle(c,a,o);const{x:R=0,x:L=0}=a;if(t!==!1&&(g?g(n,a,o):i&&(n.setCommonStyle(c,p?k:a,R-h,L-d,p?w:o),n.fill())),this.afterRenderStep(c,n,h,d,!!i,!1,t,!1,o,f,g,null,{attribute:a}),s!==!1)if(_)_(n,a,o);else{const{stroke:I=o&&o[1]&&o[1].stroke}=a;W(I)&&(I[0]||I[2])&&I[1]===!1&&(n.beginPath(),Ib(n.camera?n:n.nativeContext,I[0]?e.top:e.bottom,l,B===_t.ROW?"x":"y",{offsetX:h,offsetY:d,offsetZ:u,drawConnect:p,mode:x,zeroX:S,zeroY:A})),n.setStrokeStyle(c,p?k:a,R-h,L-d,p?w:o),n.stroke()}return!1}};Jd=YH([ue(),v1(0,Ee(Kt)),v1(0,di(xb)),XH("design:paramtypes",[Object])],Jd);const KH=Ah,qH=_o;var ZH=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},JH=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},x1=function(n,e){return function(t,i){e(t,i,n)}};let Jf=class extends sn{constructor(n){super(),this.pathRenderContribitions=n,this.numberType=x_,this.builtinContributions=[qH,KH],this.init(n)}drawShape(n,e,t,i,s,r,a,o){var l,h,d;const u=(l=this.tempTheme)!==null&&l!==void 0?l:se(n,r==null?void 0:r.theme).path,{x:c=u.x,y:f=u.y}=n.attribute,p=(h=this.z)!==null&&h!==void 0?h:0,g=this.valid(n,u,a,o);if(!g)return;const{fVisible:_,sVisible:m,doFill:y,doStroke:b}=g;if(e.beginPath(),n.pathShape)lr(n.pathShape.commandList,e,t,i,1,1,p);else{const v=(d=n.attribute.path)!==null&&d!==void 0?d:u.path;lr(v.commandList,e,t,i,1,1,p)}e.setShadowBlendStyle&&e.setShadowBlendStyle(n,n.attribute,u),this.beforeRenderStep(n,e,t,i,y,b,_,m,u,s,a,o),b&&(o?o(e,n.attribute,u):m&&(e.setStrokeStyle(n,n.attribute,c-t,f-i,u),e.stroke())),y&&(a?a(e,n.attribute,u):_&&(e.setCommonStyle(n,n.attribute,c-t,f-i,u),e.fill())),this.afterRenderStep(n,e,t,i,y,b,_,m,u,s,a,o)}draw(n,e,t,i){const s=se(n,i==null?void 0:i.theme).path;this.tempTheme=s,this._draw(n,s,!1,t,i),this.tempTheme=null}};Jf=ZH([ue(),x1(0,Ee(Kt)),x1(0,di(kb)),JH("design:paramtypes",[Object])],Jf);var QH=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},eG=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},S1=function(n,e){return function(t,i){e(t,i,n)}};let Qf=class extends sn{constructor(n){super(),this.rectRenderContribitions=n,this.type="rect",this.numberType=A_,this.builtinContributions=[PH,RH,EH],this.init(n)}drawShape(n,e,t,i,s,r,a,o){var l;const h=(l=this.tempTheme)!==null&&l!==void 0?l:se(n,r==null?void 0:r.theme).rect,{fill:d=h.fill,background:u,stroke:c=h.stroke,cornerRadius:f=h.cornerRadius,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:_=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible,x1:b,y1:v,x=h.x,y:S=h.y}=n.attribute;let{width:A,height:k}=n.attribute;A=(A??b-x)||0,k=(k??v-S)||0;const w=jx(p,g,A,k,d),M=Gx(p,m,A,k),T=go(d,u),E=Sh(c,_);if(!n.valid||!y||!T&&!E||!(w||M||a||o||u))return;f===0||W(f)&&f.every(B=>B===0)?(e.beginPath(),e.rect(t,i,A,k)):(e.beginPath(),so(e,t,i,A,k,f));const O={doFill:T,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(n,n.attribute,h),this.beforeRenderStep(n,e,t,i,T,E,w,M,h,s,a,o,O),O.doFill&&(a?a(e,n.attribute,h):w&&(e.setCommonStyle(n,n.attribute,x-t,S-i,h),e.fill())),O.doStroke&&(o?o(e,n.attribute,h):M&&(e.setStrokeStyle(n,n.attribute,x-t,S-i,h),e.stroke())),this.afterRenderStep(n,e,t,i,T,E,w,M,h,s,a,o)}draw(n,e,t,i){const s=se(n,i==null?void 0:i.theme).rect;this.tempTheme=s,this._draw(n,s,!1,t,i),this.tempTheme=null}};Qf=QH([ue(),S1(0,Ee(Kt)),S1(0,di(ed)),eG("design:paramtypes",[Object])],Qf);var tG=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},iG=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},A1=function(n,e){return function(t,i){e(t,i,n)}};let ep=class extends sn{constructor(n){super(),this.symbolRenderContribitions=n,this.numberType=k_,this.builtinContributions=[BH,IH,LH],this.init(n)}drawShape(n,e,t,i,s,r,a,o){var l;const h=se(n,r==null?void 0:r.theme).symbol,{size:d=h.size,x:u=h.x,y:c=h.y,scaleX:f=h.scaleX,scaleY:p=h.scaleY}=n.attribute,g=this.valid(n,h,a,o);if(!g)return;const{fVisible:_,sVisible:m,doFill:y,doStroke:b}=g,v=n.getParsedPath();if(!v)return;const{keepDirIn3d:x=h.keepDirIn3d}=n.attribute,S=(l=this.z)!==null&&l!==void 0?l:0;if(e.beginPath(),x&&e.camera&&e.project){const A=e.project(t,i,S),k=e.camera;e.camera=null,v.draw(e,W(d)?[d[0]*f,d[1]*p]:d*f,A.x,A.y,void 0,(w,M)=>{var T,E,O;if(n._parsedPath.svgCache){const B=Object.assign({},M);B.fill=(T=M.fill)!==null&&T!==void 0?T:n.attribute.fill,B.opacity=(E=M.fill)!==null&&E!==void 0?E:n.attribute.opacity,B.fillOpacity=n.attribute.fillOpacity,B.stroke=(O=M.stroke)!==null&&O!==void 0?O:n.attribute.stroke,M=B}M.fill&&(a?a(e,n.attribute,h):(e.setCommonStyle(n,M,u-t,c-i,h),e.fill())),M.stroke&&(o?o(e,n.attribute,h):(e.setStrokeStyle(n,M,(u-t)/f,(c-i)/p,h),e.stroke()))})===!1&&e.closePath(),e.camera=k}else v.draw(e,d,t,i,S,(A,k)=>{var w,M,T;if(n._parsedPath.svgCache){const E=Object.assign({},k);E.fill=(w=k.fill)!==null&&w!==void 0?w:n.attribute.fill,E.opacity=(M=k.opacity)!==null&&M!==void 0?M:n.attribute.opacity,E.fillOpacity=n.attribute.fillOpacity,E.stroke=(T=k.stroke)!==null&&T!==void 0?T:n.attribute.stroke,k=E}k.fill&&(a?a(e,n.attribute,h):(e.setCommonStyle(n,k,u-t,c-i,h),e.fill())),k.stroke&&(o?o(e,n.attribute,h):(e.setStrokeStyle(n,k,(u-t)/f,(c-i)/p,h),e.stroke()))})===!1&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(n,n.attribute,h),this.beforeRenderStep(n,e,t,i,y,b,_,m,h,s,a,o),y&&!v.isSvg&&(a?a(e,n.attribute,h):_&&(e.setCommonStyle(n,n.attribute,u-t,c-i,h),e.fill())),b&&!v.isSvg&&(o?o(e,n.attribute,h):m&&(e.setStrokeStyle(n,n.attribute,(u-t)/f,(c-i)/p,h),e.stroke())),this.afterRenderStep(n,e,t,i,y,b,_,m,h,s,a,o)}draw(n,e,t,i){const s=se(n,i==null?void 0:i.theme).symbol;this._draw(n,s,!1,t,i)}};ep=tG([ue(),A1(0,Ee(Kt)),A1(0,di(Mb)),iG("design:paramtypes",[Object])],ep);class nG{constructor(){this.pools=[];for(let e=0;e<10;e++)this.pools.push(new St)}allocate(e,t,i,s){if(!this.pools.length)return new St().setValue(e,t,i,s);const r=this.pools.pop();return r.x1=e,r.y1=t,r.x2=i,r.y2=s,r}allocateByObj(e){if(!this.pools.length)return new St(e);const t=this.pools.pop();return t.x1=e.x1,t.y1=e.y1,t.x2=e.x2,t.y2=e.y2,t}free(e){this.pools.push(e)}get length(){return this.pools.length}release(...e){this.pools=[]}}const tp=new nG;class sG extends $u{constructor(){super(...arguments),this.time=ui.beforeFillStroke}drawShape(e,t,i,s,r,a,o,l,h,d,u,c){var f,p,g,_,m,y,b,v,x,S;const{backgroundMode:A=h.backgroundMode,backgroundFit:k=h.backgroundFit}=e.attribute;let w,{background:M}=e.attribute;if(!M)return;const T=He(M)&&M.background,E=e.transMatrix.onlyTranslate();if(T){const O=e.AABBBounds,B=((f=M.x)!==null&&f!==void 0?f:O.x1)+((p=M.dx)!==null&&p!==void 0?p:0),R=((g=M.y)!==null&&g!==void 0?g:O.y1)+((_=M.dy)!==null&&_!==void 0?_:0),L=(m=M.width)!==null&&m!==void 0?m:O.width(),I=(y=M.height)!==null&&y!==void 0?y:O.height();if(w=tp.allocate(B,R,B+L,R+I),M=M.background,!E){const F=w.width(),H=w.height();w.set(((b=M.x)!==null&&b!==void 0?b:0)+((v=M.dx)!==null&&v!==void 0?v:0),((x=M.y)!==null&&x!==void 0?x:0)+((S=M.dy)!==null&&S!==void 0?S:0),F,H)}}else w=e.AABBBounds,E||w.set(0,0,w.width(),w.height());if(e.backgroundImg&&e.resources){const O=e.resources.get(M);if(O.state!=="success"||!O.data)return;t.highPerformanceSave(),E&&t.setTransformFromMatrix(e.parent.globalTransMatrix,!0),t.setCommonStyle(e,e.attribute,i,s,h),this.doDrawImage(t,O.data,w,A,k),t.highPerformanceRestore(),t.setTransformForCurrent()}else t.highPerformanceSave(),t.setCommonStyle(e,e.attribute,i,s,h),t.fillStyle=M,t.fillRect(w.x1,w.y1,w.width(),w.height()),t.highPerformanceRestore();T&&tp.free(w)}}const BE=new sG;var rG=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},aG=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},k1=function(n,e){return function(t,i){e(t,i,n)}};let Db=class extends sn{constructor(n){super(),this.textRenderContribitions=n,this.numberType=w_,this.builtinContributions=[BE],this.init(n)}drawShape(n,e,t,i,s,r,a,o){var l,h,d;const u=se(n,r==null?void 0:r.theme).text,{text:c,underline:f=u.underline,lineThrough:p=u.lineThrough,keepDirIn3d:g=u.keepDirIn3d,direction:_=u.direction,whiteSpace:m=u.whiteSpace,fontSize:y=u.fontSize,verticalMode:b=u.verticalMode,x:v=u.x,y:x=u.y}=n.attribute;let{textAlign:S=u.textAlign,textBaseline:A=u.textBaseline}=n.attribute;if(!b&&_==="vertical"){const I=S;S=(l=n.getBaselineMapAlign()[A])!==null&&l!==void 0?l:"left",A=(h=n.getAlignMapBaseline()[I])!==null&&h!==void 0?h:"top"}const k=(d=Bs(n.attribute.lineHeight,y))!==null&&d!==void 0?d:y,w=this.valid(n,u,a,o);if(!w)return;const{fVisible:M,sVisible:T,doFill:E,doStroke:O}=w,B=!g,R=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(n,n.attribute,u),this.beforeRenderStep(n,e,t,i,E,O,M,T,u,s,a,o),B&&this.transformUseContext2d(n,u,R,e);const L=(I,F,H,G)=>{let U=t+F;const $=i+H;if(G){e.highPerformanceSave(),U+=y;const Z=Vn.allocate(1,0,0,1,0,0);Z.rotateByCenter(Math.PI/2,U,$),e.transformFromMatrix(Z,!0),Vn.free(Z)}O&&(o?o(e,n.attribute,u):T&&(e.setStrokeStyle(n,n.attribute,v-t,x-i,u),e.strokeText(I,U,$,R))),E&&(a?a(e,n.attribute,u):M&&(e.setCommonStyle(n,n.attribute,v-t,x-i,u),e.fillText(I,U,$,R),this.drawUnderLine(f,p,n,U,$,R,u,e))),G&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(n.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(n.attribute,u,R),_==="horizontal"){const{multilineLayout:I}=n;if(!I)return void e.highPerformanceRestore();const{xOffset:F,yOffset:H}=I.bbox;O&&(o?o(e,n.attribute,u):T&&(e.setStrokeStyle(n,n.attribute,v-t,x-i,u),I.lines.forEach(G=>{e.strokeText(G.str,(G.leftOffset||0)+F+t,(G.topOffset||0)+H+i,R)}))),E&&(a?a(e,n.attribute,u):M&&(e.setCommonStyle(n,n.attribute,v-t,x-i,u),I.lines.forEach(G=>{e.fillText(G.str,(G.leftOffset||0)+F+t,(G.topOffset||0)+H+i,R),this.drawMultiUnderLine(f,p,n,(G.leftOffset||0)+t,(G.topOffset||0)+H+i,R,G.width,u,e)})))}else{n.tryUpdateAABBBounds();const I=n.cache,{verticalList:F}=I;e.textAlign="left",e.textBaseline="top";const H=k*F.length;let G=0;F.forEach(Z=>{const q=Z.reduce((ie,K)=>ie+(K.width||0),0);G=Ji(q,G)});let U=0,$=0;A==="bottom"?$=-H:A==="middle"&&($=-H/2),S==="center"?U-=G/2:S==="right"&&(U-=G),F.forEach((Z,q)=>{const ie=Z.reduce((te,le)=>te+(le.width||0),0),K=G-ie;let V=U;S==="center"?V+=K/2:S==="right"&&(V+=K),Z.forEach(te=>{const{text:le,width:he,direction:Ce}=te;L(le,H-(q+1)*k+$,V,Ce),V+=he})})}else if(_==="horizontal"){e.setTextStyle(n.attribute,u,R);const I=n.clipedText;let F=0;k!==y&&(A==="top"?F=(k-y)/2:A==="middle"||A==="bottom"&&(F=-(k-y)/2)),L(I,0,F,0)}else{n.tryUpdateAABBBounds();const I=n.cache;if(I){e.setTextStyleWithoutAlignBaseline(n.attribute,u,R);const{verticalList:F}=I;let H=0;const G=F[0].reduce(($,Z)=>$+(Z.width||0),0);let U=0;A==="bottom"?U=-k:A==="middle"&&(U=-k/2),S==="center"?H-=G/2:S==="right"&&(H-=G),e.textAlign="left",e.textBaseline="top",F[0].forEach($=>{const{text:Z,width:q,direction:ie}=$;L(Z,U,H,ie),H+=q})}}B&&this.restoreTransformUseContext2d(n,u,R,e),this.afterRenderStep(n,e,t,i,E,O,M,T,u,s,a,o)}draw(n,e,t,i){const s=se(n,i==null?void 0:i.theme).text,{keepDirIn3d:r=s.keepDirIn3d}=n.attribute,a=!r;this._draw(n,s,a,t,i)}drawUnderLine(n,e,t,i,s,r,a,o){if(e+n<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:d=a.fontSize,fill:u=a.fill,opacity:c=a.opacity,fillOpacity:f=a.fillOpacity}=t.attribute,p=t.clipedWidth,g=ir(l,p),_=nr(h,d,d),m={lineWidth:0,stroke:u,opacity:c,strokeOpacity:f};if(n){m.lineWidth=n,o.setStrokeStyle(t,m,i,s,a),o.beginPath();const y=s+_+d;o.moveTo(i+g,y,r),o.lineTo(i+g+p,y,r),o.stroke()}if(e){m.lineWidth=e,o.setStrokeStyle(t,m,i,s,a),o.beginPath();const y=s+_+d/2;o.moveTo(i+g,y,r),o.lineTo(i+g+p,y,r),o.stroke()}}drawMultiUnderLine(n,e,t,i,s,r,a,o,l){if(e+n<=0)return;const{textAlign:h=o.textAlign,fontSize:d=o.fontSize,fill:u=o.fill,opacity:c=o.opacity,fillOpacity:f=o.fillOpacity}=t.attribute,p=ir(h,a),g=nr("alphabetic",d,d),_={lineWidth:0,stroke:u,opacity:c,strokeOpacity:f};let m=-3;if(n){_.lineWidth=n,l.setStrokeStyle(t,_,i,s,o),l.beginPath();const y=s+g+d+m;l.moveTo(i+p,y,r),l.lineTo(i+p+a,y,r),l.stroke()}if(m=-1,e){_.lineWidth=e,l.setStrokeStyle(t,_,i,s,o),l.beginPath();const y=s+g+d/2+m;l.moveTo(i+p,y,r),l.lineTo(i+p+a,y,r),l.stroke()}}};Db=rG([ue(),k1(0,Ee(Kt)),k1(0,di(Tb)),aG("design:paramtypes",[Object])],Db);function LE(n,e,t,i){n.moveTo(e[0].x+t,e[0].y+i);for(let s=1;s<e.length;s++)n.lineTo(e[s].x+t,e[s].y+i)}function oG(n,e,t,i,s,r=!0){var a;if(e.length<3)return void LE(n,e,t,i);let o=0,l=e.length-1;r||(o+=1,l-=1,n.moveTo(e[0].x+t,e[0].y+i));for(let h=o;h<=l;h++){const d=e[h===0?l:(h-1)%e.length],u=e[h%e.length],c=e[(h+1)%e.length],f=u.x-d.x,p=u.y-d.y,g=u.x-c.x,_=u.y-c.y,m=(Math.atan2(p,f)-Math.atan2(_,g))/2,y=Math.abs(Math.tan(m));let b=Array.isArray(s)?(a=s[h%e.length])!==null&&a!==void 0?a:0:s,v=b/y;const x=jc(f,p),S=jc(g,_),A=Math.min(x,S);v>A&&(v=A,b=A*y);const k=Xm(u,v,x,f,p),w=Xm(u,v,S,g,_),M=2*u.x-k.x-w.x,T=2*u.y-k.y-w.y,E=jc(M,T),O=Xm(u,jc(v,b),E,M,T);let B=Math.atan2(k.y-O.y,k.x-O.x);const R=Math.atan2(w.y-O.y,w.x-O.x);let L=R-B;L<0&&(B=R,L=-L),L>Math.PI&&(L-=Math.PI),h===0?n.moveTo(k.x+t,k.y+i):n.lineTo(k.x+t,k.y+i),L&&n.arcTo(u.x+t,u.y+i,w.x+t,w.y+i,b),n.lineTo(w.x+t,w.y+i)}r||n.lineTo(e[l+1].x+t,e[l+1].y+i)}function jc(n,e){return Math.sqrt(n*n+e*e)}function Xm(n,e,t,i,s){const r=e/t;return{x:n.x-i*r,y:n.y-s*r}}const lG=Ah,hG=_o;var dG=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},uG=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},w1=function(n,e){return function(t,i){e(t,i,n)}};let Fb=class extends sn{constructor(n){super(),this.polygonRenderContribitions=n,this.numberType=S_,this.builtinContributions=[hG,lG],this.init(n)}drawShape(n,e,t,i,s,r,a,o){const l=se(n,r==null?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:d=l.cornerRadius,x:u=l.x,y:c=l.y,closePath:f=l.closePath}=n.attribute,p=this.valid(n,l,a,o);if(!p)return;const{fVisible:g,sVisible:_,doFill:m,doStroke:y}=p;e.beginPath(),d<=0||W(d)&&d.every(b=>b===0)?LE(e.camera?e:e.nativeContext,h,t,i):oG(e.camera?e:e.nativeContext,h,t,i,d,f),f&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(n,n.attribute,l),this.beforeRenderStep(n,e,t,i,m,y,g,_,l,s,a,o),m&&(a?a(e,n.attribute,l):g&&(e.setCommonStyle(n,n.attribute,u-t,c-i,l),e.fill())),y&&(o?o(e,n.attribute,l):_&&(e.setStrokeStyle(n,n.attribute,u-t,c-i,l),e.stroke())),this.afterRenderStep(n,e,t,i,m,y,g,_,l,s,a,o)}draw(n,e,t,i){const s=se(n,i==null?void 0:i.theme).polygon;this._draw(n,s,!1,t,i)}};Fb=dG([ue(),w1(0,Ee(Kt)),w1(0,di(wb)),uG("design:paramtypes",[Object])],Fb);var cG=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},fG=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},M1=function(n,e){return function(t,i){e(t,i,n)}};const pG=["","repeat-x","repeat-y","repeat"];let zb=class extends sn{constructor(n){super(),this.imageRenderContribitions=n,this.numberType=v_,this.builtinContributions=[TH],this.init(n)}drawShape(n,e,t,i,s,r,a){const o=se(n).image,{width:l=o.width,height:h=o.height,repeatX:d=o.repeatX,repeatY:u=o.repeatY,cornerRadius:c=o.cornerRadius,image:f}=n.attribute,p=this.valid(n,o,a);if(!p)return;const{fVisible:g,sVisible:_,doFill:m,doStroke:y}=p;if(e.setShadowBlendStyle&&e.setShadowBlendStyle(n,o),this.beforeRenderStep(n,e,t,i,m,!1,g,!1,o,s,a),m){if(a)a(e,n.attribute,o);else if(g){if(!f||!n.resources)return;const b=n.resources.get(f);if(b.state!=="success")return;let v=!1;c===0||W(c)&&c.every(S=>S===0)||(e.beginPath(),so(e,t,i,l,h,c),e.save(),e.clip(),v=!0),e.setCommonStyle(n,n.attribute,t,i,o);let x=0;if(d==="repeat"&&(x|=1),u==="repeat"&&(x|=2),x){const S=e.createPattern(b.data,pG[x]);e.fillStyle=S,e.translate(t,i,!0),e.fillRect(0,0,l,h),e.translate(-t,-i,!0)}else e.drawImage(b.data,t,i,l,h);v&&e.restore()}}this.afterRenderStep(n,e,t,i,m,!1,g,!1,o,s,a)}draw(n,e,t){const{image:i}=n.attribute;if(!i||!n.resources||n.resources.get(i).state!=="success")return;const{context:s}=e.drawParams;if(!s)return;const r=se(n).image;this._draw(n,r,!1,t)}};zb=cG([ue(),M1(0,Ee(Kt)),M1(0,di(Ab)),fG("design:paramtypes",[Object])],zb);const IE=Symbol.for("IncrementalDrawContribution"),ip=Symbol.for("ArcRender"),jb=Symbol.for("Arc3dRender"),np=Symbol.for("AreaRender"),sp=Symbol.for("CircleRender"),ci=Symbol.for("GraphicRender"),T1=Symbol.for("GroupRender"),rp=Symbol.for("LineRender"),ap=Symbol.for("PathRender"),op=Symbol.for("PolygonRender"),lp=Symbol.for("RectRender"),Hb=Symbol.for("Rect3DRender"),hp=Symbol.for("SymbolRender"),Gb=Symbol.for("TextRender"),Wb=Symbol.for("RichTextRender"),Vb=Symbol.for("Pyramid3dRender"),dp=Symbol.for("GlyphRender"),C1=Symbol.for("ImageRender"),Kx=Symbol.for("DrawContribution");var gG=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},_G=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},mG=function(n,e){return function(t,i){e(t,i,n)}};const DE=Symbol.for("RenderService");let Nb=class{constructor(n){this.drawContribution=n}prepare(n){n&&this.renderTreeRoots.forEach(e=>{this._prepare(e,n)})}_prepare(n,e){n.forEachChildren(t=>{this._prepare(t,e)}),n.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(n){}draw(n){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(n){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(n,e){this.renderTreeRoots=n,this.drawParams=e;const t=e.updateBounds;this.prepare(t),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e)}};Nb=gG([ue(),mG(0,Ee(Kx)),_G("design:paramtypes",[Object])],Nb);const yG=new Me(n=>{n(DE).to(Nb).inSingletonScope()}),Ol=Symbol.for("PickerService"),P1=Symbol.for("GlobalPickerService");var qx=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};const Uo=Symbol.for("PickItemInterceptor");let up=class{constructor(){this.order=1}afterPickItem(n,e,t,i,s){return n.attribute.shadowRootIdx>0||!n.attribute.shadowRootIdx?this._pickItem(n,e,t,i,s):null}beforePickItem(n,e,t,i,s){return n.attribute.shadowRootIdx<0?this._pickItem(n,e,t,i,s):null}_pickItem(n,e,t,i,s){if(!n.shadowRoot)return null;const{parentMatrix:r}=s||{};if(!r)return null;const a=e.pickContext;a.highPerformanceSave();const o=n.shadowRoot,l=Vn.allocateByObj(r),h=new Et(l.a*t.x+l.c*t.y+l.e,l.b*t.x+l.d*t.y+l.f),d=e.pickGroup(o,h,l,i);return a.highPerformanceRestore(),d}};up=qx([ue()],up);let cp=class{constructor(){this.order=1}beforePickItem(n,e,t,i,s){const r=n.baseGraphic;if(r&&r.parent){const a=new Et(t.x,t.y),o=e.pickContext;o.highPerformanceSave();const l=r.parent.globalTransMatrix;l.transformPoint(a,a);const h=r.isContainer?e.pickGroup(r,a.clone(),l,i):e.pickItem(r,a.clone(),l,i);return o.highPerformanceRestore(),h}return null}};cp=qx([ue()],cp);let fp=class{constructor(){this.order=1}beforePickItem(n,e,t,i,s){if(!n.in3dMode||i.in3dInterceptor)return null;const r=e.pickContext,a=n.stage;if(!r||!a)return null;if(i.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,n.isContainer){let o,l=!1,h=!1;if(n.forEachChildren(d=>(l=d.numberType===Gu,!l)),n.forEachChildren(d=>(h=!!d.findFace,!h)),l){const d=n.getChildren(),u=[...d];u.sort((c,f)=>{var p,g,_,m;let y=((g=(p=c.attribute.startAngle)!==null&&p!==void 0?p:0+c.attribute.endAngle)!==null&&g!==void 0?g:0)/2,b=((m=(_=f.attribute.startAngle)!==null&&_!==void 0?_:0+f.attribute.endAngle)!==null&&m!==void 0?m:0)/2;for(;y<0;)y+=Be;for(;b<0;)b+=Be;return b-y}),u.forEach(c=>{c._next=null,c._prev=null}),n.removeAllChild(),n.update(),u.forEach(c=>{n.appendChild(c)}),i.hack_pieFace="outside",o=e.pickGroup(n,t,s.parentMatrix,i),o.graphic||(i.hack_pieFace="inside",o=e.pickGroup(n,t,s.parentMatrix,i)),o.graphic||(i.hack_pieFace="top",o=e.pickGroup(n,t,s.parentMatrix,i)),n.removeAllChild(),d.forEach(c=>{c._next=null,c._prev=null}),d.forEach(c=>{n.appendChild(c)})}else if(h){const d=n.getChildren(),u=d.map(c=>({ave_z:c.findFace().vertices.map(f=>{var p;return r.view(f[0],f[1],(p=f[2]+c.attribute.z)!==null&&p!==void 0?p:0)[2]}).reduce((f,p)=>f+p,0),g:c}));u.sort((c,f)=>f.ave_z-c.ave_z),n.removeAllChild(),u.forEach(c=>{c.g._next=null,c.g._prev=null}),n.update(),u.forEach(c=>{n.add(c.g)}),o=e.pickGroup(n,t,s.parentMatrix,i),n.removeAllChild(),d.forEach(c=>{c._next=null,c._prev=null}),n.update(),d.forEach(c=>{n.add(c)})}else o=e.pickGroup(n,t,s.parentMatrix,i);return r.camera=null,i.in3dInterceptor=!1,r.restore(),o}return r.restore(),null}initCanvasCtx(n){n.setTransformForCurrent()}};fp=qx([ue()],fp);const bG=new Me((n,e,t)=>{t(Ol)||(n(P1).toSelf(),n(Ol).toService(P1)),n(fp).toSelf().inSingletonScope(),n(Uo).toService(fp),n(up).toSelf().inSingletonScope(),n(Uo).toService(up),n(cp).toSelf().inSingletonScope(),n(Uo).toService(cp),ki(n,Uo)}),vG=new Me(n=>{n(uE).to(Bb).inSingletonScope(),n(cE).toConstantValue(ce)}),Qd=Symbol.for("AutoEnablePlugins"),FE=Symbol.for("PluginService");var xG=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},SG=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},E1=function(n,e){return function(t,i){e(t,i,n)}};let Ub=class{constructor(n){this.autoEnablePlugins=n,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(n,e){this.stage=n,this.actived=!0;const{pluginList:t}=e;t&&we.isBound(Qd)&&this.autoEnablePlugins.getContributions().forEach(i=>{t.includes(i.name)&&this.register(i)})}findPluginsByName(n){const e=[];return this.onStartupFinishedPlugin.forEach(t=>{t.name===n&&e.push(t)}),this.onRegisterPlugin.forEach(t=>{t.name===n&&e.push(t)}),e}register(n){n.activeEvent==="onStartupFinished"?this.onStartupFinishedPlugin.push(n):n.activeEvent==="onRegister"&&(this.onRegisterPlugin.push(n),n.activate(this))}unRegister(n){n.activeEvent==="onStartupFinished"?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(n),1):n.activeEvent==="onRegister"&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(n),1),n.deactivate(this)}release(...n){this.onStartupFinishedPlugin.forEach(e=>{e.deactivate(this)}),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach(e=>{e.deactivate(this)}),this.onRegisterPlugin=[]}};Ub=xG([ue(),E1(0,Ee(Kt)),E1(0,di(Qd)),SG("design:paramtypes",[Object])],Ub);const AG=new Me(n=>{n(FE).to(Ub),AF(n,Qd)}),kG=new Me(n=>{ki(n,p_)}),wG=new Me(n=>{n(ub).to(cb).inSingletonScope(),ki(n,ub)});var MG=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},TG=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};let pp=class{constructor(){this.type="static",this.offscreen=!1,this.global=Q.global}setDpr(n){this.canvas.dpr=n}init(n,e,t){if(this.layer=n,this.window=e,t.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let i;this.main=!1,t.canvasId&&(i=this.global.getElementById(t.canvasId)),i||(i=this.global.createCanvas({width:e.width,height:e.height})),i.style&&(i.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,r=jf({nativeCanvas:i,width:e.width,height:e.height,dpr:e.dpr,id:t.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});r.applyPosition(),this.canvas=r,this.context=r.getContext()}}resize(n,e){this.canvas.resize(n,e)}resizeView(n,e){}render(n,e,t){var i;if(!this.main){const s=this.window.getContext().getCanvas().nativeCanvas;!s||this.canvas.x===s.offsetLeft&&this.canvas.y===s.offsetTop||(this.canvas.x=s.offsetLeft,this.canvas.y=s.offsetTop,this.canvas.applyPosition())}e.renderService.render(n,Object.assign(Object.assign({context:this.context,clear:(i=e.background)!==null&&i!==void 0?i:"#ffffff"},e),t))}merge(n){n.forEach(e=>{const t=e.getContext().canvas.nativeCanvas;this.context.drawImage(t,0,0)})}prepare(n,e){}drawTo(n,e,t){var i;const s=n.getContext();t.renderService.render(e,Object.assign(Object.assign({context:s},t),{clear:t.clear?(i=t.background)!==null&&i!==void 0?i:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};pp=MG([ue(),TG("design:paramtypes",[])],pp);var CG=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},PG=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};let gp=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=Q.global}setDpr(n){}init(n,e,t){if(this.layer=n,this.window=e,t.main)throw new Error("virtual layer不能作为main layer");this.main=!1,this.canvas=null,this.context=null}resize(n,e){}resizeView(n,e){}render(n,e,t){this.mainHandler.render(n,e,Object.assign(Object.assign({},t),{clear:!1}))}merge(n){}prepare(n,e){}drawTo(n,e,t){var i;const s=n.getContext();t.renderService.render(e,Object.assign(Object.assign({context:s},t),{clear:t.clear?(i=t.background)!==null&&i!==void 0?i:"#fff":void 0}))}getContext(){return null}release(){}};gp=CG([ue(),PG("design:paramtypes",[])],gp);var EG=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},RG=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};let _p=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=Q.global}setDpr(n){this.canvas.dpr=n}init(n,e,t){this.layer=n;const i=this.global.createOffscreenCanvas({width:t.width,height:t.height,dpr:e.dpr}),s=jf({nativeCanvas:i,width:t.width,height:t.height,dpr:e.dpr,canvasControled:!0});this.canvas=s,this.context=s.getContext()}resize(n,e){this.canvas.resize(n,e)}resizeView(n,e){this.canvas.resize(n,e)}render(n,e){var t;e.renderService.render(n,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:(t=e.background)!==null&&t!==void 0?t:"#ffffff"}))}prepare(n,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(n,e,t){const i=n.getContext(),s=n.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=t;i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),t.clear&&i.clearRect(r,a,o,l),i.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),i.nativeContext.restore()}merge(n){}};_p=EG([ue(),RG("design:paramtypes",[])],_p);const OG=new Me(n=>{n(pp).toSelf(),n(_p).toSelf(),n(gp).toSelf(),n(_E).toService(pp),n(mE).toService(_p),n(yE).toService(gp)});function BG(n){n.load(kG),n.load(wG),n.load(OG)}var LG=function(n,e,t,i){return new(t||(t=Promise))(function(s,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?s(h.value):(d=h.value,d instanceof t?d:new t(function(u){u(d)})).then(a,o)}l((i=i.apply(n,e||[])).next())})};function zE(n,e,t,i=!1,s=!1){const r={},a=[];let o=!1;if(s)o=!0;else{let l;n.forEachChildren((h,d)=>{const{zIndex:u=e}=h.attribute;if(d===0)l=u;else if(l!==u)return o=!0,!0;return!1},i)}if(o){n.forEachChildren(h=>{const{zIndex:d=e}=h.attribute;r[d]?r[d].push(h):(r[d]=[h],a.push(d))},i),a.sort((h,d)=>i?d-h:h-d);let l=!1;for(let h=0;h<a.length&&!l;h++){const d=a[h],u=r[d];s&&u.sort((c,f)=>{var p,g;return(i?-1:1)*(((p=f.attribute.z)!==null&&p!==void 0?p:0)-((g=c.attribute.z)!==null&&g!==void 0?g:0))});for(let c=0;c<u.length;c++)if(t(u[c],c)){l=!0;break}}}else n.forEachChildren(t,i)}function R1(n,e,t,i=!1){return LG(this,void 0,void 0,function*(){yield n.forEachChildrenAsync(t,i)})}function IG(n,e,t,i=!1){const s={},r=[];let a=!1;n.forEachChildren((h,d)=>{const{zIndex:u=t}=h.attribute;if(d!==0){if(u!==void 0)return a=!0,!0}return!1},i);let o=null,l=!1;if(a){n.forEachChildren(d=>{const{zIndex:u=t}=d.attribute;s[u]?s[u].push(d):(s[u]=[d],r.push(u))},i),r.sort((d,u)=>i?u-d:d-u);let h=!1;for(let d=0;d<r.length&&!h;d++){const u=r[d],c=s[u];for(let f=0;f<c.length;f++){if(l){h=!0,o=c[f];break}c[f]._uid!==e||(l=!0)}}}else n.forEachChildren(h=>l?(o=h,!0):(h._uid===e&&(l=!0),!1),i);return o}var DG=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},FG=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};const mp=Symbol.for("DrawItemInterceptor"),O1=new St;class zG{constructor(){this.order=1}afterDrawItem(e,t,i,s,r){return(e.attribute.shadowRootIdx>0||!e.attribute.shadowRootIdx)&&this.drawItem(e,t,i,s,r),!1}beforeDrawItem(e,t,i,s,r){return e.attribute.shadowRootIdx<0&&this.drawItem(e,t,i,s,r),!1}drawItem(e,t,i,s,r){if(!e.shadowRoot)return!1;const{context:a}=i;if(a.highPerformanceSave(),a.transformFromMatrix(e.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){O1.copy(s.dirtyBounds);const o=e.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(o)}return s.renderGroup(e.shadowRoot,i,e.parent.globalTransMatrix),a.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&s.dirtyBounds.copy(O1),!0}}class jG{constructor(){this.order=1}afterDrawItem(e,t,i,s,r){return e.attribute._debug_bounds&&this.drawItem(e,t,i,s,r),!1}drawItem(e,t,i,s,r){if(!e.attribute._debug_bounds)return!1;const{context:a}=i;a.highPerformanceSave(),e.parent&&a.setTransformFromMatrix(e.parent.globalTransMatrix,!0),e.glyphHost&&e.glyphHost.parent&&a.setTransformFromMatrix(e.glyphHost.parent.globalTransMatrix,!0);const o=e.AABBBounds;return e.attribute._debug_bounds!==!0&&e.attribute._debug_bounds(a,e),a.strokeRect(o.x1,o.y1,o.width(),o.height()),a.highPerformanceRestore(),!0}}let yp=class{constructor(){this.order=1,this.interceptors=[new zG,new GG,new HG,new jG]}afterDrawItem(n,e,t,i,s){for(let r=0;r<this.interceptors.length;r++)if(this.interceptors[r].afterDrawItem&&this.interceptors[r].afterDrawItem(n,e,t,i,s))return!0;return!1}beforeDrawItem(n,e,t,i,s){if((!n.in3dMode||t.in3dInterceptor)&&!n.shadowRoot&&!(n.baseGraphic||n.attribute.globalZIndex||n.interactiveGraphic))return!1;for(let r=0;r<this.interceptors.length;r++)if(this.interceptors[r].beforeDrawItem&&this.interceptors[r].beforeDrawItem(n,e,t,i,s))return!0;return!1}};yp=DG([ue(),FG("design:paramtypes",[])],yp);class HG{constructor(){this.order=1}beforeDrawItem(e,t,i,s,r){return!this.processing&&(e.baseGraphic?this.beforeDrawInteractive(e,t,i,s,r):this.beforeSetInteractive(e,t,i,s,r))}beforeSetInteractive(e,t,i,s,r){let a=e.interactiveGraphic;if(e.attribute.globalZIndex){a||(a=e.clone(),e.interactiveGraphic=a,a.baseGraphic=e),a.setAttributes({globalZIndex:0,zIndex:e.attribute.globalZIndex},!1,{skipUpdateCallback:!0}),i.stage.tryInitInteractiveLayer();const o=i.stage.getLayer("_builtin_interactive");return o&&this.getShadowRoot(o).add(a),!0}if(a){i.stage.tryInitInteractiveLayer();const o=i.stage.getLayer("_builtin_interactive");o&&this.getShadowRoot(o).removeChild(a),e.interactiveGraphic=null,a.baseGraphic=null}return!1}beforeDrawInteractive(e,t,i,s,r){const a=e.baseGraphic;if(a){this.processing=!0;const{context:o}=i;return o.highPerformanceSave(),o.setTransformFromMatrix(a.parent.globalTransMatrix,!0),a.isContainer?s.renderGroup(a,i,a.parent.globalTransMatrix):s.renderItem(a,i),o.highPerformanceRestore(),this.processing=!1,!0}return!1}getShadowRoot(e){var t;let i=e.getElementById("_interactive_group");return i||(i=ce.CreateGraphic("group",{}),i.id="_interactive_group",e.add(i)),(t=i.shadowRoot)!==null&&t!==void 0?t:i.attachShadow()}}class GG{constructor(){this.order=1}beforeDrawItem(e,t,i,s,r){if(!e.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:a,stage:o}=t.drawParams;a.canvas,a.save(),this.initCanvasCtx(a),a.camera=o.camera;const l=a.currentMatrix;l.a/=a.dpr,l.b/=a.dpr,l.c/=a.dpr,l.d/=a.dpr,l.e/=a.dpr,l.f/=a.dpr;const h=lt.allocate();Ob(h,l);const d=a.modelMatrix;if(d){if(h){const u=lt.allocate();a.modelMatrix=Nu(u,d,h)}}else a.modelMatrix=h;if(a.setTransform(1,0,0,1,0,0,!0),e.isContainer){let u=!1,c=!1;if(e.forEachChildren(f=>(u=f.numberType===Gu,!u)),e.forEachChildren(f=>(c=!!f.findFace,!c)),u){const f=e.getChildren(),p=[...f];p.sort((_,m)=>{var y,b,v,x;let S=(((y=_.attribute.startAngle)!==null&&y!==void 0?y:0)+((b=_.attribute.endAngle)!==null&&b!==void 0?b:0))/2,A=(((v=m.attribute.startAngle)!==null&&v!==void 0?v:0)+((x=m.attribute.endAngle)!==null&&x!==void 0?x:0))/2;for(;S<0;)S+=Be;for(;A<0;)A+=Be;return A-S}),p.forEach(_=>{_._next=null,_._prev=null}),e.removeAllChild(),e.update(),p.forEach(_=>{e.appendChild(_)});const g=e.parent.globalTransMatrix;i.hack_pieFace="outside",s.renderGroup(e,i,g),i.hack_pieFace="inside",s.renderGroup(e,i,g),i.hack_pieFace="top",s.renderGroup(e,i,g),e.removeAllChild(),f.forEach(_=>{_._next=null,_._prev=null}),f.forEach(_=>{e.appendChild(_)})}else if(c){const f=e.getChildren(),p=f.map(g=>({ave_z:g.findFace().vertices.map(_=>{var m;return a.view(_[0],_[1],(m=_[2]+g.attribute.z)!==null&&m!==void 0?m:0)[2]}).reduce((_,m)=>_+m,0),g}));p.sort((g,_)=>_.ave_z-g.ave_z),e.removeAllChild(),p.forEach(g=>{g.g._next=null,g.g._prev=null}),e.update(),p.forEach(g=>{e.add(g.g)}),s.renderGroup(e,i,e.parent.globalTransMatrix,!0),e.removeAllChild(),f.forEach(g=>{g._next=null,g._prev=null}),e.update(),f.forEach(g=>{e.add(g)})}else s.renderGroup(e,i,e.parent.globalTransMatrix)}else s.renderItem(e,i);return a.camera=null,a.restore(),a.modelMatrix!==d&&lt.free(a.modelMatrix),a.modelMatrix=d,i.in3dInterceptor=!1,!0}initCanvasCtx(e){e.setTransformForCurrent()}}var WG=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},VG=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Km=function(n,e){return function(t,i){e(t,i,n)}};let bp=class{constructor(n,e){this.contributions=n,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new _i,this.backupDirtyBounds=new _i,this.global=Q.global,this.layerService=Q.layerService,this.init()}init(){this.contributions.forEach(n=>{if(n.style){const e=this.styleRenderMap.get(n.style)||new Map;e.set(n.numberType,n),this.styleRenderMap.set(n.style,e)}else this.defaultRenderMap.set(n.numberType,n)}),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort((n,e)=>n.order-e.order)}prepareForDraw(n,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(n,e){this.prepareForDraw(n,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=n;const{context:t,stage:i,x:s=0,y:r=0,width:a,height:o}=e;if(!t)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(i.dirtyBounds&&!i.dirtyBounds.empty()){const u=TC(l,i.dirtyBounds);l.x1=Math.floor(u.x1),l.y1=Math.floor(u.y1),l.x2=Math.ceil(u.x2),l.y2=Math.ceil(u.y2)}const h=t.dpr%1;(h||h!==.5)&&(l.x1=Math.floor(l.x1*t.dpr)/t.dpr,l.y1=Math.floor(l.y1*t.dpr)/t.dpr,l.x2=Math.ceil(l.x2*t.dpr)/t.dpr,l.y2=Math.ceil(l.y2*t.dpr)/t.dpr),this.backupDirtyBounds.copy(l),t.inuse=!0,t.clearMatrix(),t.setTransformForCurrent(!0);const d=l.width()*t.dpr<t.canvas.width||l.height()*t.dpr<t.canvas.height;t.save(),t.translate(s,r,!0),d&&(t.beginPath(),t.rect(l.x1,l.y1,l.width(),l.height()),t.clip()),i.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(n,t,e),t.save(),n.renderTreeRoots.sort((u,c)=>{var f,p;return((f=u.attribute.zIndex)!==null&&f!==void 0?f:Mt.zIndex)-((p=c.attribute.zIndex)!==null&&p!==void 0?p:Mt.zIndex)}).forEach(u=>{u.isContainer?this.renderGroup(u,e,Vn.allocate(1,0,0,1,0,0)):this.renderItem(u,e)}),t.restore(),t.restore(),t.draw(),t.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(n){let e=n.parent,t=n._uid;for(;e;){const i=IG(e,t,Mt.zIndex);if(i)return i;t=e._uid,e=e.parent}return null}renderGroup(n,e,t,i){if(e.break||n.attribute.visibleAll===!1)return;if(n.incremental&&(e.startAtId==null||e.startAtId===n._uid))return e.break=!0,void this._increaseRender(n,e);if(this.useDirtyBounds&&!Dd(n.AABBBounds,this.dirtyBounds,!1))return;let s,r=t;if(this.useDirtyBounds){s=tp.allocateByObj(this.dirtyBounds);const a=n.transMatrix;r=Vn.allocateByObj(t).multiply(a.a,a.b,a.c,a.d,a.e,a.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(n,e,{drawingCb:()=>{var a;i?n.forEachChildren(o=>{e.break||(o.isContainer?this.renderGroup(o,e,r):this.renderItem(o,e))}):zE(n,Mt.zIndex,o=>{e.break||(o.isContainer?this.renderGroup(o,e,r):this.renderItem(o,e))},!1,!!(!((a=e.context)===null||a===void 0)&&a.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(s),tp.free(s),Vn.free(r))}_increaseRender(n,e){const{layer:t,stage:i}=e,{subLayers:s}=t;let r=s.get(n._uid);r||(r={layer:this.layerService.createLayer(i),zIndex:s.size,group:n},s.set(n._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||we.get(IE);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:r.layer,context:a,startAtId:n._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(n);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let h=s.get(l._uid);h||(h={layer:this.layerService.createLayer(i),zIndex:s.size},s.set(l._uid,h));const d=h.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:h.layer,context:d,startAtId:l._uid,break:!1}))}}getRenderContribution(n){let e;return e||(e=this.selectRenderByNumberType(n.numberType)),e||(e=this.selectRenderByType(n.type)),e}renderItem(n,e,t){if(this.InterceptorContributions.length)for(let o=0;o<this.InterceptorContributions.length;o++){const l=this.InterceptorContributions[o];if(l.beforeDrawItem&&l.beforeDrawItem(n,this.currentRenderService,e,this,t))return}const i=this.getRenderContribution(n);if(!i)return;let s,r=!1;if(n.parent){const{scrollX:o=0,scrollY:l=0}=n.parent.attribute;if(r=!(!o&&!l),r){s=this.dirtyBounds.clone();const h=n.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(h),this.dirtyBounds.translate(-o,-l)}}if(this.useDirtyBounds&&!n.isContainer&&!Dd(n.AABBBounds,this.dirtyBounds,!1))return void(r&&this.dirtyBounds.copy(s));const a=e.startAtId!=null&&n._uid!==e.startAtId;if(n._uid===e.startAtId&&(e.startAtId=null),t&&(t.skipDraw=a),a?n.isContainer&&i.draw(n,this.currentRenderService,e,t):i.draw(n,this.currentRenderService,e,t),r&&this.dirtyBounds.copy(s),this.InterceptorContributions.length)for(let o=0;o<this.InterceptorContributions.length;o++){const l=this.InterceptorContributions[o];if(l.afterDrawItem&&l.afterDrawItem(n,this.currentRenderService,e,this))return}}selectRenderByType(n){return De.getInstance().warn("未知错误,不应该走到这里"),null}selectRenderByNumberType(n){return this.currentRenderMap.get(n)||this.defaultRenderMap.get(n)}clearScreen(n,e,t){var i,s;const{clear:r}=t;if(r){const a=e.getCanvas(),{width:o=a.width,height:l=a.height}=t,h=0,d=0;e.clearRect(h,d,o,l);const u=(i=n.drawParams)===null||i===void 0?void 0:i.stage;if(u&&(e.globalAlpha=(s=u.attribute.opacity)!==null&&s!==void 0?s:1),u&&u.backgroundImg&&u.resources){const c=u.resources.get(r);c&&c.state==="success"&&c.data&&e.drawImage(c.data,h,d,o,l)}else e.fillStyle=Lb(e,r,{AABBBounds:{x1:h,y1:d,x2:h+o,y2:d+l}},0,0),e.fillRect(h,d,o,l)}}afterDraw(n,e){}};bp=WG([ue(),Km(0,TP(ci)),Km(1,Ee(Kt)),Km(1,di(mp)),VG("design:paramtypes",[Array,Object])],bp);var NG=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},UG=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},B1=function(n,e){return function(t,i){e(t,i,n)}};let $b=class{constructor(n){this.groupRenderContribitions=n,this.numberType=Bx}drawShape(n,e,t,i,s,r,a,o){const l=se(n,r==null?void 0:r.theme).group,{fill:h=l.fill,background:d,stroke:u=l.stroke,opacity:c=l.opacity,width:f=l.width,height:p=l.height,clip:g=l.clip,fillOpacity:_=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:v=l.lineWidth,visible:x=l.visible}=n.attribute,S=jx(c,_,f,p,h),A=Gx(c,m,f,p),k=go(h,d),w=Sh(u,v);if(!n.valid||!x||!g&&(!k&&!w||!(S||A||a||o||d)))return;if(b&&b.length&&s.drawContribution){const T=e.disableFill,E=e.disableStroke,O=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach(B=>{s.drawContribution.getRenderContribution(B).draw(B,s.renderService,s,r)}),e.disableFill=T,e.disableStroke=E,e.disableBeginPath=O}else y===0||W(y)&&y.every(T=>T===0)?(e.beginPath(),e.rect(t,i,f,p)):(e.beginPath(),so(e,t,i,f,p,y));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(kH));const M={doFill:k,doStroke:w};this._groupRenderContribitions.forEach(T=>{T.time===ui.beforeFillStroke&&T.drawShape(n,e,t,i,k,w,S,A,l,s,a,o,M)}),g&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(n,n.attribute,l),M.doFill&&(a?a(e,n.attribute,l):S&&(e.setCommonStyle(n,n.attribute,t,i,l),e.fill())),M.doStroke&&(o?o(e,n.attribute,l):A&&(e.setStrokeStyle(n,n.attribute,t,i,l),e.stroke())),this._groupRenderContribitions.forEach(T=>{T.time===ui.afterFillStroke&&T.drawShape(n,e,t,i,k,w,S,A,l,s,a,o)})}draw(n,e,t,i){const{context:s}=t;if(!s)return;const{clip:r}=n.attribute;r?s.save():s.highPerformanceSave();const a=se(n,i==null?void 0:i.theme).group,o=s.modelMatrix;if(s.camera){const u=lt.allocate(),c=lt.allocate();RE(c,n,a),Nu(u,o||u,c),s.modelMatrix=u,lt.free(c),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(n.transMatrix,!0);s.beginPath(),i.skipDraw?this.drawShape(n,s,0,0,t,i,()=>!1,()=>!1):this.drawShape(n,s,0,0,t);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=n.attribute;let d;(l||h)&&s.translate(l,h),i&&i.drawingCb&&(d=i.drawingCb()),s.modelMatrix!==o&&lt.free(s.modelMatrix),s.modelMatrix=o,d&&d.then?d.then(()=>{r?s.restore():s.highPerformanceRestore()}):r?s.restore():s.highPerformanceRestore()}};$b=NG([ue(),B1(0,Ee(Kt)),B1(0,di(vE)),UG("design:paramtypes",[Object])],$b);var $G=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};let vp=class extends Zd{constructor(){super(...arguments),this.numberType=Vu}drawShape(n,e,t,i,s,r,a,o){if(n.incremental&&s.multiGraphicOptions){const{startAtIdx:l,length:h}=s.multiGraphicOptions,{segments:d=[]}=n.attribute;if(l>d.length)return;const u=se(n).line,{fill:c=u.fill,stroke:f=u.stroke,opacity:p=u.opacity,fillOpacity:g=u.fillOpacity,strokeOpacity:_=u.strokeOpacity,lineWidth:m=u.lineWidth,visible:y=u.visible}=n.attribute,b=Jl(p,g,c),v=Hx(p,_),x=go(c),S=Sh(f,m);if(!n.valid||!y||!x&&!S||!(b||v||a||o))return;const{context:A}=s;for(let k=l;k<l+h;k++)this.drawIncreaseSegment(n,A,d[k-1],d[k],n.attribute.segments[k],[u,n.attribute],t,i)}else super.drawShape(n,e,t,i,s,r,a,o)}drawIncreaseSegment(n,e,t,i,s,r,a,o){i&&(e.beginPath(),GH(e.nativeContext,t,i,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(n,s,r),e.setStrokeStyle(n,s,a,o,r),e.stroke())}};vp=$G([ue()],vp);var YG=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};let xp=class extends Jd{constructor(){super(...arguments),this.numberType=Wu}drawShape(n,e,t,i,s,r,a){if(n.incremental&&s.multiGraphicOptions){const{startAtIdx:o,length:l}=s.multiGraphicOptions,{segments:h=[]}=n.attribute;if(o>h.length)return;const d=se(n).area,{fill:u=d.fill,fillOpacity:c=d.fillOpacity,opacity:f=d.opacity,visible:p=d.visible}=n.attribute,g=Jl(f,c,u),_=go(u);if(!n.valid||!p||!_||!g&&!a)return;for(let m=o;m<o+l;m++)this.drawIncreaseSegment(n,e,h[m-1],h[m],n.attribute.segments[m],[d,n.attribute],t,i)}else super.drawShape(n,e,t,i,s,r,a)}drawIncreaseSegment(n,e,t,i,s,r,a,o){i&&(e.beginPath(),WH(e.camera?e:e.nativeContext,t,i,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(n,s,r),e.setCommonStyle(n,s,a,o,r),e.fill())}};xp=YG([ue()],xp);var $o,XG=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},KG=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Dh=function(n,e){return function(t,i){e(t,i,n)}},ks=function(n,e,t,i){return new(t||(t=Promise))(function(s,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?s(h.value):(d=h.value,d instanceof t?d:new t(function(u){u(d)})).then(a,o)}l((i=i.apply(n,e||[])).next())})};(function(n){n[n.NORMAL=0]="NORMAL",n[n.STOP=1]="STOP"})($o||($o={}));let Yb=class extends bp{constructor(n,e,t,i){super(n,i),this.contributions=n,this.lineRender=e,this.areaRender=t,this.drawItemInterceptorContributions=i,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=$o.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new _n([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(n,e){return ks(this,void 0,void 0,function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=n,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const t=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,t)return;this.currentRenderService=n;const{context:i,x:s=0,y:r=0}=e;i&&(i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0),i.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,i,e),i.translate(s,r,!0),i.save(),n.renderTreeRoots.sort((a,o)=>{var l,h;return((l=a.attribute.zIndex)!==null&&l!==void 0?l:Mt.zIndex)-((h=o.attribute.zIndex)!==null&&h!==void 0?h:Mt.zIndex)}).forEach(a=>{this.renderGroup(a,e)}),this.hooks.completeDraw.tap("top-draw",()=>{i.restore(),i.restore(),i.draw(),i.inuse=!1,this.rendering=!1}))})}_increaseRender(n,e){return ks(this,void 0,void 0,function*(){this.rendering=!0,yield this._renderIncrementalGroup(n,e)})}_renderIncrementalGroup(n,e){return ks(this,void 0,void 0,function*(){this.count=n.count,yield new Promise(t=>{this.renderItem(n,e,{drawingCb:()=>ks(this,void 0,void 0,function*(){if(n.count!==2)yield R1(n,Mt.zIndex,(i,s)=>{if(this.status===$o.STOP)return!0;if(i.isContainer||s<this.currentIdx)return!1;const r=this.currFrameStartAt+n.incremental;return s<r&&(this.currentIdx=s+1,this.renderItem(i,e)),s===r-1&&(this.currFrameStartAt=this.currentIdx,this.waitToNextFrame())}),t(!1);else{const i=n.getChildAt(0);if(i.incremental&&i.attribute.segments)for(i.incrementalAt||(i.incrementalAt=0);i.incrementalAt<i.attribute.segments.length;)e.multiGraphicOptions={startAtIdx:i.incrementalAt,length:i.incremental},this.renderItem(i,e),i.incrementalAt+=i.incremental,yield this.waitToNextFrame();else this.renderItem(i,e);t(!1)}})})}),this.hooks.completeDraw.call()})}waitToNextFrame(){return ks(this,void 0,void 0,function*(){return new Promise(n=>{this.global.getRequestAnimationFrame()(()=>{n(!1)})})})}checkForDraw(n){return ks(this,void 0,void 0,function*(){let e=this.rendering;return n.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e})}forceStop(){return ks(this,void 0,void 0,function*(){this.rendering&&(this.status=$o.STOP,yield new Promise(n=>{this.hooks.completeDraw.tap("stopCb",()=>{this.status=$o.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter(e=>e.name!=="stopCb"),n(!1)})}))})}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(n,e){return ks(this,void 0,void 0,function*(){if(!e.break&&n.attribute.visibleAll!==!1)return n.incremental&&e.startAtId===n._uid?(yield this._increaseRender(n,e),void(e.break=!0)):void(yield new Promise(t=>{this.renderItem(n,e,{drawingCb:()=>ks(this,void 0,void 0,function*(){yield R1(n,Mt.zIndex,i=>ks(this,void 0,void 0,function*(){e.break||i.isContainer&&(yield this.renderGroup(i,e))})),t(!1)})})}))})}};Yb=XG([ue(),Dh(0,TP(ci)),Dh(1,Ee(vp)),Dh(2,Ee(xp)),Dh(3,Ee(Kt)),Dh(3,di(mp)),KG("design:paramtypes",[Array,Object,Object,Object])],Yb);const qG=new Me(n=>{n($u).toSelf().inSingletonScope(),n(Xx).toSelf().inSingletonScope(),n(Kx).to(bp),n(IE).to(Yb),n(T1).to($b).inSingletonScope(),n(ci).toService(T1),ki(n,vE),n(Kn).toSelf().inSingletonScope(),ki(n,Wx),ki(n,ci),n(yp).toSelf().inSingletonScope(),n(mp).toService(yp),ki(n,mp)});function ZG(n){n.load(qG)}function Sp(){Sp.__loaded||(Sp.__loaded=!0,we.load(Oz),we.load(vG),we.load(yG),we.load(bG),we.load(AG),BG(we),ZG(we))}Sp.__loaded=!1,Sp();const Fe=we.get(kx);Q.global=Fe;const JG=we.get(gE);Q.graphicUtil=JG;const QG=we.get(pE);Q.transformUtil=QG;const eW=we.get(uE);Q.graphicService=eW;const tW=we.get(zx);Q.layerService=tW;class iW{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Nt.GenAutoIncrementId(),this.key=this.name+this._uid}activate(e){this.pluginService=e,Q.graphicService.hooks.onAttributeUpdate.tap(this.key,t=>{t.glyphHost&&(t=t.glyphHost),t.stage===e.stage&&t.stage!=null&&t.stage.renderNextFrame()}),Q.graphicService.hooks.onSetStage.tap(this.key,t=>{t.glyphHost&&(t=t.glyphHost),t.stage===e.stage&&t.stage!=null&&t.stage.renderNextFrame()})}deactivate(e){Q.graphicService.hooks.onAttributeUpdate.taps=Q.graphicService.hooks.onAttributeUpdate.taps.filter(t=>t.name!==this.key),Q.graphicService.hooks.onSetStage.taps=Q.graphicService.hooks.onSetStage.taps.filter(t=>t.name!==this.key)}}class nW{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Nt.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=e=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=e.page.x,this.pageY=e.page.y)},this.onMouseUp=e=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=e=>{var t,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const r=e.page.x-this.pageX,a=e.page.y-this.pageY;this.pageX=e.page.x,this.pageY=e.page.y;const o=r/100,l=a/100;this.option3d.alpha=((t=this.option3d.alpha)!==null&&t!==void 0?t:0)+o,this.option3d.beta=((i=this.option3d.beta)!==null&&i!==void 0?i:0)+l,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=e.page.x,this.pageY=e.page.y}}activate(e){this.pluginService=e;const t=e.stage;this.option3d=t.option3d,t.addEventListener("mousedown",this.onMouseDown),t.addEventListener("mouseup",this.onMouseUp),t.addEventListener("mousemove",this.onMouseMove)}deactivate(e){const t=e.stage;t.removeEventListener("mousedown",this.onMouseDown),t.removeEventListener("mouseup",this.onMouseUp),t.removeEventListener("mousemove",this.onMouseMove)}}class sW{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Nt.GenAutoIncrementId(),this.key=this.name+this._uid}activate(e){this.pluginService=e,Q.graphicService.hooks.onAddIncremental.tap(this.key,(t,i,s)=>{t.glyphHost&&(t=t.glyphHost),t.stage===e.stage&&t.stage!=null&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))}),Q.graphicService.hooks.onClearIncremental.tap(this.key,(t,i)=>{t.stage===e.stage&&t.stage!=null&&(this.nextUserParams.startAtId=t._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(t))})}deactivate(e){Q.graphicService.hooks.onAddIncremental.taps=Q.graphicService.hooks.onAddIncremental.taps.filter(t=>t.name!==this.key),Q.graphicService.hooks.onClearIncremental.taps=Q.graphicService.hooks.onClearIncremental.taps.filter(t=>t.name!==this.key)}renderNextFrame(e){this.nextFrameRenderGroupSet.add(e),this.willNextFrameRender||(this.willNextFrameRender=!0,Q.global.getRequestAnimationFrame()(()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1}))}_doRenderInThisFrame(){const e=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach(t=>{const i=t.layer;if(!i||!t.layer.subLayers)return;const s=t.layer.subLayers.get(t._uid);s&&s.drawContribution&&s.drawContribution.draw(e.renderService,Object.assign({x:e.x,y:e.y,width:i.viewWidth,height:i.viewHeight,stage:e,layer:i,clear:"transparent",renderService:e.renderService,updateBounds:!1,startAtId:t._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))}),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class rW{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Nt.GenAutoIncrementId(),this.key=this.name+this._uid}activate(e){this.pluginService=e,e.stage.hooks.afterRender.tap(this.key,t=>{t&&t===this.pluginService.stage&&this.drawHTML(e.stage.renderService)}),Q.graphicService.hooks.onRelease.tap(this.key,t=>{this.removeDom(t)})}deactivate(e){e.stage.hooks.afterRender.taps=e.stage.hooks.afterRender.taps.filter(t=>t.name!==this.key)}drawHTML(e){Q.global.env==="browser"&&e.renderTreeRoots.sort((t,i)=>{var s,r;return((s=t.attribute.zIndex)!==null&&s!==void 0?s:Mt.zIndex)-((r=i.attribute.zIndex)!==null&&r!==void 0?r:Mt.zIndex)}).forEach(t=>{this.renderGroupHTML(t)})}renderGroupHTML(e){this.renderGraphicHTML(e),e.forEachChildren(t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)})}removeDom(e){e.bindDom&&e.bindDom.size&&(e.bindDom.forEach(t=>{t.dom&&t.dom.parentElement.removeChild(t.dom)}),e.bindDom.clear())}renderGraphicHTML(e){const{html:t}=e.attribute;if(!t)return void(e.bindDom&&e.bindDom.size&&(e.bindDom.forEach(S=>{S.dom&&S.dom.parentElement.removeChild(S.dom)}),e.bindDom.clear()));const i=e.stage;if(!i)return;const{dom:s,container:r,width:a,height:o,style:l,anchorType:h="boundsLeftTop"}=t;e.bindDom||(e.bindDom=new Map);const d=e.bindDom.get(s);if(d&&(!r||r===d.container))return;let u,c;e.bindDom.forEach(({wrapGroup:S})=>{Q.global.removeDom(S)}),typeof s=="string"?(u=new DOMParser().parseFromString(s,"text/html").firstChild,u.lastChild&&(u=u.lastChild.firstChild)):u=s;const f=r||(i.params.enableHtmlAttribute===!0?null:i.params.enableHtmlAttribute);c=f?typeof f=="string"?Q.global.getElementById(f):f:e.stage.window.getContainer();const p=Q.global.createDom({tagName:"div",width:a,height:o,style:l,parent:c});p&&(p.appendChild(u),e.bindDom.set(s,{dom:u,container:r,wrapGroup:p})),p.style.pointerEvents="none",p.style.position||(p.style.position="absolute",c.style.position="relative");let g=0,_=0;const m=e.globalAABBBounds;if(h==="position"||m.empty()){const S=e.globalTransMatrix;g=S.e,_=S.f}else g=m.x1,_=m.y1;const y=Q.global.getElementTopLeft(c,!1),b=i.window.getTopLeft(!1),v=g+b.left-y.left,x=_+b.top-y.top;p.style.left=`${v}px`,p.style.top=`${x}px`}}const L1=new St;class aW{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Nt.GenAutoIncrementId(),this.key=this.name+this._uid}activate(e){this.pluginService=e,e.stage.hooks.afterRender.tap(this.key,t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()}),Q.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,(t,i,s,r)=>{t.glyphHost&&(t=t.glyphHost),i&&i===this.pluginService.stage&&i.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||s&&(L1.setValue(r.x1,r.y1,r.x2,r.y2),i.dirty(L1,t.parent&&t.parent.globalTransMatrix)))}),Q.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,(t,i,s,r,a)=>{i&&i===this.pluginService.stage&&i.renderCount&&(t.isContainer&&!a||i.dirty(r.globalAABBBounds))}),Q.graphicService.hooks.onRemove.tap(this.key,t=>{const i=t.stage;i&&i===this.pluginService.stage&&i.renderCount&&i&&i.dirty(t.globalAABBBounds)})}deactivate(e){Q.graphicService.hooks.beforeUpdateAABBBounds.taps=Q.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(t=>t.name!==this.key),Q.graphicService.hooks.afterUpdateAABBBounds.taps=Q.graphicService.hooks.afterUpdateAABBBounds.taps.filter(t=>t.name!==this.key),e.stage.hooks.afterRender.taps=e.stage.hooks.afterRender.taps.filter(t=>t.name!==this.key),Q.graphicService.hooks.onRemove.taps=Q.graphicService.hooks.onRemove.taps.filter(t=>t.name!==this.key)}}const I1=new St;class oW{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Nt.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new St}tryLayout(e){if(this.layouting)return;this.layouting=!0;const t=e.parent;if(!t||!e.needUpdateLayout())return;const i=se(t).group,{display:s=i.display}=t.attribute;if(s!=="flex")return;const{flexDirection:r=i.flexDirection,flexWrap:a=i.flexWrap,justifyContent:o=i.justifyContent,alignItems:l=i.alignItems,alignContent:h=i.alignContent,clip:d=i.clip}=t.attribute;let u=0,c=0,f=0;if(t.forEachChildren(w=>{const M=w.AABBBounds;r==="column"||r==="column-reverse"?(c+=M.height(),u=Math.max(u,M.width())):(u+=M.width(),c=Math.max(c,M.height())),f+=M.x1,f+=M.y1,f+=M.x2,f+=M.y2}),!isFinite(f))return;const p=t.attribute.width||u,g=t.attribute.height||c;t.attribute.width||(t.attribute.width=0),t.attribute.height||(t.attribute.height=0),this.tempBounds.copy(t._AABBBounds);const _={main:{len:p,field:"x"},cross:{len:g,field:"y"},dir:1},m=_.main,y=_.cross;r==="row-reverse"?_.dir=-1:r==="column"?(m.len=g,y.len=p,m.field="y",y.field="x"):r==="column-reverse"&&(m.len=g,y.len=p,m.field="y",y.field="x",_.dir=-1);let b=0,v=0;const x=[];t.forEachChildren(w=>{const M=w.AABBBounds,T=m.field==="x"?M.width():M.height(),E=y.field==="x"?M.width():M.height();x.push({mainLen:T,crossLen:E}),b+=T,v=Math.max(v,E)});const S=[];if(b>m.len&&a==="wrap"){let w=0,M=0;x.forEach(({mainLen:T,crossLen:E},O)=>{w+T>m.len?w===0?(S.push({idx:O,mainLen:w+T,crossLen:E}),w=0,M=0):(S.push({idx:O-1,mainLen:w,crossLen:E}),w=T,M=E):(w+=T,M=Math.max(M,E))}),S.push({idx:x.length-1,mainLen:w,crossLen:M})}else S.push({idx:x.length-1,mainLen:b,crossLen:v});const A=t.getChildren();let k=0;if(S.forEach(w=>{this.layoutMain(t,A,o,m,x,k,w),k=w.idx+1}),v=S.reduce((w,M)=>w+M.crossLen,0),S.length===1)if(l==="flex-end"){const w=y.len;this.layoutCross(A,l,y,w,x,S[0],0)}else if(l==="center"){const w=y.len/2;this.layoutCross(A,l,y,w,x,S[0],0)}else A.forEach(w=>{w.attribute[y.field]=is(w,y.field)});else if(h==="flex-start"){k=0;let w=0;S.forEach((M,T)=>{this.layoutCross(A,"flex-start",y,w,x,S[T],k),k=M.idx+1,w+=M.crossLen})}else if(h==="center"){k=0;let w=Math.max(0,(y.len-v)/2);S.forEach((M,T)=>{this.layoutCross(A,"center",y,w+M.crossLen/2,x,S[T],k),k=M.idx+1,w+=M.crossLen})}else if(h==="space-around"){k=0;const w=Math.max(0,(y.len-v)/S.length/2);let M=w;S.forEach((T,E)=>{this.layoutCross(A,"flex-start",y,M,x,S[E],k),k=T.idx+1,M+=T.crossLen+2*w})}else if(h==="space-between"){k=0;const w=Math.max(0,(y.len-v)/(2*S.length-2));let M=0;S.forEach((T,E)=>{this.layoutCross(A,"flex-start",y,M,x,S[E],k),k=T.idx+1,M+=T.crossLen+2*w})}A.forEach((w,M)=>{w.addUpdateBoundTag(),w.addUpdatePositionTag(),w.clearUpdateLayoutTag()}),t.addUpdateLayoutTag(),d||this.tempBounds.equals(t.AABBBounds)||(this.tryLayout(t),this.layouting=!1)}layoutMain(e,t,i,s,r,a,o){if(i==="flex-start"){let l=0;for(let h=a;h<=o.idx;h++)t[h].attribute[s.field]=l+is(t[h],s.field),l+=r[h].mainLen}else if(i==="flex-end"){let l=s.len;for(let h=a;h<=o.idx;h++)l-=r[h].mainLen,t[h].attribute[s.field]=l+is(t[h],s.field)}else if(i==="space-around")if(o.mainLen>=s.len){let l=0;for(let h=a;h<=o.idx;h++)t[h].attribute[s.field]=l+is(t[h],s.field),l+=r[h].mainLen}else{const l=o.idx-a+1,h=(s.len-o.mainLen)/l/2;let d=h;for(let u=a;u<=o.idx;u++)t[u].attribute[s.field]=d+is(t[u],s.field),d+=r[u].mainLen+2*h}else if(i==="space-between")if(o.mainLen>=s.len){let l=0;for(let h=a;h<=o.idx;h++)t[h].attribute[s.field]=l+is(t[h],s.field),l+=r[h].mainLen}else{const l=o.idx-a+1,h=(s.len-o.mainLen)/(2*l-2);let d=0;for(let u=a;u<=o.idx;u++)t[u].attribute[s.field]=d+is(t[u],s.field),d+=r[u].mainLen+2*h}else if(i==="center"){let l=(s.len-o.mainLen)/2;for(let h=a;h<=o.idx;h++)t[h].attribute[s.field]=l+is(t[h],s.field),l+=r[h].mainLen}}layoutCross(e,t,i,s,r,a,o){if(t==="flex-end")for(let l=o;l<=a.idx;l++)e[l].attribute[i.field]=s-r[l].crossLen+is(e[l],i.field);else if(t==="center")for(let l=o;l<=a.idx;l++)e[l].attribute[i.field]=s-r[l].crossLen/2+is(e[l],i.field);else for(let l=o;l<=a.idx;l++)e[l].attribute[i.field]=s+is(e[l],i.field)}activate(e){this.pluginService=e,Q.graphicService.hooks.onAttributeUpdate.tap(this.key,t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t),this.layouting=!1}),Q.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,(t,i,s,r)=>{t.glyphHost&&(t=t.glyphHost),i&&i===this.pluginService.stage&&t.isContainer&&I1.copy(r)}),Q.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,(t,i,s,r,a)=>{i&&i===this.pluginService.stage&&t.isContainer&&(I1.equals(s)||(this.tryLayout(t),this.layouting=!1))}),Q.graphicService.hooks.onSetStage.tap(this.key,t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t),this.layouting=!1})}deactivate(e){Q.graphicService.hooks.onAttributeUpdate.taps=Q.graphicService.hooks.onAttributeUpdate.taps.filter(t=>t.name!==this.key),Q.graphicService.hooks.onSetStage.taps=Q.graphicService.hooks.onSetStage.taps.filter(t=>t.name!==this.key)}}function is(n,e){if(!n.attribute.boundsPadding)return 0;if(b3(n.attribute.boundsPadding))return n.attribute.boundsPadding;if(W(n.attribute.boundsPadding)&&n.attribute.boundsPadding.length===1)return n.attribute.boundsPadding[0];const t=mi(n.attribute.boundsPadding);return e==="x"?t[3]:e==="y"?t[0]:0}const Zx=new R3;Zx.addTimeline(KP);Zx.setFPS(60);class lW{constructor(e,t,i=.8){this.dir=e,this.color=t,this.colorRgb=vt.Get(t,Vi.Color1),this.ambient=i;const s=en(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);this.formatedDir=[e[0]/s,e[1]/s,e[2]/s]}computeColor(e,t){const i=this.formatedDir,s=gi(Ji((e[0]*i[0]+e[1]*i[1]+e[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let r;r=ae(t)?vt.Get(t,Vi.Color1):t;const a=this.colorRgb;return`rgb(${a[0]*r[0]*s}, ${a[1]*r[1]*s}, ${a[2]*r[2]*s})`}}function hW(n,e,t,i){let s,r,a,o,l,h,d,u,c,f;const p=e[0],g=e[1],_=e[2],m=i[0],y=i[1],b=i[2],v=t[0],x=t[1],S=t[2];return Math.abs(p-v)<Qe&&Math.abs(g-x)<Qe&&Math.abs(_-S)<Qe?E_.identity(n):(d=p-v,u=g-x,c=_-S,f=1/Math.hypot(d,u,c),d*=f,u*=f,c*=f,s=y*c-b*u,r=b*d-m*c,a=m*u-y*d,f=Math.hypot(s,r,a),f?(f=1/f,s*=f,r*=f,a*=f):(s=0,r=0,a=0),o=u*a-c*r,l=c*s-d*a,h=d*r-u*s,f=Math.hypot(o,l,h),f?(f=1/f,o*=f,l*=f,h*=f):(o=0,l=0,h=0),n[0]=s,n[1]=o,n[2]=d,n[3]=0,n[4]=r,n[5]=l,n[6]=u,n[7]=0,n[8]=a,n[9]=h,n[10]=c,n[11]=0,n[12]=-(s*p+r*g+a*_),n[13]=-(o*p+l*g+h*_),n[14]=-(d*p+u*g+c*_),n[15]=1,n)}function dW(n,e,t,i,s,r,a){const o=1/(e-t),l=1/(i-s),h=1/(r-a);return n[0]=-2*o,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*l,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*h,n[11]=0,n[12]=(e+t)*o,n[13]=(s+i)*l,n[14]=(a+r)*h,n[15]=1,n}function D1(n,e,t){const i=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],d=e[7],u=e[8],c=e[9],f=e[10],p=e[11],g=e[12],_=e[13],m=e[14],y=e[15];let b=t[0],v=t[1],x=t[2],S=t[3];return n[0]=b*i+v*o+x*u+S*g,n[1]=b*s+v*l+x*c+S*_,n[2]=b*r+v*h+x*f+S*m,n[3]=b*a+v*d+x*p+S*y,b=t[4],v=t[5],x=t[6],S=t[7],n[4]=b*i+v*o+x*u+S*g,n[5]=b*s+v*l+x*c+S*_,n[6]=b*r+v*h+x*f+S*m,n[7]=b*a+v*d+x*p+S*y,b=t[8],v=t[9],x=t[10],S=t[11],n[8]=b*i+v*o+x*u+S*g,n[9]=b*s+v*l+x*c+S*_,n[10]=b*r+v*h+x*f+S*m,n[11]=b*a+v*d+x*p+S*y,b=t[12],v=t[13],x=t[14],S=t[15],n[12]=b*i+v*o+x*u+S*g,n[13]=b*s+v*l+x*c+S*_,n[14]=b*r+v*h+x*f+S*m,n[15]=b*a+v*d+x*p+S*y,n}function fn(n,e,t){const i=e[0],s=e[1],r=e[2];let a=t[3]*i+t[7]*s+t[11]*r+t[15];return a=a||1,n[0]=(t[0]*i+t[4]*s+t[8]*r+t[12])/a,n[1]=(t[1]*i+t[5]*s+t[9]*r+t[13])/a,n[2]=(t[2]*i+t[6]*s+t[10]*r+t[14])/a,n}class uW{set params(e){this._params=Object.assign({},e),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(e){this.params=e}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=lt.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=lt.allocate());const{pos:e,center:t,up:i}=this.params.viewParams;return hW(this._viewMatrixCached,e,t,i),this._vp||(this._vp=lt.allocate()),this._vp=D1(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=lt.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=lt.allocate());const{left:e,top:t,right:i,bottom:s}=this._params;return dW(this._projectionMatrixCached,e,i,s,t,0,-2e6),this._vp||(this._vp=lt.allocate()),this._vp=D1(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:e=.8,fieldDepth:t,left:i,right:s}=this._params;return(t??s-i)*e}getProjectionScale(e){const t=this.getField();return t/(t+e)}view(e,t,i){const s=[0,0,0];return fn(s,[e,t,i],this._viewMatrixCached),s}vp(e,t,i){const s=[0,0,0],{pos:r}=this._params.viewParams;fn(s,[e,t,i],this._viewMatrixCached),e=s[0],t=s[1],i=s[2];const a=this.getProjectionScale(i);return{x:e*a+r[0],y:t*a+r[1]}}}let Lo;function cW(){if(Lo==null)try{Lo=globalThis===window,Lo&&(Lo=!!document.createElement)}catch{Lo=!1}}function Jx(){cW();const n=Q.global&&Q.global.env;return n?n==="browser":Lo}const F1={WIDTH:500,HEIGHT:500,X:0,Y:0,BACKGROUND:"white"};class fW extends xh{set viewBox(e){this._viewBox.setValue(e.x1,e.y1,e.x2,e.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(e){this._viewBox.translate(e-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(e){this._viewBox.translate(0,e-this._viewBox.y1)}get width(){return this.window.width}set width(e){this.resize(e,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(e){this.resizeView(e,this.viewHeight)}get viewHeight(){return this._viewBox.height()}set viewHeight(e){this.resizeView(this.viewWidth,e)}get height(){return this.window.height}set height(e){this.resize(this.width,e)}get dpr(){return this.window.dpr}set dpr(e){this.setDpr(e)}get background(){var e;return(e=this._background)!==null&&e!==void 0?e:F1.BACKGROUND}set background(e){this._background=e}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(e={}){var t;super({}),this._onVisibleChange=i=>{this._skipRender<0||(i?(this.dirtyBounds&&this.dirtyBounds.setValue(0,0,this._viewBox.width(),this._viewBox.height()),this._skipRender>1&&this.renderNextFrame(),this._skipRender=0):this._skipRender=1)},this.beforeRender=i=>{this._beforeRender&&this._beforeRender(i)},this.afterRender=i=>{this.renderCount++,this._afterRender&&this._afterRender(i),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach(s=>s(i)),this._afterNextRenderCbs=null},this.params=e,this.theme=new Wd,this.hooks={beforeRender:new _n(["stage"]),afterRender:new _n(["stage"])},this.global=Q.global,!this.global.env&&Jx()&&this.global.setEnv("browser"),this.window=we.get(Hf),this.renderService=we.get(DE),this.pluginService=we.get(FE),this.layerService=we.get(zx),this.pluginService.active(this,e),this.window.create({width:e.width,height:e.height,container:e.container,dpr:e.dpr||this.global.devicePixelRatio,canvasControled:e.canvasControled!==!1,title:e.title||"",canvas:e.canvas}),this._viewBox=new St,e.viewBox?this._viewBox.setValue(e.viewBox.x1,e.viewBox.y1,e.viewBox.x2,e.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=(t=e.background)!==null&&t!==void 0?t:F1.BACKGROUND,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=e.renderStyle,e.autoRender&&this.enableAutoRender(),e.disableDirtyBounds===!1&&this.enableDirtyBounds(),e.enableHtmlAttribute&&this.enableHtmlAttribute(e.enableHtmlAttribute),e.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=e.beforeRender,this._afterRender=e.afterRender,this.ticker=e.ticker||Zx,this.supportInteractiveLayer=e.interactiveLayer!==!1,this.timeline=new XP,this.ticker.addTimeline(this.timeline),this.timeline.pause(),e.optimize||(e.optimize={}),this.optmize(e.optimize),e.background&&ae(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new E3(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}},this.params.event)))}preventRender(e){e?this._skipRender=-1/0:this.params.optimize.skipRenderWithOutRange!==!1?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(e){this.optmizeRender(e.skipRenderWithOutRange),this.params.optimize=e}optmizeRender(e=!1){e&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(e){const{center:t={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:r=0,camera:a,fieldRatio:o=1,fieldDepth:l}=e;return Object.assign(Object.assign({},e),{center:t,light:i,alpha:s,beta:r,camera:a,fieldRatio:o,fieldDepth:l})}set3dOptions(e){var t,i,s,r,a,o;this.option3d=e;const l=this.get3dOptions(e),{light:h,center:d,camera:u,alpha:c,beta:f,fieldRatio:p,fieldDepth:g}=l,{dir:_=[1,1,-1],color:m="white",ambient:y}=h,b=((t=d.x)!==null&&t!==void 0?t:this.width/2)+((i=d.dx)!==null&&i!==void 0?i:0),v=((s=d.y)!==null&&s!==void 0?s:this.height/2)+((r=d.dy)!==null&&r!==void 0?r:0),x=[b,v,((a=d.z)!==null&&a!==void 0?a:0)+((o=d.dz)!==null&&o!==void 0?o:0)];let S=0,A=0,k=0;u||(S=Math.sin(c)+b,A=Math.sin(f)+v,k=Math.cos(c)*Math.cos(f)*1),this.light=new lW(_,m,y);const w={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[S,A,k],center:x,up:[0,1,0]}};this.camera?this.camera.params=w:this.camera=new uW(w),e.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(e){this._beforeRender=e}setAfterRender(e){this._afterRender=e}afterNextRender(e){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(e)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new nW))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach(e=>{this.pluginService.unRegister(e)}))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new iW))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach(e=>{this.pluginService.unRegister(e)}))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new sW))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach(e=>{this.pluginService.unRegister(e)}))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new _i;let e=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];e?e.activate(this.pluginService):(e=new aW,this.pluginService.register(e))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach(e=>{this.pluginService.unRegister(e)}))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new oW))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach(e=>{this.pluginService.unRegister(e)}))}enableHtmlAttribute(e){this.htmlAttribute||(this.htmlAttribute=e,this.pluginService.register(new rW))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach(e=>{this.pluginService.unRegister(e)}))}tryUpdateAABBBounds(){const e=this._viewBox;return this._AABBBounds.setValue(e.x1,e.y1,e.x2,e.y2),this._AABBBounds}combineLayer(e,t){throw new Error("暂不支持")}createLayer(e,t){const i=this.layerService.createLayer(this,{main:!1,layerMode:t,canvasId:e});return this.appendChild(i),i}sortLayer(e){const t=this.children;t.sort(e),this.removeAllChild(),t.forEach(i=>{this.appendChild(i)})}removeLayer(e){return this.removeChild(this.findChildByUid(e))}tryInitInteractiveLayer(){this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(e){this.window.clearViewBox(this._viewBox,e)}render(e,t){this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=t,this.hooks.beforeRender.call(this),this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){}renderNextFrame(e,t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(e||this).forEach(i=>{this.nextFrameRenderLayerSet.add(i)}),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()(()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1}))}_doRenderInThisFrame(){this.timeline.resume(),this.ticker.start();const e=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear()),this.state=e,this._skipRender&&this._skipRender++}renderLayerList(e,t){const i=[];for(let s=0;s<e.length;s++){let r=e[s];r.layerMode==="virtual"&&(r=r.getNativeHandler().mainHandler.layer),i.includes(r)||i.push(r)}i.forEach(s=>{s.renderCount>this.renderCount||(s.renderCount=this.renderCount+1,s.render({renderService:this.renderService,background:s===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())},Object.assign({renderStyle:this.renderStyle},t)))}),this.interactiveLayer&&!e.includes(this.interactiveLayer)&&this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())},Object.assign({renderStyle:this.renderStyle},t))}resizeWindow(e,t,i=!0){this.window.resize(e,t),i&&this.render()}resize(e,t,i=!0){this.window.resize(e,t),this.forEachChildren(s=>{s.resize(e,t)}),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+e,this.viewBox.y1+t),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(e,t,i=!0){this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+e,this.viewBox.y1+t),this.forEachChildren(s=>{s.resizeView(e,t)}),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(e,t,i,s,r){let a=!0;typeof e=="object"?(this.viewBox.setValue(e.x1,e.y1,e.x2,e.y2),t===!1&&(a=!1)):(this.viewBox.setValue(e,t,e+i,t+s),r===!1&&(a=!1)),this.forEachChildren(o=>{o.resizeView(this.viewBox.width(),this.viewBox.height())}),a&&this.render()}setDpr(e,t=!0){this.forEachChildren(i=>{i.setDpr(e)}),t&&this.render()}setOrigin(e,t){throw new Error("暂不支持")}export(e){throw new Error("暂不支持")}pick(e,t){this.pickerService||(this.pickerService=we.get(Ol));const i=this.pickerService.pick(this.children,new Et(e,t),{bounds:this.AABBBounds});return!(!(i!=null&&i.graphic)&&!(i!=null&&i.group))&&i}startAnimate(e){throw new Error("暂不支持")}setToFrame(e){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach(e=>{e.release()}),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(e){}dirty(e,t){t&&e.transformWithMatrix(t),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(e.x1,e.y1,e.x2,e.y2),this.dirtyBounds.union(e)}getLayer(e){return this.children.filter(t=>t.name===e)[0]}renderTo(e,t){this.forEachChildren((i,s)=>{i.drawTo(e,Object.assign(Object.assign({},t),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:s===0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())}))})}renderToNewWindow(e=!0,t){const i=we.get(Hf);if(e)i.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""});else{const a=t?t.width():Math.min(this.viewWidth,this.window.width-this.x),o=t?t.height():Math.min(this.viewHeight,this.window.height-this.y);i.create({width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""})}const s=t?-t.x1:0,r=t?-t.y1:0;return this.renderTo(i,{x:s,y:r,width:t?t.x2:i.width,height:t?t.y2:i.height}),i}toCanvas(e=!0,t){const i=this.renderToNewWindow(e,t).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(e){this._cursor=e,this.eventSystem.setCursor(e,"ignore")}getCursor(){return this._cursor}}function pW(n){return new fW(n)}var gW=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},_W=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};const qm={WIDTH:500,HEIGHT:500,DPR:1};let fd=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(n){this._x=n}get y(){return this._y}set y(n){this._y=n}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(n){this._pixelWidth=n,this._displayWidth=n/(this._dpr||1)}get height(){return this._pixelHeight}set height(n){this._pixelHeight=n,this._displayHeight=n/(this._dpr||1)}getContext(n){return this._context}get visiable(){return this._visiable}set visiable(n){this._visiable=n,n?this.show():this.hide()}get dpr(){return this._dpr}set dpr(n){this._dpr=n,this.resize(this._displayWidth,this._displayHeight)}constructor(n){var e;const{nativeCanvas:t,width:i=qm.WIDTH,height:s=qm.HEIGHT,dpr:r=qm.DPR,x:a,y:o,id:l,canvasControled:h=!0}=n;this._x=a??0,this._y=o??0,this._pixelWidth=i*r,this._pixelHeight=s*r,this._visiable=n.visiable!==!1,this.controled=h,this._displayWidth=i,this._displayHeight=s,this._dpr=r,this._nativeCanvas=t,this._id=(e=t.id)!==null&&e!==void 0?e:l,l&&(t.id=l),this.init(n)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(n){}resize(n,e){}toDataURL(n,e){return""}readPixels(n,e,t,i){return this._context.getImageData(n,e,t,i)}convertToBlob(n){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...n){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};fd.env="browser",fd=gW([ue(),_W("design:paramtypes",[Object])],fd);var mW=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};let Ap=class{configure(n,...e){n.env===this.type&&n.setActiveEnvContribution(this)}getNativeAABBBounds(n){return new St}removeDom(n){return!1}createDom(n){return null}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(n){return document.getElementById(n)}getRootElement(){return document.body}loadJson(n){const e=fetch(n).then(t=>t.json());return e.then(t=>({data:t,state:"success"})).catch(()=>({data:null,state:"fail"})),e}loadArrayBuffer(n){return fetch(n).then(e=>e.arrayBuffer()).then(e=>({data:e,loadState:"success"})).catch(()=>({data:null,loadState:"fail"}))}loadBlob(n){return fetch(n).then(e=>e.blob()).then(e=>({data:e,loadState:"success"})).catch(()=>({data:null,loadState:"fail"}))}getElementTop(n,e){return 0}getElementLeft(n,e){return 0}getElementTopLeft(n,e){return{top:0,left:0}}};Ap=mW([ue()],Ap);var yW=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},bW=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};let kp=class{constructor(){this._uid=Nt.GenAutoIncrementId()}onChange(n){this._onChangeCb=n}configure(n,e){e.env===this.type&&n.setWindowHandler(this)}release(...n){this.releaseWindow()}isVisible(n){return!0}onVisibleChange(n){}getTopLeft(n){return{top:0,left:0}}};kp=yW([ue(),bW("design:paramtypes",[])],kp);var vW=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},xW=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},z1=function(n,e){return function(t,i){e(t,i,n)}};let Xb=class{constructor(n){this.pickItemInterceptorContributions=n,this.type="default",this.global=Q.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort((n,e)=>n.order-e.order)}pick(n,e,t){let i={graphic:null,group:null};t.pickerService=this;let s=0,r=0;if(t&&t.bounds){if(!t.bounds.contains(e.x,e.y))return i;s=t.bounds.x1,r=t.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),t.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ft(1,0,0,1,s,r);let o;for(let l=n.length-1;l>=0&&(i=n[l].isContainer?this.pickGroup(n[l],e,a,t):this.pickItem(n[l],e,a,t),!i.graphic);l--)o||(o=i.group);if(i.graphic||(i.group=o),this.pickContext&&(this.pickContext.inuse=!1),i.graphic){let l=i.graphic;for(;l.parent;)l=l.parent;l.shadowHost&&(i.params={shadowTarget:i.graphic},i.graphic=l.shadowHost)}return i}containsPoint(n,e,t){var i;return!!(!((i=this.pickItem(n,e,null,t??{pickContext:this.pickContext,pickerService:this}))===null||i===void 0)&&i.graphic)}pickGroup(n,e,t,i){let s={group:null,graphic:null};if(n.attribute.visibleAll===!1)return s;const r=i.pickContext,a=r.modelMatrix;if(r.camera){const f=n.transMatrix,p=lt.allocate();if(Ob(p,f),a){if(p){const g=lt.allocate();r.modelMatrix=Nu(g,a,p),lt.free(p)}}else Ob(p,n.globalTransMatrix),r.modelMatrix=p}if(this.InterceptorContributions.length)for(let f=0;f<this.InterceptorContributions.length;f++){const p=this.InterceptorContributions[f];if(p.beforePickItem){const g=p.beforePickItem(n,this,e,i,{parentMatrix:t});if(g)return r.modelMatrix!==a&&lt.free(r.modelMatrix),r.modelMatrix=a,g}}const o=n.transMatrix,l=Vn.allocateByObj(t),h=new Et(e.x,e.y);l.transformPoint(h,h);const d=n.AABBBounds.containsPoint(h);if(!d&&!n.stage.camera)return s;const u=this.pickItem(n,h.clone(),t,i);u&&u.graphic&&(s.graphic=u.graphic,s.params=u.params);const c=n.attribute.pickable!==!1&&d;return l.multiply(o.a,o.b,o.c,o.d,o.e,o.f),n.attribute.childrenPickable===!1||u&&u.graphic||zE(n,Mt.zIndex,f=>{if(f.isContainer){const p=new Et(e.x,e.y),g=se(n).group,{scrollX:_=g.scrollX,scrollY:m=g.scrollY}=n.attribute;p.x-=_,p.y-=m,s=this.pickGroup(f,p,l,i)}else{const p=new Et(e.x,e.y);l.transformPoint(p,p);const g=se(n).group,{scrollX:_=g.scrollX,scrollY:m=g.scrollY}=n.attribute;p.x-=_,p.y-=m;const y=this.pickItem(f,p,t,i);y&&y.graphic&&(s.graphic=y.graphic,s.params=y.params)}return!!s.graphic||!!s.group},!0,!!r.camera),r.modelMatrix!==a&&lt.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!c||n.stage.camera||(s.group=n),Vn.free(l),s}selectPicker(n){return this.pickerMap.get(n.numberType)||null}};Xb=vW([ue(),z1(0,Ee(Kt)),z1(0,di(Uo)),xW("design:paramtypes",[Object])],Xb);let j1=!1;const SW=new Me(n=>{j1||(j1=!0,n(Kf).toSelf().inSingletonScope(),n(ip).to(Kf).inSingletonScope(),n(ci).toService(ip),n(vb).toService(Kn),ki(n,vb))});let H1=!1;const AW=new Me(n=>{H1||(H1=!0,n(Qf).toSelf().inSingletonScope(),n(lp).to(Qf).inSingletonScope(),n(ci).toService(lp),n(Xf).toSelf(),n(Yf).toSelf(),n(ed).toService(Xf),n(ed).toService(Yf),n(ed).toService(Kn),ki(n,ed))});let G1=!1;const kW=new Me(n=>{G1||(G1=!0,n(Zd).toSelf().inSingletonScope(),n(vp).toSelf().inSingletonScope(),n(rp).to(Zd).inSingletonScope(),n(ci).toService(rp))});let W1=!1;const wW=new Me(n=>{W1||(W1=!0,n(Jd).toSelf().inSingletonScope(),n(np).to(Jd).inSingletonScope(),n(ci).toService(np),n(xb).toService(Kn),ki(n,xb),n(xp).toSelf().inSingletonScope())});let V1=!1;const MW=new Me(n=>{V1||(V1=!0,n(ep).toSelf().inSingletonScope(),n(hp).to(ep).inSingletonScope(),n(ci).toService(hp),n(Mb).toService(Kn),ki(n,Mb))});let N1=!1;const TW=new Me(n=>{N1||(N1=!0,n(qf).toSelf().inSingletonScope(),n(sp).to(qf).inSingletonScope(),n(ci).toService(sp),n(Sb).toService(Kn),ki(n,Sb))});let U1=!1;const CW=new Me(n=>{U1||(U1=!0,n(Gb).to(Db).inSingletonScope(),n(ci).toService(Gb),n(Tb).toService(Kn),ki(n,Tb))});let $1=!1;const PW=new Me(n=>{$1||($1=!0,n(Jf).toSelf().inSingletonScope(),n(ap).to(Jf).inSingletonScope(),n(ci).toService(ap),n(kb).toService(Kn),ki(n,kb))});let Y1=!1;const EW=new Me(n=>{Y1||(Y1=!0,n(op).to(Fb).inSingletonScope(),n(ci).toService(op),n(wb).toService(Kn),ki(n,wb))});var RW=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};let Kb=class{constructor(){this.numberType=b_}drawShape(n,e,t,i,s,r,a,o){s.drawContribution&&n.getSubGraphic().forEach(l=>{const h=s.drawContribution.getRenderContribution(l);h&&h.drawShape&&h.drawShape(l,e,t,i,s,r,a,o)})}draw(n,e,t,i){const{context:s}=t;if(!s||(s.highPerformanceSave(),!t.drawContribution))return;const r=se(n),a=n.getSubGraphic();a.length&&a.forEach(o=>{t.drawContribution.renderItem(o,t,{theme:r})}),s.highPerformanceRestore()}};Kb=RW([ue()],Kb);let X1=!1;const OW=new Me(n=>{X1||(X1=!0,n(dp).to(Kb).inSingletonScope(),n(ci).toService(dp))});var BW=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},LW=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};let qb=class extends sn{constructor(){super(),this.numberType=Dx,this.builtinContributions=[BE],this.init()}drawShape(n,e,t,i,s){const r=se(n).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=n.attribute;if(!n.valid||!h)return;const d=Jl(o,l,!0),u=Jl(o,a,!0);d&&(e.translate(t,i),this.beforeRenderStep(n,e,t,i,d,u,d,u,r,s),n.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(n,e,t,i,d,u,d,u,r,s))}drawIcon(n,e,t,i,s){var r;const a=se(n).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:d,backgroundFill:u=a.backgroundFill,backgroundFillOpacity:c=a.backgroundFillOpacity,backgroundStroke:f=a.backgroundStroke,backgroundStrokeOpacity:p=a.backgroundStrokeOpacity,backgroundRadius:g=a.backgroundRadius,margin:_}=n.attribute,{backgroundWidth:m=o,backgroundHeight:y=l}=n.attribute;if(_&&(t+=n._marginArray[3],i+=n._marginArray[0]),n._hovered){const v=(m-o)/2,x=(y-l)/2;g===0?(e.beginPath(),e.rect(t-v,i-x,m,y)):(e.beginPath(),so(e,t-v,i-x,m,y,g)),u&&(e.globalAlpha=c,e.fillStyle=u,e.fill()),f&&(e.globalAlpha=p,e.strokeStyle=f,e.stroke())}const b=d&&((r=n==null?void 0:n.resources)===null||r===void 0?void 0:r.get(d));b&&b.state==="success"&&(e.globalAlpha=h,e.drawImage(b.data,t,i,o,l))}draw(n,e,t){const i=se(n).richtext;this._draw(n,i,!1,t)}};qb=BW([ue(),LW("design:paramtypes",[])],qb);let K1=!1;const IW=new Me(n=>{K1||(K1=!0,n(Wb).to(qb).inSingletonScope(),n(ci).toService(Wb))});let q1=!1;const DW=new Me(n=>{q1||(q1=!0,n(C1).to(zb).inSingletonScope(),n(ci).toService(C1),n(Ab).toService(Kn),ki(n,Ab))});var FW=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};let Zb=class extends sn{constructor(){super(...arguments),this.type="rect3d",this.numberType=Ix}drawShape(n,e,t,i,s,r,a,o){var l;const h=se(n,r==null?void 0:r.theme).rect3d,{fill:d=h.fill,stroke:u=h.stroke,x1:c,y1:f,x:p,y:g,opacity:_=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:y=h.lineWidth,strokeOpacity:b=h.strokeOpacity,visible:v=h.visible}=n.attribute;let{width:x,height:S}=n.attribute;x=(x??c-p)||0,S=(S??f-g)||0;const A=(l=this.z)!==null&&l!==void 0?l:0,k=jx(_,m,x,S,d),w=Gx(_,b,x,S),M=go(d),T=Sh(u,y);if(!n.valid||!v||!M&&!T||!(k||w||a||o))return;const{light:E,camera:O}=s.stage||{},B=n.findFace();if(d!==!1){e.setCommonStyle(n,n.attribute,t,i,h);let R=d;typeof R!="string"&&(R="black"),this.fill(t,i,A,B,R,e,E,a)}u!==!1&&(e.setStrokeStyle(n,n.attribute,t,i,h),this.stroke(t,i,A,B,e))}stroke(n,e,t,i,s){const r=i.vertices;i.edges.forEach(a=>{const o=r[a[0]],l={x:n+o[0],y:e+o[1],z:t+o[2]},h=r[a[1]],d={x:n+h[0],y:e+h[1],z:t+h[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(d.x,d.y,d.z),s.stroke()})}fill(n,e,t,i,s,r,a,o){const l=vt.Get(s,Vi.Color255),h=i.vertices,d=h.map(c=>r.view(c[0],c[1],c[2])[2]),u=[];i.polygons.forEach((c,f)=>{u.push({faceIdx:f,polygon:c});const{polygon:p,normal:g}=c,_=d[p[0]],m=d[p[1]],y=d[p[2]],b=d[p[3]];c.ave_z=_+m+y+b}),u.sort((c,f)=>f.polygon.ave_z-c.polygon.ave_z),u.forEach(c=>{const{polygon:f,normal:p}=c.polygon,g=h[f[0]],_=h[f[1]],m=h[f[2]],y=h[f[3]],b={x:n+g[0],y:e+g[1],z:t+g[2]},v={x:n+_[0],y:e+_[1],z:t+_[2]},x={x:n+m[0],y:e+m[1],z:t+m[2]},S={x:n+y[0],y:e+y[1],z:t+y[2]};r.beginPath(),r.moveTo(b.x,b.y,b.z),r.lineTo(v.x,v.y,v.z),r.lineTo(x.x,x.y,x.z),r.lineTo(S.x,S.y,S.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(p,l):s,r.fill())})}draw(n,e,t){const i=se(n).rect;this._draw(n,i,!1,t)}};Zb=FW([ue()],Zb);let Z1=!1;const zW=new Me(n=>{Z1||(Z1=!0,n(Hb).to(Zb).inSingletonScope(),n(ci).toService(Hb))});var jW=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};function HW(n,e,t,i,s,r,a){const{startAngle:o,endAngle:l}=n.getParsedAngle(),h=Ve(l-o),d=l>o;let u=!1;if(r<a){const c=r;r=a,a=c}if(r<=Qe)e.moveTo(t,i,s);else if(h>=Be-Qe)e.moveTo(t+r*nt(o),i+r*Ze(o),s),e.arc(t,i,r,o,l,!d,s),a>Qe&&(e.moveTo(t+a*nt(l),i+a*Ze(l),s),e.arc(t,i,a,l,o,d,s));else{const{outerDeltaAngle:c,innerDeltaAngle:f,outerStartAngle:p,outerEndAngle:g,innerEndAngle:_,innerStartAngle:m}=n.getParsePadAngle(o,l),y=r*nt(p),b=r*Ze(p),v=a*nt(_),x=a*Ze(_);c<.001?u=!0:(e.moveTo(t+y,i+b,s),e.arc(t,i,r,p,g,!d,s)),!(a>Qe)||f<.001?(e.lineTo(t+v,i+x,s),u=!0):(e.lineTo(t+v,i+x,s),e.arc(t,i,a,_,m,d,s))}return e.closePath(),u}function GW(n,e,t,i,s,r,a,o){const{startAngle:l,endAngle:h}=n.getParsedAngle(),d=Ve(h-l),u=h>l;let c=!1;if(a<=Qe)e.moveTo(t,i,s);else if(d>=Be-Qe)e.moveTo(t+a*nt(l),i+a*Ze(l),s),e.arc(t,i,a,l,h,!u,s),e.lineTo(t+a*nt(h),i+a*Ze(h),r),e.arc(t,i,a,h,l,u,r);else{const{innerouterDeltaAngle:f,innerouterStartAngle:p,innerouterEndAngle:g}=o(l,h),_=a*nt(p),m=a*Ze(p),y=a*nt(g),b=a*Ze(g);f<.001?c=!0:(e.moveTo(t+_,i+m,s),e.arc(t,i,a,p,g,!u,s),e.lineTo(t+y,i+b,r),e.arc(t,i,a,g,p,u,r))}return e.closePath(),c}let Jb=class extends sn{constructor(){super(...arguments),this.numberType=Gu}drawShape(n,e,t,i,s,r,a,o){var l;const h=se(n,r==null?void 0:r.theme).arc,{fill:d=h.fill}=n.attribute,u=this.valid(n,h,a,o);if(!u)return;const{fVisible:c,sVisible:f,doFill:p,doStroke:g}=u,_=(l=this.z)!==null&&l!==void 0?l:0,{outerRadius:m=h.outerRadius,innerRadius:y=h.innerRadius,height:b=10}=n.attribute,v=vt.Get(d,Vi.Color255),{light:x}=s.stage||{},S=s.hack_pieFace,A={top:_,bottom:_+b},k={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};S==="bottom"||S==="top"?(e.beginPath(),HW(n,e,t,i,A[S],m,y),e.setShadowBlendStyle&&e.setShadowBlendStyle(n,n.attribute,h),p&&(a?a(e,n.attribute,h):c&&(e.setCommonStyle(n,n.attribute,t,i,h),e.fillStyle=x?x.computeColor(k[S],v):d,e.fill())),g&&(o?o(e,n.attribute,h):f&&(e.setStrokeStyle(n,n.attribute,t,i,h),e.stroke()))):S!=="outside"&&S!=="inside"||(S==="inside"&&(e.save(),e.beginPath(),e.arc(t,i,y,0,Be,!0,A.top),e.clip()),e.beginPath(),GW(n,e,t,i,A.top,A.bottom,S==="outside"?m:y,(w,M)=>{const{outerDeltaAngle:T,innerDeltaAngle:E,outerStartAngle:O,outerEndAngle:B,innerEndAngle:R,innerStartAngle:L}=n.getParsePadAngle(w,M);return S==="outside"?{innerouterDeltaAngle:T,innerouterEndAngle:B,innerouterStartAngle:O}:{innerouterDeltaAngle:E,innerouterEndAngle:R,innerouterStartAngle:L}}),e.setShadowBlendStyle&&e.setShadowBlendStyle(n,n.attribute,h),p&&(a?a(e,n.attribute,h):c&&(e.setCommonStyle(n,n.attribute,t,i,h),e.fillStyle=x?x.computeColor(k[S],v):d,e.fill())),g&&(o?o(e,n.attribute,h):f&&(e.setStrokeStyle(n,n.attribute,t,i,h),e.stroke())),S==="inside"&&e.restore())}draw(n,e,t,i){const s=se(n,i==null?void 0:i.theme).arc;this._draw(n,s,!1,t,i)}};Jb=jW([ue()],Jb);let J1=!1;const WW=new Me(n=>{J1||(J1=!0,n(jb).to(Jb).inSingletonScope(),n(ci).toService(jb))});var VW=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};let Qb=class extends sn{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=Lx}drawShape(n,e,t,i,s,r,a,o){var l;const h=se(n,r==null?void 0:r.theme).polygon,{fill:d=h.fill,stroke:u=h.stroke,face:c=[!0,!0,!0,!0,!0,!0]}=n.attribute,f=(l=this.z)!==null&&l!==void 0?l:0;if(!this.valid(n,h,a,o))return;const{light:p,camera:g}=s.stage||{},_=n.findFace();if(d!==!1){e.setCommonStyle(n,n.attribute,t,i,h);let m=d;typeof m!="string"&&(m="black"),this.fill(t,i,f,_,c,m,e,p,g,n,h,a)}u!==!1&&(e.setStrokeStyle(n,n.attribute,t,i,h),this.stroke(t,i,f,_,e))}stroke(n,e,t,i,s){const r=i.vertices;i.edges.forEach(a=>{const o=r[a[0]],l=r[a[1]],h={x:n+o[0],y:e+o[1],z:t+o[2]},d={x:n+l[0],y:e+l[1],z:t+l[2]};s.beginPath(),s.moveTo(h.x,h.y,h.z),s.lineTo(d.x,d.y,d.z),s.stroke()})}fill(n,e,t,i,s,r,a,o,l,h,d,u){const c=vt.Get(r,Vi.Color255),f=i.vertices,p=f.map(_=>a.view(_[0],_[1],_[2])[2]),g=[];i.polygons.forEach((_,m)=>{if(!s[m])return;g.push({faceIdx:m,polygon:_});const{polygon:y,normal:b}=_,v=p[y[0]],x=p[y[1]],S=p[y[2]],A=p[y[3]];_.ave_z=v+x+S+A}),g.sort((_,m)=>m.polygon.ave_z-_.polygon.ave_z),g.forEach(_=>{const{polygon:m,normal:y}=_.polygon,b=f[m[0]],v=f[m[1]],x=f[m[2]],S=f[m[3]],A={x:n+b[0],y:e+b[1],z:t+b[2]},k={x:n+v[0],y:e+v[1],z:t+v[2]},w={x:n+x[0],y:e+x[1],z:t+x[2]},M={x:n+S[0],y:e+S[1],z:t+S[2]};a.beginPath(),a.moveTo(A.x,A.y,A.z),a.lineTo(k.x,k.y,k.z),a.lineTo(w.x,w.y,w.z),a.lineTo(M.x,M.y,M.z),a.closePath(),u?u(a,h.attribute,d):(a.fillStyle=o?o.computeColor(y,c):r,a.fill())})}draw(n,e,t){const i=se(n).polygon;this._draw(n,i,!1,t)}};Qb=VW([ue()],Qb);let Q1=!1;const NW=new Me(n=>{Q1||(Q1=!0,n(Vb).to(Qb).inSingletonScope(),n(ci).toService(Vb))});function UW(){ce.RegisterGraphicCreator("arc",Yx)}function $W(){ce.RegisterGraphicCreator("arc3d",CE)}function YW(){ce.RegisterGraphicCreator("area",TE)}function XW(){ce.RegisterGraphicCreator("circle",Dz)}function KW(){ce.RegisterGraphicCreator("glyph",kE)}function qW(){ce.RegisterGraphicCreator("group",Fx)}function ZW(){ce.RegisterGraphicCreator("image",$x)}function JW(){ce.RegisterGraphicCreator("line",Ux)}function QW(){ce.RegisterGraphicCreator("path",ME)}function e5(){ce.RegisterGraphicCreator("polygon",PE)}function t5(){ce.RegisterGraphicCreator("pyramid3d",EE)}function i5(){ce.RegisterGraphicCreator("rect",eh)}function n5(){ce.RegisterGraphicCreator("rect3d",AE)}function s5(){ce.RegisterGraphicCreator("richtext",wE)}function r5(){ce.RegisterGraphicCreator("symbol",M_)}function a5(){ce.RegisterGraphicCreator("text",no)}function o5(){ce.RegisterGraphicCreator("shadowRoot",Kj)}function l5(){ce.RegisterGraphicCreator("wrapText",Fz)}const jE=Jx(),$r=jE&&globalThis?globalThis.document:void 0;function Nn(n){return(n==="desktop-browser"||n==="mobile-browser")&&jE}function va(n){return xa(n)||n==="mobile-browser"}function xa(n){return n.includes("miniApp")||n==="lynx"||n==="wx"}let Zm=0;function mo(){return Zm>=9999999&&(Zm=0),Zm++}function Ws(n){return n!=null&&n!==""&&(!!oe(n)||+n==+n)}function h5(n){if(j(n))return n;const e=+n;return j(e)?e:0}function Yo(n){return!(!n||n.length===0)&&!C(n[0])&&!C(n[0].dataId)&&W(n[0].fields)}const yo=(n,e,t)=>(n.fields=e||[],n.fname=t,n),d5=n=>e=>Te(e,n),Ka=n=>{De.getInstance().error(n)},u5=n=>{const e=[],t=n.length;let i,s,r,a=null,o=0,l="";n+="";const h=()=>{e.push(l+n.substring(i,s)),l="",i=s+1};for(i=0,s=0;s<t;s+=1)if(r=n[s],r==="\\")l+=n.substring(i,s),l+=n.substring(++s,++s),i=s;else if(r===a)h(),a=null,o=-1;else{if(a)continue;i===o&&r==='"'||i===o&&r==="'"?(i=s+1,a=r):r!=="."||o?r==="["?(s>i&&h(),i=s+1,o=i):r==="]"&&(o||Ka("Access path missing open bracket: "+n),o>0&&h(),o=0,i=s+1):s>i?h():i=s+1}return o&&Ka("Access path missing closing bracket: "+n),a&&Ka("Access path missing closing quote: "+n),s>i&&(s+=1,h()),e},ek=(n,e,t={})=>{if(Y(n))return n;const i=u5(n),s=i.length===1?i[0]:n;return yo((t&&t.get||d5)(i),[s],s)},ys=(n,e,t={})=>{if(W(n)){const i=n.map(s=>ek(s,e,t));return s=>i.map(r=>r(s))}return ek(n,e,t)};ys("id");const c5=yo(function(n){return n},[],"identity"),f5=yo(function(){return 0},[],"zero");yo(function(){return 1},[],"one");yo(function(){return!0},[],"true");yo(function(){return!1},[],"false");yo(function(){return{}},[],"emptyObject");const ev=(n,e)=>{const t=Y(e)?e:r=>r;let i,s;if(n&&n.length){const r=n.length;for(let a=0;a<r;a+=1){let o=t(n[a]);C(o)||!oe(o=+o)||Number.isNaN(o)||(C(i)?(i=o,s=o):(i=Math.min(i,o),s=Math.max(s,o)))}return[i,s]}return[i,s]},R_=(n,e,t,i=!0)=>{if(e===t)return!0;if(C(e)||C(t))return C(e)&&C(t);if(!Iy(e)&&!Iy(t))return e===t;const s=W(e)?e:e[n],r=W(t)?t:t[n];return s===r||i!==!1&&(W(r)?!(!W(s)||r.length!==s.length||!r.every((a,o)=>a===s[o])):!!He(r)&&!(!He(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every(a=>R_(a,r,s))))},bn=(n,e)=>C(n)?e:ae(n)?e*parseFloat(n)/100:n;function p5(n,e,t,i){const s=i-n*n,r=Math.abs(s)<1e-24?0:(t-n*e)/s;return[e-r*n,r]}function HE(n,e,t,i){let s,r,a=-1;n.forEach(o=>{s=e(o),r=t(o),!C(s)&&(s=+s)>=s&&!C(r)&&(r=+r)>=r&&i(s,r,++a)})}function g5(n,e,t,i,s){let r=0,a=0;return HE(n,e,t,(o,l)=>{const h=l-s(o),d=l-i;r+=h*h,a+=d*d}),1-r/a}function _5(n,e=i=>i.x,t=i=>i.y){let i=0,s=0,r=0,a=0,o=0;HE(n,e,t,(d,u)=>{++o,i+=(d-i)/o,s+=(u-s)/o,r+=(d*u-r)/o,a+=(d*d-a)/o});const l=p5(i,s,r,a),h=d=>l[0]+l[1]*d;return{coef:l,predict:h,rSquared:g5(n,e,t,s,h)}}function Ai(n){return n==="horizontal"}function tk(n){return n==="vertical"}var Rt;(function(n){n.Identity="identity",n.Linear="linear",n.Log="log",n.Pow="pow",n.Sqrt="sqrt",n.Symlog="symlog",n.Time="time",n.Quantile="quantile",n.Quantize="quantize",n.Threshold="threshold",n.Ordinal="ordinal",n.Point="point",n.Band="band"})(Rt||(Rt={}));const GE={};Object.values(Rt).forEach(n=>{GE[n]=!0});function Ue(n){switch(n){case Rt.Linear:case Rt.Log:case Rt.Pow:case Rt.Sqrt:case Rt.Symlog:case Rt.Time:return!0;default:return!1}}function tv(n){return!!GE[n]}function wi(n){switch(n){case Rt.Ordinal:case Rt.Point:case Rt.Band:return!0;default:return!1}}function Io(n){return n}const m5=n=>n<0?-Math.sqrt(-n):Math.sqrt(n),y5=n=>n<0?-n*n:n*n,b5=n=>-Math.log(-n),v5=n=>-Math.exp(-n),x5=n=>isFinite(n)?Math.pow(10,n):n<0?0:n,ik=n=>n===10?x5:n===Math.E?Math.exp:e=>Math.pow(n,e),nk=n=>n===Math.E?Math.log:n===10?Math.log10:n===2?Math.log2:(n=Math.log(n),e=>Math.log(e)/n),sk=n=>e=>Math.sign(e)*Math.log1p(Math.abs(e/n)),rk=n=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*n;function iv(n,e){if(n=Number(n),e=Number(e),e-=n)return i=>(i-n)/e;const t=Number.isNaN(e)?NaN:.5;return()=>t}function ak(n,e,t){const i=n[0],s=n[1],r=e[0],a=e[1];let o,l;return s<i?(o=iv(s,i),l=t(a,r)):(o=iv(i,s),l=t(r,a)),h=>l(o(h))}function Qx(n,e,t){let i;return i=n===1?n+2*t:n-e+2*t,n?i>0?i:1:0}function WE(n,e,t,i){return t===1&&(t=0),Qx(n,t,i)*(e/(1-t))}function S5(n,e,t,i,s){const r=Qx(n,t,i);let a=e/Math.max(1,r||1);s&&(a=Math.floor(a));let o=a*(1-t);return s&&(o=Math.round(o)),o}function VE(n,e){const t=(n[1]-n[0])/(e[1]-e[0]),i=n[0]-t*e[0];return[i,t+i]}function A5(n,e,t){const i=Math.min(n.length,e.length)-1,s=new Array(i),r=new Array(i);let a=-1;for(n[i]<n[0]&&(n=n.slice().reverse(),e=e.slice().reverse());++a<i;)s[a]=iv(n[a],n[a+1]),r[a]=t(e[a],e[a+1]);return function(o){const l=xC(n,o,1,i)-1;return r[l](s[l](o))}}const NE=(n,e)=>{const t=n.slice();let i=0,s=t.length-1,r=t[i],a=t[s];return a<r&&([i,s]=[s,i],[r,a]=[a,r]),t[i]=e.floor(r),t[s]=e.ceil(a),t},UE=(n,e=!1)=>{const t=Math.floor(Math.log10(n)),i=n/Math.pow(10,t);let s;return s=e?i<1.5?1:i<3?2:i<7?5:10:i<=1?1:i<=2?2:i<=5?5:10,s*Math.pow(10,t)},k5=(n,e)=>{let t,i;return e[0]<e[1]?(t=e[0],i=e[1]):(t=e[1],i=e[0]),Math.min(Math.max(n,t),i)};class $E{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(e){return this._wholeRange?this._wholeRange:P(this._rangeFactorStart)&&P(this._rangeFactorEnd)&&e.length===2?(this._wholeRange=VE(e,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):e}rangeFactor(e,t,i){return e?(e.length===2&&e.every(s=>s>=0&&s<=1)&&(this._wholeRange=null,e[0]===0&&e[1]===1?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=e[0],this._rangeFactorEnd=e[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):P(this._rangeFactorStart)&&P(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(e,t){var i;return C(e)?this._rangeFactorStart:(e>=0&&e<=1&&(this._wholeRange=null,e!==0||!C(this._rangeFactorEnd)&&this._rangeFactorEnd!==1?(this._rangeFactorStart=e,this._rangeFactorEnd=(i=this._rangeFactorEnd)!==null&&i!==void 0?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(e,t){var i;return C(e)?this._rangeFactorEnd:(e>=0&&e<=1&&(this._wholeRange=null,e!==0||!C(this._rangeFactorStart)&&this._rangeFactorStart!==0?(this._rangeFactorEnd=e,this._rangeFactorStart=(i=this._rangeFactorStart)!==null&&i!==void 0?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var e;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:t=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,r=this.range(),a=r[0],o=r[r.length-1],l=Math.min(a,o),h=Math.max(a,o),d=ai((e=this._fishEyeOptions.focus)!==null&&e!==void 0?e:0,l,h),u=C(s)?(h-l)*i:s;let c=Math.exp(t);c=c/(c-1)*u;const f=t/u;this._fishEyeTransform=p=>{const g=Math.abs(p-d);if(g>=u)return p;if(g<=1e-6)return d;const _=c*(1-Math.exp(-g*f))/g*.75+.25;return d+(p-d)*_}}unknown(e){return arguments.length?(this._unknown=e,this):this._unknown}}const nv=Symbol("implicit");class ro extends $E{specified(e){var t;return e?(this._specified=Object.assign((t=this._specified)!==null&&t!==void 0?t:{},e),this):Object.assign({},this._specified)}_getSpecifiedValue(e){if(this._specified)return this._specified[e]}constructor(){super(),this.type=Rt.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=nv}clone(){return new ro().domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}calculateVisibleDomain(e){return P(this._rangeFactorStart)&&P(this._rangeFactorEnd)&&e.length===2?[this.invert(e[0]),this.invert(e[1])]:this._domain}scale(e){const t=`${e}`,i=this._getSpecifiedValue(t);if(i!==void 0)return i;let s=this._index.get(t);if(!s){if(this._unknown!==nv)return this._unknown;s=this._domain.push(e),this._index.set(t,s)}const r=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(r):r}invert(e){let t=0;for(;t<this._ordinalRange.length&&this._ordinalRange[t]!==e;)t++;return this._domain[(t-1)%this._domain.length]}domain(e){if(!e)return this._domain.slice();this._domain=[],this._index=new Map;for(const t of e){const i=`${t}`;this._index.has(i)||this._index.set(i,this._domain.push(t))}return this}range(e){if(!e)return this._ordinalRange.slice();const t=Array.from(e);return this._ordinalRange=t,this}}function ok(n,e,t,i){let s;const r=[];let a;if(e=Math.floor(+e),n=Math.floor(+n),!(t=Math.floor(+t)))return[];if(n===e)return[n];if(s=e<n){const h=n;n=e,e=h}let o=ux(1,e-n+1)(t);if(a=Math.floor((e-n+1)/o),!i)for(;Math.ceil((e-n+1)/a)>t&&o>1;)o-=1,a=Math.floor((e-n)/o);let l=n;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}function w5(n,e,t){const i=[];let s;if(e=Math.floor(+e),n=Math.floor(+n),t=ux(1,e-n+1)(Math.floor(+t)),s=e<n){const a=n;n=e,e=a}let r=n;for(;r<=e;)i.push(r),r+=t;return s&&i.reverse(),i}class bo extends ro{constructor(e){super(),this.type=Rt.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(e)}rescale(e,t){if(e)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,t),s=super.domain().length,r=i[1]<i[0];let a=i[Number(r)-0];const o=i[1-Number(r)],l=Qx(s,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*(s-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:r,start:r?a+this._step*(s-1):a,count:s},this.generateFishEyeTransform(),this}scale(e){if(!this._bandRangeState)return;const t=`${e}`,i=this._getSpecifiedValue(t);if(i!==void 0)return i;let s=this._index.get(t);if(!s){if(this._unknown!==nv)return this._unknown;s=this._domain.push(e),this._index.set(t,s)}const{count:r,start:a,reverse:o}=this._bandRangeState,l=a+(o?-1:1)*((s-1)%r)*this._step;return this._fishEyeTransform?this._fishEyeTransform(l):l}_calculateWholeRange(e,t){if(this._wholeRange)return this._wholeRange;if((this._minBandwidth||this._maxBandwidth)&&!this._isBandwidthFixedByUser()){let i;if(P(this._rangeFactorStart)&&P(this._rangeFactorEnd)&&e.length===2){const r=VE(e,[this._rangeFactorStart,this._rangeFactorEnd]);i=Math.abs(r[1]-r[0])}else i=Math.abs(e[1]-e[0]);const s=S5(super.domain().length,i,this._paddingInner,this._paddingOuter,this._round);s<this._minBandwidth?(this._bandwidth=this._minBandwidth,this._isFixed=!0):s>this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=s,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=WE(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(e[1]-e[0]),s=Math.min((e[1]-e[0])/i,1);if(P(this._rangeFactorStart)&&P(this._rangeFactorEnd)){if(i>0){const o=e[0]-i*this._rangeFactorStart,l=o+i;this._wholeRange=[o,l]}else{const o=e[1]+i*(1-this._rangeFactorEnd),l=o-i;this._wholeRange=[l,o]}const r=this._rangeFactorStart+s<=1,a=this._rangeFactorEnd-s>=0;t==="rangeFactorStart"&&r?this._rangeFactorEnd=this._rangeFactorStart+s:t==="rangeFactorEnd"&&a?this._rangeFactorStart=this._rangeFactorEnd-s:e[0]<=e[1]?r?this._rangeFactorEnd=this._rangeFactorStart+s:a?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):a?this._rangeFactorStart=this._rangeFactorEnd-s:r?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[e[0],e[0]+i];return this._wholeRange}return super._calculateWholeRange(e)}calculateWholeRangeSize(){const e=this._calculateWholeRange(this._range);return Math.abs(e[1]-e[0])}calculateVisibleDomain(e){const t=this._domain;if(P(this._rangeFactorStart)&&P(this._rangeFactorEnd)&&t.length){const i=this._getInvertIndex(e[0]),s=this._getInvertIndex(e[1]);return t.slice(Math.min(i,s),Math.max(i,s)+1)}return t}domain(e,t){return e?(super.domain(e),this.rescale(t)):super.domain()}range(e,t){return e?(this._range=[Ds(e[0]),Ds(e[1])],this.rescale(t)):this._range}rangeRound(e,t){return this._range=[Ds(e[0]),Ds(e[1])],this._round=!0,this.rescale(t)}ticks(e=10){const t=this.calculateVisibleDomain(this._range);return e===-1?t:ok(0,t.length-1,e,!1).map(i=>t[i])}tickData(e=10){return this.ticks(e).map((t,i)=>({index:i,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])}))}forceTicks(e=10){const t=this.calculateVisibleDomain(this._range);return ok(0,t.length-1,e,!0).filter(i=>i<t.length).map(i=>t[i])}stepTicks(e){const t=this.calculateVisibleDomain(this._range);return w5(0,t.length-1,e).map(i=>t[i])}_getInvertIndex(e){let t=0;const i=this.step()/2,s=this.bandwidth()/2,r=this._domain.length,a=this.range(),o=a[0]>a[a.length-1];for(t=0;t<r;t++){const l=this.scale(this._domain[t])+s;if(t===0&&(!o&&!Ts(e,l+i)||o&&!rs(e,l-i))||t===r-1||!rs(e,l-i)&&!Ts(e,l+i))break}return t>=0&&t<=r-1?t:r-1}invert(e){return this._domain[this._getInvertIndex(e)]}padding(e,t){return e!==void 0?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(e)?Math.min.apply(null,e):e)),this._paddingInner=this._paddingOuter,this.rescale(t)):this._paddingInner}paddingInner(e,t){return e!==void 0?(this._paddingInner=Math.max(0,Math.min(1,e)),this.rescale(t)):this._paddingInner}paddingOuter(e,t){return e!==void 0?(this._paddingOuter=Math.max(0,Math.min(1,e)),this.rescale(t)):this._paddingOuter}step(){return this._step}round(e,t){return e!==void 0?(this._round=e,this.rescale(t)):this._round}align(e,t){return e!==void 0?(this._align=Math.max(0,Math.min(1,e)),this.rescale(t)):this._align}rangeFactor(e,t){return e?(super.rangeFactor(e),this.rescale(t)):super.rangeFactor()}rangeFactorStart(e,t){return C(e)?super.rangeFactorStart():(super.rangeFactorStart(e),this.rescale(t,"rangeFactorStart"))}rangeFactorEnd(e,t){return C(e)?super.rangeFactorEnd():(super.rangeFactorEnd(e),this.rescale(t,"rangeFactorEnd"))}bandwidth(e,t){return e?(e==="auto"?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=e,this._isFixed=!0),this._userBandwidth=e,this.rescale(t)):this._bandwidth}maxBandwidth(e,t){return e?(this._maxBandwidth=e==="auto"?void 0:e,this.rescale(t)):this._maxBandwidth}minBandwidth(e,t){return e?(this._minBandwidth=e==="auto"?void 0:e,this.rescale(t)):this._minBandwidth}fishEye(e,t,i){return e||i?(this._fishEyeOptions=e,this._fishEyeTransform=null,this.rescale(t)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&oe(this._userBandwidth)}clone(){var e,t,i;return new bo(!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((e=this._userBandwidth)!==null&&e!==void 0?e:"auto",!0).maxBandwidth((t=this._maxBandwidth)!==null&&t!==void 0?t:"auto",!0).minBandwidth((i=this._maxBandwidth)!==null&&i!==void 0?i:"auto")}}const{interpolateRgb:Jm}=MD;function M5(n,e){const t=typeof e;let i;if(C(e)||t==="boolean")return()=>e;if(t==="number")return rd(n,e);if(t==="string"){if(i=Gt.parseColorString(e)){const s=Jm(Gt.parseColorString(n),i);return r=>s(r).formatRgb()}return rd(Number(n),Number(e))}return e instanceof Si?Jm(n,e):e instanceof Gt?Jm(n.color,e.color):e instanceof Date?cD(n,e):rd(Number(n),Number(e))}class YE extends $E{constructor(e=Io,t=Io){super(),this._unknown=void 0,this.transformer=e,this.untransformer=t,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Io,this._piecewise=ak,this._interpolate=M5}calculateVisibleDomain(e){var t;return P(this._rangeFactorStart)&&P(this._rangeFactorEnd)&&e.length===2?[this.invert(e[0]),this.invert(e[1])]:(t=this._niceDomain)!==null&&t!==void 0?t:this._domain}fishEye(e,t,i){return e||i?(this._fishEyeOptions=e,this._fishEyeTransform=null,this.rescale(t)):this._fishEyeOptions}scale(e){var t;if(e=Number(e),Number.isNaN(e)||this._domainValidator&&!this._domainValidator(e))return this._unknown;this._output||(this._output=this._piecewise(((t=this._niceDomain)!==null&&t!==void 0?t:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(e)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(e){var t;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),((t=this._niceDomain)!==null&&t!==void 0?t:this._domain).map(this.transformer),rd)),this._clamp(this.untransformer(this._input(e)))}domain(e,t){var i;if(!e)return((i=this._niceDomain)!==null&&i!==void 0?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(e,Ds);return this._domain=s,this.rescale(t)}range(e,t){if(!e)return this._range.slice();const i=Array.from(e);return this._range=i,this.rescale(t)}rangeRound(e,t){const i=Array.from(e);return this._range=i,this._interpolate=uD,this.rescale(t)}rescale(e){var t;if(e)return this;const i=(t=this._niceDomain)!==null&&t!==void 0?t:this._domain,s=i.length,r=this._range.length;let a=Math.min(s,r);if(s&&s<r&&this._forceAlign){const o=r-s+1,l=i[s-1],h=s>=2?(l-i[s-2])/o:0;for(let d=1;d<=o;d++)i[s-2+d]=l-h*(o-d);a=r}return this._autoClamp&&(this._clamp=ux(i[0],i[a-1])),this._piecewise=a>2?A5:ak,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(e,t,i){return arguments.length?(t?(this._autoClamp=!1,this._clamp=t):(this._autoClamp=!!e,this._clamp=e?void 0:Io),this.rescale(i)):this._clamp!==Io}interpolate(e,t){return arguments.length?(this._interpolate=e,this.rescale(t)):this._interpolate}ticks(e=10){return[]}tickData(e=10){const t=this.ticks(e);return(t??[]).map((i,s)=>({index:s,tick:i,value:(this.scale(i)-this._range[0])/(this._range[1]-this._range[0])}))}rangeFactor(e,t){return e?(super.rangeFactor(e),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(e,t){return C(e)?super.rangeFactorStart():(super.rangeFactorStart(e),this._output=this._input=null,this)}rangeFactorEnd(e,t){return C(e)?super.rangeFactorEnd():(super.rangeFactorEnd(e),this._output=this._input=null,this)}forceAlignDomainRange(e){return arguments.length?(this._forceAlign=e,this):this._forceAlign}}const T5=Math.sqrt(50),C5=Math.sqrt(10),P5=Math.sqrt(2),Hc=[1,2,5,10],lk=(n,e,t)=>{let i=1,s=n;const r=Math.floor((e-1)/2),a=Math.abs(n);return n>=0&&n<=Number.MIN_VALUE?s=0:n<0&&n>=-Number.MIN_VALUE?s=-(e-1):!t&&a<1?i=XE(a).step:(t||a>1)&&(s=Math.floor(n)-r*i),i>0?(n>0?s=Math.max(s,0):n<0&&(s=Math.min(s,-(e-1)*i)),bC(0,e).map(o=>s+o*i)):n>0?wp(0,-(e-1)/i,i):wp((e-1)/i,0,i)},E5=yh((n,e,t,i)=>{let s,r,a,o,l=-1;if(t=+t,(n=+n)==(e=+e))return[n];if(Math.abs(n-e)<=Number.MIN_VALUE&&t>0)return[n];if((s=e<n)&&(r=n,n=e,e=r),o=e0(n,e,t).step,!isFinite(o))return[];if(o>0){let h=Math.round(n/o),d=Math.round(e/o);for(h*o<n&&++h,d*o>e&&--d,a=new Array(r=d-h+1);++l<r;)a[l]=(h+l)*o}else if(o<0&&(i!=null&&i.noDecimals)){o=1;const h=Math.ceil(n),d=Math.floor(e);if(!(h<=d))return[];for(a=new Array(r=d-h+1);++l<r;)a[l]=h+l}else{o=-o;let h=Math.round(n*o),d=Math.round(e*o);for(h/o<n&&++h,d/o>e&&--d,a=new Array(r=d-h+1);++l<r;)a[l]=(h+l)/o}return s&&a.reverse(),a}),wp=(n,e,t)=>{let i,s,r=-1;if(t>0){let a=Math.floor(n/t),o=Math.ceil(e/t);for((a+1)*t<n&&++a,(o-1)*t>e&&--o,s=new Array(i=o-a+1);++r<i;)s[r]=(a+r)*t}else{t=-t;let a=Math.floor(n*t),o=Math.ceil(e*t);for((a+1)/t<n&&++a,(o-1)/t>e&&--o,s=new Array(i=o-a+1);++r<i;)s[r]=(a+r)/t}return s},R5=(n,e,t)=>{let i;const s=n[0],r=n[n.length-1],a=e-n.length;if(r<=0){const h=[];for(i=a;i>=1;i--)h.push(s-i*t);return h.concat(n)}if(s>=0){for(i=1;i<=a;i++)n.push(r+i*t);return n}let o=[];const l=[];for(i=1;i<=a;i++)i%2==0?o=[s-Math.floor(i/2)*t].concat(o):l.push(r+Math.ceil(i/2)*t);return o.concat(n).concat(l)},Mp=yh((n,e,t,i)=>{let s,r,a;if(t=+t,(n=+n)==(e=+e)||Math.abs(n-e)<=Number.MIN_VALUE&&t>0)return lk(n,t,i==null?void 0:i.noDecimals);(s=e<n)&&(a=n,n=e,e=a);const o=e0(n,e,t);let l=o.step;if(!isFinite(l))return[];if(l>0){let h=1;const{power:d,gap:u}=o,c=u===10?2*10**d:1*10**d;for(;h<=5&&(r=wp(n,e,l),r.length>t+1)&&t>2;)l+=c,h+=1;t>2&&r.length<t-1&&(r=R5(r,t,l))}else i!=null&&i.noDecimals&&l<0&&(l=1),r=wp(n,e,l);return s&&r.reverse(),r}),XE=n=>{const e=Math.floor(Math.log(n)/Math.LN10),t=n/10**e;let i=Hc[0];return t>=T5?i=Hc[3]:t>=C5?i=Hc[2]:t>=P5&&(i=Hc[1]),e>=0?{step:i*10**e,gap:i,power:e}:{step:-(10**-e)/i,gap:i,power:e}};function e0(n,e,t){const i=(e-n)/Math.max(0,t);return XE(i)}function KE(n,e,t){let i;if(t=+t,(n=+n)==(e=+e)&&t>0)return[n];if(t<=0||(i=O5(n,e,t))===0||!isFinite(i))return[];const s=new Array(t);for(let r=0;r<t;r++)s[r]=n+r*i;return s}function O5(n,e,t){return(e-n)/Math.max(1,t-1)}function B5(n,e,t){let i,s,r=-1;if(t=+t,(s=(e=+e)<(n=+n))&&(i=n,n=e,e=i),!isFinite(t)||e-n<=t)return[n];const a=Math.floor((e-n)/t+1),o=new Array(a);for(;++r<a;)o[r]=n+r*t;return s&&o.reverse(),o}function Qm(n,e=10){let t,i,s=0,r=n.length-1,a=n[s],o=n[r],l=10;for(o<a&&(i=a,a=o,o=i,i=s,s=r,r=i);l-- >0;){if(i=e0(a,o,e).step,i===t)return n[s]=a,n[r]=o,n;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}t=i}}function t0(n,e){const t=oe(e.forceMin),i=oe(e.forceMax);let s=null;const r=[];let a=null;const o=t&&i?l=>l>=e.forceMin&&l<=e.forceMax:t?l=>l>=e.forceMin:i?l=>l<=e.forceMax:null;return t?r[0]=e.forceMin:oe(e.min)&&e.min<=Math.min(n[0],n[n.length-1])&&(r[0]=e.min),i?r[1]=e.forceMax:oe(e.max)&&e.max>=Math.max(n[0],n[n.length-1])&&(r[1]=e.max),oe(r[0])&&oe(r[1])?(a=n.slice(),a[0]=r[0],a[a.length-1]=r[1]):s=oe(r[0])||oe(r[1])?oe(r[0])?"max":"min":"all",{niceType:s,niceDomain:a,niceMinMax:r,domainValidator:o}}const ey=(n,e,t)=>Math.abs(e-n)<1?+t.toFixed(1):Math.round(+t),qE=yh((n,e,t,i,s,r,a)=>{let o=n,l=e;const h=l<o;h&&([o,l]=[l,o]);let d,u,c=s(o),f=s(l),p=[];if(!(i%1)&&f-c<t){if(c=Math.floor(c),f=Math.ceil(f),o>0){for(;c<=f;++c)for(d=1;d<i;++d)if(u=c<0?d/r(-c):d*r(c),!(u<o)){if(u>l)break;p.push(u)}}else for(;c<=f;++c)for(d=i-1;d>=1;--d)if(u=c>0?d/r(-c):d*r(c),!(u<o)){if(u>l)break;p.push(u)}2*p.length<t&&(p=Mp(o,l,t))}else p=Mp(c,f,Math.min(f-c,t)).map(r);return p=p.filter(g=>g!==0),a!=null&&a.noDecimals&&(p=Array.from(new Set(p.map(g=>Math.floor(g))))),h?p.reverse():p}),ZE=yh((n,e,t,i,s,r)=>{const a=[],o={},l=s(n),h=s(e);let d=[];if(Number.isInteger(i))d=Mp(l,h,t);else{const u=(h-l)/(t-1);for(let c=0;c<t;c++)d.push(l+c*u)}return d.forEach(u=>{const c=r(u),f=Number.isInteger(i)?ey(n,e,c):ey(n,e,UE(c)),p=ey(n,e,k5(f,[n,e]));!o[p]&&!isNaN(p)&&d.length>1&&(o[p]=1,a.push(p))}),a}),Tp=yh((n,e,t,i,s)=>KE(i(n),i(e),t).map(r=>UE(s(r))));class qn extends YE{constructor(){super(...arguments),this.type=Rt.Linear}clone(){return new qn().domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(e=10,t){const i=this.calculateVisibleDomain(this._range);return E5(i[0],i[i.length-1],e,t)}ticks(e=10,t){var i;if(P(this._rangeFactorStart)&&P(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&this._range.length===2||!this._niceType)return this.d3Ticks(e,t);const s=(i=this._niceDomain)!==null&&i!==void 0?i:this._domain,r=this._domain,a=s[0],o=s[s.length-1];let l=Mp(r[0],r[r.length-1],e,t);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 h=s.slice();if(this._niceType==="all"?(h[0]=l[0],h[h.length-1]=l[l.length-1],this._niceDomain=h,this.rescale()):this._niceType==="min"&&l[0]!==a?(h[0]=l[0],this._niceDomain=h,this.rescale()):this._niceType==="max"&&l[l.length-1]!==o&&(h[h.length-1]=l[l.length-1],this._niceDomain=h,this.rescale()),this._niceType!=="all"){const d=Math.min(h[0],h[h.length-1]),u=Math.max(h[0],h[h.length-1]);l=l.filter(c=>c>=d&&c<=u)}}return l}forceTicks(e=10){const t=this.calculateVisibleDomain(this._range);return KE(t[0],t[t.length-1],e)}stepTicks(e){const t=this.calculateVisibleDomain(this._range);return B5(t[0],t[t.length-1],e)}nice(e=10,t){var i,s;const r=this._domain;let a=[];if(t){const o=t0(r,t);if(a=o.niceMinMax,this._domainValidator=o.domainValidator,this._niceType=o.niceType,o.niceDomain)return this._niceDomain=o.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const o=Qm(r.slice(),e);this._niceType==="min"?o[o.length-1]=(i=a[1])!==null&&i!==void 0?i:o[o.length-1]:this._niceType==="max"&&(o[0]=(s=a[0])!==null&&s!==void 0?s:o[0]),this._niceDomain=o,this.rescale()}return this}niceMin(e=10){this._niceType="min";const t=this._domain[this._domain.length-1],i=Qm(this.domain(),e);return i&&(i[i.length-1]=t,this._niceDomain=i,this.rescale()),this}niceMax(e=10){this._niceType="max";const t=this._domain[0],i=Qm(this._domain.slice(),e);return i&&(i[0]=t,this._niceDomain=i,this.rescale()),this}}function hk(n){return e=>-n(-e)}function dk(n=Number.EPSILON){return e=>Math.max(e,n)}function L5(n=Number.EPSILON){return e=>Math.min(e,-n)}class i0 extends YE{constructor(){super(nk(10),ik(10)),this.type=Rt.Log,this._limit=dk(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return new i0().domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(e){var t;if(e)return this;super.rescale();const i=nk(this._base),s=ik(this._base);return((t=this._niceDomain)!==null&&t!==void 0?t:this._domain)[0]<0?(this._logs=hk(i),this._pows=hk(s),this._limit=L5(),this.transformer=b5,this.untransformer=v5):(this._logs=i,this._pows=s,this._limit=dk(),this.transformer=this._logs,this.untransformer=s),this}scale(e){var t;if(e=Number(e),Number.isNaN(e)||this._domainValidator&&!this._domainValidator(e))return this._unknown;this._output||(this._output=this._piecewise(((t=this._niceDomain)!==null&&t!==void 0?t:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(e))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(e,t){return arguments.length?(this._base=e,this.rescale(t)):this._base}tickFormat(){return Io}d3Ticks(e=10,t){const i=this.domain(),s=this._limit(i[0]),r=this._limit(i[i.length-1]);return qE(s,r,e,this._base,this.transformer,this.untransformer,t)}ticks(e=10){const t=this.calculateVisibleDomain(this._range);return ZE(this._limit(t[0]),this._limit(t[t.length-1]),e,this._base,this.transformer,this.untransformer)}forceTicks(e=10){const t=this.calculateVisibleDomain(this._range);return Tp(t[0],t[t.length-1],e,this.transformer,this.untransformer)}stepTicks(e){const t=this.calculateVisibleDomain(this._range);return Tp(this._limit(t[0]),this._limit(t[t.length-1]),e,this.transformer,this.untransformer)}nice(e=10,t){var i,s;const r=this._domain;let a=[],o=null;if(t){const l=t0(r,t);if(a=l.niceMinMax,this._domainValidator=l.domainValidator,o=l.niceType,l.niceDomain)return this._niceDomain=l.niceDomain,this.rescale(),this}else o="all";if(o){const l=NE(r.slice(),{floor:h=>this._pows(Math.floor(this._logs(this._limit(h)))),ceil:h=>Math.abs(h)>=1?Math.ceil(h):this._pows(Math.ceil(this._logs(this._limit(h))))});return o==="min"?l[l.length-1]=(i=a[1])!==null&&i!==void 0?i:l[l.length-1]:o==="max"&&(l[0]=(s=a[0])!==null&&s!==void 0?s:l[0]),this._niceDomain=l,this.rescale(),this}return this}niceMin(){const e=this._domain[this._domain.length-1];this.nice();const t=this._domain.slice();return this._domain&&(t[t.length-1]=e,this._niceDomain=t,this.rescale()),this}niceMax(){const e=this._domain[0];this.nice();const t=this._domain.slice();return this._domain&&(t[0]=e,this._niceDomain=t,this.rescale()),this}}class I5 extends bo{constructor(e){super(!1),this.type=Rt.Point,this._padding=0,this.paddingInner(1,e),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class Cp extends qn{constructor(){super(m5,y5),this.type=Rt.Sqrt}clone(){return new Cp().domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class n0 extends qn{constructor(){super(sk(1),rk(1)),this.type=Rt.Symlog,this._const=1}clone(){return new n0().domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(e,t){return arguments.length?(this._const=e,this.transformer=sk(e),this.untransformer=rk(e),this.rescale(t)):this._const}d3Ticks(e=10,t){const i=this.domain(),s=i[0],r=i[i.length-1];return qE(s,r,e,this._const,this.transformer,this.untransformer,t)}ticks(e=10){const t=this.calculateVisibleDomain(this._range);return ZE(t[0],t[t.length-1],e,this._const,this.transformer,this.untransformer)}forceTicks(e=10){const t=this.calculateVisibleDomain(this._range);return Tp(t[0],t[t.length-1],e,this.transformer,this.untransformer)}stepTicks(e){const t=this.calculateVisibleDomain(this._range);return Tp(t[0],t[t.length-1],e,this.transformer,this.untransformer)}nice(e=10,t){var i,s;const r=this._domain;let a=[],o=null;if(t){const l=t0(r,t);if(a=l.niceMinMax,this._domainValidator=l.domainValidator,o=l.niceType,l.niceDomain)return this._niceDomain=l.niceDomain,this.rescale(),this}else o="all";if(o){const l=NE(r.slice(),{floor:h=>Math.floor(h),ceil:h=>Math.ceil(h)});return o==="min"?l[l.length-1]=(i=a[1])!==null&&i!==void 0?i:l[l.length-1]:o==="max"&&(l[0]=(s=a[0])!==null&&s!==void 0?s:l[0]),this._niceDomain=l,this.rescale(),this}return this}niceMin(){const e=this._domain[this._domain.length-1];this.nice();const t=this._domain.slice();return this._domain&&(t[t.length-1]=e,this._niceDomain=t,this.rescale()),this}niceMax(){const e=this._domain[0];this.nice();const t=this._domain.slice();return this._domain&&(t[0]=e,this._niceDomain=t,this.rescale()),this}}class s0{constructor(){this.type=Rt.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(e){return arguments.length?(this._unknown=e,this):this._unknown}scale(e){return!C(e)&&j(+e)?this._range[xC(this._domain,e,0,this.n)]:this._unknown}invertExtent(e){const t=this._range.indexOf(e);return[this._domain[t-1],this._domain[t]]}domain(e){return e?(this._domain=Array.from(e),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(e){return e?(this._range=Array.from(e),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return new s0().domain(this._domain).range(this._range).unknown(this._unknown)}}const uk=5,r0=(n,e,t,i)=>new si(Object.assign({defaultFontParams:Object.assign({fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14},i),getTextBounds:t?void 0:Uu,specialCharSet:`-/: .,@%'"~`+si.ALPHABET_CHAR_SET+si.ALPHABET_CHAR_SET.toUpperCase()},e??{}),n);function a0(n){for(;n<0;)n+=2*Math.PI;for(;n>=2*Math.PI;)n-=2*Math.PI;return n}function JE(n){let e="center",t="middle";return e=(n=a0(n))>=Math.PI*(5/3)||n<=Math.PI*(1/3)?"left":n>=Math.PI*(2/3)&&n<=Math.PI*(4/3)?"right":"center",t=n>=Math.PI*(7/6)&&n<=Math.PI*(11/6)?"bottom":n>=Math.PI*(1/6)&&n<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:t}}const Gs=n=>n.map((e,t)=>({index:t,value:e})),ck=(n,e,t=0)=>{const i=new St(n).expand(t/2),s=new St(e).expand(t/2);return i.intersects(s)};function QE(n,e,t){return t>Math.max(e.x1-n.x2,n.x1-e.x2,e.y1-n.y2,n.y1-e.y2)}function D5(n,e){for(let t,i=1,s=n.length,r=n[0];i<s;r=t,++i)if(t=n[i],QE(r.AABBBounds,t.AABBBounds,e))return!0;return!1}const eR=(n,e,t)=>{var i;const{labelStyle:s,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=t;let h=(i=s.angle)!==null&&i!==void 0?i:0;s.direction==="vertical"&&(h+=st(90));const d=["bottom","top"].includes(r),u=["left","right"].includes(r);let c=1,f=0;d||(u?(c=0,f=1):l&&(c=Math.cos(l),f=-Math.sin(l)));const p=r0(s);return e.map((_,m)=>{var y,b;const v=o?o(_):`${_}`,{width:x,height:S}=p.quickMeasure(v),A=Math.max(x,12),k=Math.max(S,12),w=n.scale(_),M=c*w,T=f*w;let E,O,B=M,R=T;E=a&&d&&m===0?"left":a&&d&&m===e.length-1?"right":(y=s.textAlign)!==null&&y!==void 0?y:"center",E==="right"?B-=A:E==="center"&&(B-=A/2),O=a&&u&&m===0?"top":a&&u&&m===e.length-1?"bottom":(b=s.textBaseline)!==null&&b!==void 0?b:"middle",O==="bottom"?R-=k:O==="middle"&&(R-=k/2);const L=new St().set(B,R,B+A,R+k);return h&&L.rotate(h,M,T),L})},F5=(n,e,t)=>{var i;const{labelStyle:s,getRadius:r,labelOffset:a,labelFormatter:o}=t,l=r==null?void 0:r(),h=(i=s.angle)!==null&&i!==void 0?i:0,d=r0(s);return e.map(u=>{const c=o?o(u):`${u}`,{width:f,height:p}=d.quickMeasure(c),g=Math.max(f,12),_=Math.max(p,12),m=n.scale(u);let y=0,b=0;const v=JE(m),{x,y:S}=as({x:0,y:0},l+a,m);return y=x+(v.align==="right"?-g:v.align==="center"?-g/2:0),b=S+(v.baseline==="bottom"?-_:v.baseline==="middle"?-_/2:0),new St().set(y,b,y+g,b+_).rotate(h,y+g/2,b+_/2)})},z5=n=>["bottom","top","z"].includes(n),j5=(n,e)=>{if(!Ue(n.type))return Gs(n.domain());const t=n.range(),i=Math.abs(t[t.length-1]-t[0]);if(i<2)return Gs([n.domain()[0]]);const{tickCount:s,forceTickCount:r,tickStep:a,noDecimals:o=!1,labelStyle:l}=e;let h;if(P(a))h=n.stepTicks(a);else if(P(r))h=n.forceTicks(r);else if(e.tickMode==="d3"){const d=Y(s)?s({axisLength:i,labelStyle:l}):s;h=n.d3Ticks(d??uk,{noDecimals:o})}else{const d=Y(s)?s({axisLength:i,labelStyle:l}):s;h=n.ticks(d??uk,{noDecimals:o})}if(e.sampling&&(e.coordinateType==="cartesian"||e.coordinateType==="polar"&&e.axisOrientType==="radius")){const{labelGap:d=4,labelFlush:u}=e;let c=eR(n,h,e).map((p,g)=>({AABBBounds:p,value:h[g]}));for(;c.length>=3&&D5(c,d);)c=H5.parity(c);const f=c.map(p=>p.value);f.length<3&&u&&(f.length>1&&f.pop(),ra(f)!==ra(h)&&f.push(ra(h))),h=f}return Gs(h)},H5={parity:function(n){return n.filter((e,t)=>t%2==0)},greedy:function(n,e){let t;return n.filter((i,s)=>(!s||!QE(t.AABBBounds,i.AABBBounds,e))&&(t=i,!0))}},fk=(n,e)=>tR(0,n.length,t=>e(n[t])),tR=(n,e,t)=>{let i=n,s=e;for(;i<s;){const r=Math.floor((i+s)/2);t(r)>=0?s=r:i=r+1}return i},pk=(n,e,t,i)=>eR(n,e,t).map(s=>i?[s.x1,s.x2,s.width()]:[s.y1,s.y2,s.height()]),gk=(n,e,t=0)=>Math.max(n[0],e[0])-t/2<=Math.min(n[1],e[1])+t/2,_k=(n,e)=>n[1]<e[0]?e[0]-n[1]:e[1]<n[0]?n[0]-e[1]:0,G5=(n,e)=>{var t;const i=n.domain();if(!i.length)return[];const{tickCount:s,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,d=z5(l),u=n.range(),c=n.calculateWholeRangeSize();if(c<2)return e.labelLastVisible?Gs([i[i.length-1]]):Gs([i[0]]);let f;if(P(a))f=n.stepTicks(a);else if(P(r))f=n.forceTicks(r);else if(P(s)){const p=Y(s)?s({axisLength:c,labelStyle:h}):s;f=n.ticks(p)}else if(e.sampling){const p=((t=e.labelStyle.fontSize)!==null&&t!==void 0?t:12)+2,g=hi(u),_=Vt(u);if(i.length<=c/p){const m=(_-g)/i.length,y=pk(n,i,e,d),b=Math.min(...y.map(x=>x[2])),v=W5(i,y,o,e.labelLastVisible,Math.floor(b/m));f=n.stepTicks(v.step),e.labelLastVisible&&(v.delCount&&(f=f.slice(0,f.length-v.delCount)),f.push(i[i.length-1]))}else{const m=[i[0],i[Math.floor(i.length/2)],i[i.length-1]],y=pk(n,m,e,d);let b=null;y.forEach(x=>{b?b[2]<x[2]&&(b=x):b=x});const v=_-g-o>0?Math.ceil(i.length*(o+b[2])/(_-g-o)):i.length-1;f=n.stepTicks(v),!e.labelLastVisible||f.length&&f[f.length-1]===i[i.length-1]||(f.length&&Math.abs(n.scale(f[f.length-1])-n.scale(i[i.length-1]))<b[2]&&(f=f.slice(0,-1)),f.push(i[i.length-1]))}}else f=n.domain();return Gs(f)},W5=(n,e,t,i,s,r)=>{let a=0,o=0,l=-1,h=Number.MAX_VALUE;const d=f=>{let p=!0,g=0;do g+f<n.length&&gk(e[g],e[g+f],t)&&(p=!1),g+=f;while(p&&g<n.length);return p},u=tR(s,n.length,f=>d(f)?1:-1);let c=u;do if(c>u&&!d(c))c++;else{if(!i){o=c;break}{const f=n.length-1;let p,g=0;p=n.length%c>0?n.length-n.length%c+c:n.length;do{if(p-=c,p!==f&&!gk(e[p],e[f],t))break;g++}while(p>0);if(p===f){o=c,a=g;break}{const _=Math.floor(n.length/c)-g+1;if(_<l)break;{l=_;const m=_k(e[p],e[f]),y=p-c>=0?_k(e[p-c],e[p]):m,b=Math.abs(m-y);if(b<h&&(h=b,o=c,a=g),m<=y)break}}}c++}while(c<=n.length);return{step:o,delCount:a}},V5=(n,e)=>{const{tickCount:t,forceTickCount:i,tickStep:s,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=r==null?void 0:r();if(!h)return Gs(n.domain());let d;if(P(s))d=n.stepTicks(s);else if(P(i))d=n.forceTicks(i);else if(P(t)){const u=n.range(),c=Math.abs(u[u.length-1]-u[0]),f=Y(t)?t({axisLength:c,labelStyle:l}):t;d=n.ticks(f)}else if(e.sampling){const u=n.domain(),c=n.range(),f=F5(n,u,e),p=hi(c),g=Vt(c),_=Math.abs(g-p)*(h+a)/u.length,{step:m,delCount:y}=N5(u,f,o,Math.floor(f.reduce((b,v)=>Math.min(b,v.width(),v.height()),Number.MAX_VALUE)/_));d=n.stepTicks(m),d=d.slice(0,d.length-y)}else d=n.domain();return Gs(d)},N5=(n,e,t,i)=>{let s=i;do{let a=!0;s++;let o=0;do o+s<n.length&&ck(e[o],e[o+s],t)&&(a=!1),o+=s;while(a&&o<n.length);if(a)break}while(s<=n.length);let r=0;if(n.length>2){let a=n.length-n.length%s;for(a>=n.length&&(a-=s);a>0&&ck(e[0],e[a]);)r++,a-=s}return{step:s,delCount:r}},U5=(n,e)=>{if(Ue(n.type))return j5(n,e);if(wi(n.type)){if(e.coordinateType==="cartesian")return G5(n,e);if(e.coordinateType==="polar"&&e.axisOrientType==="angle")return V5(n,e)}return Gs(n.domain())},cf=(n,e,t)=>{if(C(e))return n;const i=e[0];return C(i)?n:e.length===1?(n[i]=t,n):(C(n[i])&&(typeof e[1]=="number"?n[i]=[]:n[i]={}),cf(n[i],e.slice(1),t))},$5=(n,e,t)=>{if(!C(e))return Te(n,e,t)};function Yr(n){return n.radius?{x:Math.cos(n.angle)*n.radius,y:Math.sin(n.angle)*n.radius}:{x:0,y:0}}function Y5(n){return(n=a0(n))>0&&n<=Math.PI/2?2:n>Math.PI/2&&n<=Math.PI?3:n>Math.PI&&n<=3*Math.PI/2?4:1}function X5(n,e){let t=0,i=2*Math.PI;const s=P(n),r=P(e);for(s||r?r?s?(t=n,i=e):(t=e-2*Math.PI,i=e):(t=n,i=n+2*Math.PI):(t=0,i=2*Math.PI);i<=t;)i+=2*Math.PI;for(;t>2*Math.PI;)t-=2*Math.PI,i-=2*Math.PI;for(;i<0;)t+=2*Math.PI,i+=2*Math.PI;return{startAngle:t,endAngle:i}}function K5(n,e,t){return n.x1>e||n.x2<e||n.y1>t||n.y2<t}function iR(n,e){const t=[];return n.forEach(i=>{const s=+i[e];j(s)&&t.push(s)}),t.length===0?null:hi(t)}function o0(n,e){const t=[];return n.forEach(i=>{const s=+i[e];j(s)&&t.push(s)}),t.length===0?null:Vt(t)}function nR(n,e){return n.reduce((t,i)=>{const s=e?+i[e]:+i;return j(s)&&(t+=s),t},0)}function sR(n,e){let t=0,i=0;return n.forEach(s=>{const r=e?+s[e]:+s;j(r)&&(t+=r,i++)}),t/i}function rR(n,e){const t=sR(n,e);return n.length<=1?0:n.reduce((s,r)=>s+(e?+r[e]:+r-t)**2,0)/(n.length-1)}function q5(n,e){return Math.sqrt(rR(n,e))}function Z5(n,e){return lD(n.map(t=>t[e]))}function J5(n,e,t){const{predict:i}=_5(n,l=>l[e],l=>l[t]),s=iR(n,e),r=o0(n,e),a=i(s),o=i(r);return[{[e]:s,[t]:a},{[e]:r,[t]:o}]}function Q5(n){let e="center",t="middle";return e=(n=a0(n))>=Math.PI*(7/6)&&n<=Math.PI*(11/6)?"right":n>=Math.PI*(1/6)&&n<=Math.PI*(5/6)?"left":"center",t=n>=Math.PI*(5/3)||n<=Math.PI*(1/3)?"bottom":n>=Math.PI*(2/3)&&n<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:t}}function mk(n,e){const t=Pp(n),i=Pp(e),s=Math.asin((n.x*e.y-e.x*n.y)/t/i),r=Math.acos((n.x*e.x+n.y*e.y)/t/i);return s<0?-r:r}function Pp(n,e={x:0,y:0}){return wt.distancePP(n,e)}function xt(n,e,t){let i=!1;if(e&&Y(e)){for(const s of n)for(const r of s.getSeries(t))if(i=!!e.call(null,r),i)return i}return i}function eV(n,e){const t=[];for(const i of n)for(const s of i.getSeries(e))t.push(s);return t}const l0=(n,e)=>{for(let t=0;t<n.length;t++){const i=n[t].getSeries();for(let s=0;s<i.length;s++){const r=i[s];if(e&&r&&r.coordinate===e||!e&&r)return r}}return null};function ff(n){return function(e){let t;return t=W(n)?n.reduce((i,s)=>i==null?void 0:i[s],e):e==null?void 0:e[n],t}}var z;(function(n){n.area="area",n.line="line",n.bar="bar",n.bar3d="bar3d",n.rangeColumn="rangeColumn",n.rangeColumn3d="rangeColumn3d",n.rangeArea="rangeArea",n.dot="dot",n.geo="geo",n.link="link",n.map="map",n.pie="pie",n.pie3d="pie3d",n.radar="radar",n.rose="rose",n.scatter="scatter",n.circularProgress="circularProgress",n.wordCloud="wordCloud",n.wordCloud3d="wordCloud3d",n.funnel="funnel",n.funnel3d="funnel3d",n.linearProgress="linearProgress",n.boxPlot="boxPlot",n.sankey="sankey",n.gaugePointer="gaugePointer",n.gauge="gauge",n.treemap="treemap",n.sunburst="sunburst",n.circlePacking="circlePacking",n.waterfall="waterfall",n.heatmap="heatmap",n.correlation="correlation"})(z||(z={}));var yk;(function(n){n.label="label",n.point="point",n.line="line",n.area="area",n.bar="bar",n.bar3d="bar3d",n.boxPlot="boxPlot",n.outlier="outlier",n.circlePacking="circlePacking",n.group="group",n.gridBackground="gridBackground",n.grid="grid",n.dot="dot",n.title="title",n.subTitle="subTitle",n.symbol="symbol",n.funnel="funnel",n.funnel3d="funnel3d",n.transform="transform",n.transform3d="transform3d",n.transformLabel="transformLabel",n.outerLabel="outerLabel",n.outerLabelLine="outerLabelLine",n.pin="pin",n.pinBackground="pinBackground",n.pointer="pointer",n.segment="segment",n.track="track",n.cell="cell",n.cellBackground="cellBackground",n.link="link",n.arrow="arrow",n.pie="pie",n.pie3d="pie3d",n.labelLine="labelLine",n.progress="progress",n.minLabel="minLabel",n.maxLabel="maxLabel",n.rose="rose",n.node="node",n.sunburst="sunburst",n.nonLeaf="nonLeaf",n.leaf="leaf",n.nonLeafLabel="nonLeafLabel",n.leaderLine="leaderLine",n.stackLabel="stackLabel",n.word="word",n.fillingWord="fillingWord",n.nodePoint="nodePoint",n.ripplePoint="ripplePoint",n.centerPoint="centerPoint",n.centerLabel="centerLabel",n.barBackground="barBackground",n.lineLabel="lineLabel",n.areaLabel="areaLabel"})(yk||(yk={}));const be="__VCHART",Xo=500,Ko=500,tV=`${be}_LABEL_VISIBLE`,ty=`${be}_ARC_TRANSFORM_VALUE`,aR=`${be}_ARC_RATIO`,bk=`${be}_ARC_START_ANGLE`,vk=`${be}_ARC_END_ANGLE`,iV=`${be}_ARC_K`,hr=`${be}_ARC_MIDDLE_ANGLE`,nV=`${be}_ARC_QUADRANT`,sV=`${be}_ARC_RADIAN`,O_=-Math.PI/2,h0=3*Math.PI/2,pd=-90,pf=270,eu=.6,Fr=9,hn=0;var Ls;(function(n){n.enter="enter",n.update="update",n.exit="exit",n.group="group"})(Ls||(Ls={}));var Je;(function(n){n.enter="enter",n.update="update",n.exit="exit",n.unChange="unChange"})(Je||(Je={}));var ne;(function(n){n.arc="arc",n.arc3d="arc3d",n.area="area",n.image="image",n.line="line",n.path="path",n.rect="rect",n.rect3d="rect3d",n.rule="rule",n.shape="shape",n.symbol="symbol",n.text="text",n.richtext="richtext",n.polygon="polygon",n.pyramid3d="pyramid3d",n.circle="circle",n.cell="cell",n.interval="interval",n.group="group",n.glyph="glyph",n.component="component",n.largeRects="largeRects",n.largeSymbols="largeSymbols"})(ne||(ne={}));var ut;(function(n){n.axis="axis",n.grid="grid",n.legend="legend",n.slider="slider",n.label="label",n.datazoom="datazoom",n.player="player",n.title="title",n.scrollbar="scrollbar"})(ut||(ut={}));var xk;(function(n){n[n.player=1]="player",n[n.rollUp=2]="rollUp",n[n.drillDown=3]="drillDown",n[n.slider=4]="slider",n[n.datazoom=5]="datazoom",n[n.legend=6]="legend",n[n.scrollbar=7]="scrollbar",n[n.brush=8]="brush",n[n.normal=9]="normal"})(xk||(xk={}));var Fs;(function(n){n.lineAxis="lineAxis",n.circleAxis="circleAxis"})(Fs||(Fs={}));var ii;(function(n){n.lineAxisGrid="lineAxisGrid",n.circleAxisGrid="circleAxisGrid"})(ii||(ii={}));var Sk;(function(n){n.discreteLegend="discreteLegend",n.colorLegend="colorLegend",n.sizeLegend="sizeLegend"})(Sk||(Sk={}));var Ak;(function(n){n.lineCrosshair="lineCrosshair",n.rectCrosshair="rectCrosshair",n.sectorCrosshair="sectorCrosshair",n.circleCrosshair="circleCrosshair",n.polygonCrosshair="polygonCrosshair",n.ringCrosshair="ringCrosshair"})(Ak||(Ak={}));var kk;(function(n){n.symbolLabel="symbolLabel",n.rectLabel="rectLabel",n.lineLabel="lineLabel",n.dataLabel="dataLabel"})(kk||(kk={}));var wk;(function(n){n.continuousPlayer="continuousPlayer",n.discretePlayer="discretePlayer"})(wk||(wk={}));var Bn;(function(n){n.before="before",n.layouting="layouting",n.reevaluate="reevaluate",n.after="after"})(Bn||(Bn={}));var de;(function(n){n.BEFORE_EVALUATE_DATA="beforeEvaluateData",n.AFTER_EVALUATE_DATA="afterEvaluateData",n.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",n.AFTER_EVALUATE_SCALE="afterEvaluateScale",n.BEFORE_PARSE_VIEW="beforeParseView",n.AFTER_PARSE_VIEW="afterParseView",n.BEFORE_TRANSFORM="beforeTransform",n.AFTER_TRANSFORM="afterTransform",n.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",n.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",n.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",n.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",n.BEFORE_STAGE_RESIZE="beforeStageResize",n.AFTER_STAGE_RESIZE="afterStageResize",n.BEFORE_VRENDER_DRAW="beforeVRenderDraw",n.AFTER_VRENDER_DRAW="afterVRenderDraw",n.BEFORE_MARK_JOIN="beforeMarkJoin",n.AFTER_MARK_JOIN="afterMarkJoin",n.BEFORE_MARK_UPDATE="beforeMarkUpdate",n.AFTER_MARK_UPDATE="afterMarkUpdate",n.BEFORE_MARK_STATE="beforeMarkState",n.AFTER_MARK_STATE="afterMarkState",n.BEFORE_MARK_ENCODE="beforeMarkEncode",n.AFTER_MARK_ENCODE="afterMarkEncode",n.BEFORE_DO_LAYOUT="beforeDoLayout",n.AFTER_DO_LAYOUT="afterDoLayout",n.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",n.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",n.BEFORE_DO_RENDER="beforeDoRender",n.AFTER_DO_RENDER="afterDoRender",n.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",n.AFTER_MARK_RENDER_END="afterMarkRenderEnd",n.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",n.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",n.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",n.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",n.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",n.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",n.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",n.BEFORE_ELEMENT_STATE="beforeElementState",n.AFTER_ELEMENT_STATE="afterElementState",n.BEFORE_ELEMENT_ENCODE="beforeElementEncode",n.AFTER_ELEMENT_ENCODE="afterElementEncode",n.ANIMATION_START="animationStart",n.ANIMATION_END="animationEnd",n.ELEMENT_ANIMATION_START="elementAnimationStart",n.ELEMENT_ANIMATION_END="elementAnimationEnd",n.ALL_ANIMATION_START="allAnimationStart",n.ALL_ANIMATION_END="allAnimationEnd"})(de||(de={}));var sv;(function(n){n.signal="signal",n.data="data",n.scale="scale",n.coordinate="coordinate",n.mark="mark"})(sv||(sv={}));var Mk;(function(n){n.active="active",n.selected="selected",n.highlight="highlight",n.blur="blur"})(Mk||(Mk={}));const ao="__vgrammar_scene_item__",oR=[ne.line,ne.area],rV=[ne.arc3d,ne.rect3d,ne.pyramid3d],zs="key",gf=[{}],aV=["key"],oV=!0,lV=!0,hV=!1,dV=null,uV=!0,Tk="VGRAMMAR_IMMEDIATE_ANIMATION",Ck=0,lR=1e3,rv=0,Pk=0,Ek=!1,av=!1,ov="quintInOut",Rk={stopWhenStateChange:!1,immediatelyApply:!0},cV="VGRAMMAR_ANIMATION_PARAMETERS";function d0(n,e){return N(n).reduce((t,i)=>{const s=ae(i)?e.getGrammarById(i):i;return s&&t.push(s),t},[])}function fV(n){return!Y(n)&&!!(n!=null&&n.signal)}function pV(n){return!Y(n)&&!!(n!=null&&n.callback)}function Di(n,e){if(C(n))return[];if(fV(n)){const t=n.signal;if(ae(t))return N(e.getGrammarById(t));if((t==null?void 0:t.grammarType)==="signal")return[t]}else if(pV(n))return d0(n.dependency,e);return[]}function Xr(n){return Y(n)||(n==null?void 0:n.signal)||!!(n!=null&&n.callback)}function Ot(n,e,t,i){if(C(n))return n;if(Y(n))return i?n.call(null,t,i,e):n.call(null,t,e);if(n.signal){const s=n.signal;return ae(s)?e==null?void 0:e[s]:s.output()}return n.callback?i?n.callback.call(null,t,i,e):n.callback.call(null,t,e):n}function iy(n,e){if(C(n))return n;if(Y(n))return n.call(null,e);if(n.signal){const t=n.signal;return ae(t)?e==null?void 0:e[t]:t.output()}return n.callback?n.callback.call(null,e):n}function tu(n,e){return Yu(n)?n.output():e[n]}function gV(n){return n&&(n.signal||n.callback)}const Yu=n=>n&&!C(n.grammarType),Bl=n=>Y(n)?n:e=>e[n];function B_(n){return!!(n!=null&&n.scale)}function u0(n){return!!(n!=null&&n.field)}function Da(n,e){if(!n)return[];let t=[];return n.scale&&(t=Yu(n.scale)?[n.scale]:N(e.getScaleById(n.scale))),t.concat(Di(n,e))}function Ep(n,e){switch(e){case"line":return n.some(t=>["x","y","defined"].includes(t));case"area":return n.some(t=>["x","y","x1","y1","defined"].includes(t));case"largeRects":return n.some(t=>["x","y","width","y1"].includes(t));case"largeSymbols":return n.some(t=>["x","y"].includes(t))}return!1}function _V(n){const{x:e,y:t,x1:i,y1:s}=n;return j(e)&&j(t)&&j(i)&&j(s)?[{x:e,y:t},{x:i,y:s}]:[]}function mV(n,e,t,i){return!n||!n.length||n.length===1&&e?[]:n.some(s=>Ep(Object.keys(s.nextAttrs),"line"))?n.map((s,r)=>{var a;const o=s.nextAttrs,{x:l,y:h,x1:d,y1:u,defined:c}=(a=t==null?void 0:t[r])!==null&&a!==void 0?a:{};return C(o.x)&&(o.x=l),C(o.y)&&(o.y=h),C(o.defined)&&c===!1&&(o.defined=!1),o.context=s.key,i&&(C(o.x1)&&(o.x1=d),C(o.y1)&&(o.y1=u)),o}):t??[]}function yV(n,e,t=[]){if(!n||!n.length||n.length===1&&e)return[];const i=new Float32Array(4*n.length);return n.forEach((s,r)=>{var a,o,l,h;const d=s.nextAttrs,u=(a=d.x)!==null&&a!==void 0?a:t[4*r],c=(o=d.y)!==null&&o!==void 0?o:t[4*r+1],f=(l=d.width)!==null&&l!==void 0?l:t[4*r+2],p=(h=d.y1)!==null&&h!==void 0?h:t[4*r+3];i[4*r]=u,i[4*r+1]=c,i[4*r+2]=f,i[4*r+3]=p-c}),i}function bV(n,e,t=[]){if(!n||!n.length||n.length===1&&e)return[];const i=new Float32Array(2*n.length);return n.forEach((s,r)=>{var a,o;const l=s.nextAttrs,h=(a=l.x)!==null&&a!==void 0?a:t[2*r],d=(o=l.y)!==null&&o!==void 0?o:t[2*r+1];i[2*r]=h,i[2*r+1]=d}),i}function Rp(n,e){if(["x","y","dx","dy"].includes(e))return!0;switch(n){case ne.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case ne.group:case ne.rect:case ne.image:return["width","height","y1"].includes(e);case ne.path:case ne.shape:return["path","customPath"].includes(e);case ne.line:return e==="defined";case ne.area:return["x1","y1","defined"].includes(e);case ne.rule:return["x1","y1"].includes(e);case ne.symbol:return e==="size";case ne.polygon:return e==="points";case ne.text:return e==="text"}return!1}function vV(n){return[ne.line,ne.area,ne.largeRects,ne.largeSymbols].includes(n)}class xV{constructor(e,t,i,s){this.channelEncoder={},this.marks=e,t&&this.registerChannelEncoder(t),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(e,t){return ae(e)?this.channelEncoder[e]=t:Object.assign(this.channelEncoder,e),this}registerFunctionEncoder(e){return this.functionEncoder=e,this}registerDefaultEncoder(e){return this.defaultEncoder=e,this}registerProgressiveChannels(e){return this.progressiveChannels=N(e),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}let ee=class Lt{static registerPlotMarks(e,t){Lt._plotMarks[e]=t}static createPlotMark(e,t){return Lt._plotMarks[e]?new Lt._plotMarks[e](t):null}static registerMark(e,t){Lt._marks[e]=t}static createMark(e,t,i){return Lt._marks[e]?new Lt._marks[e](t,e,i):null}static hasMark(e){return!!Lt._marks[e]}static registerComponent(e,t){Lt._components[e]=t}static createComponent(e,t,i,s){const r=Lt._components[e];return r?new r(t,i,s):null}static hasComponent(e){return!!Lt._components[e]}static registerGraphicComponent(e,t){Lt._graphicComponents[e]=t}static createGraphicComponent(e,t,i){const s=Lt._graphicComponents[e];return s?s(t,i):null}static registerTransform(e,t,i){Lt._transforms[e]=Object.assign(t,{type:e,isBuiltIn:!!i})}static getTransform(e){return Lt._transforms[e]}static unregisterRuntimeTransforms(){Object.keys(Lt._transforms).forEach(e=>{Lt._transforms[e]&&!Lt._transforms[e].isBuiltIn&&(Lt._transforms[e]=null)})}static registerGrammar(e,t,i){Lt._grammars[e]={grammarClass:t,specKey:i??e}}static createGrammar(e,t,i){var s;const r=(s=Lt._grammars[e])===null||s===void 0?void 0:s.grammarClass;return r?new r(t,i):null}static getGrammars(){return this._grammars}static getGlyph(e){return Lt._glyphs[e]}static createInteraction(e,t,i){const s=Lt._interactions[e];return s?new s(t,i):null}};ee._plotMarks={},ee._marks={},ee._components={},ee._graphicComponents={},ee._transforms={},ee._grammars={},ee._glyphs={},ee._animations={},ee._interactions={},ee._graphics={},ee.registerGlyph=(n,e,t,i,s)=>(ee._glyphs[n]=new xV(e,t,i,s),ee._glyphs[n]),ee.registerAnimationType=(n,e)=>{ee._animations[n]=e},ee.getAnimationType=n=>ee._animations[n],ee.registerInteraction=(n,e)=>{ee._interactions[n]=e},ee.registerGraphic=(n,e)=>{ee._graphics[n]=e},ee.getGraphicType=n=>ee._graphics[n],ee.createGraphic=(n,e)=>{const t=ee._graphics[n];return t?t(e):null};function tr(n,e,t,i,s){t&&(Xr(t)?e.forEach(r=>{const a=Ot(t,i,r.datum,n);Object.assign(r.nextAttrs,a)}):Object.keys(t).forEach(r=>{var a,o;const l=t[r],h=s&&!Rp(n.mark.markType,r)?[e[0]]:e;if(B_(l)){const d=tu(l.scale,i),u=(a=l==null?void 0:l.offset)!==null&&a!==void 0?a:0,c=!C(l.band)&&d.bandwidth?d.bandwidth()*l.band:null,f=ae(l==null?void 0:l.field),p=f?ys(l.field):null;let g=f?null:C(l==null?void 0:l.value)?0:(o=d.scale)===null||o===void 0?void 0:o.call(d,l.value);h.forEach(_=>{var m;f&&(g=(m=d.scale)===null||m===void 0?void 0:m.call(d,p(_.datum))),_.nextAttrs[r]=oe(g)||oe(c)?g+u+c:g})}else if(u0(l)){const d=ys(l.field);h.forEach(u=>{u.nextAttrs[r]=d(u.datum)})}else h.forEach(d=>{d.nextAttrs[r]=Ot(l,i,d.datum,n)})}))}function qa(n,e,t,i){if(!n)return null;if(Xr(n))return Ot(n,i,e,t);const s={};return Object.keys(n).forEach(r=>{var a,o,l;const h=n[r];if(B_(h)){const d=tu(h.scale,i),u=(a=h==null?void 0:h.offset)!==null&&a!==void 0?a:0,c=!C(h.band)&&d.bandwidth?d.bandwidth()*h.band:null,f=ae(h==null?void 0:h.field),p=f?ys(h.field):null,g=f?(o=d.scale)===null||o===void 0?void 0:o.call(d,p(e)):C(h==null?void 0:h.value)?0:(l=d.scale)===null||l===void 0?void 0:l.call(d,h.value);s[r]=oe(g)||oe(c)?g+u+c:g}else if(u0(h)){const d=ys(h.field);s[r]=d(e)}else s[r]=Ot(h,i,e,t)}),s}function SV(n,e,t){if(Xr(e))return{themeEncoder:{},positionEncoder:e};const i={},s={};if(n===ne.glyph&&ee.getGlyph(t)){const r=ee.getGlyph(t),a=r.getProgressiveChannels();if(a)Object.keys(e).forEach(o=>{a.includes(o)?s[o]=e[o]:i[o]=e[o]});else{const o=Array.from(new Set(Object.values(r.getMarks())));Object.keys(e).forEach(l=>{o.some(h=>Rp(h,l))?s[l]=e[l]:i[l]=e[l]})}}else Object.keys(e).forEach(r=>{Rp(n,r)?s[r]=e[r]:i[r]=e[r]});return{positionEncoder:s,themeEncoder:i}}const hR=n=>!!ne[n];function gd(n,e,t={}){var i;const s=ee.getGraphicType(e)?ee.createGraphic(e,t):ee.createGraphicComponent(e,t,{skipDefault:(i=n==null?void 0:n.spec)===null||i===void 0?void 0:i.skipTheme});return s||De.getInstance().error(`create ${e} graphic failed!`),s}function AV(n,e,t={}){if(!ee.getGraphicType(ne.glyph))return;const i=ee.createGraphic(ne.glyph,t),s=e.getMarks(),r=Object.keys(s).map(a=>{if(ee.getGraphicType(s[a])){const o=ee.createGraphic(s[a]);if(o)return o.name=a,o}});return i.setSubGraphic(r),i}const Op=n=>{n&&(n[ao]=null,n.release(),n.parent&&n.parent.removeChild(n))},Ok=["fillOpacity"],Bk=(n,e,t)=>{var i;return e==="fillOpacity"?(n.fillOpacity=(i=t.fillOpacity)!==null&&i!==void 0?i:1,["fillOpacity"]):[]};function kV(n,e,t,i,s,r){const a=s.getGraphicAttribute(n,!1,r);if(a)return e.forEach(l=>{l in i&&(a[l]=i[l])}),a;const o={};return e.forEach(l=>{o[l]=i[l]}),t[n]=o,o}const oo={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(n,e,t)=>{var i,s,r,a,o,l,h,d,u,c,f,p;j(e.width)||!j(e.x1)&&j(t.width)?(n.x=Math.min((i=t.x)!==null&&i!==void 0?i:0,(s=t.x1)!==null&&s!==void 0?s:1/0),n.width=t.width):j(e.x1)||!j(e.width)&&j(t.x1)?(n.x=Math.min(t.x,t.x1),n.width=Math.abs(t.x1-t.x)):(n.x=Math.min((r=t.x)!==null&&r!==void 0?r:0,(a=t.x1)!==null&&a!==void 0?a:1/0),n.width=t.width),j(e.height)||!j(e.y1)&&j(t.height)?(n.y=Math.min((o=t.y)!==null&&o!==void 0?o:0,(l=t.y1)!==null&&l!==void 0?l:1/0),n.height=t.height):j(e.y1)||!j(e.height)&&j(t.y1)?(n.y=Math.min(t.y,t.y1),n.height=Math.abs(t.y1-t.y)):(n.y=Math.min((h=t.y)!==null&&h!==void 0?h:0,(d=t.y1)!==null&&d!==void 0?d:1/0),n.height=t.height),j(e.length)||!j(e.z1)&&j(t.length)?(n.z=Math.min((u=t.z)!==null&&u!==void 0?u:0,(c=t.z1)!==null&&c!==void 0?c:1/0),n.length=t.length):j(e.z1)||!j(e.length)&&j(t.z1)?(n.z=Math.min(t.z,t.z1),n.length=Math.abs(t.z1-t.z)):(n.z=Math.min((f=t.z)!==null&&f!==void 0?f:0,(p=t.z1)!==null&&p!==void 0?p:1/0),n.length=t.length)},storedAttrs:"sizeAttrs"}],[ne.text]:[{channels:["text","limit","autoLimit","maxLineWidth"],transform:(n,e,t)=>{var i,s,r,a;const o=(i=t.limit)!==null&&i!==void 0?i:1/0,l=(s=t.autoLimit)!==null&&s!==void 0?s:1/0,h=Math.min(o,l),d=_s(t.text)&&!C(t.text.text),u=d?t.text.text:t.text;n.maxLineWidth=h===1/0?t.maxLineWidth:h,d?t.text.type==="html"?(n.html={dom:u,width:(r=e.width)!==null&&r!==void 0?r:h,height:(a=e.height)!==null&&a!==void 0?a:e.fontSize,anchorType:"position"},n.text=""):t.text.type==="rich"?n.textConfig=u:n.text=u:n.text=u},storedAttrs:"limitAttrs"}],[ne.rule]:[{channels:["x","y","x1","y1"],transform:(n,e,t)=>{const i=_V(t);n.points=i,n.x=0,n.y=0},storedAttrs:"pointAttrs"}],[ne.symbol]:[{channels:["shape","symbolType"],transform:(n,e,t)=>{var i;n.symbolType=(i=e.shape)!==null&&i!==void 0?i:e.symbolType}},{channels:["image","fill","background"],transform:(n,e,t)=>{e.image?(n.background=e.image,n.fill=!1):t.image?(n.background=t.image,n.fill=!1):(n.fill=t.fill,n.background=t.background)},storedAttrs:"imageAttrs"}],[ne.richtext]:[{channels:["text","textConfig"],transform:(n,e,t)=>{var i,s,r,a;n.text=null,((i=e.text)===null||i===void 0?void 0:i.type)==="rich"?n.textConfig=e.text.text:((s=e.textConfig)===null||s===void 0?void 0:s.type)==="html"?(n.html={dom:e.textConfig.text,width:e.width,height:(r=e.height)!==null&&r!==void 0?r:e.fontSize,anchorType:"position"},n.text=""):((a=e.textConfig)===null||a===void 0?void 0:a.type)==="rich"?n.textConfig=e.textConfig.text:n.textConfig=e.textConfig}}]};function wV(n,e){var t;return((t=oo[n])!==null&&t!==void 0?t:[]).reduce((i,s)=>(s.channels.forEach(r=>{Fn(e,r)&&(i[r]=e[r])}),i),{})}const iu=(n,e,t,i)=>{const s={},r=e?Object.keys(e):[],a=ae(n)?oo[n]:n;if(a&&a.length){const o=[];r.forEach(l=>{let h=!1;a.forEach((d,u)=>{if(d.channels.includes(l)){if(!o[u])if(d.storedAttrs){const c=kV(d.storedAttrs,d.channels,s,e,t,i);d.transform(s,e,c)}else d.transform(s,e,null);o[u]=!0,h=!0}}),h||(Ok.includes(l)?Bk(s,l,e):s[l]=e[l])})}else r.forEach(o=>{Ok.includes(o)?Bk(s,o,e):s[o]=e[o]});return s},MV=(n,e)=>{var t,i;if(n===e)return!0;const s=(t=n&&n.length)!==null&&t!==void 0?t:0;return s===((i=e&&e.length)!==null&&i!==void 0?i:0)&&s!==0&&n.every((r,a)=>!r&&!e[a]||r&&e[a]&&r.color===e[a].color&&r.offset===e[a].offset)},TV=(n,e)=>{if(n===e)return!0;if(typeof n!=typeof e||ae(n)||n.gradient!==e.gradient)return!1;const t=Object.keys(n),i=Object.keys(e);return t.length===i.length&&t.every(s=>s==="stops"?MV(n[s],e[s]):n[s]===e[s])},CV=(n,e)=>n.length===e.length&&n.join("-")===e.join("-"),PV=(n,e,t)=>!(!C(n)||!C(e))||!C(n)&&!C(e)&&(t==="lineDash"?CV(n,e):t==="stroke"||t==="fill"?TV(n,e):n===e),EV=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"],dR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],RV=EV.concat(dR);function OV(n,e,t){var i;if(!n||n.length<=1)return null;const s=((i=t==null?void 0:t.mark)===null||i===void 0?void 0:i.markType)==="area"?RV:dR,r=[];let a=null;return n.forEach((o,l)=>{a&&s.every(h=>PV(a[h],o[h],h))||(r.length&&(r[r.length-1].endIndex=l),a=o,r.push({attrs:a,startIndex:l}))}),r.length>=2?r.map(o=>{const l=iu(ne.line,uR(o.attrs),t);return l.points=e.slice(o.startIndex,C(o.endIndex)?e.length:o.endIndex),l}):null}function BV(n){return n?n.reduce((e,t)=>e.concat(t.points),[]):null}function uR(n){const e={};return n&&Object.keys(n).forEach(t=>{t!=="x"&&t!=="y"&&t!=="x1"&&t!=="y1"&&t!=="defined"&&t!=="size"&&t!=="width"&&t!=="height"&&t!=="context"&&(e[t]=n[t])}),e}let cR=class{constructor(e){this.data=null,this.states=[],this.diffState=Je.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,i)=>{var s,r,a;const o=!C((s=this.runtimeStatesEncoder)===null||s===void 0?void 0:s[t]),l=o?this.runtimeStatesEncoder[t]:(r=this.mark.getSpec().encode)===null||r===void 0?void 0:r[t];if(!l)return{};if(Y(l))return l(this.getDatum(),this,t,i);if(!o&&(!((a=this.graphicItem.states)===null||a===void 0)&&a[t]))return this.graphicItem.states[t];const h=this.items.map(u=>Object.assign({},u,{nextAttrs:{}}));tr(this,h,l,this.mark.parameters());const d=this.transformElementItems(h,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=d):this.graphicItem.states={[t]:d},d},this.mark=e}initGraphicItem(e={}){if(this.graphicItem)return;const t=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(t?iu(t,e,this):e,this.groupKey),this.graphicItem&&(this.graphicItem[ao]=this,t&&(this.graphicItem.onBeforeAttributeUpdate=i=>this.mark?iu(t,i,this):i),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(e),this.setFinalGraphicAttributes(e)))}updateGraphicItem(e){if(!this.graphicItem)return;C(e.clip)||this.graphicItem.setAttribute("clip",e.clip),C(e.interactive)||this.graphicItem.setAttribute("pickable",e.interactive),C(e.zIndex)||this.graphicItem.setAttribute("zIndex",e.zIndex),this.diffState===Je.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const t=this.mark.animate.getAnimationConfigs("state");t.length!==0&&(this.graphicItem.stateAnimateConfig=t[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var e,t;this.graphicItem&&((t=(e=this.graphicItem.animates)===null||e===void 0?void 0:e.forEach)===null||t===void 0||t.call(e,i=>i.stop())),this.graphicItem&&(Op(this.graphicItem),this.graphicItem[ao]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var e;return(e=this.graphicItem)===null||e===void 0?void 0:e.AABBBounds}getStates(){return this.states}updateData(e,t,i){var s;this.mark.emit(de.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:e,data:t,key:i},this),this.data=t;const r=Bl(i);return this.items=t.map(a=>({datum:a,key:r(a),view:this.mark.view,nextAttrs:{}})),this.groupKey=e,this.key=this.mark.isCollectionMark()?e:(s=this.items)===null||s===void 0?void 0:s[0].key,this.mark.emit(de.AFTER_ELEMENT_UPDATE_DATA,{groupKey:e,data:t,key:i},this),this.items}state(e,t){var i;const s=this.mark.isCollectionMark(),r=this.states,a=N(Ot(e,t,this.getDatum(),this)),o=(i=this.mark.getSpec())===null||i===void 0?void 0:i.stateSort;o&&o.sort(o);const l=a.length!==r.length||a.some((h,d)=>h!==r[d]);this.states=a,!s&&l&&this.diffState===Je.unChange&&(this.diffState=Je.update)}encodeGraphic(e){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);e&&(this.mark.isCollectionMark()&&delete e.defined,Object.assign(t,e)),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(t)):this.initGraphicItem(t),this.diffState!==Je.enter&&this.diffState!==Je.update||!this.states.length||this.useStates(this.states),this.mark.markType===ne.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach(i=>{i.nextAttrs={}}),this._setCustomizedShape()}_setCustomizedShape(){var e;if(!this.graphicItem)return;const t=(e=this.mark.getSpec())===null||e===void 0?void 0:e.setCustomizedShape;t&&(this.graphicItem.pathProxy=i=>t(this.data,i,new Xt))}encodeItems(e,t,i=!1,s){const r=this.mark.isCollectionMark(),a=t[Ls.update],o=t[Ls.enter],l=t[Ls.exit],h=this.mark.isLargeMode()||r&&!this.mark.getSpec().enableSegments;this.diffState===Je.enter?(o&&tr(this,e,o,s,h),a&&tr(this,e,a,s,h)):this.diffState===Je.update?((r&&o||i)&&tr(this,e,o,s,h),a&&tr(this,e,a,s,h)):this.diffState===Je.exit&&l&&(i&&tr(this,e,o,s,h),tr(this,e,l,s,h))}coordinateTransformEncode(e){if(!this.mark.coord||this.mark.markType==="arc"||this.mark.disableCoordinateTransform===!0)return;const t=this.mark.coord.output();e.forEach(i=>{const s=i.nextAttrs,r=t.convert(s);Object.assign(s,r)})}clearStates(e){const t=ht(e)?e:this.mark.animate.getAnimationConfigs("state").length!==0;this.states=[],this.graphicItem&&this.graphicItem.clearStates(t),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(e,t){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[e]=t}hasState(e){return this.states&&e&&this.states.includes(e)}addState(e,t){var i;if(!this.graphicItem)return!1;if(t&&ae(e)&&!ft(t,(i=this.runtimeStatesEncoder)===null||i===void 0?void 0:i[e])){const a=this.states.slice();return a.includes(e)?this.graphicItem.clearStates():a.push(e),this._updateRuntimeStates(e,t),this.useStates(a),!0}const s=this.mark.getSpec().encode,r=N(e).reduce((a,o)=>(o&&!a.includes(o)&&(s!=null&&s[o])&&a.push(o),a),this.states.slice());return r.length!==this.states.length&&(this.useStates(r),!0)}removeState(e){if(!this.graphicItem)return!1;const t=N(e);if(!t.length)return!1;const i=this.states.filter(s=>!t.includes(s));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&t.forEach(s=>{this.runtimeStatesEncoder[s]=null}),this.useStates(i),!0)}useStates(e,t){var i;if(!this.graphicItem)return!1;this.mark.emit(de.BEFORE_ELEMENT_STATE,{states:e},this);const s=(i=this.mark.getSpec())===null||i===void 0?void 0:i.stateSort;s&&e.sort(s),this.states=e;const r=ht(t)?t:this.mark.animate.getAnimationConfigs("state").length!==0;return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(de.AFTER_ELEMENT_STATE,{states:e},this),!0}diffAttributes(e){const t={},i=this.getFinalGraphicAttributes();for(const s in e)R_(s,i,e)&&Fn(i,s)||(t[s]=e[s]);return t}transformElementItems(e,t,i){var s,r,a,o;const l=e[0];if(!l.nextAttrs||Object.keys(l.nextAttrs).length===0)return{};let h=l.nextAttrs;if(vV(t)&&e&&e.length&&C((s=l.nextAttrs)===null||s===void 0?void 0:s.points)&&(i===!0||Ep(Object.keys(l.nextAttrs),this.mark.markType))){const d=this.getGraphicAttribute("points",!1),u=this.getGraphicAttribute("segments",!1),c=this.mark.getSpec().enableSegments,f=e.map(g=>g.nextAttrs),p=this.mark.isProgressive();if(h=uR(h),t===ne.line||t===ne.area){const g=mV(e,!0,d,t===ne.area);if(c&&!p){const _=g&&g.length!==0?g:BV(u),m=OV(f,_,this);m?(h.segments=m,h.points=null):(h.segments=null,h.points=_)}else p?h.segments=((o=(a=(r=this.graphicItem)===null||r===void 0?void 0:r.attribute)===null||a===void 0?void 0:a.segments)!==null&&o!==void 0?o:[]).concat([{points:g}]):(h.points=g,h.segments=null)}else t===ne.largeRects?h.points=yV(e,!0,d):t===ne.largeSymbols&&(h.points=bV(e,!0,d))}return h}applyGraphicAttributes(e){var t,i;if(!fe(e))if(this.mark.needAnimate()){const s=this.diffAttributes(e),r=(t=this.getPrevGraphicAttributes())!==null&&t!==void 0?t:{},a=(i=this.getFinalGraphicAttributes())!==null&&i!==void 0?i:{};Object.keys(s).forEach(h=>{r[h]=this.getGraphicAttribute(h),a[h]=s[h]}),this.setNextGraphicAttributes(s),this.setPrevGraphicAttributes(r),this.setFinalGraphicAttributes(a);const o=this.mark.animate.getElementAnimators(this).reduce((h,d)=>Object.assign(h,d.getEndAttributes()),{}),l=Object.assign({},o,a);this.graphicItem.setAttributes(l)}else this.graphicItem.setAttributes(e)}getGraphicAttribute(e,t=!1){var i;if(!this.graphicItem)return;if(t){let a;const o=this.getPrevGraphicAttributes();if(!C(a=Te(o,e)))return a}const s=this.mark.getAttributeTransforms();let r=[e];if(s&&s.length){const a=s.find(o=>o.storedAttrs&&o.channels.includes(e));a&&(r=[a.storedAttrs,e])}return Te((i=this.graphicItem)===null||i===void 0?void 0:i.attribute,r)}setGraphicAttribute(e,t,i=!0){if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),r=this.getPrevGraphicAttributes();i&&s&&(s[e]=t),r&&!Fn(r,e)&&(r[e]=this.graphicItem.attribute[e]),this.graphicItem.setAttribute(e,t)}setGraphicAttributes(e,t=!0){if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(e).forEach(r=>{i&&t&&(i[r]=e[r]),s&&!Fn(s,r)&&(s[r]=this.graphicItem.attribute[r])}),this.graphicItem.setAttributes(e)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(e){this.graphicItem.finalAttrs=e}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(e){this.graphicItem.prevAttrs=e}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(e){this.graphicItem.nextAttrs=e}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null))}clearGraphicAttributes(){this.graphicItem&&(this.graphicItem.prevAttrs&&this.setPrevGraphicAttributes(null),this.graphicItem.nextAttrs&&this.setNextGraphicAttributes(null),this.graphicItem.finalAttrs&&this.setFinalGraphicAttributes(null))}remove(){this.graphicItem&&(Op(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(e){var t,i;if(!((t=this.items)===null||t===void 0)&&t.length)return this.mark.isCollectionMark()?C(e)?this.items.map(s=>s.nextAttrs):this.items.map(s=>{var r;return(r=s.nextAttrs)===null||r===void 0?void 0:r[e]}):C(e)?this.items[0].nextAttrs:(i=this.items[0].nextAttrs)===null||i===void 0?void 0:i[e]}setItemAttributes(e){var t;!((t=this.items)===null||t===void 0)&&t.length&&(this.mark.isCollectionMark()?W(e)&&this.items.forEach((i,s)=>{Object.assign(i.nextAttrs,e[s])}):Object.assign(this.items[0].nextAttrs,e))}getItem(){var e,t;return this.mark.isCollectionMark()?(e=this.items)!==null&&e!==void 0?e:[]:(t=this.items)===null||t===void 0?void 0:t[0]}getDatum(){var e,t;return this.mark.isCollectionMark()?(e=this.data)!==null&&e!==void 0?e:[]:(t=this.data)===null||t===void 0?void 0:t[0]}};const Lk=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class ti extends xh{constructor(e,t){super(e),t!=null&&t.mode&&(this.mode=t.mode,this.setMode(t.mode)),t!=null&&t.skipDefault&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=e,this.onSetStage(()=>{this.render(),this.bindEvents()})}setAttribute(e,t,i){_s(this.attribute[e])&&_s(t)&&!Y(this.attribute[e])&&!Y(t)?re(this.attribute[e],t):this.attribute[e]=t,Lk.includes(e)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(e)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(e,t){const i=Object.keys(e);this._mergeAttributes(e,i),i.every(s=>Lk.includes(s))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!t&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(e,t){C(t)&&(t=Object.keys(e));for(let i=0;i<t.length;i++){const s=t[i];!_s(this.attribute[s])||Y(this.attribute[s])||Y(e[s])?this.attribute[s]=e[s]:re(this.attribute[s],e[s])}}bindEvents(){}_getNodeId(e){return`${this.id}-${this.name}-${e}`}_dispatchEvent(e,t){var i;const s=new Cx(e,t);s.manager=(i=this.stage)===null||i===void 0?void 0:i.eventSystem.manager,this.dispatchEvent(s)}}class LV{constructor(e){this.onPointerDown=t=>{const i=t.target,s=this.rootNode,r=i===s;if(i&&!r){let l=function(d){if(o||(d.type="dragstart",i==null||i.dispatchEvent(d),o=!0),d.type="drag",i==null||i.dispatchEvent(d),!r){i.pickable=!1;const u=(s==null?void 0:s.pick(d.global.x,d.global.y)).graphic;i.pickable=!0,a!==u&&(a&&(d.type="dragleave",d.target=a,a.dispatchEvent(d)),u&&(d.type="dragenter",d.target=u,u.dispatchEvent(d)),a=u,a&&(d.type="dragover",d.target=a,a.dispatchEvent(d)))}},a,o=!1;s==null||s.addEventListener("pointermove",l);const h=function(){o&&(a&&(t.type="drop",t.target=a,a.dispatchEvent(t)),t.type="dragend",i.dispatchEvent(t),o=!1),s==null||s.removeEventListener("pointermove",l)};i.addEventListener("pointerup",h,{once:!0}),i.addEventListener("pointerupoutside",h,{once:!0})}},this.rootNode=e,this.initEvents()}initEvents(){var e;(e=this.rootNode)===null||e===void 0||e.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var e;(e=this.rootNode)===null||e===void 0||e.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const Ik=(n,e)=>{const t=e.x-n.x,i=e.y-n.y;return Math.abs(t)>Math.abs(i)?t>0?"right":"left":i>0?"down":"up"},Gc=(n,e)=>{const t=Math.abs(e.x-n.x),i=Math.abs(e.y-n.y);return Math.sqrt(t*t+i*i)},IV=n=>{const e=n.length;if(e===1)return{x:Math.round(n[0].x),y:Math.round(n[0].y)};let t=0,i=0,s=0;for(;s<e;)t+=n[s].x,i+=n[s].y,s++;return{x:Math.round(t/e),y:Math.round(i/e)}};class DV extends po{constructor(e,t={}){var i,s,r,a,o,l,h,d,u,c;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=f=>{this.reset(),this.startTime=Na.now();const{cachedEvents:p,startPoints:g}=this;f&&p.push(f.clone()),g.length=p.length;for(let _=0;_<p.length;_++){const{x:m,y}=p[_],b={x:m,y};g[_]=b}if(g.length!==1)this.startDistance=Gc(g[0],g[1]),this.center=IV([g[0],g[1]]);else{const _=p[0];this.pressTimeout=setTimeout(()=>{_.direction="none",_.deltaX=0,_.deltaY=0,_.points=g,this.triggerStartEvent("press",_),this.triggerEvent("press",_),this.eventType="press",this.direction="none"},this.config.press.time)}},this.onMove=f=>{this.clearPressTimeout();const{startPoints:p,cachedEvents:g}=this;if(!p.length)return;const _=f.clone(),{x:m,y,pointerId:b}=_;for(let w=0,M=g.length;w<M;w++)if(b===g[w].pointerId){g[w]=_;break}const v={x:m,y},x=g.map(w=>({x:w.x,y:w.y})),S=Na.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=S,this.lastMovePoint=v,p.length===1){const w=p[0],M=m-w.x,T=y-w.y,E=this.direction||Ik(w,v);this.direction=E;const O=this.getEventType(v);return _.direction=E,_.deltaX=M,_.deltaY=T,_.points=x,this.triggerStartEvent(O,_),void this.triggerEvent(O,_)}const{startDistance:A}=this,k=Gc(x[0],x[1]);_.scale=k/A,_.center=this.center,_.points=x,this.triggerStartEvent("pinch",_),this.triggerEvent("pinch",_)},this.onEnd=f=>{const p=f.clone(),{cachedEvents:g,startPoints:_}=this,m=g.map(y=>({x:y.x,y:y.y}));if(p.points=m,this.triggerEndEvent(p),g.length===1){const y=Na.now(),b=this.lastMoveTime;if(y-b<100){const v=b-(this.prevMoveTime||this.startTime);if(v>0){const x=this.prevMovePoint||_[0],S=this.lastMovePoint||_[0],A=Gc(x,S),k=A/v;k>this.config.swipe.velocity&&A>this.config.swipe.threshold&&(p.velocity=k,p.direction=Ik(x,S),this.triggerEvent("swipe",p))}}y-this.lastTapTime<this.config.tap.interval&&f.target===this.lastTapTarget?this.tapCount++:this.tapCount=1,this.lastTapTime=y,this.lastTapTarget=f.target,this.tapCount===1?this.triggerEvent("tap",p):this.tapCount===2&&(this.triggerEvent("doubletap",p),this.tapCount=0)}for(let y=0,b=g.length;y<b;y++)if(g[y].pointerId===p.pointerId){g.splice(y,1),_.splice(y,1);break}this.reset(),g.length>0&&this.onStart()},this.element=e,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:(s=(i=t==null?void 0:t.press)===null||i===void 0?void 0:i.time)!==null&&s!==void 0?s:251,threshold:(a=(r=t==null?void 0:t.press)===null||r===void 0?void 0:r.threshold)!==null&&a!==void 0?a:9},swipe:{threshold:(l=(o=t==null?void 0:t.swipe)===null||o===void 0?void 0:o.threshold)!==null&&l!==void 0?l:10,velocity:(d=(h=t==null?void 0:t.swipe)===null||h===void 0?void 0:h.velocity)!==null&&d!==void 0?d:.3},tap:{interval:(c=(u=t==null?void 0:t.tap)===null||u===void 0?void 0:u.interval)!==null&&c!==void 0?c:300}},this.initEvents()}initEvents(){const{element:e}=this;e&&(e.addEventListener("pointerdown",this.onStart),e.addEventListener("pointermove",this.onMove),e.addEventListener("pointerup",this.onEnd),e.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:e}=this;e&&(e.removeEventListener("pointerdown",this.onStart),e.removeEventListener("pointermove",this.onMove),e.removeEventListener("pointerup",this.onEnd),e.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(e){const{eventType:t,startTime:i,startPoints:s}=this;if(t)return t;let r;return r=Na.now()-i>this.config.press.time&&Gc(s[0],e)<this.config.press.threshold?"press":"pan",this.eventType=r,r}enable(e){this.processEvent[e]=!0}isProcess(e){return this.processEvent[e]}pushEvent(e,t){const{emitThrottles:i}=this,s={type:e,ev:t};for(let r=0,a=i.length;r<a;r++)if(i[r].type===e)return void i.splice(r,1,s);i.push(s)}clearPressTimeout(){this.pressTimeout&&(clearTimeout(this.pressTimeout),this.pressTimeout=null)}reset(){this.clearPressTimeout(),this.startTime=0,this.startDistance=0,this.direction=null,this.eventType=null,this.prevMoveTime=0,this.prevMovePoint=null,this.lastMoveTime=0,this.lastMovePoint=null}triggerEvent(e,t){this.pushEvent(e,t);const{throttleTimer:i,emitThrottles:s}=this;i||(this.throttleTimer=Q.global.getRequestAnimationFrame()(()=>{for(let r=0,a=s.length;r<a;r++){const{type:o,ev:l}=s[r];this.emitEvent(o,l)}this.throttleTimer=0,this.emitThrottles.length=0}))}triggerStartEvent(e,t){this.isProcess(e)||(this.enable(e),this.triggerEvent(`${e}start`,t))}triggerEndEvent(e){const t=this.processEvent;Object.keys(t).forEach(i=>{this.triggerEvent(`${i}end`,e),i==="press"&&this.triggerEvent(`${i}up`,e),delete t[i]})}emitEvent(e,t){const i=this.element._events[YP];if(i)if("fn"in i)i.fn.call(i.context,t,e);else for(let s=0,r=i.length;s<r&&!t.propagationImmediatelyStopped;s++)i[s].fn.call(i[s].context,t,e);this.emit(e,t)}}var FV=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},zV=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};const Ie=[0,0,0],jV=new Ft(1,0,0,1,0,0),HV=(n,e,t,i,s,r,a,o)=>{if(o)for(;t>e;)t-=Be;else for(;t<e;)t+=Be;const l=et/3*(t>e?1:-1);let h=e,d=h;for(;d!==t;){d=l>0?Math.min(d+l,t):Math.max(d+l,t);const u=Math.abs(d-h),c=4*Math.tan(u/4)/3,f=d<h?-1:1,p=Math.cos(h),g=Math.sin(h),_=Math.cos(d),m=Math.sin(d),y=p*r+i,b=g*a+s,v=_*r+i,x=m*a+s,S=r*c*f,A=a*c*f;n.push([y-S*g,b+A*p,v+S*m,x-A*_,v,x]),h=d}};let Ll=class{set fillStyle(n){this.nativeContext.fillStyle=n}get fillStyle(){return this.nativeContext.fillStyle}set font(n){this.nativeContext.font=n}get font(){return this.nativeContext.font}set globalAlpha(n){this.nativeContext.globalAlpha=n}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(n){this.nativeContext.lineCap=n}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(n){this.nativeContext.lineDashOffset=n}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(n){this.nativeContext.lineJoin=n}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(n){this.nativeContext.lineWidth=n}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(n){this.nativeContext.miterLimit=n}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(n){this.nativeContext.shadowBlur=n}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(n){this.nativeContext.shadowColor=n}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(n){this.nativeContext.shadowOffsetX=n}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(n){this.nativeContext.shadowOffsetY=n}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(n){this.nativeContext.strokeStyle=n}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(n){this.nativeContext.textAlign=n}get textAlign(){return this.nativeContext.textAlign}set textBaseline(n){this.nativeContext.textBaseline=n}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(n){n!==!!this._inuse&&(this._inuse=n,n?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(n,e){this.fillAttributes=Object.assign(Object.assign({},zP),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},jP),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},fr),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const t=n.nativeCanvas.getContext("2d");if(!t)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=t,this.canvas=n,this.matrix=new Ft(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ft(1,0,0,1,0,0)}reset(){this.stack.length&&De.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ft(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(n=!1){!n&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(n){return Vn.allocateByObj(n)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(Vn.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(Vn.free(this.matrix),this.matrix=this.stack.pop())}rotate(n,e=!0){this.matrix.rotate(n),e&&this.setTransformForCurrent()}save(){const n=this.cloneMatrix(this.matrix);this.stack.push(n),this.nativeContext.save()}highPerformanceSave(){const n=this.cloneMatrix(this.matrix);this.stack.push(n)}scale(n,e,t=!0){this.matrix.scale(n,e),t&&this.setTransformForCurrent()}setScale(n,e,t=!0){this.matrix.setScale(n,e),t&&this.setTransformForCurrent()}scalePoint(n,e,t,i,s=!0){this.translate(t,i,!1),this.scale(n,e,!1),this.translate(-t,-i,!1),s&&this.setTransformForCurrent()}setTransform(n,e,t,i,s,r,a=!0,o=this.dpr){this.matrix.setValue(o*n,o*e,o*t,o*i,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(n,e=!0,t=this.dpr){this.matrix.setValue(n.a*t,n.b*t,n.c*t,n.d*t,n.e*t,n.f*t),e&&this.setTransformForCurrent()}resetTransform(n=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),n&&this.setTransformForCurrent()}transform(n,e,t,i,s,r,a=!0){this.matrix.multiply(n,e,t,i,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(n,e){this.matrix.multiply(n.a,n.b,n.c,n.d,n.e,n.f),e&&this.setTransformForCurrent()}translate(n,e,t=!0){this.matrix.translate(n,e),t&&this.setTransformForCurrent()}rotateDegrees(n,e=!0){const t=n*Math.PI/180;this.rotate(t,e)}rotateAbout(n,e,t,i=!0){this.translate(e,t,!1),this.rotate(n,!1),this.translate(-e,-t,!1),i&&this.setTransformForCurrent()}rotateDegreesAbout(n,e,t,i=!0){this.translate(e,t,!1),this.rotateDegrees(n,!1),this.translate(-e,-t,!1),i&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(n,e){n?typeof n=="string"?this.nativeContext.clip(n):this.nativeContext.clip(n,e):this.nativeContext.clip()}arc(n,e,t,i,s,r,a){if(a=a||0,this.camera){const o=[];HV(o,i,s,n,e,t,t,r);for(let l=0;l<o.length;++l){const h=o[l];this.bezierCurveTo(h[0],h[1],h[2],h[3],h[4],h[5],a)}}else this.nativeContext.arc(n,e,t,i,s,r)}arcTo(n,e,t,i,s){this.nativeContext.arcTo(n,e,t,i,s)}bezierCurveTo(n,e,t,i,s,r,a){if(a=a||0,this.camera){let o=a,l=a;this.modelMatrix&&(fn(Ie,[n,e,a],this.modelMatrix),n=Ie[0],e=Ie[1],o=Ie[2],fn(Ie,[t,i,a],this.modelMatrix),t=Ie[0],i=Ie[1],l=Ie[2],fn(Ie,[s,r,a],this.modelMatrix),s=Ie[0],r=Ie[1],a=Ie[2]);let h=this.camera.vp(s,r,a);s=h.x,r=h.y,h=this.camera.vp(n,e,o),n=h.x,e=h.y,h=this.camera.vp(t,i,l),t=h.x,i=h.y}this.nativeContext.bezierCurveTo(n,e,t,i,s,r)}closePath(){this.nativeContext.closePath()}ellipse(n,e,t,i,s,r,a,o){o==null?this.nativeContext.ellipse(n,e,t,i,s,r,a):this.nativeContext.ellipse(n,e,t,i,s,r,a,o)}lineTo(n,e,t){if(t=t||0,this.camera){this.modelMatrix&&(fn(Ie,[n,e,t],this.modelMatrix),n=Ie[0],e=Ie[1],t=Ie[2]);const i=this.camera.vp(n,e,t);n=i.x,e=i.y}this.nativeContext.lineTo(n,e)}moveTo(n,e,t){if(t=t||0,this.camera){this.modelMatrix&&(fn(Ie,[n,e,t],this.modelMatrix),n=Ie[0],e=Ie[1],t=Ie[2]);const i=this.camera.vp(n,e,t);n=i.x,e=i.y}this.nativeContext.moveTo(n,e)}quadraticCurveTo(n,e,t,i,s){if(s=s||0,this.camera){let r=s;this.modelMatrix&&(fn(Ie,[n,e,s],this.modelMatrix),n=Ie[0],e=Ie[1],r=Ie[2],fn(Ie,[t,i,s],this.modelMatrix),t=Ie[0],i=Ie[1],s=Ie[2]);let a=this.camera.vp(t,i,s);t=a.x,i=a.y,a=this.camera.vp(n,e,r),n=a.x,e=a.y}this.nativeContext.quadraticCurveTo(n,e,t,i)}rect(n,e,t,i,s){s=s||0,this.camera?(this.moveTo(n,e,s),this.lineTo(n+t,e,s),this.lineTo(n+t,e+i,s),this.lineTo(n,e+i,s),this.closePath()):this.nativeContext.rect(n,e,t,i)}createImageData(){const n=arguments;return n.length===2?this.nativeContext.createImageData(n[0],n[1]):n.length===1?this.nativeContext.createImageData(n[0]):null}createLinearGradient(n,e,t,i){return this.nativeContext.createLinearGradient(n,e,t,i)}createPattern(n,e){return n.width===0||n.height===0?null:this.nativeContext.createPattern(n,e)}createRadialGradient(n,e,t,i,s,r){return this.nativeContext.createRadialGradient(n,e,t,i,s,r)}createConicGradient(n,e,t,i){let s,r=!1;const a=this;return{stops:[],addColorStop(o,l){this.stops.push([o,l]),r=!0},GetPattern(o,l,h){return r&&(h||(h=i-t),s=Iz(a,this.stops,n,e,h,t,i,o,l),r=!1),s}}}fill(n,e){this.disableFill||(n?this.nativeContext.fill(n):this.nativeContext.fill())}fillRect(n,e,t,i){this.nativeContext.fillRect(n,e,t,i)}clearRect(n,e,t,i){this.nativeContext.clearRect(n,e,t,i)}project(n,e,t){if(t=t||0,this.camera){this.modelMatrix&&(fn(Ie,[n,e,t],this.modelMatrix),n=Ie[0],e=Ie[1],t=Ie[2]);const i=this.camera.vp(n,e,t);n=i.x,e=i.y}return{x:n,y:e}}view(n,e,t){return t=t||0,this.camera?(this.modelMatrix&&(fn(Ie,[n,e,t],this.modelMatrix),n=Ie[0],e=Ie[1],t=Ie[2]),this.camera.view(n,e,t)):[n,e,t]}fillText(n,e,t,i){if(i=i||0,this.camera){this.modelMatrix&&(fn(Ie,[e,t,i],this.modelMatrix),e=Ie[0],t=Ie[1],i=Ie[2]);const s=this.camera.vp(e,t,i);e=s.x,t=s.y}this.nativeContext.fillText(n,e,t)}getImageData(n,e,t,i){return this.nativeContext.getImageData(n,e,t,i)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(n,e){return this.nativeContext.isPointInPath(n,e)}isPointInStroke(n,e){return this.nativeContext.isPointInStroke(n,e)}measureText(n,e=Q.global.measureTextMethod){var t,i;if(!e||e==="native")return this.nativeContext.measureText(n);this.mathTextMeasure||(this.mathTextMeasure=Q.graphicUtil.createTextMeasureInstance({},{},()=>this.canvas.nativeCanvas));const s=(t=this.fontFamily)!==null&&t!==void 0?t:fr.fontFamily,r=(i=this.fontSize)!==null&&i!==void 0?i:fr.fontSize;return this.mathTextMeasure.textSpec.fontFamily===s&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=s,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(n,e)}putImageData(n,e,t){this.nativeContext.putImageData(n,e,t)}setLineDash(n){const e=arguments,t=this.nativeContext;this.nativeContext.setLineDash?t.setLineDash(e[0]):"mozDash"in t?t.mozDash=e[0]:"webkitLineDash"in t&&(t.webkitLineDash=e[0])}stroke(n){this.disableStroke||(n?this.nativeContext.stroke(n):this.nativeContext.stroke())}strokeRect(n,e,t,i){this.nativeContext.strokeRect(n,e,t,i)}strokeText(n,e,t,i){if(i=i||0,this.camera){this.modelMatrix&&(fn(Ie,[e,t,i],this.modelMatrix),e=Ie[0],t=Ie[1],i=Ie[2]);const s=this.camera.vp(e,t,i);e=s.x,t=s.y}this.nativeContext.strokeText(n,e,t)}drawImage(){const n=this.nativeContext,e=arguments;e.length===3?n.drawImage(e[0],e[1],e[2]):e.length===5?n.drawImage(e[0],e[1],e[2],e[3],e[4]):e.length===9&&n.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(n,e,t,i,s){if(Array.isArray(s)){if(s.length<=1)return this._setCommonStyle(n,e,t,i,s[0]);const r=Object.create(s[0]);return s.forEach((a,o)=>{o!==0&&Object.assign(r,a)}),this._setCommonStyle(n,e,t,i,r)}return this._setCommonStyle(n,e,t,i,s)}_setCommonStyle(n,e,t,i,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=Lb(this,l,n,t,i)):r.globalAlpha=a*o}setShadowBlendStyle(n,e,t){if(Array.isArray(t)){if(t.length<=1)return this._setShadowBlendStyle(n,t[0]);const i=Object.create(t[0]);return t.forEach((s,r)=>{r!==0&&Object.assign(i,s)}),this._setShadowBlendStyle(n,e,i)}return this._setShadowBlendStyle(n,e,t)}_setShadowBlendStyle(n,e,t){const i=this.nativeContext;t||(t=this.fillAttributes);const{opacity:s=t.opacity,shadowBlur:r=t.shadowBlur,shadowColor:a=t.shadowColor,shadowOffsetX:o=t.shadowOffsetX,shadowOffsetY:l=t.shadowOffsetY,blur:h=t.blur,globalCompositeOperation:d=t.globalCompositeOperation}=e;s<=1e-12||(r||o||l?(i.shadowBlur=r*this.dpr,i.shadowColor=a,i.shadowOffsetX=o*this.dpr,i.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0),h?(i.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(i.filter="blur(0px)",this._clearFilterStyle=!1),d?(i.globalCompositeOperation=d,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(i.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(n,e,t,i,s){if(Array.isArray(s)){if(s.length<=1)return this._setStrokeStyle(n,e,t,i,s[0]);const r=Object.create(s[0]);return s.forEach((a,o)=>{o!==0&&Object.assign(r,a)}),this._setStrokeStyle(n,e,t,i,r)}return this._setStrokeStyle(n,e,t,i,s)}_setStrokeStyle(n,e,t,i,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:d=s.lineJoin,lineDash:u=s.lineDash,lineCap:c=s.lineCap,miterLimit:f=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=Mi(this,l,this.dpr),r.strokeStyle=Lb(this,h,n,t,i),r.lineJoin=d,r.setLineDash(u),r.lineCap=c,r.miterLimit=f}}setTextStyleWithoutAlignBaseline(n,e,t){const i=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=n;n.font?i.font=n.font:i.font=Cb(n,e,s&&this.camera&&this.camera.getProjectionScale(t));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=n;this.fontFamily=r,this.fontSize=a,i.textAlign="left",i.textBaseline="alphabetic"}setTextStyle(n,e,t){var i,s;const r=this.nativeContext;e||(e=this.textAttributes),n.font?r.font=n.font:r.font=Cb(n,e,this.camera&&this.camera.getProjectionScale(t));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=n;this.fontFamily=a,this.fontSize=o,r.textAlign=(i=n.textAlign)!==null&&i!==void 0?i:e.textAlign,r.textBaseline=(s=n.textBaseline)!==null&&s!==void 0?s:e.textBaseline}draw(){}clearMatrix(n=!0,e=this.dpr){this.setTransformFromMatrix(jV,n,e)}onlyTranslate(n=this.dpr){return this.matrix.a===n&&this.matrix.b===0&&this.matrix.c===0&&this.matrix.d===n}release(...n){this.stack.forEach(e=>Vn.free(e)),this.stack.length=0}};Ll.env="browser",Ll=FV([ue(),zV("design:paramtypes",[Object,Number])],Ll);var GV=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},WV=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};let Il=class extends fd{constructor(n){super(n)}init(n){const{container:e}=n;if(typeof e=="string"){const t=Q.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Ll(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:n}=this;n.width=this._pixelWidth,n.height=this._pixelHeight,!n.style||this.setCanvasStyle(n,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(n),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const n=this._nativeCanvas;n.style.position="absolute",n.style.top=`${this._y}px`,n.style.left=`${this._x}px`}resetStyle(n){if(!this.controled)return;const{width:e=this._displayWidth,height:t=this._displayHeight,dpr:i=this._dpr,x:s=this._x,y:r=this._y}=n,{nativeCanvas:a}=this;a.width=e*i,a.height=t*i,!a.style||this.setCanvasStyle(a,s,r,e,t),n.id&&(a.id=n.id),this.visiable||this.hide()}setCanvasStyle(n,e,t,i,s){this.controled&&(n.style.width=`${i}px`,n.style.height=`${s}px`)}toDataURL(n,e){return n==="image/jpeg"?this._nativeCanvas.toDataURL(n,e):n==="image/png"?this._nativeCanvas.toDataURL(n):this._nativeCanvas.toDataURL(n,e)}resize(n,e){this.controled&&(this._pixelWidth=n*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=n,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${n}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};Il.env="browser",Il=GV([ue(),WV("design:paramtypes",[Object])],Il);function fR(n,e){return new Me(t=>{t(VP).toDynamicValue(()=>i=>new n(i)).whenTargetNamed(n.env),t(y3).toDynamicValue(()=>(i,s)=>new e(i,s)).whenTargetNamed(e.env)})}const VV=fR(Il,Ll),Ar=Symbol.for("MathPickerContribution"),Dk=Symbol.for("MathArcPicker"),Fk=Symbol.for("MathAreaPicker"),zk=Symbol.for("MathCirclePicker"),Bp=Symbol.for("MathImagePicker"),jk=Symbol.for("MathLinePicker"),Hk=Symbol.for("MathPathPicker"),Gk=Symbol.for("MathRectPicker"),Wk=Symbol.for("MathSymbolPicker"),Vk=Symbol.for("MathTextPicker"),Nk=Symbol.for("MathPolygonPicker"),Uk=Symbol.for("MathGlyphPicker"),$k=Symbol.for("CanvasArcPicker"),Yk=Symbol.for("CanvasArc3dPicker"),Xk=Symbol.for("CanvasAreaPicker"),Kk=Symbol.for("CanvasCirclePicker"),qk=Symbol.for("CanvasImagePicker"),Zk=Symbol.for("CanvasLinePicker"),Jk=Symbol.for("CanvasPathPicker"),Qk=Symbol.for("CanvasRectPicker"),ew=Symbol.for("CanvasRect3dPicker"),tw=Symbol.for("CanvasSymbolPicker"),iw=Symbol.for("CanvasTextPicker"),nw=Symbol.for("CanvasPolygonPicker"),sw=Symbol.for("CanvasPyramid3dPicker"),rw=Symbol.for("CanvasRichTextPicker"),aw=Symbol.for("CanvasGlyphPicker"),ow=Symbol.for("CanvasGroupPicker"),yi=Symbol.for("CanvasPickerContribution");var NV=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},UV=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Fh=function(n,e){return function(t,i){e(t,i,n)}};let qo=class extends Xb{constructor(n,e,t){super(t),this.contributions=n,this.drawContribution=e,this.pickItemInterceptorContributions=t,this.global.hooks.onSetEnv.tap("canvas-picker-service",(i,s,r)=>{this.configure(r,s)}),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach(n=>{this.pickerMap.set(n.numberType,n)}),super._init()}configure(n,e){this.pickCanvas=Zl.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(n,e,t,i){if(n.attribute.pickable===!1)return null;if(this.InterceptorContributions.length)for(let o=0;o<this.InterceptorContributions.length;o++){const l=this.InterceptorContributions[o];if(l.beforePickItem){const h=l.beforePickItem(n,this,e,i,{parentMatrix:t});if(h)return h}}const s=this.pickerMap.get(n.numberType);if(!s)return null;const r=s.contains(n,e,i)?n:null,a={graphic:r};if(r)return a;if(this.InterceptorContributions.length)for(let o=0;o<this.InterceptorContributions.length;o++){const l=this.InterceptorContributions[o];if(l.afterPickItem){const h=l.afterPickItem(n,this,e,i,{parentMatrix:t});if(h)return h}}return a}};qo=NV([ue(),Fh(0,Ee(Kt)),Fh(0,di(yi)),Fh(1,Ee(Kx)),Fh(2,Ee(Kt)),Fh(2,di(Uo)),UV("design:paramtypes",[Object,Object,Object])],qo);var $V=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};let lv=class{constructor(){this.type="group",this.numberType=Bx}contains(n,e,t){return!1}};lv=$V([ue()],lv);const Lp=new Me((n,e,t,i)=>{Lp.__vloaded||(Lp.__vloaded=!0,n(ow).to(lv).inSingletonScope(),n(yi).toService(ow),ki(n,yi))});Lp.__vloaded=!1;const YV=new Me((n,e,t,i)=>{t(qo)||n(qo).toSelf().inSingletonScope(),t(Ol)?i(Ol).toService(qo):n(Ol).toService(qo)});function XV(n){n.load(Lp),n.load(YV)}var id,KV=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},qV=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};let Hr=id=class extends kp{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${id.idprefix}_${id.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Q.global}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(n){n.canvas?this.createWindowByCanvas(n):this.createWindowByConfig(n),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch{console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(n){const e=n.getBoundingClientRect(),t=window.innerWidth||document.documentElement.clientWidth,i=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>t||e.top>i)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const n=new IntersectionObserver((e,t)=>{e.forEach(i=>{this._canvasIsIntersecting!==i.isIntersecting?(this._canvasIsIntersecting=i.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(i.isIntersecting)):this._canvasIsIntersecting=i.isIntersecting})});n&&n.observe(this.canvas.nativeCanvas)}createWindowByConfig(n){const e=this.global.createCanvas({width:n.width,height:n.height});let t;if(t=typeof n.container=="string"?this.global.getElementById(n.container):n.container?n.container:this.global.getRootElement(),!t)throw new Error("发生错误,containerId可能传入有误");n.offscreen?t=null:t.appendChild(e);const i={width:n.width,height:n.height,dpr:n.dpr,nativeCanvas:e,container:t,id:id.GenerateCanvasId(),canvasControled:!0};this.canvas=new Il(i)}createWindowByCanvas(n){var e;let t;if(typeof n.canvas=="string"){if(t=this.global.getElementById(n.canvas),!t)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else t=n.canvas;if(!t)throw new Error("发生错误,传入的canvas不正确");let i=n.width,s=n.height;if(i==null||s==null||!n.canvasControled){const a=t.getBoundingClientRect();i=a.width,s=a.height}let r=n.dpr;r==null&&(r=(e=t.getContext("2d").pixelRatio)!==null&&e!==void 0?e:t.width/i),this.canvas=new Il({width:i,height:s,dpr:r,nativeCanvas:t,canvasControled:n.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(n,e){this.canvas.resize(n,e)}setDpr(n){this.canvas.dpr=n}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(n,e,t){return this.canvas.nativeCanvas.addEventListener(n,e,t)}removeEventListener(n,e,t){return this.canvas.nativeCanvas.removeEventListener(n,e,t)}dispatchEvent(n){return this.canvas.nativeCanvas.dispatchEvent(n)}getStyle(){return this.canvas.nativeCanvas.style}setStyle(n){this.canvas.nativeCanvas.style=n}getBoundingClientRect(){const n=this.canvas.nativeCanvas,e=this.getWH();return n.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(n,e){const t=this.getContext(),i=this.getDpr();t.nativeContext.save(),t.nativeContext.setTransform(i,0,0,i,0,0),t.clearRect(n.x1,n.y1,n.x2-n.x1,n.y2-n.y1),e&&(t.fillStyle=e,t.fillRect(n.x1,n.y1,n.x2-n.x1,n.y2-n.y1)),t.nativeContext.restore()}isVisible(n){return this._canvasIsIntersecting}onVisibleChange(n){this._onVisibleChangeCb=n}getTopLeft(n){return this.global.getElementTopLeft(this.canvas.nativeCanvas,n)}};Hr.env="browser",Hr.idprefix="visactor_window",Hr.prefix_count=0,Hr=id=KV([ue(),qV("design:paramtypes",[])],Hr);const ZV=new Me(n=>{n(Hr).toSelf(),n(Tx).toDynamicValue(e=>e.container.get(Hr)).whenTargetNamed(Hr.env)});var JV=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},QV=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};class eN{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(e){this.dom=e}}function lw(n,e=!1){const t=document.createElement("img");if(t.crossOrigin="anonymous",e){const i=new Blob([n],{type:"image/svg+xml"});n=window.URL.createObjectURL(i)}return t.src=n,t.complete?Promise.resolve(t):new Promise((i,s)=>{t.onload=()=>{i(t)},t.onerror=()=>{s(new Error("加载失败"))}})}let Ip=class extends Ap{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch{this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(n,e){var t;if(e){const{clientX:i,clientY:s}=n,r=e.getBoundingClientRect(),a=(t=e.getNativeHandler)===null||t===void 0?void 0:t.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(i-r.left)/(j(o)?o:1),y:(s-r.top)/(j(l)?l:1)}}return{x:n.offsetX,y:n.offsetY}}getNativeAABBBounds(n){let e=n;if(typeof n=="string"&&(e=new DOMParser().parseFromString(n,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new eN(t)}return new St}removeDom(n){return n.parentElement.removeChild(n),!0}createDom(n){const{tagName:e="div",width:t,height:i,style:s,parent:r}=n,a=document.createElement(e);if(s&&(ae(s)?a.setAttribute("style",s):Object.keys(s).forEach(o=>{a.setAttribute(o,s[o])})),t!=null&&(a.style.width=`${t}px`),i!=null&&(a.style.height=`${i}px`),r){const o=ae(r)?this.getElementById(r):r;o&&o.appendChild&&o.appendChild(a)}return a}loadImage(n){return lw(n,!1).then(e=>({data:e,loadState:"success"})).catch(()=>({data:null,loadState:"fail"}))}loadSvg(n){return lw(n,!0).then(e=>({data:e,loadState:"success"})).catch(()=>({data:null,loadState:"fail"}))}createCanvas(n){var e,t;const i=document.createElement("canvas");n.id&&(i.id=(e=n.id)!==null&&e!==void 0?e:Nt.GenAutoIncrementId().toString());const s=(t=n.dpr)!==null&&t!==void 0?t:window.devicePixelRatio;return n.width&&n.height&&(i.style.width=`${n.width}px`,i.style.height=`${n.height}px`,i.width=n.width*s,i.height=n.height*s),i}createOffscreenCanvas(n){var e;const t=(e=n.dpr)!==null&&e!==void 0?e:window.devicePixelRatio;return new OffscreenCanvas(n.width*t,n.height*t)}releaseCanvas(n){let e;e=typeof n=="string"?document.getElementById(n):n,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(n,e,t){return document.addEventListener(n,e,t)}removeEventListener(n,e,t){return document.removeEventListener(n,e,t)}dispatchEvent(n){return document.dispatchEvent(n)}getElementById(n){return document.getElementById(n)}getRootElement(){return document.body}getDocument(){return document}release(...n){}getElementTop(n,e){let t=n.offsetTop,i=n.offsetParent;for(;i!==null;)t+=i.offsetTop,i=i.offsetParent;return t}getElementLeft(n,e){let t=n.offsetLeft,i=n.offsetParent;for(;i!==null;)t+=i.offsetLeft,i=i.offsetParent;return t}getElementTopLeft(n,e){let t=n.offsetTop,i=n.offsetLeft,s=n.offsetParent;for(;s!==null;)t+=s.offsetTop,i+=s.offsetLeft,s=s.offsetParent;return{top:t,left:i}}};Ip=JV([ue(),QV("design:paramtypes",[])],Ip);const Dp=new Me(n=>{Dp.isBrowserBound||(Dp.isBrowserBound=!0,n(Ip).toSelf().inSingletonScope(),n(p_).toService(Ip))});Dp.isBrowserBound=!1;function Fp(n,e=!0){Fp.__loaded||(Fp.__loaded=!0,n.load(Dp),n.load(VV),n.load(ZV),e&&XV(n))}Fp.__loaded=!1;var tN=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},iN=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};let _d=class extends Ll{constructor(n,e){super(n,e);const t=n.nativeCanvas.getContext("2d");if(!t)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=t,this.canvas=n,this.matrix=new Ft(1,0,0,1,0,0),this.stack=[],this.dpr=e??1}release(...n){}};_d.env="node",_d=tN([ue(),iN("design:paramtypes",[Object,Number])],_d);var nN=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},sN=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};let Dl=class extends fd{constructor(n){super(n)}init(){this._context=new _d(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...n){this._nativeCanvas.release&&Y(this._nativeCanvas.release)&&this._nativeCanvas.release()}};Dl.env="node",Dl=nN([ue(),sN("design:paramtypes",[Object])],Dl);const rN=fR(Dl,_d);var aN=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},oN=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},lN=function(n,e){return function(t,i){e(t,i,n)}};let Fl=class extends kp{get container(){return null}constructor(n){super(),this.global=n,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(n){n.canvas?this.createWindowByCanvas(n):this.createWindowByConfig(n)}createWindowByConfig(n){const e=this.global.createCanvas({width:n.width,height:n.height}),t={width:n.width,height:n.height,dpr:n.dpr,nativeCanvas:e,id:Nt.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new Dl(t)}createWindowByCanvas(n){const e=n.canvas;let t=n.width,i=n.height;t!=null&&i!=null&&n.canvasControled||(t=e.width,i=e.height),this.canvas=new Dl({width:t,height:i,dpr:1,nativeCanvas:e,canvasControled:n.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(n,e){this.canvas.resize(n,e)}setDpr(n){this.canvas.dpr=n}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(n="image/png"){return this.canvas.nativeCanvas.toBuffer(n)}addEventListener(n,e,t){}dispatchEvent(n){return!0}removeEventListener(n,e,t){}getStyle(){}setStyle(n){}getBoundingClientRect(){return null}clearViewBox(n,e){}};Fl.env="node",Fl=aN([ue(),lN(0,Ee(kx)),oN("design:paramtypes",[Object])],Fl);const hN=new Me(n=>{n(Fl).toSelf(),n(Tx).toDynamicValue(e=>e.container.get(Fl)).whenTargetNamed(Fl.env)});var dN=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};let zp=class extends Ap{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(n,e){n.env===this.type&&(n.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(n){const e=fetch(n).then(t=>t.json());return e.then(t=>({data:t,state:"success"})).catch(()=>({data:null,state:"fail"})),e}loadArrayBuffer(n){return fetch(n).then(e=>e.arrayBuffer()).then(e=>({data:e,loadState:"success"})).catch(()=>({data:null,loadState:"fail"}))}loadImage(n){const{loadImage:e}=this.pkg;return e?e(n).then(t=>({loadState:t?"success":"fail",data:t})).catch(()=>({loadState:"fail",data:null})):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(n){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const t=new e(n).render().asPng();return this.loadImage(t)}createCanvas(n){return this.pkg.createCanvas(n.width,n.height)}releaseCanvas(n){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(n){return SA.call(n)}}getCancelAnimationFrame(){return n=>{SA.clear(n)}}addEventListener(n,e,t){}removeEventListener(n,e,t){}getElementById(n){return null}getRootElement(){return null}dispatchEvent(n){}release(...n){}createOffscreenCanvas(n){}};zp=dN([ue()],zp);const jp=new Me(n=>{jp.isNodeBound||(jp.isNodeBound=!0,n(zp).toSelf().inSingletonScope(),n(p_).toService(zp))});jp.isNodeBound=!1;function Hp(n,e=!0){Hp.__loaded||(Hp.__loaded=!0,n.load(jp),n.load(rN),n.load(hN))}Hp.__loaded=!1;var uN=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},cN=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},fN=function(n,e){return function(t,i){e(t,i,n)}};let hv=class{constructor(n){this.canvasRenderer=n,this.type="arc",this.numberType=m_}contains(n,e,t){if(!n.AABBBounds.containsPoint(e))return!1;if(n.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=t??{};if(!i)return!1;const s=se(n).arc;i.highPerformanceSave();let{x:r=s.x,y:a=s.y}=n.attribute;if(n.transMatrix.onlyTranslate()){const l=n.getOffsetXY(s);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(n.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(n,i,r,a,{},null,(l,h,d)=>!!o||(o=l.isPointInPath(e.x,e.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=Mi(i,u+c,i.dpr),o=l.isPointInStroke(e.x,e.y),o}),i.highPerformanceRestore(),o}};hv=uN([ue(),fN(0,Ee(ip)),cN("design:paramtypes",[Object])],hv);let hw=!1;const pN=new Me((n,e,t,i)=>{hw||(hw=!0,n($k).to(hv).inSingletonScope(),n(yi).toService($k))});var gN=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},_N=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},mN=function(n,e){return function(t,i){e(t,i,n)}};let dv=class{constructor(n){this.canvasRenderer=n,this.type="arc",this.numberType=m_}contains(n,e,t){if(!n.AABBBounds.containsPoint(e))return!1;if(n.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=t??{};if(!i)return!1;const s=se(n).arc;i.highPerformanceSave();let{x:r=s.x,y:a=s.y}=n.attribute;if(n.transMatrix.onlyTranslate()){const l=n.getOffsetXY(s);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(n.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(n,i,r,a,{},null,(l,h,d)=>!!o||(o=l.isPointInPath(e.x,e.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=u+c,o=l.isPointInStroke(e.x,e.y),o}),i.highPerformanceRestore(),o}};dv=gN([ue(),mN(0,Ee(ip)),_N("design:paramtypes",[Object])],dv);let dw=!1;const yN=new Me((n,e,t,i)=>{dw||(dw=!0,n(Dk).to(dv).inSingletonScope(),n(Ar).toService(Dk))});var bN=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},vN=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},xN=function(n,e){return function(t,i){e(t,i,n)}};const ny=new St;let uv=class{constructor(n){this.canvasRenderer=n,this.type="rect",this.numberType=A_}contains(n,e,t){if(!n.AABBBounds.containsPoint(e))return!1;if(n.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=t??{};if(!i)return!1;const s=se(n).rect,{cornerRadius:r=s.cornerRadius}=n.attribute;let{x:a=s.x,y:o=s.y}=n.attribute;i.highPerformanceSave();let l=!0;if(n.transMatrix.onlyTranslate()){const d=n.getOffsetXY(s);a+=d.x,o+=d.y,i.setTransformForCurrent()}else a=0,o=0,l=!1,i.transformFromMatrix(n.transMatrix,!0);let h=!0;if(!l||n.shadowRoot||oe(r,!0)&&r!==0||W(r)&&r.some(d=>d!==0))h=!1,this.canvasRenderer.drawShape(n,i,a,o,{},null,(d,u,c)=>!!h||(h=d.isPointInPath(e.x,e.y),h),(d,u,c)=>{if(h)return!0;const f=u.lineWidth||c.lineWidth,p=u.pickStrokeBuffer||c.pickStrokeBuffer;return i.lineWidth=Mi(i,f+p,i.dpr),h=d.isPointInStroke(e.x,e.y),h});else{const{fill:d=s.fill,stroke:u=s.stroke,lineWidth:c=s.lineWidth}=n.attribute;if(d)h=!0;else if(u){const f=n.AABBBounds;ny.setValue(f.x1,f.y1,f.x2,f.y2),ny.expand(-c/2),h=!ny.containsPoint(e)}}return i.highPerformanceRestore(),h}};uv=bN([ue(),xN(0,Ee(lp)),vN("design:paramtypes",[Object])],uv);let uw=!1;const SN=new Me((n,e,t,i)=>{uw||(uw=!0,n(Qk).to(uv).inSingletonScope(),n(yi).toService(Qk))});var AN=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},kN=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},wN=function(n,e){return function(t,i){e(t,i,n)}};const sy=new St;let cv=class{constructor(n){this.canvasRenderer=n,this.type="rect",this.numberType=A_}contains(n,e,t){if(!n.AABBBounds.containsPoint(e))return!1;if(n.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=t??{};if(!i)return!1;const s=se(n).rect,{cornerRadius:r=s.cornerRadius}=n.attribute;let{x:a=s.x,y:o=s.y}=n.attribute;i.highPerformanceSave();let l=!0;if(n.transMatrix.onlyTranslate()){const d=n.getOffsetXY(s);a+=d.x,o+=d.y,i.setTransformForCurrent()}else a=0,o=0,l=!1,i.transformFromMatrix(n.transMatrix,!0);let h=!0;if(!l||oe(r,!0)&&r!==0||W(r)&&r.some(d=>d!==0))h=!1,this.canvasRenderer.drawShape(n,i,a,o,{},null,(d,u,c)=>!!h||(h=d.isPointInPath(e.x,e.y),h),(d,u,c)=>{if(h)return!0;const f=u.lineWidth||c.lineWidth,p=u.pickStrokeBuffer||c.pickStrokeBuffer;return i.lineWidth=f+p,h=d.isPointInStroke(e.x,e.y),h});else if(h){const{fill:d=s.fill,stroke:u=s.stroke,lineWidth:c=s.lineWidth}=n.attribute;if(d)h=!0;else if(u){const f=n.AABBBounds;sy.setValue(f.x1,f.y1,f.x2,f.y2),sy.expand(-c/2),h=!sy.containsPoint(e)}}return i.highPerformanceRestore(),h}};cv=AN([ue(),wN(0,Ee(lp)),kN("design:paramtypes",[Object])],cv);let cw=!1;const MN=new Me((n,e,t,i)=>{cw||(cw=!0,n(Gk).to(cv).inSingletonScope(),n(Ar).toService(Gk))});var TN=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};let yr=class extends sn{};yr=TN([ue()],yr);var CN=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},PN=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},EN=function(n,e){return function(t,i){e(t,i,n)}};let fv=class extends yr{constructor(n){super(),this.canvasRenderer=n,this.type="line",this.numberType=Vu}contains(n,e,t){if(!n.AABBBounds.containsPoint(e))return!1;if(n.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=t??{};if(!i)return!1;i.highPerformanceSave();const s=se(n).line,r=this.transform(n,s,i),{x:a,y:o,z:l,lastModelMatrix:h}=r;let d=e;if(i.camera){d=e.clone();const c=n.parent.globalTransMatrix;d.x=c.a*e.x+c.c*e.y+c.e,d.y=c.b*e.x+c.d*e.y+c.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(n,i,a,o,{},null,c=>!!u||(u=c.isPointInPath(d.x,d.y),u),(c,f,p)=>{if(u)return!0;const g=f.lineWidth||p.lineWidth,_=f.pickStrokeBuffer||p.pickStrokeBuffer;return i.lineWidth=Mi(i,g+_,i.dpr),u=c.isPointInStroke(d.x,d.y),u}),this.canvasRenderer.z=0,i.modelMatrix!==h&&lt.free(i.modelMatrix),i.modelMatrix=h,i.highPerformanceRestore(),u}};fv=CN([ue(),EN(0,Ee(rp)),PN("design:paramtypes",[Object])],fv);let fw=!1;const RN=new Me((n,e,t,i)=>{fw||(fw=!0,n(Zk).to(fv).inSingletonScope(),n(yi).toService(Zk))});var ON=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},BN=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},LN=function(n,e){return function(t,i){e(t,i,n)}};let pv=class{constructor(n){this.canvasRenderer=n,this.type="line",this.numberType=Vu}contains(n,e,t){if(!n.AABBBounds.containsPoint(e))return!1;if(n.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=t??{};if(!i)return!1;const s=se(n).line;let{x:r=s.x,y:a=s.y}=n.attribute;if(i.highPerformanceSave(),n.transMatrix.onlyTranslate()){const l=n.getOffsetXY(s);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(n.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(n,i,r,a,{},null,l=>!!o||(o=l.isPointInPath(e.x,e.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=u+c,o=l.isPointInStroke(e.x,e.y),o}),i.highPerformanceRestore(),o}};pv=ON([ue(),LN(0,Ee(rp)),BN("design:paramtypes",[Object])],pv);let pw=!1;const IN=new Me((n,e,t,i)=>{pw||(pw=!0,n(jk).to(pv).inSingletonScope(),n(Ar).toService(jk))});var DN=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},FN=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},zN=function(n,e){return function(t,i){e(t,i,n)}};let gv=class{constructor(n){this.canvasRenderer=n,this.type="area",this.numberType=Wu}contains(n,e,t){if(!n.AABBBounds.containsPoint(e))return!1;if(n.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=t??{};if(!i)return!1;const s=se(n).area;let{x:r=s.x,y:a=s.y}=n.attribute;const{fillPickable:o=s.fillPickable,strokePickable:l=s.strokePickable}=n.attribute;if(i.highPerformanceSave(),n.transMatrix.onlyTranslate()){const d=n.getOffsetXY(s);r+=d.x,a+=d.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(n.transMatrix,!0);let h=!1;return this.canvasRenderer.drawShape(n,i,r,a,{},null,d=>!!h||!!o&&(h=d.isPointInPath(e.x,e.y),h),(d,u,c)=>{if(h)return!0;if(!l)return!1;const f=u.lineWidth||c.lineWidth,p=u.pickStrokeBuffer||c.pickStrokeBuffer;return i.lineWidth=Mi(i,f+p,i.dpr),h=d.isPointInStroke(e.x,e.y),h}),i.highPerformanceRestore(),h}};gv=DN([ue(),zN(0,Ee(np)),FN("design:paramtypes",[Object])],gv);let gw=!1;const jN=new Me((n,e,t,i)=>{gw||(gw=!0,n(Xk).to(gv).inSingletonScope(),n(yi).toService(Xk))});var HN=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},GN=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},WN=function(n,e){return function(t,i){e(t,i,n)}};let _v=class{constructor(n){this.canvasRenderer=n,this.type="area",this.numberType=Wu}contains(n,e,t){if(!n.AABBBounds.containsPoint(e))return!1;if(n.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=t??{};if(!i)return!1;const s=se(n).area;let{x:r=s.x,y:a=s.y}=n.attribute;if(i.highPerformanceSave(),n.transMatrix.onlyTranslate()){const l=n.getOffsetXY(s);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(n.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(n,i,r,a,{},null,l=>!!o||(o=l.isPointInPath(e.x,e.y),o)),i.highPerformanceRestore(),o}};_v=HN([ue(),WN(0,Ee(np)),GN("design:paramtypes",[Object])],_v);let _w=!1;const VN=new Me((n,e,t,i)=>{_w||(_w=!0,n(Fk).to(_v).inSingletonScope(),n(Ar).toService(Fk))});var NN=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},UN=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},$N=function(n,e){return function(t,i){e(t,i,n)}};let mv=class extends yr{constructor(n){super(),this.canvasRenderer=n,this.type="symbol",this.numberType=k_}contains(n,e,t){const{pickContext:i}=t??{};if(!i)return!1;const s=n.getParsedPath();if(!i.camera){if(!n.AABBBounds.containsPoint(e))return!1;if(s.isSvg||n.attribute.pickMode==="imprecise")return!0}i.highPerformanceSave();const r=se(n).symbol,a=this.transform(n,r,i),{x:o,y:l,z:h,lastModelMatrix:d}=a;let u=e;if(i.camera){u=e.clone();const f=n.parent.globalTransMatrix;u.x=f.a*e.x+f.c*e.y+f.e,u.y=f.b*e.x+f.d*e.y+f.f}this.canvasRenderer.z=h;let c=!1;return this.canvasRenderer.drawShape(n,i,o,l,{},null,(f,p,g)=>!!c||(c=f.isPointInPath(u.x,u.y),c),(f,p,g)=>{if(c)return!0;const _=p.lineWidth||g.lineWidth,m=p.pickStrokeBuffer||g.pickStrokeBuffer;return i.lineWidth=Mi(i,_+m,i.dpr),c=f.isPointInStroke(u.x,u.y),c}),this.canvasRenderer.z=0,i.modelMatrix!==d&&lt.free(i.modelMatrix),i.modelMatrix=d,i.highPerformanceRestore(),c}};mv=NN([ue(),$N(0,Ee(hp)),UN("design:paramtypes",[Object])],mv);let mw=!1;const YN=new Me((n,e,t,i)=>{mw||(mw=!0,n(tw).to(mv).inSingletonScope(),n(yi).toService(tw))});var XN=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},KN=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},qN=function(n,e){return function(t,i){e(t,i,n)}};let yv=class{constructor(n){this.canvasRenderer=n,this.type="symbol",this.numberType=k_}contains(n,e,t){if(!n.AABBBounds.containsPoint(e))return!1;if(n.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=t??{};if(!i)return!1;const s=se(n).symbol;let{x:r=s.x,y:a=s.y}=n.attribute;if(i.highPerformanceSave(),n.transMatrix.onlyTranslate()){const l=n.getOffsetXY(s);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(n.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(n,i,r,a,{},null,(l,h,d)=>!!o||(o=l.isPointInPath(e.x,e.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=u+c,o=l.isPointInStroke(e.x,e.y),o}),i.highPerformanceRestore(),o}};yv=XN([ue(),qN(0,Ee(hp)),KN("design:paramtypes",[Object])],yv);let yw=!1;const ZN=new Me((n,e,t,i)=>{yw||(yw=!0,n(Wk).to(yv).inSingletonScope(),n(Ar).toService(Wk))});var JN=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},QN=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},eU=function(n,e){return function(t,i){e(t,i,n)}};let bv=class{constructor(n){this.canvasRenderer=n,this.type="circle",this.numberType=y_}contains(n,e,t){if(!n.AABBBounds.containsPoint(e))return!1;if(n.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=t??{};if(!i)return!1;const s=se(n).circle;let{x:r=s.x,y:a=s.y}=n.attribute;if(i.highPerformanceSave(),n.transMatrix.onlyTranslate()){const l=n.getOffsetXY(s);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(n.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(n,i,r,a,{},null,(l,h,d)=>!!o||(o=l.isPointInPath(e.x,e.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=Mi(i,u+c,i.dpr),o=l.isPointInStroke(e.x,e.y),o}),i.highPerformanceRestore(),o}};bv=JN([ue(),eU(0,Ee(sp)),QN("design:paramtypes",[Object])],bv);let bw=!1;const tU=new Me((n,e,t,i)=>{bw||(bw=!0,n(Kk).to(bv).inSingletonScope(),n(yi).toService(Kk))});var iU=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},nU=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},sU=function(n,e){return function(t,i){e(t,i,n)}};let vv=class{constructor(n){this.canvasRenderer=n,this.type="circle",this.numberType=y_}contains(n,e,t){if(!n.AABBBounds.containsPoint(e))return!1;if(n.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=t??{};if(!i)return!1;const s=se(n).circle;let{x:r=s.x,y:a=s.y}=n.attribute;if(i.highPerformanceSave(),n.transMatrix.onlyTranslate()){const l=n.getOffsetXY(s);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(n.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(n,i,r,a,{},null,(l,h,d)=>!!o||(o=l.isPointInPath(e.x,e.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=u+c,o=l.isPointInStroke(e.x,e.y),o}),i.highPerformanceRestore(),o}};vv=iU([ue(),sU(0,Ee(sp)),nU("design:paramtypes",[Object])],vv);let vw=!1;const rU=new Me((n,e,t,i)=>{vw||(vw=!0,n(zk).to(vv).inSingletonScope(),n(Ar).toService(zk))});var aU=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},oU=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},lU=function(n,e){return function(t,i){e(t,i,n)}};let xv=class extends yr{constructor(n){super(),this.canvasRenderer=n,this.type="text",this.numberType=w_}contains(n,e,t){const{pickContext:i}=t??{};if(!i)return!1;const s=n.AABBBounds;if(!i.camera)return!!s.containsPoint(e);i.highPerformanceSave();const r=se(n).text,{keepDirIn3d:a=r.keepDirIn3d}=n.attribute,o=!a,l=this.transform(n,r,i,o),{x:h,y:d,z:u,lastModelMatrix:c}=l;this.canvasRenderer.z=u;let f=e;if(i.camera){f=e.clone();const g=n.parent.globalTransMatrix;f.x=g.a*e.x+g.c*e.y+g.e,f.y=g.b*e.x+g.d*e.y+g.f}let p=!1;return this.canvasRenderer.drawShape(n,i,h,d,{},null,(g,_,m)=>{if(p)return!0;const{fontSize:y=r.fontSize,textBaseline:b=r.textBaseline,textAlign:v=r.textAlign}=n.attribute,x=n.AABBBounds,S=x.height(),A=x.width(),k=nr(b,S,y),w=ir(v,A);return g.rect(w+h,k+d,A,S,u),p=g.isPointInPath(f.x,f.y),p},(g,_,m)=>p),this.canvasRenderer.z=0,i.modelMatrix!==c&&lt.free(i.modelMatrix),i.modelMatrix=c,i.highPerformanceRestore(),p}};xv=aU([ue(),lU(0,Ee(Gb)),oU("design:paramtypes",[Object])],xv);let xw=!1;const hU=new Me((n,e,t,i)=>{xw||(xw=!0,n(iw).to(xv).inSingletonScope(),n(yi).toService(iw))});var dU=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};let Sv=class{constructor(){this.type="text",this.numberType=w_}contains(n,e,t){return!!n.AABBBounds.containsPoint(e)}};Sv=dU([ue()],Sv);let Sw=!1;const uU=new Me((n,e,t,i)=>{Sw||(Sw=!0,n(Vk).to(Sv).inSingletonScope(),n(Ar).toService(Vk))});var cU=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},fU=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},pU=function(n,e){return function(t,i){e(t,i,n)}};let Av=class extends yr{constructor(n){super(),this.canvasRenderer=n,this.type="path",this.numberType=x_}contains(n,e,t){if(!n.AABBBounds.containsPoint(e))return!1;if(n.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=t??{};if(!i)return!1;const s=se(n).path;i.highPerformanceSave();const r=this.transform(n,s,i),{x:a,y:o,z:l,lastModelMatrix:h}=r;let d=e;if(i.camera){d=e.clone();const c=n.parent.globalTransMatrix;d.x=c.a*e.x+c.c*e.y+c.e,d.y=c.b*e.x+c.d*e.y+c.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(n,i,a,o,{},null,(c,f,p)=>!!u||(u=c.isPointInPath(d.x,d.y),u),(c,f,p)=>{if(u)return!0;const g=f.lineWidth||p.lineWidth,_=f.pickStrokeBuffer||p.pickStrokeBuffer;return i.lineWidth=Mi(i,g+_,i.dpr),u=c.isPointInStroke(d.x,d.y),u}),this.canvasRenderer.z=0,i.modelMatrix!==h&&lt.free(i.modelMatrix),i.modelMatrix=h,i.highPerformanceRestore(),u}};Av=cU([ue(),pU(0,Ee(ap)),fU("design:paramtypes",[Object])],Av);let Aw=!1;const gU=new Me((n,e,t,i)=>{Aw||(Aw=!0,n(Jk).to(Av).inSingletonScope(),n(yi).toService(Jk))});var _U=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},mU=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},yU=function(n,e){return function(t,i){e(t,i,n)}};let kv=class{constructor(n){this.canvasRenderer=n,this.type="path",this.numberType=x_}contains(n,e,t){if(!n.AABBBounds.containsPoint(e))return!1;if(n.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=t??{};if(!i)return!1;const s=se(n).path;let{x:r=s.x,y:a=s.y}=n.attribute;if(i.highPerformanceSave(),n.transMatrix.onlyTranslate()){const l=n.getOffsetXY(s);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(n.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(n,i,r,a,{},null,(l,h,d)=>!!o||(o=l.isPointInPath(e.x,e.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=u+c,o=l.isPointInStroke(e.x,e.y),o}),i.highPerformanceRestore(),o}};kv=_U([ue(),yU(0,Ee(ap)),mU("design:paramtypes",[Object])],kv);let kw=!1;const bU=new Me((n,e,t,i)=>{kw||(kw=!0,n(Hk).to(kv).inSingletonScope(),n(Ar).toService(Hk))});var vU=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},xU=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},SU=function(n,e){return function(t,i){e(t,i,n)}};let wv=class{constructor(n){this.canvasRenderer=n,this.type="polygon",this.numberType=S_}contains(n,e,t){if(!n.AABBBounds.contains(e.x,e.y))return!1;if(n.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=t??{};if(!i)return!1;const s=se(n).polygon;let{x:r=s.x,y:a=s.y}=n.attribute;if(i.highPerformanceSave(),n.transMatrix.onlyTranslate()){const l=n.getOffsetXY(s);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(n.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(n,i,r,a,{},null,(l,h,d)=>!!o||(o=l.isPointInPath(e.x,e.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=Mi(i,u+c,i.dpr),o=l.isPointInStroke(e.x,e.y),o}),i.highPerformanceRestore(),o}};wv=vU([ue(),SU(0,Ee(op)),xU("design:paramtypes",[Object])],wv);let ww=!1;const AU=new Me((n,e,t,i)=>{ww||(ww=!0,n(nw).to(wv).inSingletonScope(),n(yi).toService(nw))});var kU=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},wU=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},MU=function(n,e){return function(t,i){e(t,i,n)}};let Mv=class{constructor(n){this.canvasRenderer=n,this.type="polygon",this.numberType=S_}contains(n,e,t){if(!n.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:i}=t??{};if(!i)return!1;const s=se(n).polygon;let{x:r=s.x,y:a=s.y}=n.attribute;if(i.highPerformanceSave(),n.transMatrix.onlyTranslate()){const l=n.getOffsetXY(s);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(n.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(n,i,r,a,{},null,(l,h,d)=>!!o||(o=l.isPointInPath(e.x,e.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=u+c,o=l.isPointInStroke(e.x,e.y),o}),i.highPerformanceRestore(),o}};Mv=kU([ue(),MU(0,Ee(op)),wU("design:paramtypes",[Object])],Mv);let Mw=!1;const TU=new Me((n,e,t,i)=>{Mw||(Mw=!0,n(Nk).to(Mv).inSingletonScope(),n(Ar).toService(Nk))});var CU=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},PU=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},EU=function(n,e){return function(t,i){e(t,i,n)}};let Tv=class{constructor(n){this.canvasRenderer=n,this.type="glyph",this.numberType=b_}contains(n,e,t){if(!n.AABBBounds.containsPoint(e))return!1;if(n.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=t??{};if(!i)return!1;const s=t==null?void 0:t.pickerService;if(s){let r=!1;return n.getSubGraphic().forEach(a=>{if(r)return;const o=s.pickItem(a,e,null,t);r=!(!o||!o.graphic)}),r}return!1}};Tv=CU([ue(),EU(0,Ee(dp)),PU("design:paramtypes",[Object])],Tv);let Tw=!1;const RU=new Me((n,e,t,i)=>{Tw||(Tw=!0,n(aw).to(Tv).inSingletonScope(),n(yi).toService(aw))});var OU=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},BU=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},LU=function(n,e){return function(t,i){e(t,i,n)}};let Gp=class{constructor(n){this.canvasRenderer=n,this.type="glyph",this.numberType=b_}contains(n,e,t){if(!n.AABBBounds.containsPoint(e))return!1;if(n.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=t??{};if(!i)return!1;const s=t==null?void 0:t.pickerService;if(s){let r=!1;return n.getSubGraphic().forEach(a=>{r||(r=!!s.pickItem(a,e,null,t))}),r}return!1}};Gp=OU([ue(),LU(0,Ee(dp)),BU("design:paramtypes",[Object])],Gp);let Cw=!1;const IU=new Me((n,e,t,i)=>{Cw||(Cw=!0,n(Uk).to(Gp).inSingletonScope(),n(Gp).toService(Uk))});var DU=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},FU=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},zU=function(n,e){return function(t,i){e(t,i,n)}};let Cv=class{constructor(n){this.canvasRenderer=n,this.type="richtext",this.numberType=Dx}contains(n,e,t){return!!n.AABBBounds.containsPoint(e)}};Cv=DU([ue(),zU(0,Ee(Wb)),FU("design:paramtypes",[Object])],Cv);let Pw=!1;const jU=new Me((n,e,t,i)=>{Pw||(Pw=!0,n(rw).to(Cv).inSingletonScope(),n(yi).toService(rw))});var HU=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};let sh=class{constructor(){this.type="image",this.numberType=v_}contains(n,e,t){const{pickContext:i}=t??{};return!!i&&!!n.AABBBounds.containsPoint(e)}};sh=HU([ue()],sh);let Ew=!1;const GU=new Me((n,e,t,i)=>{Ew||(Ew=!0,n(Bp).to(sh).inSingletonScope(),n(sh).toService(Bp))});var WU=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};let Pv=class{constructor(){this.type="image",this.numberType=v_}contains(n,e,t){const{pickContext:i}=t??{};return!!i&&!!n.AABBBounds.containsPoint(e)}};Pv=WU([ue()],Pv);let Rw=!1;const VU=new Me((n,e,t,i)=>{Rw||(Rw=!0,n(qk).to(Pv).inSingletonScope(),n(yi).toService(qk))});let Ow=!1;const NU=new Me((n,e,t,i)=>{Ow||(Ow=!0,n(Bp).to(sh).inSingletonScope(),n(sh).toService(Bp))});var UU=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},$U=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},YU=function(n,e){return function(t,i){e(t,i,n)}};new St;let Ev=class extends yr{constructor(n){super(),this.canvasRenderer=n,this.type="rect3d",this.numberType=Ix}contains(n,e,t){const{pickContext:i}=t??{};if(!i)return!1;const s=se(n).rect;i.highPerformanceSave();const r=this.transform(n,s,i),{x:a,y:o,z:l,lastModelMatrix:h}=r;let d=e;if(i.camera){d=e.clone();const c=n.parent.globalTransMatrix;d.x=c.a*e.x+c.c*e.y+c.e,d.y=c.b*e.x+c.d*e.y+c.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(n,i,a,o,t,null,(c,f,p)=>!!u||(u=c.isPointInPath(d.x,d.y),u)),this.canvasRenderer.z=0,i.modelMatrix!==h&&lt.free(i.modelMatrix),i.modelMatrix=h,i.highPerformanceRestore(),u}};Ev=UU([ue(),YU(0,Ee(Hb)),$U("design:paramtypes",[Object])],Ev);let Bw=!1;const XU=new Me((n,e,t,i)=>{Bw||(Bw=!0,n(ew).to(Ev).inSingletonScope(),n(yi).toService(ew))});var KU=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},qU=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},ZU=function(n,e){return function(t,i){e(t,i,n)}};let Rv=class extends yr{constructor(n){super(),this.canvasRenderer=n,this.type="arc3d",this.numberType=Gu}contains(n,e,t){const{pickContext:i}=t??{};if(!i)return!1;const s=se(n).arc;i.highPerformanceSave();const r=this.transform(n,s,i),{x:a,y:o,z:l,lastModelMatrix:h}=r;let d=e;if(i.camera){d=e.clone();const c=n.parent.globalTransMatrix;d.x=c.a*e.x+c.c*e.y+c.e,d.y=c.b*e.x+c.d*e.y+c.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(n,i,a,o,t,null,(c,f,p)=>!!u||(u=c.isPointInPath(d.x,d.y),u)),this.canvasRenderer.z=0,i.modelMatrix!==h&&lt.free(i.modelMatrix),i.modelMatrix=h,i.highPerformanceRestore(),u}};Rv=KU([ue(),ZU(0,Ee(jb)),qU("design:paramtypes",[Object])],Rv);let Lw=!1;const JU=new Me((n,e,t,i)=>{Lw||(Lw=!0,n(Yk).to(Rv).inSingletonScope(),n(yi).toService(Yk))});var QU=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a},e4=function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},t4=function(n,e){return function(t,i){e(t,i,n)}};let Ov=class extends yr{constructor(n){super(),this.canvasRenderer=n,this.type="pyramid3d",this.numberType=Lx}contains(n,e,t){const{pickContext:i}=t??{};if(!i)return!1;const s=se(n).polygon;i.highPerformanceSave();const r=this.transform(n,s,i),{x:a,y:o,z:l,lastModelMatrix:h}=r;let d=e;if(i.camera){d=e.clone();const c=n.parent.globalTransMatrix;d.x=c.a*e.x+c.c*e.y+c.e,d.y=c.b*e.x+c.d*e.y+c.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(n,i,a,o,{},null,(c,f,p)=>!!u||(u=c.isPointInPath(d.x,d.y),u),(c,f,p)=>!1),this.canvasRenderer.z=0,i.modelMatrix!==h&&lt.free(i.modelMatrix),i.modelMatrix=h,i.highPerformanceRestore(),u}};Ov=QU([ue(),t4(0,Ee(Vb)),e4("design:paramtypes",[Object])],Ov);let Iw=!1;const i4=new Me((n,e,t,i)=>{Iw||(Iw=!0,n(sw).to(Ov).inSingletonScope(),n(yi).toService(sw))}),Jn=Jx();function Wp(){Wp.__loaded||(Wp.__loaded=!0,UW(),we.load(SW),we.load(Jn?pN:yN))}Wp.__loaded=!1;const c0=Wp;function Vp(){Vp.__loaded||(Vp.__loaded=!0,$W(),we.load(WW),we.load(JU))}Vp.__loaded=!1;const n4=Vp;function Np(){Np.__loaded||(Np.__loaded=!0,YW(),we.load(wW),we.load(Jn?jN:VN))}Np.__loaded=!1;const pR=Np;function Up(){Up.__loaded||(Up.__loaded=!0,XW(),we.load(TW),we.load(Jn?tU:rU))}Up.__loaded=!1;const s4=Up;function $p(){$p.__loaded||($p.__loaded=!0,KW(),we.load(OW),we.load(Jn?RU:IU))}$p.__loaded=!1;const r4=$p;function Yp(){Yp.__loaded||(Yp.__loaded=!0,qW())}Yp.__loaded=!1;const zt=Yp;function Xp(){Xp.__loaded||(Xp.__loaded=!0,ZW(),we.load(DW),we.load(Jn?VU:NU))}Xp.__loaded=!1;const gR=Xp;function Kp(){Kp.__loaded||(Kp.__loaded=!0,JW(),we.load(kW),we.load(Jn?RN:IN))}Kp.__loaded=!1;const Ca=Kp;function qp(){qp.__loaded||(qp.__loaded=!0,QW(),we.load(PW),we.load(Jn?gU:bU))}qp.__loaded=!1;const Xu=qp;function Zp(){Zp.__loaded||(Zp.__loaded=!0,e5(),we.load(EW),we.load(Jn?AU:TU))}Zp.__loaded=!1;const L_=Zp;function Jp(){Jp.__loaded||(Jp.__loaded=!0,t5(),we.load(NW),we.load(i4))}Jp.__loaded=!1;const a4=Jp;function Qp(){Qp.__loaded||(Qp.__loaded=!0,i5(),we.load(AW),we.load(Jn?SN:MN))}Qp.__loaded=!1;const kr=Qp;function eg(){eg.__loaded||(eg.__loaded=!0,n5(),we.load(zW),we.load(XU))}eg.__loaded=!1;const o4=eg;function tg(){tg.__loaded||(tg.__loaded=!0,s5(),we.load(IW),we.load(Jn?jU:GU))}tg.__loaded=!1;const Pa=tg;function ig(){ig.__loaded||(ig.__loaded=!0,o5())}ig.__loaded=!1;const Pi=ig;function ng(){ng.__loaded||(ng.__loaded=!0,r5(),we.load(MW),we.load(Jn?YN:ZN))}ng.__loaded=!1;const xs=ng;function sg(){sg.__loaded||(sg.__loaded=!0,a5(),we.load(CW),we.load(Jn?hU:uU))}sg.__loaded=!1;const Ea=sg;function rg(){rg.__loaded||(rg.__loaded=!0,l5())}rg.__loaded=!1;const _R=rg;function l4(){zt(),kr()}const Dw={debounce:Us,throttle:Ta};l4();let mR=class yR extends ti{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},yR.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=i=>{const{viewX:s,viewY:r}=i,{direction:a,width:o,height:l,range:h}=this.attribute,d=this._sliderSize,[u,c]=this._getScrollRange();let f;if(a==="vertical"){const p=r-this._viewPosition.y,g=ai(p-d/2,u,c);f=p/l,this._slider.setAttribute("y",g,!0)}else{const p=s-this._viewPosition.x,g=ai(p-d/2,u,c);f=p/o,this._slider.setAttribute("x",g,!0)}this.setScrollRange([f-(h[1]-h[0])/2,f+(h[1]-h[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=i=>{i.stopPropagation();const{direction:s}=this.attribute;this._prePos=s==="horizontal"?i.clientX:i.clientY,this._dispatchEvent("scrollDown",{pos:this._prePos,event:i}),Fe.env==="browser"?(Fe.addEventListener("pointermove",this._onSliderPointerMove,{capture:!0}),Fe.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=i=>{const{direction:s}=this.attribute;let r,a,o=0;const{width:l,height:h}=this._getSliderRenderBounds();return s==="vertical"?(a=i.clientY,o=a-this._prePos,r=o/h):(a=i.clientX,o=a-this._prePos,r=o/l),[a,r]},this._onSliderPointerMove=Dw[this.attribute.delayType](i=>{i.stopPropagation();const s=this.getScrollRange(),[r,a]=this._computeScrollValue(i);this.setScrollRange([s[0]+a,s[1]+a],!0),this._prePos=r},this.attribute.delayTime),this._onSliderPointerUp=i=>{i.preventDefault();const{realTime:s=!0,range:r,limitRange:a=[0,1]}=this.attribute,o=this.getScrollRange(),[l,h]=this._computeScrollValue(i),d=[o[0]+h,o[1]+h];s||this._dispatchEvent("scroll",{pre:r,value:Ir(d,a[0],a[1])}),this._dispatchEvent("scrollUp",{pre:r,value:Ir(d,a[0],a[1])}),Fe.env==="browser"?(Fe.removeEventListener("pointermove",this._onSliderPointerMove,{capture:!0}),Fe.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(e,t=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:r,realTime:a=!0}=this.attribute,o=Ir(e,s[0],s[1]);if(t){const l=this._getSliderPos(o);this._slider&&(i==="horizontal"?this._slider.setAttribute("x",l[0],!0):this._slider.setAttribute("y",l[0],!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame())}this.attribute.range=o,a&&(this._dispatchEvent("scroll",{pre:r,value:o}),this._dispatchEvent("scrollDrag",{pre:r,value:o}))}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:e="throttle",delayTime:t=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",Dw[e](this._onRailPointerDown,t)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:e="horizontal",width:t,height:i,range:s,limitRange:r=[0,1],railStyle:a,sliderStyle:o,padding:l=2}=this.attribute,h=this.createOrUpdateChild("scrollbar-container",{},"group"),d=h.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:t,height:i},a),"rect");this._rail=d;const u=this._getSliderRenderBounds(),c=this._getSliderPos(Ir(s,r[0],r[1])),f=c[1]-c[0];let p;this._sliderSize=f,p=e==="horizontal"?{x:c[0],y:u.y1,width:f,height:u.height}:{x:u.x1,y:c[0],width:u.width,height:f};const g=h.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),o),{boundsPadding:tn(l),pickMode:"imprecise"}),"rect");this._slider=g,this._container=h;const _=this._container.AABBBounds;this._viewPosition={x:_.x1,y:_.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:e,height:t,padding:i=2}=this.attribute,[s,r,a,o]=tn(i),l={x1:o,y1:s,x2:e-r,y2:t-a,width:Math.max(0,e-(o+r)),height:Math.max(0,t-(s+a))};return this._sliderRenderBounds=l,l}_getDefaultSliderCornerRadius(){const{direction:e,round:t}=this.attribute;if(t){const{width:i,height:s}=this._getSliderRenderBounds();return e==="horizontal"?s:i}return 0}_getSliderPos(e){const{direction:t}=this.attribute,{width:i,height:s,x1:r,y1:a}=this._getSliderRenderBounds();return t==="horizontal"?[i*e[0]+r,i*e[1]+r]:[s*e[0]+a,s*e[1]+a]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:e=[0,1],direction:t}=this.attribute,[i,s]=Ir(e,0,1),{width:r,height:a,x1:o,y1:l}=this._getSliderRenderBounds(),h=this._sliderSize;return t==="horizontal"?Ir([o+i*r,o+s*r],o,r-h):Ir([l+i*a,l+s*a],l,a-h)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};mR.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};function fs(n,e){n.forEachChildren(t=>{const i=e(t);t.isContainer&&!i&&fs(t,e)})}const Ht=n=>!C(n)&&n.visible!==!1;function h4(n,e){if(!e)return[];const t=n.find(i=>i.name===e,!0);return t?t.getChildren():[]}function d4(n,e){if(!e)return[];const t=n.find(i=>i.name===e,!0);return t?t.findAll(i=>i.type!=="group",!0):[]}const u4=["#ffffff","#000000"];function Fw(n,e,t,i,s,r){if(typeof n!="string"||typeof e!="string")return n;const a=new Gt(n).toHex(),o=new Gt(e).toHex();return f0(a,o,t,i,r)?a:c4(a,o,t,i,s,r)}function c4(n,e,t,i,s,r){const a=[];s&&(s instanceof Array?a.push(...s):a.push(s)),a.push(...u4);for(const o of a)if(n!==o&&f0(o,e,t,i,r))return o}function f0(n,e,t,i,s){if(s==="lightness"){const r=Gt.getColorBrightness(new Gt(e));return Gt.getColorBrightness(new Gt(n))<.5?r>=.5:r<.5}return i?ry(n,e)>i:t==="largeText"?ry(n,e)>3:ry(n,e)>4.5}function ry(n,e){const t=zw(n),i=zw(e);return((t>i?t:i)+.05)/((t>i?i:t)+.05)}function zw(n){const e=kC(n),t=e[0]/255,i=e[1]/255,s=e[2]/255;let r,a,o;return r=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),a=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function Mo(n,e,t,i){let s;switch(n){case"base":s=e;break;case"invertBase":s=t;break;case"similarBase":s=i}return s}function bR(n,e){return[n[0]*e,n[1]*e]}function f4(n){const[e,t]=n;return Math.sqrt(e*e+t*t)}function p4(n){const[e,t]=n;let i=e*e+t*t;return i>0&&(i=1/Math.sqrt(i)),[n[0]*i,n[1]*i]}function g4(n,e){const[t,i]=n,[s,r]=e,a=Math.sqrt((t*t+i*i)*(s*s+r*r)),o=a&&(t*s+i*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}function _4(n,e){return n[0]*e[1]-e[0]*n[1]}function m4(n,e,t){const i=g4(n,e),s=_4(n,e)>=0;return t?s?2*Math.PI-i:i:s?i:2*Math.PI-i}const rh=-.5*Math.PI,ah=1.5*Math.PI,md="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",y4=11;var Dt;(function(n){n.selected="selected",n.selectedReverse="selected_reverse",n.hover="hover",n.hoverReverse="hover_reverse"})(Dt||(Dt={}));const To={[Dt.selectedReverse]:{},[Dt.selected]:{},[Dt.hover]:{},[Dt.hoverReverse]:{}},br={container:"",width:30,height:30,style:{}},ay=(n,e,t)=>new si(Object.assign({defaultFontParams:{fontFamily:md,fontSize:y4},getTextBounds:Uu,specialCharSet:`-/: .,@%'"~`+si.ALPHABET_CHAR_SET+si.ALPHABET_CHAR_SET.toUpperCase()},{}),n);function I_(n,e,t=md){var i,s;if(!n)return{width:0,height:0};const r=Uu({text:n,fontFamily:(i=e.fontFamily)!==null&&i!==void 0?i:t,fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:(s=e.textAlign)!==null&&s!==void 0?s:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:r.width(),height:r.height()}}function D_(){zt(),kr(),xs(),Pa(),Ea()}var Wc=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};D_();class Ss extends ti{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},Ss.defaultAttributes,e)),this.name="tag"}render(){var e,t,i,s;const{text:r="",textStyle:a={},shape:o={},panel:l={},space:h=4,minWidth:d,maxWidth:u,padding:c=4,visible:f,state:p,type:g,textAlwaysCenter:_}=this.attribute,m=tn(c),y=this.createOrUpdateChild("tag-content",{x:0,y:0,zIndex:1},"group");let b,v=m[1]+m[3],x=m[0]+m[2],S=0,A=0;const{visible:k}=o,w=Wc(o,["visible"]);if(ht(k)){const T=(w==null?void 0:w.size)||10,E=oe(T)?T:Math.max(T[0],T[1]);b=y.createOrUpdateChild("tag-shape",Object.assign(Object.assign({symbolType:"circle",size:T,strokeBoundsBuffer:0},w),{visible:k,x:E/2,y:E/2}),"symbol"),fe(p==null?void 0:p.shape)||(b.states=p.shape),k&&(A=E+h)}let M;if(v+=A,S+=A,g==="rich"){const T=Object.assign(Object.assign({textConfig:r,visible:P(r)&&f!==!1},a),{x:S,y:0,width:(e=a.width)!==null&&e!==void 0?e:0,height:(t=a.height)!==null&&t!==void 0?t:0});M=y.createOrUpdateChild("tag-text",T,"richtext");const{visible:E}=l,O=Wc(l,["visible"]);if(f&&ht(E)){const B=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},O),{visible:E&&!!r,x:M.AABBBounds.x1,y:M.AABBBounds.y1,width:M.AABBBounds.width(),height:M.AABBBounds.height()}),"rect");fe(p==null?void 0:p.panel)||(B.states=p.panel)}}else if(g==="html"){const T=Object.assign(Object.assign({textConfig:[],visible:P(r)&&f!==!1,html:Object.assign(Object.assign({dom:r},br),a)},a),{x:S,y:0});M=y.createOrUpdateChild("tag-text",T,"richtext");const{visible:E}=l,O=Wc(l,["visible"]);if(f&&ht(E)){const B=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},O),{visible:E&&!!r,x:M.AABBBounds.x1,y:M.AABBBounds.y1,width:M.AABBBounds.width(),height:M.AABBBounds.height()}),"rect");fe(p==null?void 0:p.panel)||(B.states=p.panel)}}else{const T=Object.assign(Object.assign({text:r,visible:P(r)&&f!==!1,lineHeight:a==null?void 0:a.fontSize},a),{x:S,y:0});C(T.lineHeight)&&(T.lineHeight=a.fontSize),M=y.createOrUpdateChild("tag-text",T,"text"),fe(p==null?void 0:p.text)||(M.states=p.text);const E=I_(T.text,a,(i=this.stage)===null||i===void 0?void 0:i.getTheme().text.fontFamily),O=E.width,B=E.height;v+=O;const R=(s=o.size)!==null&&s!==void 0?s:10,L=oe(R)?R:Math.max(R[0],R[1]);x+=Math.max(B,o.visible?L:0);const{textAlign:I,textBaseline:F}=a;(P(d)||P(u))&&(P(d)&&v<d&&(v=d),P(u)&&v>u&&(v=u,M.setAttribute("maxLineWidth",u-m[1]-m[2])));let H=0,G=0;I==="center"?(H-=v/2,b&&b.setAttribute("x",(b.attribute.x||0)-O/2),y.setAttribute("x",-A/2)):I==="right"||I==="end"?(H-=v,b&&b.setAttribute("x",(b.attribute.x||0)-O),y.setAttribute("x",-m[1]-A)):I!=="left"&&I!=="start"||y.setAttribute("x",m[3]),!_||I!=="left"&&I!=="start"||M.setAttributes({x:S+v/2,textAlign:"center"}),F==="middle"?(G-=x/2,b&&b.setAttribute("y",0)):F==="bottom"?(G-=x,b&&b.setAttribute("y",-B/2),y.setAttribute("y",-m[2])):F==="top"&&(y.setAttribute("y",m[0]),b&&b.setAttribute("y",B/2));const{visible:U}=l,$=Wc(l,["visible"]);if(f&&ht(U)){const Z=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},$),{visible:U&&!!r,x:H,y:G,width:v,height:x}),"rect");fe(p==null?void 0:p.panel)||(Z.states=p.panel)}}}}Ss.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const vR={visible:!0,position:"auto",titleStyle:{fontSize:16,fill:"#08979c"},contentStyle:{fontSize:12,fill:"green"},panel:{visible:!0,fill:"#e6fffb",size:12,space:0,stroke:"#87e8de",lineWidth:1,cornerRadius:4}},xR={poptip:re({},vR)};function b4(){zt(),_R(),xs(),kr()}function v4(n){re(xR.poptip,vR,n)}var x4=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};const jw=new St;b4();class nu extends ti{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},nu.defaultAttributes,e)),this.name="poptip",this.positionList=["top","tl","tr","bottom","bl","br","left","lt","lb","right","rt","rb"]}render(){var e,t,i,s,r,a,o,l;const{titleStyle:h={},position:d,contentStyle:u={},panel:c={},space:f=4,minWidth:p=0,maxWidth:g=1/0,padding:_=4,maxWidthPercent:m,visible:y,state:b,dx:v=0,dy:x=0}=this.attribute;let{title:S="",content:A=""}=this.attribute;S=this.attribute.titleFormatMethod?this.attribute.titleFormatMethod(S):S,A=this.attribute.contentFormatMethod?this.attribute.contentFormatMethod(A):A;const k=tn(_),w=this.createOrUpdateChild("poptip-content",{x:0,y:0,zIndex:1},"group"),M=g-k[1]-k[3],T=P(S)&&y!==!1,E=Object.assign(Object.assign({text:W(S)?S:[S],visible:T},h),{x:k[3],y:k[0],maxLineWidth:M,textAlign:"left",textBaseline:"top"}),O=w.createOrUpdateChild("poptip-title",E,"wrapText");fe(b==null?void 0:b.title)||(O.states=b.title);const B=O.AABBBounds,R=B.height(),L=B.width();let I=R+f;T||(I=0);const F=P(A)&&y!==!1,H=Object.assign(Object.assign({text:W(A)?A:[A],visible:F},u),{x:k[3],y:k[0]+I,maxLineWidth:M,textAlign:"left",textBaseline:"top"}),G=w.createOrUpdateChild("poptip-content",H,"wrapText");fe(b==null?void 0:b.content)||(G.states=b.content);const U=G.AABBBounds,$=U.height(),Z=U.width();F&&(I+=$);let q=Ji(L+k[1]+k[3],Z+k[1]+k[3]);q>g?q=g:q<p&&(q=p);let ie=k[0]+k[2]+I;const{visible:K}=c,V=x4(c,["visible"]),te=(e=V.size)!==null&&e!==void 0?e:12,le=W(te)?[te[0]+((t=V.space)!==null&&t!==void 0?t:0),te[1]+((i=V.space)!==null&&i!==void 0?i:0)]:te+((s=V.space)!==null&&s!==void 0?s:0),he=(r=V.lineWidth)!==null&&r!==void 0?r:1,Ce=this.stage?[(a=this.stage.viewWidth)!==null&&a!==void 0?a:this.stage.width,(o=this.stage.viewHeight)!==null&&o!==void 0?o:this.stage.height]:void 0;if(Ce){const Re=this.AABBBounds,Pe=(l=this.attribute.x)!==null&&l!==void 0?l:Re.x1,Ei=Ce[0]-Re.x1;let Tt=Math.max(Pe,Ei);const Mn=(W(te)?te[0]:12)+3;if(Tt=Math.min(Tt-Mn,Tt*m),Tt<q){q=Tt;const fi=k[1]+k[3];O.setAttribute("maxLineWidth",Tt-fi),G.setAttribute("maxLineWidth",Tt-fi),ie=k[0]+k[2],T&&(ie+=O.AABBBounds.height()+f),ie+=G.AABBBounds.height()}}const ge=d==="auto";let ke,xe=-1/0;for(let Re=0;Re<this.positionList.length+1;Re++){const Pe=ge?this.positionList[Re===this.positionList.length?ke:Re]:d,{angle:Ei,offset:Tt,rectOffset:Mn}=this.getAngleAndOffset(Pe,q,ie,W(le)?le:[le,le-he]);if(ht(K)){const fi=(W(te)?te[0]:te)/4,Tn=w.createOrUpdateChild("poptip-symbol-panel",Object.assign(Object.assign({},V),{visible:K&&(F||T),x:fi,y:0,strokeBoundsBuffer:-1,boundsPadding:-2,anchor:[0,0],symbolType:"arrow2Left",angle:Ei,dx:Tt[0],dy:Tt[1],size:te,zIndex:-9}),"symbol");fe(b==null?void 0:b.panel)||(Tn.states=b.panel);const dt=w.createOrUpdateChild("poptip-rect-panel",Object.assign(Object.assign({},V),{visible:K&&(F||T),x:0,y:0,width:q,height:ie,zIndex:-8}),"rect");fe(b==null?void 0:b.panel)||(dt.states=b.panel)}if(w.setAttributes({x:-Tt[0]+v,y:-Tt[1]+x}),!ge||!Ce)break;{jw.setValue(0,0,q,ie).transformWithMatrix(w.globalTransMatrix);const fi=jw,Tn=new _i().setValue(0,0,Ce[0],Ce[1]);if(TD(fi,Tn))break;{const dt=TC(fi,Tn),Ct=(dt.x2-dt.x1)*(dt.y2-dt.y1);Ct>xe&&(xe=Ct,ke=Re)}}}}getAngleAndOffset(e,t,i,s){const r=s[1]/2;switch(e){case"tl":return{angle:et/2*3,offset:[t/4,i+r],rectOffset:[-t/4,-i-s[1]]};case"top":return{angle:et/2*3,offset:[t/2,i+r],rectOffset:[0,-i-s[1]]};case"tr":return{angle:et/2*3,offset:[t/4*3,i+r],rectOffset:[t/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-r,i/5],rectOffset:[t/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-r,i/2],rectOffset:[t/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-r,i/5*4],rectOffset:[t/4*3,-i-s[1]]};case"bl":return{angle:et/2,offset:[t/4,-r],rectOffset:[-t/4,-i-s[1]]};case"bottom":return{angle:et/2,offset:[t/2,-r],rectOffset:[0,-i-s[1]]};case"br":return{angle:et/2,offset:[t/4*3,-r],rectOffset:[t/4*3,-i-s[1]]};case"lt":return{angle:et,offset:[t+r,i/5],rectOffset:[-t/4,-i-s[1]]};case"left":return{angle:et,offset:[t+r,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:et,offset:[t+r,i/5*4],rectOffset:[t/4*3,-i-s[1]]}}}}nu.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};var S4=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};function A4(n,e){return re(n,xR.poptip,e),n}let yd=class{render(n,e,t,i,s,r,a,o,l,h,d,u,c){var f;if(n._showPoptip===1){const{visible:p,visibleCb:g}=n.attribute.poptip||{};if(p===!1||g&&g(n)===!1)return;const _={};re(_,nu.defaultAttributes,n.attribute.poptip?n.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(_):this.poptipComponent=new nu(_);let m=n.attribute.poptip||{};if(n.type==="text"&&m.title==null&&m.content==null){const v={};A4(v,m),m=v,m.content=(f=m.content)!==null&&f!==void 0?f:n.attribute.text}const y=n.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},m),{x:y.e,y:y.f})),h.stage.tryInitInteractiveLayer();const b=h.stage.getLayer("_builtin_interactive");b&&b.add(this.poptipComponent)}else n._showPoptip===2&&(n._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};yd=S4([ue()],yd);var SR=function(n,e,t,i){var s,r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,t,i);else for(var o=n.length-1;o>=0;o--)(s=n[o])&&(a=(r<3?s(a):r>3?s(e,t,a):s(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};let bd=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=Nt.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=n=>{const e=n.target;if(e.isContainer||!e.attribute)return void this.unpoptip(n);if(e===this.activeGraphic)return;const{poptip:t}=e.attribute;t&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=n=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(n){this.pluginService=n;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(n,e){this.activeGraphic=n,this.pluginService.stage.renderNextFrame()}deactivate(n){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};bd=SR([ue()],bd);let vd=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=Nt.GenAutoIncrementId(),this.key=this.name+this._uid,this.pointerlave=n=>{const{stage:e}=this.pluginService;n.target===e&&this.unpoptip(n)},this.poptip=n=>{const e=n.target;if(e.type!=="text"||!e.cliped||e.isContainer||!e.attribute||e.attribute.disableAutoClipedPoptip)return void this.unpoptip(n);if(e===this.activeGraphic)return;const{poptip:t={}}=e.attribute;t&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=n=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(n){this.pluginService=n;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip),e.addEventListener("pointerleave",this.pointerlave)}setActiveGraphic(n,e){this.activeGraphic=n,this.pluginService.stage.renderNextFrame()}deactivate(n){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip),e.removeEventListener("pointerleave",this.pointerlave)}};vd=SR([ue()],vd);const k4=new Me((n,e,t,i)=>{t(yd)||(n(yd).toSelf().inSingletonScope(),n(Wx).toService(yd)),t(bd)||(n(bd).toSelf(),n(Qd).toService(bd)),t(vd)||(n(vd).toSelf(),n(Qd).toService(vd))});function w4(){we.load(k4)}class Ku extends ti{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}function M4(){zt(),Ca()}function T4(){zt(),c0()}function C4(){zt(),Xu()}function P4(){zt(),kr()}function E4(){zt(),c0()}M4();class qu extends Ku{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},qu.defaultAttributes,e))}renderCrosshair(e){const{start:t,end:i,lineStyle:s}=this.attribute;return e.createOrUpdateChild("crosshair-line",Object.assign({points:[t,i]},s),"line")}setLocation(e){const{start:t,end:i}=e;this.setAttributes({start:t,end:i})}}qu.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};P4();class F_ extends Ku{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},F_.defaultAttributes,e))}renderCrosshair(e){const{start:t,end:i,rectStyle:s}=this.attribute;return e.createOrUpdateChild("crosshair-rect",Object.assign({x:t.x,y:t.y,width:i.x-t.x,height:i.y-t.y},s),"rect")}setLocation(e){const{start:t,end:i}=e;this.setAttributes({start:t,end:i})}}F_.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};T4();class z_ extends Ku{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},z_.defaultAttributes,e))}renderCrosshair(e){const{center:t,radius:i,lineStyle:s}=this.attribute;return e.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},t),{outerRadius:i}),this.attribute),s),"arc")}setLocation(e){const{center:t}=this.attribute,i=wt.distancePP(e,t);this.setAttribute("radius",i)}}z_.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};E4();class j_ extends Ku{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},j_.defaultAttributes,e))}renderCrosshair(e){const{center:t,radius:i,innerRadius:s=0,sectorStyle:r}=this.attribute,{startAngle:a,endAngle:o}=this.attribute;return e.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},t),{outerRadius:i,innerRadius:s,startAngle:a,endAngle:o}),r),"arc")}setLocation(e){const{center:t,startAngle:i=rh,endAngle:s=ah}=this.attribute,r=s-i,a=$l(Af(t,e));this.setAttributes({startAngle:a-r/2,endAngle:a+r/2})}}j_.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};C4();class H_ extends Ku{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},H_.defaultAttributes,e))}renderCrosshair(e){const{center:t,radius:i,sides:s=6,lineStyle:r}=this.attribute,{startAngle:a,endAngle:o}=this.attribute,l=(o-a)%(2*Math.PI)==0,h=(o-a)/s;let d;for(let u=0;u<=s;u++){const c=as(t,i,a+h*u);u===0?d=`M${c.x},${c.y}`:d+=`L${c.x},${c.y}`,u===s&&l&&(d+="Z")}return e.createOrUpdateChild("crosshair-polygon",Object.assign({path:d},r),"path")}setLocation(e){const{center:t}=this.attribute,i=wt.distancePP(e,t);this.setAttribute("radius",i)}}H_.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const zr=new Uint32Array(33),os=new Uint32Array(33);os[0]=0,zr[0]=~os[0];for(let n=1;n<=32;++n)os[n]=os[n-1]<<1|1,zr[n]=~os[n];function R4(n,e){const t=new Uint32Array(~~((n*e+32)/32));function i(r,a){t[r]|=a}function s(r,a){t[r]&=a}return{array:t,get:(r,a)=>{const o=a*n+r;return t[o>>>5]&1<<(31&o)},set:(r,a)=>{const o=a*n+r;i(o>>>5,1<<(31&o))},clear:(r,a)=>{const o=a*n+r;s(o>>>5,~(1<<(31&o)))},getRange:({x1:r,y1:a,x2:o,y2:l})=>{if(o<0||l<0||r>n||a>e)return!0;let h,d,u,c,f=l;for(;f>=a;--f)if(h=f*n+r,d=f*n+o,u=h>>>5,c=d>>>5,u===c){if(t[u]&zr[31&h]&os[1+(31&d)])return!0}else{if(t[u]&zr[31&h]||t[c]&os[1+(31&d)])return!0;for(let p=u+1;p<c;++p)if(t[p])return!0}return!1},setRange:({x1:r,y1:a,x2:o,y2:l})=>{if(o<0||l<0||r>n||a>e)return;let h,d,u,c,f;for(;a<=l;++a)if(h=a*n+r,d=a*n+o,u=h>>>5,c=d>>>5,u===c)i(u,zr[31&h]&os[1+(31&d)]);else for(i(u,zr[31&h]),i(c,os[1+(31&d)]),f=u+1;f<c;++f)i(f,4294967295)},clearRange:({x1:r,y1:a,x2:o,y2:l})=>{let h,d,u,c,f;for(;a<=l;++a)if(h=a*n+r,d=a*n+o,u=h>>>5,c=d>>>5,u===c)s(u,os[31&h]|zr[1+(31&d)]);else for(s(u,os[31&h]),s(c,zr[1+(31&d)]),f=u+1;f<c;++f)s(f,0)},outOfBounds:({x1:r,y1:a,x2:o,y2:l})=>r<0||a<0||l>=e||o>=n,toImageData:r=>{const a=r.createImageData(n,e),o=a.data;for(let l=0;l<e;++l)for(let h=0;h<n;++h){const d=l*n+h,u=4*d,c=t[d>>>5]&1<<(31&d);o[u+0]=255*c,o[u+1]=255*c,o[u+2]=255*c,o[u+3]=31}return a}}}function AR(n,e,t=0){const i=Math.max(1,Math.sqrt(n*e/1e6)),s=~~((n+2*t+i)/i),r=~~((e+2*t+i)/i),a=o=>~~((o+t)/i);return a.invert=o=>o*i-t,a.bitmap=()=>R4(s,r),a.ratio=i,a.padding=t,a.width=n,a.height=e,a}function Cs(n,e,t=!1){if(t){const{x1:i,x2:s,y1:r,y2:a}=e,o=ai(i,0,n.width),l=ai(s,0,n.width),h=ai(r,0,n.height),d=ai(a,0,n.height);return{x1:n(o),x2:n(l),y1:n(h),y2:n(d)}}return{x1:n(e.x1),x2:n(e.x2),y1:n(e.y1),y2:n(e.y2)}}function _f(n,e,t,i=!0,s=0){let r=t;return s>0&&(r={x1:t.x1-s,x2:t.x2+s,y1:t.y1-s,y2:t.y2+s}),r=Cs(n,r),!(i&&e.outOfBounds(r))&&!e.getRange(r)}function oy(n,e,t,i=[],s=!0,r=0){const a=i.filter(o=>P(o));for(let o=0;o<a.length;o++){const l=t.clone();if(l.setAttributes(a[o]),l.update(),_f(n,e,Cs(n,l.AABBBounds),s,r))return e.setRange(Cs(n,l.AABBBounds,!0)),a[o]}return!1}function O4(n,e,t,i,s,r,a){var o,l;const h=(o=i.overlap)===null||o===void 0?void 0:o.clampForce,d=(l=i.overlap)===null||l===void 0?void 0:l.overlapPadding;if(t.type==="bound"||t.type==="position"){if(Y(a)){const u=((Y(t.position)?t.position(s.attribute):t.position)||I4(i.type)).map(c=>a(s.AABBBounds,r,c,i.offset));return oy(n,e,s,u,h,d)}return!1}if(t.type==="moveY"){const u=(t.offset?Y(t.offset)?t.offset(s.attribute):t.offset:[]).map(c=>({x:s.attribute.x,y:s.attribute.y+c}));return oy(n,e,s,u,h,d)}if(t.type==="moveX"){const u=(t.offset?Y(t.offset)?t.offset(s.attribute):t.offset:[]).map(c=>({x:s.attribute.x+c,y:s.attribute.y}));return oy(n,e,s,u,h,d)}return!1}const B4=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],L4=["top","inside-top","inside"];function I4(n){return n==="rect"?L4:B4}function D4(n,e,t){const{x1:i,x2:s,y1:r,y2:a}=n.AABBBounds,o=Math.min(i,s),l=Math.max(i,s),h=Math.min(r,a),d=Math.max(r,a);let u=0,c=0;return o<0&&l-o<=e?u=-o:l>e&&o-(l-e)>=0&&(u=e-l),h<0&&d-h<=t?c=-h:d>t&&h-(d-t)>=0&&(c=t-d),{dx:u,dy:c}}const F4=(n={})=>{var e,t,i;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:(e=n.opacity)!==null&&e!==void 0?e:1,fillOpacity:(t=n.fillOpacity)!==null&&t!==void 0?t:1,strokeOpacity:(i=n.strokeOpacity)!==null&&i!==void 0?i:1}}},z4=(n={})=>{var e,t,i;return{from:{opacity:(e=n.opacity)!==null&&e!==void 0?e:1,fillOpacity:(t=n.fillOpacity)!==null&&t!==void 0?t:1,strokeOpacity:(i=n.strokeOpacity)!==null&&i!==void 0?i:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},Hw={fadeIn:F4,fadeOut:z4};function Gw(n,e){var t,i;return(i=(t=Hw[e])===null||t===void 0?void 0:t.call(Hw,n))!==null&&i!==void 0?i:{from:{},to:{}}}function j4(n,e,t){if(!W(t)){const{duration:i,easing:s,increaseEffect:r=!0}=t;return n.animate().to(e.attribute,i,s),void(r&&Ww(n,e,i,s))}t.forEach((i,s)=>{const{duration:r,easing:a,increaseEffect:o=!0,channel:l}=i,{from:h,to:d}=H4(n,e,l,i.options);fe(d)||n.animate().to(d,r,a),"text"in h&&"text"in d&&o&&Ww(n,e,r,a)})}const H4=(n,e,t,i)=>{const s=Object.assign({},n.attribute),r=Object.assign({},e.attribute);return N(i==null?void 0:i.excludeChannels).forEach(a=>{delete r[a]}),Object.keys(r).forEach(a=>{t&&!t.includes(a)&&delete r[a]}),{from:s,to:r}};function Ww(n,e,t,i){n.attribute.text!==e.attribute.text&&j(Number(n.attribute.text)*Number(e.attribute.text))&&n.animate().play(new D3({text:n.attribute.text},{text:e.attribute.text},t,i))}const ly={mode:"same-time",duration:300,easing:"linear"};function G4(n){return n.radius?{x:Math.cos(n.angle)*n.radius,y:Math.sin(n.angle)*n.radius}:{x:0,y:0}}function Vc(n,e,t,i){const s=G4({radius:t,angle:i});return{x:n+s.x,y:e+s.y}}function W4(n){return(n=V4(n))>0&&n<=Math.PI/2?2:n>Math.PI/2&&n<=Math.PI?3:n>Math.PI&&n<=3*Math.PI/2?4:1}function V4(n){for(;n<0;)n+=2*Math.PI;for(;n>=2*Math.PI;)n-=2*Math.PI;return n}function Fa(n){return n===3||n===4}function N4(n){return n===1||n===2}function U4(n,e,t,i,s,r){if(n===0&&e===0||r<=0)return[];if(n===0){const c=-t/e,f=r**2-(c-s)**2;return f<0?[]:f===0?[{x:i,y:c}]:[{x:Math.sqrt(f)+i,y:c},{x:-Math.sqrt(f)+i,y:c}]}if(e===0){const c=-t/n,f=r**2-(c-i)**2;return f<0?[]:f===0?[{x:c,y:s}]:[{x:c,y:Math.sqrt(f)+s},{x:c,y:-Math.sqrt(f)+s}]}const a=(e/n)**2+1,o=2*((t/n+i)*(e/n)-s),l=o**2-4*a*((t/n+i)**2+s**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),d=(-o-Math.sqrt(l))/(2*a),u=-(e*h+t)/n;return l===0?[{x:u,y:h}]:[{x:u,y:h},{x:-(e*d+t)/n,y:d}]}function $4(n,e){return e>2*n?NaN:2*Math.asin(e/2/n)}function Y4(n,e){const{x1:t,y1:i,x2:s,y2:r}=n,{x1:a,y1:o,x2:l,y2:h}=e;return!(t<=a&&s<=a||t>=l&&s>=l||i<=o&&r<=o||i>=h&&r>=h)}const kR=(n,e,t="top",i=0)=>{if(!n)return;const{x1:s,y1:r,x2:a,y2:o}=n,l=Math.abs(a-s),h=Math.abs(o-r),d=(e.x1+e.x2)/2,u=(e.y1+e.y2)/2;let c=0,f=0,p=0,g=0;e&&(p=Math.abs(e.x1-e.x2)/2,g=Math.abs(e.y1-e.y2)/2);const _={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(t){case"top":f=-1;break;case"bottom":f=1;break;case"left":c=-1;break;case"right":c=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":c=Math.sin(_[t]*(Math.PI/180)),f=Math.cos(_[t]*(Math.PI/180));break;case"center":c=0,f=0}return{x:d+c*(i+p)+Math.sign(c)*(l/2),y:u+f*(i+g)+Math.sign(f)*(h/2)}},X4=n=>{if(!n||!n.attribute)return[];const{points:e,segments:t}=n.attribute;if(t&&t.length){const i=[];return t.forEach(s=>{s.points.forEach(r=>{i.push(r)})}),i}return e};function wR(n,e,t="end",i=0){if(!n||!e)return{x:1/0,y:1/0};const{x1:s,x2:r}=n,a=Math.abs(r-s),o=e.x1;let l=o;return t==="end"?l=o+a/2+i:t==="start"&&(l=o-a/2-i),{x:l,y:e.y1}}function K4(n,e){if(!n||!e||Dd(n,e,!0))return;const t=Math.min(n.x1,n.x2),i=Math.min(n.y1,n.y2),s=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(n.x2-t)/2,o=Math.abs(n.y2-i)/2,l=Math.abs(e.x2-s)/2,h=Math.abs(e.y2-r)/2,d=t+a,u=i+o,c=s+l,f=r+h,p=c-d,g=f-u;return[Vw(p,g,d,u,a,o),Vw(-p,-g,c,f,l,h)]}function Vw(n,e,t,i,s,r){return Math.abs(e/n)<r/s?{x:t+(n>0?s:-s),y:i+e*s/Math.abs(n)}:{x:t+n*r/Math.abs(e),y:i+(e>0?r:-r)}}function q4(){zt(),Ea(),Pa(),Ca()}q4();class $s extends ti{setBitmap(e){this._bitmap=e}setBitmapTool(e){this._bmpTool=e}constructor(e,t){super(t!=null&&t.skipDefault?e:re({},$s.defaultAttributes,e)),this.name="label",this._onHover=i=>{const s=i.target;s===this._lastHover||fe(s.states)||(s.addState(Dt.hover,!0),fs(this,r=>{r===s||fe(r.states)||r.addState(Dt.hoverReverse,!0)}),this._lastHover=s)},this._onUnHover=i=>{this._lastHover&&(fs(this,s=>{fe(s.states)||(s.removeState(Dt.hoverReverse),s.removeState(Dt.hover))}),this._lastHover=null)},this._onClick=i=>{const s=i.target;if(this._lastSelect===s&&s.hasState("selected"))return this._lastSelect=null,void fs(this,r=>{fe(r.states)||(r.removeState(Dt.selectedReverse),r.removeState(Dt.selected))});fe(s.states)||(s.addState(Dt.selected,!0),fs(this,r=>{r===s||fe(r.states)||r.addState(Dt.selectedReverse,!0)}),this._lastSelect=s)},this._handleRelatedGraphicSetState=i=>{var s,r,a,o,l;if(((s=i.detail)===null||s===void 0?void 0:s.type)===kt.STATE||((r=i.detail)===null||r===void 0?void 0:r.type)===kt.ANIMATE_UPDATE&&(!((a=i.detail.animationState)===null||a===void 0)&&a.isFirstFrameOfStep)){const h=(l=(o=i.target)===null||o===void 0?void 0:o.currentStates)!==null&&l!==void 0?l:[];(this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(i.target)]).forEach(d=>{d&&(d.text&&d.text.useStates(h),d.labelLine&&d.labelLine.useStates(h))})}}}labeling(e,t,i,s){}_createLabelLine(e,t){const i=K4(e.AABBBounds,t==null?void 0:t.AABBBounds);if(i){const s=ce.line({points:i});return t&&t.attribute.fill&&s.setAttribute("stroke",t.attribute.fill),this.attribute.line&&!fe(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),C(this._idToGraphic)||this._isCollectionBase&&C(this._idToPoint))return;const{overlap:e,smartInvert:t,dataFilter:i,customLayoutFunc:s,customOverlapFunc:r}=this.attribute;let a,o=this.attribute.data;Y(i)&&(o=i(o)),a=Y(s)?s(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?l=>this._idToPoint.get(l.id):null):this._layout(o),Y(r)?a=r(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?l=>this._idToPoint.get(l.id):null):e!==!1&&(a=this._overlapping(a)),a&&a.length&&a.forEach(l=>{this._bindEvent(l),this._setStatesOfText(l)}),t!==!1&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(e){if(this.attribute.disableTriggerEvent||!e)return;const{hover:t,select:i}=this.attribute;t&&(e.addEventListener("pointermove",this._onHover),e.addEventListener("pointerout",this._onUnHover)),i&&e.addEventListener("pointerdown",this._onClick)}_setStatesOfText(e){if(!e)return;const t=this.attribute.state;t&&!fe(t)&&(e.states=t)}_setStatesOfLabelLine(e){if(!e)return;const t=this.attribute.labelLineState;t&&!fe(t)&&(e.states=t)}_createLabelText(e){var t,i;return e.textType==="rich"?(e.textConfig=e.text,e.width=(t=e.width)!==null&&t!==void 0?t:0,e.height=(i=e.height)!==null&&i!==void 0?i:0,ce.richtext(e)):e.textType==="html"?(e.textConfig=[],e.html=Object.assign(Object.assign({dom:e.text},br),e),ce.richtext(e)):ce.text(e)}_prepare(){var e,t,i,s,r;const a=[];let o;if(o=Y(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():h4(this.getRootNode(),this.attribute.baseMarkGroupName),o.forEach(h=>{h.releaseStatus!=="willRelease"&&a.push(h)}),(e=this._idToGraphic)===null||e===void 0||e.clear(),(t=this._idToPoint)===null||t===void 0||t.clear(),this._baseMarks=a,this._isCollectionBase=this.attribute.type==="line-data",!a||a.length===0)return;const{data:l}=this.attribute;if(l&&l.length!==0){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let h=0;for(let d=0;d<a.length;d++){const u=a[d],c=X4(u);if(c&&c.length)for(let f=0;f<c.length;f++){const p=l[h];p&&c[f]&&(P(p.id)||(p.id=`vrender-component-${this.name}-${h}`),this._idToPoint.set(p.id,c[f]),this._idToGraphic.set(p.id,u)),h++}}}else for(let h=0;h<a.length;h++){const d=l[h],u=a[h];d&&u&&(P(d.id)||(d.id=`vrender-component-${this.name}-${h}`),this._idToGraphic.set(d.id,u))}if(this.attribute.animation!==!1){const h=He(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:re({},ly,h,(i=this.attribute.animationEnter)!==null&&i!==void 0?i:{}),exit:re({},ly,h,(s=this.attribute.animationExit)!==null&&s!==void 0?s:{}),update:W(this.attribute.animationUpdate)?this.attribute.animationUpdate:re({},ly,h,(r=this.attribute.animationUpdate)!==null&&r!==void 0?r:{})}}}}getRelatedGraphic(e){return this._idToGraphic.get(e.id)}_layout(e=[]){const{textStyle:t={},position:i,offset:s}=this.attribute,r=[];for(let a=0;a<e.length;a++){const o=e[a],l=this.getRelatedGraphic(o);if(!l)continue;const h=Object.assign(Object.assign({fill:this._isCollectionBase?W(l.attribute.stroke)?l.attribute.stroke.find(g=>!!g&&g!==!0):l.attribute.stroke:l.attribute.fill},t),o),d=this._createLabelText(h),u=this.getGraphicBounds(d),c=Y(i)?i(o):i,f=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(o.id),c):this.getGraphicBounds(l,{x:o.x,y:o.y},c),p=this.labeling(u,f,c,s);p&&(h.x=p.x,h.y=p.y,d.setAttributes(p)),r.push(d)}return r}_overlapping(e){var t,i,s,r;if(e.length===0)return[];const a=He(this.attribute.overlap)?this.attribute.overlap:{},o=[],l=this.getBaseMarkGroup(),h=(t=a.size)!==null&&t!==void 0?t:{width:(i=l==null?void 0:l.AABBBounds.width())!==null&&i!==void 0?i:0,height:(s=l==null?void 0:l.AABBBounds.height())!==null&&s!==void 0?s:0};if(h.width===0||h.height===0)return e;const{avoidBaseMark:d,strategy:u=[],hideOnHit:c=!0,clampForce:f=!0,avoidMarks:p=[],overlapPadding:g}=a,_=this._bmpTool||AR(h.width,h.height),m=this._bitmap||_.bitmap(),y=u.some(b=>b.type==="bound");d&&((r=this._baseMarks)===null||r===void 0||r.forEach(b=>{b.AABBBounds&&m.setRange(Cs(_,b.AABBBounds,!0))})),p.length>0&&p.forEach(b=>{ae(b)?d4(this.getRootNode(),b).forEach(v=>{v.AABBBounds&&m.setRange(Cs(_,v.AABBBounds,!0))}):b.AABBBounds&&m.setRange(Cs(_,b.AABBBounds,!0))});for(let b=0;b<e.length;b++){if(e[b].visible===!1)continue;const v=e[b],x=this.getRelatedGraphic(v.attribute);if(v.update(),!Dd(x.AABBBounds,{x1:0,x2:_.width,y1:0,y2:_.height},!0))continue;if(_f(_,m,v.AABBBounds,f,g)){if(!y){m.setRange(Cs(_,v.AABBBounds,!0)),o.push(v);continue}if(y&&x&&x.AABBBounds&&this._canPlaceInside(v.AABBBounds,x.AABBBounds)){m.setRange(Cs(_,v.AABBBounds,!0)),o.push(v);continue}}let S=!1;for(let A=0;A<u.length;A++)if(S=O4(_,m,u[A],this.attribute,v,this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(e[b].attribute.id)):this.getGraphicBounds(x,e[b].attribute),this.labeling),S!==!1){v.setAttributes({x:S.x,y:S.y}),o.push(v);break}if(!S&&f){const{dx:A=0,dy:k=0}=D4(v,_.width,_.height);if(A===0&&k===0){if(_f(_,m,v.AABBBounds)){m.setRange(Cs(_,v.AABBBounds,!0)),o.push(v);continue}}else if(_f(_,m,{x1:v.AABBBounds.x1+A,x2:v.AABBBounds.x2+A,y1:v.AABBBounds.y1+k,y2:v.AABBBounds.y2+k})){v.setAttributes({x:v.attribute.x+A,y:v.attribute.y+k}),m.setRange(Cs(_,v.AABBBounds,!0)),o.push(v);continue}}!S&&!c&&o.push(v)}return Y(this.onAfterLabelOverlap)&&this.onAfterLabelOverlap(m),o}getBaseMarkGroup(){const{baseMarkGroupName:e}=this.attribute;if(e)return this.getRootNode().find(t=>t.name===e,!0)}getGraphicBounds(e,t={}){if(e){if(e.attribute.visible!==!1)return e.AABBBounds;const{x:r,y:a}=e.attribute;return{x1:r,x2:r,y1:a,y2:a}}const{x:i,y:s}=t;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(e){this._enableAnimation===!1||this.attribute.animation===!1?this._renderWithOutAnimation(e):this._renderWithAnimation(e)}_renderWithAnimation(e){var t;const i=new Map,s=this._graphicToText||new Map,r=[],a=[],{visible:o}=(t=this.attribute.line)!==null&&t!==void 0?t:{};e.forEach((l,h)=>{const d=this.getRelatedGraphic(l.attribute),u=l.attribute.id,c=this._isCollectionBase?u:d,f=s!=null&&s.get(c)?"update":"enter";let p;if(o&&(p=this._createLabelLine(l,d)),f==="enter"){if(r.push(l),i.set(c,p?{text:l,labelLine:p}:{text:l}),d){const{from:g,to:_}=Gw(l.attribute,"fadeIn");this.add(l),p&&(a.push(p),this.add(p)),this._syncStateWithRelatedGraphic(d),this._animationConfig.enter.duration>0&&d.once("animate-bind",m=>{l.setAttributes(g),p&&p.setAttributes(g);const y=this._afterRelatedGraphicAttributeUpdate(l,r,p,a,h,d,_,this._animationConfig.enter);d.on("afterAttributeUpdate",y)})}}else if(f==="update"){const g=s.get(c);s.delete(c),i.set(c,g);const _=g.text,{duration:m,easing:y}=this._animationConfig.update;j4(_,l,this._animationConfig.update),g.labelLine&&p&&g.labelLine.animate().to(p.attribute,m,y)}}),s.forEach(l=>{var h;(h=l.text)===null||h===void 0||h.animate().to(Gw(l.text.attribute,"fadeOut").to,this._animationConfig.exit.duration,this._animationConfig.exit.easing).onEnd(()=>{this.removeChild(l.text),l.labelLine&&this.removeChild(l.labelLine)})}),this._graphicToText=i}_renderWithOutAnimation(e){var t;const i=new Map,s=this._graphicToText||new Map,{visible:r}=(t=this.attribute.line)!==null&&t!==void 0?t:{};e.forEach(a=>{const o=this.getRelatedGraphic(a.attribute),l=s!=null&&s.get(o)?"update":"enter",h=this._isCollectionBase?a.attribute.id:o;let d;if(r&&(d=this._createLabelLine(a,o)),l==="enter")i.set(h,d?{text:a,labelLine:d}:{text:a}),this.add(a),d&&this.add(d),this._syncStateWithRelatedGraphic(o);else if(l==="update"){const u=s.get(h);s.delete(h),i.set(h,u),u.text.setAttributes(a.attribute),u.labelLine&&d&&u.labelLine.setAttributes(d.attribute)}}),s.forEach(a=>{this.removeChild(a.text),a.labelLine&&this.removeChild(a.labelLine)}),this._graphicToText=i}_syncStateWithRelatedGraphic(e){this.attribute.syncState&&e.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(e,t,i,s,r,a,o,{mode:l,duration:h,easing:d,delay:u}){const c=f=>{var p,g,_;const{detail:m}=f;if(!m)return{};const y=(p=m.animationState)===null||p===void 0?void 0:p.step;if(!(m.type===kt.ANIMATE_UPDATE&&y&&!(y.type==="wait"&&((g=y.prev)===null||g===void 0?void 0:g.type)==null)))return{};if(m.type===kt.ANIMATE_END)return e.setAttributes(o),void(i&&i.setAttributes(o));const b=()=>{a&&(a.onAnimateBind=void 0,a.removeEventListener("afterAttributeUpdate",c))};switch(l){case"after":m.animationState.end&&(e.animate({onStart:b}).wait(u).to(o,h,d),i&&i.animate().wait(u).to(o,h,d));break;case"after-all":r===t.length-1&&m.animationState.end&&(t.forEach(v=>{v.animate({onStart:b}).wait(u).to(o,h,d)}),s.forEach(v=>{v.animate().wait(u).to(o,h,d)}));break;default:if(this._isCollectionBase){const v=this._idToPoint.get(e.attribute.id);!v||e.animates&&e.animates.has("label-animate")||!a.containsPoint(v.x,v.y,Hd.LOCAL,(_=this.stage)===null||_===void 0?void 0:_.pickerService)||(e.animate({onStart:b}).wait(u).to(o,h,d),i&&i.animate().wait(u).to(o,h,d))}else m.animationState.isFirstFrameOfStep&&(e.animate({onStart:b}).wait(u).to(o,h,d),i&&i.animate().wait(u).to(o,h,d))}};return c}_smartInvert(e){var t,i,s,r,a;const o=He(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:l,contrastRatiosThreshold:h,alternativeColors:d,mode:u}=o,c=(t=o.fillStrategy)!==null&&t!==void 0?t:"invertBase",f=(i=o.strokeStrategy)!==null&&i!==void 0?i:"base",p=(s=o.brightColor)!==null&&s!==void 0?s:"#ffffff",g=(r=o.darkColor)!==null&&r!==void 0?r:"#000000",_=(a=o.outsideEnable)!==null&&a!==void 0&&a;if(c!=="null"||f!=="null")for(let m=0;m<e.length;m++){const y=e[m];if(!y)continue;const b=this.getRelatedGraphic(y.attribute),v=b.attribute.fill,x=y.attribute.fill,S=v,A=Fw(x,v,l,h,d,u),k=f0(A,p)?p:g;if(_){const w=Mo(c,S,A,k);if(w&&y.setAttributes({fill:w}),y.attribute.lineWidth===0)continue;const M=Mo(f,S,A,k);M&&y.setAttributes({stroke:M})}else if(this._canPlaceInside(y.AABBBounds,b.AABBBounds)){const w=Mo(c,S,A,k);if(w&&y.setAttributes({fill:w}),y.attribute.lineWidth===0)continue;const M=Mo(f,S,A,k);M&&y.setAttributes({stroke:M})}else{if(y.attribute.lineWidth===0)continue;if(y.attribute.stroke){y.setAttributes({fill:Fw(y.attribute.fill,y.attribute.stroke,l,h,d,u)});continue}const w=Mo(c,S,A,k);w&&y.setAttributes({fill:w});const M=Mo(f,S,A,k);M&&y.setAttributes({stroke:M})}}}_canPlaceInside(e,t){return!(!e||!t)&&t.encloses(e)}setLocation(e){this.translateTo(e.x,e.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}$s.defaultAttributes={textStyle:{fontSize:12,textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},offset:0,pickable:!1};class G_ extends $s{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},G_.defaultAttributes,e)),this.name="symbol-label"}labeling(e,t,i="top",s=0){return kR(e,t,i,s)}}G_.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class su extends $s{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},su.defaultAttributes,e))}labeling(e,t,i="top",s=0){if(!e||!t)return;const{x1:r,y1:a,x2:o,y2:l}=e,h=Math.abs(o-r),d=Math.abs(l-a),u=Math.abs(t.x2-t.x1),c=Math.abs(t.y2-t.y1);let f=(t.x1+t.x2)/2,p=(t.y1+t.y2)/2,g=0,_=0;switch(i){case"top":case"inside-top":_=-.5;break;case"bottom":case"inside-bottom":_=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5;break;case"top-right":g=.5,_=-.5;break;case"top-left":g=-.5,_=-.5;break;case"bottom-right":g=.5,_=.5;break;case"bottom-left":g=-.5,_=.5}f+=g*u,p+=_*c;let m=0,y=0;const b=i.includes("inside");switch(i.includes("top")?y=b?1:-1:i.includes("bottom")?y=b?-1:1:i.includes("left")?m=b?1:-1:i.includes("right")&&(m=b?-1:1),i){case"top-right":case"bottom-right":m=-1;break;case"top-left":case"bottom-left":m=1}return{x:f+m*s+m*h/2,y:p+y*s+y*d/2}}}su.tag="rect-label",su.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};let MR=class TR extends $s{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},TR.defaultAttributes,e)),this.name="line-label"}getGraphicBounds(e,t={},i="end"){if(!e||e.type!=="line")return super.getGraphicBounds(e,t);const s=e.attribute.points||[t],r=i==="start"?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(e,t,i="end",s=0){return wR(e,t,i,s)}};MR.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"end",offset:6,pickable:!1};class Z4{constructor(e,t,i,s,r,a,o,l,h){this.refDatum=e,this.center=t,this.outerCenter=i,this.quadrant=s,this.radian=r,this.middleAngle=a,this.innerRadius=o,this.outerRadius=l,this.circleCenter=h,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class W_ extends $s{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},W_.defaultAttributes,e)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(e){return e}labeling(e,t,i="outside",s=0){if(e&&t)return{x:0,y:0}}_layout(e=[]){const t=super._layout(e),i=t.map(h=>this.getGraphicBounds(h)),s=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"}),r=this._createLabelText(s),a=this.getGraphicBounds(r),o=a.x2-a.x1,l=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),e,i,o);for(let h=0;h<e.length;h++){const d=e[h],u=l.find(c=>{var f;return((f=c.refDatum)===null||f===void 0?void 0:f.id)===d.id});if(u){const c={visible:u.labelVisible,x:u.labelPosition.x,y:u.labelPosition.y,angle:u.angle,maxLineWidth:u.labelLimit,points:u.pointA&&u.pointB&&u.pointC?[u.pointA,u.pointB,u.pointC]:void 0,line:u.labelLine};t[h].setAttributes(c)}}return t}layoutArcLabels(e,t,i,s,r,a){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=a;let o=0;i.forEach(u=>{u.attribute.outerRadius>o&&(o=u.attribute.outerRadius)}),s.forEach((u,c)=>{var f,p;const g=this._idToGraphic.get(u.id).attribute,_={x:(f=g==null?void 0:g.x)!==null&&f!==void 0?f:0,y:(p=g==null?void 0:g.y)!==null&&p!==void 0?p:0};if(!C(s[c])&&!C(r[c])){const m=s[c]?s[c]:null,y=r[c]?r[c]:{x1:0,x2:0,y1:0,y2:0},b=(g.startAngle+g.endAngle)/2,v=g.endAngle-g.startAngle,x=W4(g.endAngle-v/2),S=Vc(_.x,_.y,g.outerRadius,b),A=Vc(_.x,_.y,o+t.line.line1MinLength,b),k=new Z4(m,S,A,x,v,b,g.innerRadius,g.outerRadius,_);k.pointA=Vc(_.x,_.y,this.computeDatumRadius(2*_.x,2*_.y,g.outerRadius),k.middleAngle),k.labelSize={width:y.x2-y.x1,height:y.y2-y.y1},N4(k.quadrant)?this._arcRight.set(k.refDatum,k):Fa(k.quadrant)&&this._arcLeft.set(k.refDatum,k)}});const l=Array.from(this._arcLeft.values()),h=Array.from(this._arcRight.values()),d=[];switch(e){case"inside":case"inside-inner":case"inside-outer":d.push(...this._layoutInsideLabels(h,t,i)),d.push(...this._layoutInsideLabels(l,t,i));break;default:d.push(...this._layoutOutsideLabels(h,t,i)),d.push(...this._layoutOutsideLabels(l,t,i))}return d}_layoutInsideLabels(e,t,i){var s,r;const a=t,o=a.spaceWidth,l=(s=a.position)!==null&&s!==void 0?s:"inside",h=(r=a.offsetRadius)!==null&&r!==void 0?r:-o;return e.forEach(d=>{var u,c,f;const{labelSize:p,radian:g}=d,_=d.innerRadius,m=d.outerRadius;let y;if(g<$4(m,p.height))y=0;else{let w;w=g>=Math.PI?_:Math.max(_,p.height/2/Math.tan(g/2)),y=m-w-o}a.rotate!==!0&&(y=m-o);const b=this._getFormatLabelText(d.refDatum,y);d.labelText=b;const v=Math.min(y,d.labelSize.width),x=this._computeAlign(d,t);let S,A=0;l==="inside"&&(A=x==="left"?v:x==="right"?0:v/2),S=l==="inside-inner"?_-h+A:m+h-A,d.labelPosition=Vc(d.circleCenter.x,d.circleCenter.y,S,d.middleAngle),d.labelLimit=v,Ts(v,0)||(d.labelVisible=!1),d.angle=(c=(u=t.textStyle)===null||u===void 0?void 0:u.angle)!==null&&c!==void 0?c:d.middleAngle;let k=(f=a.offsetAngle)!==null&&f!==void 0?f:0;["inside-inner","inside-outer"].includes(l)&&(k+=Math.PI/2),d.angle+=k}),e}_layoutOutsideLabels(e,t,i){var s,r,a;const o=(s=i[0].attribute.x)!==null&&s!==void 0?s:0,l=2*((r=i[0].attribute.y)!==null&&r!==void 0?r:0),h=t.line.line2MinLength,d=t.layout,u=t.spaceWidth;if(e.forEach(f=>{const p=Fa(f.quadrant)?-1:1;f.labelPosition={x:f.outerCenter.x+p*(f.labelSize.width/2+h+u),y:f.outerCenter.y}}),e.sort((f,p)=>f.labelPosition.y-p.labelPosition.y),t.coverEnable!==!1||d.strategy==="none"){for(const f of e){const{labelPosition:p,labelSize:g}=f;f.labelLimit=g.width,f.pointB=Fa(f.quadrant)?{x:p.x+g.width/2+h+u,y:p.y}:{x:p.x-g.width/2-h-u,y:p.y},this._computeX(f,t,i)}t.coverEnable===!1&&d.strategy==="none"&&this._coverLabels(e)}else{const f=l/(((a=t.textStyle)===null||a===void 0?void 0:a.fontSize)||16);this._adjustY(e,f,t,i);const{minY:p,maxY:g}=e.reduce((y,b)=>{const{y1:v,y2:x}=b.getLabelBounds();return y.minY=Math.max(0,Math.min(v,y.minY)),y.maxY=Math.min(l,Math.max(x,y.maxY)),y},{minY:1/0,maxY:-1/0}),_=Math.max(Math.abs(l/2-p),Math.abs(g-l/2)),m=this._computeLayoutRadius(_,t,i);for(const y of e)this._computePointB(y,m,t,i),this._computeX(y,t,i)}const c=2*o;return e.forEach(f=>{var p,g;f.labelVisible&&(rs(f.pointB.x,h+u)||Ts(f.pointB.x,c-h-u))&&(f.labelVisible=!1),f.angle=(g=(p=t.textStyle)===null||p===void 0?void 0:p.angle)!==null&&g!==void 0?g:0,t.offsetAngle&&(f.angle+=t.offsetAngle),f.labelLine=Object.assign({},t.line)}),e}_computeX(e,t,i){var s;const r=e.circleCenter,a=2*r.x;r.y;let o=0;i.forEach(A=>{A.attribute.outerRadius>o&&(o=A.attribute.outerRadius)});const l=this.computeLayoutOuterRadius(o,t.width,t.height),h=t.line.line1MinLength,d=t.line.line2MinLength,u=(s=t.layout)===null||s===void 0?void 0:s.align,c=t.spaceWidth,{labelPosition:f,quadrant:p,pointB:g}=e;j(g.x*g.y)||(e.pointC={x:NaN,y:NaN},f.x=NaN,e.labelLimit=0);const _=this.computeRadius(l,t.width,t.height),m=Fa(p)?-1:1;let y=0,b=(m>0?a-g.x:g.x)-d-c;u==="labelLine"&&(y=(_+h+d)*m+r.x,b=(m>0?a-y:y)-c);const v=this._getFormatLabelText(e.refDatum,b);e.labelText=v;let x=Math.min(b,e.labelSize.width);switch(u){case"labelLine":break;case"edge":y=m>0?a-x-c:x+c;break;default:y=g.x+m*d}x=Math.max(this._ellipsisWidth,x),e.labelLimit=x,e.pointC={x:y,y:f.y};const S=.5*(e.labelLimit<e.labelSize.width?e.labelLimit:e.labelSize.width);u==="edge"?f.x=(m>0?a+0:0)-m*S:f.x=y+0+m*(c+S)}_computeAlign(e,t){var i,s,r,a,o,l;const h=t,d=(s=(i=h.textStyle)===null||i===void 0?void 0:i.textAlign)!==null&&s!==void 0?s:(r=h.textStyle)===null||r===void 0?void 0:r.align,u=(o=(a=h.layout)===null||a===void 0?void 0:a.textAlign)!==null&&o!==void 0?o:(l=h.layout)===null||l===void 0?void 0:l.align;return h.position!=="inside"?C(d)||d==="auto"?u==="edge"?Fa(e.quadrant)?"left":"right":Fa(e.quadrant)?"right":"left":d:C(d)||d==="auto"?"center":d}_getFormatLabelText(e,t){var i;return(i=e==null?void 0:e.text)!==null&&i!==void 0?i:""}_adjustY(e,t,i,s){var r;s[0].attribute.x;const a=2*((r=s[0].attribute.y)!==null&&r!==void 0?r:0),o=i.layout;if(o.strategy==="vertical"){let l,h=0;const d=e.length;if(d<=0)return;for(let c=0;c<d;c++){const{y1:f}=e[c].getLabelBounds();if(l=f-h,rs(l,0)){const g=this._shiftY(e,c,d-1,-l);this._shiftY(e,g,0,l/2)}const{y2:p}=e[c].getLabelBounds();h=p}const{y1:u}=e[0].getLabelBounds();l=u-0,rs(l,0)&&this._shiftY(e,0,d-1,-l);for(let c=e.length-1;c>=0&&e[c].getLabelBounds().y2>a;c--)e[c].labelVisible=!1}else if(o.strategy!=="none"){const l=e.map((u,c)=>({arc:u,originIndex:c,priorityIndex:0}));l.sort((u,c)=>c.arc.radian-u.arc.radian),l.forEach((u,c)=>{u.priorityIndex=c,u.arc.labelVisible=!1});let h=1/0,d=-1/0;for(let u=0;u<t&&u<e.length;u++){this._storeY(e);const c=l[u].arc;this._computeYRange(c,i,s),c.labelVisible=!0;const f=c.labelPosition.y,{lastIndex:p,nextIndex:g}=this._findNeighborIndex(e,l[u]),_=e[p],m=e[g];if(p===-1&&g!==-1){const x=m.labelPosition.y;f>x?c.labelPosition.y=x-m.labelSize.height/2-c.labelSize.height/2:this._twoWayShift(e,c,m,g)}else if(p!==-1&&g===-1){const x=_.labelPosition.y;f<x?c.labelPosition.y=x+_.labelSize.height/2+c.labelSize.height/2:this._twoWayShift(e,_,c,l[u].originIndex)}else if(p!==-1&&g!==-1){const x=_.labelPosition.y,S=m.labelPosition.y;f>S?(c.labelPosition.y=S-m.labelSize.height/2-c.labelSize.height/2,this._twoWayShift(e,_,c,l[u].originIndex)):f<x?(c.labelPosition.y=x+_.labelSize.height/2+c.labelSize.height/2,this._twoWayShift(e,c,m,g)):(this._twoWayShift(e,_,c,l[u].originIndex),this._twoWayShift(e,c,m,g))}const y=Math.min(h,l[u].originIndex),b=Math.max(d,l[u].originIndex);let v;if(v=e[b].getLabelBounds().y2-a,Ts(v,0)&&this._shiftY(e,b,0,-v),v=e[y].getLabelBounds().y1-0,rs(v,0)&&this._shiftY(e,y,e.length-1,-v),v=e[b].getLabelBounds().y2-a,Ts(v,0)){c.labelVisible=!1,this._restoreY(e);break}o.tangentConstraint&&!this._checkYRange(e)?(c.labelVisible=!1,this._restoreY(e)):(h=y,d=b)}}}_shiftY(e,t,i,s){const r=t<i?1:-1;let a=t;for(;a!==-1;){e[a].labelPosition.y+=s;const o=this._findNextVisibleIndex(e,a,i,r);if(o>=0&&o<e.length){const{y1:l,y2:h}=e[a].getLabelBounds(),{y1:d,y2:u}=e[o].getLabelBounds();if(r>0&&h<d||r<0&&l>u)return a}a=o}return i}_findNextVisibleIndex(e,t,i,s){const r=(i-t)*s;for(let a=1;a<=r;a++){const o=t+a*s;if(e[o].labelVisible)return o}return-1}_computePointB(e,t,i,s){const r=i;let a=0;s.forEach(h=>{h.attribute.outerRadius>a&&(a=h.attribute.outerRadius)});const o=this.computeLayoutOuterRadius(a,i.width,i.height),l=r.line.line1MinLength;if(r.layout.strategy==="none")e.pointB={x:e.outerCenter.x,y:e.outerCenter.y};else{const h=e.circleCenter,d=this.computeRadius(o,i.width,i.height),{labelPosition:u,quadrant:c}=e,f=t-Math.max(d+l,e.outerRadius),p=Math.sqrt(t**2-Math.abs(h.y-u.y)**2)-f;j(p)?e.pointB={x:h.x+p*(Fa(c)?-1:1),y:u.y}:e.pointB={x:NaN,y:NaN}}}_storeY(e){for(const t of e)t.labelVisible&&(t.lastLabelY=t.labelPosition.y)}_computeYRange(e,t,i){const s=e.circleCenter,r={width:2*s.x,height:2*s.y};let a=0;i.forEach(x=>{x.attribute.outerRadius>a&&(a=x.attribute.outerRadius)});const o=this.computeLayoutOuterRadius(a,t.width,t.height),l=t.line.line1MinLength,{width:h,height:d}=r,u=this.computeRadius(o,t.width,t.height),c=this._computeLayoutRadius(d/2,t,i),f=Math.abs(e.center.x-h/2),p=e.center.y-d/2;let g,_,m;if(Qi(h/2,f))g=0,_=1,m=-p;else if(Qi(d/2,p))g=1,_=0,m=-f;else{const x=-1/(p/f);g=x,_=-1,m=p-x*f}const y=U4(g,_,m,l+u-c,0,c);if(y.length<2)return;let b,v;y[0].x>y[1].x&&y.reverse(),y[0].x<0?Qi(y[0].y,y[1].y)?Ts(e.middleAngle,-Math.PI)&&rs(e.middleAngle,0)||Ts(e.middleAngle,Math.PI)&&rs(e.middleAngle,2*Math.PI)?(b=0,v=y[1].y+d/2):(b=y[1].y+d/2,v=d):y[0].y<y[1].y?(b=0,v=y[1].y+d/2):(b=y[1].y+d/2,v=r.height):(b=Math.min(y[0].y,y[1].y)+d/2,v=Math.max(y[0].y,y[1].y)+d/2),e.labelYRange=[b,v]}_computeLayoutRadius(e,t,i){const s=t,r=s.layoutArcGap,a=s.line.line1MinLength;let o=0;i.forEach(u=>{u.attribute.outerRadius>o&&(o=u.attribute.outerRadius)});const l=this.computeLayoutOuterRadius(o,t.width,t.height),h=this.computeRadius(l,t.width,t.height)+a,d=h-r;return Math.max((d**2+e**2)/(2*d),h)}_findNeighborIndex(e,t){const i=t.originIndex;let s=-1,r=-1;for(let a=i-1;a>=0;a--)if(e[a].labelVisible){s=a;break}for(let a=i+1;a<e.length;a++)if(e[a].labelVisible){r=a;break}return{lastIndex:s,nextIndex:r}}_twoWayShift(e,t,i,s){const r=i.getLabelBounds().y1-t.getLabelBounds().y2;if(rs(r,0)){const a=this._shiftY(e,s,e.length-1,-r);this._shiftY(e,a,0,r/2)}}_restoreY(e){for(const t of e)t.labelVisible&&(t.labelPosition.y=t.lastLabelY)}_checkYRange(e){for(const t of e){const{labelYRange:i,labelPosition:s}=t;if(t.labelVisible&&i&&(rs(s.y,i[0])||Ts(s.y,i[1])))return!1}return!0}_coverLabels(e){if(e.length<=1)return;let t=e[0].getLabelBounds();for(let i=1;i<e.length;i++){const s=e[i].getLabelBounds();Y4(t,s)?e[i].labelVisible=!1:t=s}}_createLabelLine(e,t){var i,s,r,a,o,l,h;const{points:d,line:u={},visible:c,fill:f}=e.attribute,p=e.attribute.points?ce.line({visible:(r=(i=u.visible&&c)!==null&&i!==void 0?i:(s=e.attribute)===null||s===void 0?void 0:s.visible)===null||r===void 0||r,stroke:(o=(a=u.style)===null||a===void 0?void 0:a.stroke)!==null&&o!==void 0?o:f,lineWidth:(h=(l=u.style)===null||l===void 0?void 0:l.lineWidth)!==null&&h!==void 0?h:1,points:d,curveType:u.smooth?"basis":null}):void 0;return p&&this._setStatesOfLabelLine(p),p}computeRadius(e,t,i,s){return this.computeLayoutRadius(t||0,i||0)*e*(C(s)?1:s)}computeLayoutRadius(e,t){return Math.min(e/2,t/2)}_canPlaceInside(e,t){return this.attribute.position==="inside"}computeLayoutOuterRadius(e,t,i){return e/(Math.min(t,i)/2)}computeDatumRadius(e,t,i){const s=this.computeLayoutOuterRadius(i,e,t);return this.computeLayoutRadius(e||0,t||0)*s}}W_.defaultAttributes={coverEnable:!1,spaceWidth:5,layoutArcGap:6,textStyle:{visible:!0,fontSize:14,fontWeight:"normal",fillOpacity:1,textAlign:"center",textBaseline:"middle"},position:"outside",offset:0,line:{visible:!0,line1MinLength:20,line2MinLength:10},layout:{align:"arc",strategy:"priority",tangentConstraint:!0},pickable:!1};class V_ extends $s{constructor(e){super(re({},V_.defaultAttributes,e)),this.name="line-label"}getGraphicBounds(e,t={},i="end"){var s;if(e.type!=="area")return super.getGraphicBounds(e,t);const r=((s=e==null?void 0:e.attribute)===null||s===void 0?void 0:s.points)||[t],a=i==="start"?0:r.length-1;return{x1:r[a].x,x2:r[a].x,y1:r[a].y,y2:r[a].y}}labeling(e,t,i="end",s=0){return wR(e,t,i,s)}}V_.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"end",offset:6,pickable:!1};class N_ extends $s{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},N_.defaultAttributes,e)),this.name="line-data-label"}labeling(e,t,i="top",s=0){return kR(e,t,i,s)}}N_.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};const J4={rect:su,symbol:G_,arc:W_,line:MR,area:V_,"line-data":N_};class U_ extends ti{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},U_.defaultAttributes,e)),this.name="data-label"}render(){var e;const{dataLabels:t,size:i}=this.attribute;if(!t||t.length===0)return;const{width:s=0,height:r=0}=i||{};if(!s||!r||!j(r*s))return;this._componentMap||(this._componentMap=new Map);const a=AR(s,r),o=a.bitmap(),l=new Map,h=this._componentMap;for(let d=0;d<t.length;d++){const u=t[d],c=J4[u.type]||$s;{const{baseMarkGroupName:f,type:p}=u,g=(e=u.id)!==null&&e!==void 0?e:`${f}-${p}-${d}`;let _=this._componentMap.get(g);_?(_.setBitmapTool(a),_.setBitmap(o),_.setAttributes(u),l.set(g,_)):(_=new c(u),_.setBitmap(o),_.setBitmapTool(a),this.add(_),l.set(g,_))}}h.forEach((d,u)=>{l.get(u)||this.removeChild(d)}),this._componentMap=l}setLocation(e){this.translateTo(e.x,e.y)}disableAnimation(){this._componentMap.forEach(e=>{e.disableAnimation()})}enableAnimation(){this._componentMap.forEach(e=>{e.enableAnimation()})}}U_.defaultAttributes={pickable:!1};function p0(){zt(),Ca(),L_(),xs()}p0();class kh extends ti{getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(e,t){super(t!=null&&t.skipDefault?e:re({},kh.defaultAttributes,e)),this.name="segment"}render(){this.removeAllChild(),this._reset();const{startSymbol:e,endSymbol:t,lineStyle:i,state:s,visible:r=!0,multiSegment:a,mainSegmentIndex:o}=this.attribute;if(!r)return;this._computeLineAngle();const l=this._renderSymbol(e,"start"),h=this._renderSymbol(t,"end");if(this.startSymbol=l,this.endSymbol=h,a){const d=[...this.attribute.points];if(j(o))d[o]=this._clipPoints(d[o]);else{const u=this._clipPoints(Dy(d));d[0][0]=u[0],d[d.length-1][d[d.length-1].length-1]=u[u.length-1]}d.forEach((u,c)=>{var f,p;const g=ce.line(Object.assign(Object.assign({points:u},W(i)?(f=i[c])!==null&&f!==void 0?f:i[i.length-1]:i),{fill:!1}));g.name=`${this.name}-line`,g.id=this._getNodeId("line"+c),fe(s==null?void 0:s.line)||(g.states=W(s.line)?(p=s.line[c])!==null&&p!==void 0?p:s.line[s.line.length-1]:s.line),this.add(g)})}else{const d=ce.polygon(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},N(i)[0]),{fill:!1,closePath:!1}));d.name=`${this.name}-line`,d.id=this._getNodeId("line"),fe(s==null?void 0:s.line)||(d.states=[].concat(s.line)[0]),this.add(d)}}_renderSymbol(e,t){const i=this._getMainSegmentPoints();if(!i.length)return;const{autoRotate:s=!0}=e;let r;if(e&&e.visible){const a=this._startAngle,o=this._endAngle,{state:l}=this.attribute,h=i[0],d=i[i.length-1],{refX:u=0,refY:c=0,refAngle:f=0,style:p,symbolType:g,size:_=12}=e;let m,y;t==="start"?(m={x:h.x+(j(a)?u*Math.cos(a)+c*Math.cos(a-Math.PI/2):0),y:h.y+(j(a)?u*Math.sin(a)+c*Math.sin(a-Math.PI/2):0)},y=a+Math.PI/2):(m={x:d.x+(j(o)?u*Math.cos(o)+c*Math.cos(o-Math.PI/2):0),y:d.y+(j(o)?u*Math.sin(o)+c*Math.sin(o-Math.PI/2):0)},y=o+Math.PI/2),r=ce.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:_,angle:s?y+f:0,strokeBoundsBuffer:0}),p)),r.name=`${this.name}-${t}-symbol`,r.id=this._getNodeId(`${t}-symbol`),fe(l==null?void 0:l.symbol)||(r.states=l.symbol),this.add(r)}return r}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:e,multiSegment:t,mainSegmentIndex:i}=this.attribute;let s;return s=t?j(i)?e[i]:Dy(e):e,this._mainSegmentPoints=s,s}_clipPoints(e){const{startSymbol:t={},endSymbol:i={}}=this.attribute;let s=e;if(t.visible){const r=t.clip?t.size||10:0;s=[{x:e[0].x-r/2*(Math.cos(this._startAngle)||0),y:e[0].y-r/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const r=i.clip?i.size||10:0,a={x:e[e.length-1].x-r/2*(Math.cos(this._endAngle)||0),y:e[e.length-1].y-r/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),a]}return s}_computeLineAngle(){const e=this._getMainSegmentPoints();if(e.length<=1)return;const t=e[0],i=e[1],s=e[e.length-2],r=e[e.length-1],a=[t.x-i.x,t.y-i.y],o=Math.atan2(a[1],a[0]),l=[r.x-s.x,r.y-s.y],h=Math.atan2(l[1],l[0]);this._startAngle=o,this._endAngle=h}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}kh.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}};var Fi;(function(n){n.innerView="inner-view",n.axisContainer="axis-container",n.labelContainer="axis-label-container",n.tickContainer="axis-tick-container",n.tick="axis-tick",n.subTick="axis-sub-tick",n.label="axis-label",n.title="axis-title",n.gridContainer="axis-grid-container",n.grid="axis-grid",n.gridRegion="axis-grid-region",n.line="axis-line",n.background="axis-background",n.axisLabelBackground="axis-label-background"})(Fi||(Fi={}));var Zo;(function(n){n.selected="selected",n.selectedReverse="selected_reverse",n.hover="hover",n.hoverReverse="hover_reverse"})(Zo||(Zo={}));const Es={[Zo.selectedReverse]:{},[Zo.selected]:{},[Zo.hover]:{},[Zo.hoverReverse]:{}},ag={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}};class CR extends ti{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=e=>{const t=e.target;t!==this._lastHover&&t.name&&!fe(t.states)&&(t.addState(Dt.hover,!0),fs(this.axisContainer,i=>{i!==t&&i.name&&!fe(i.states)&&i.addState(Dt.hoverReverse,!0)}),this._lastHover=t)},this._onUnHover=e=>{this._lastHover&&(fs(this.axisContainer,t=>{t.name&&!fe(t.states)&&(t.removeState(Dt.hoverReverse),t.removeState(Dt.hover))}),this._lastHover=null)},this._onClick=e=>{const t=e.target;if(this._lastSelect===t&&t.hasState(Dt.selected))return this._lastSelect=null,void fs(this.axisContainer,i=>{i.name&&!fe(i.states)&&(i.removeState(Dt.selectedReverse),i.removeState(Dt.selected))});t.name&&!fe(t.states)&&(t.addState(Dt.selected,!0),fs(this.axisContainer,i=>{i!==t&&i.name&&!fe(i.states)&&i.addState(Dt.selectedReverse,!0)}),this._lastSelect=t)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(e){const t=ri(this.attribute);re(this.attribute,e);const i=ce.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=t,i.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=ce.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:e,select:t}=this.attribute;e&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),t&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(e){const{title:t,label:i,tick:s,line:r,items:a}=this.attribute,o=ce.group({x:0,y:0,zIndex:1});if(o.name=Fi.axisContainer,o.id=this._getNodeId("container"),o.setMode(this.mode),this.axisContainer=o,e.add(o),r&&r.visible&&this.renderLine(o),a&&a.length&&(this.data=this._transformItems(a[0]),s&&s.visible&&this.renderTicks(o),i&&i.visible)){const l=ce.group({x:0,y:0,pickable:!1});l.name=Fi.labelContainer,l.id=this._getNodeId("label-container"),this.axisLabelsContainer=l,o.add(l),a.forEach((h,d)=>{const u=this.renderLabels(l,h,d),c=u.getChildren();this.beforeLabelsOverlap(c,h,u,d,a.length),this.handleLabelsOverlap(c,h,u,d,a.length),this.afterLabelsOverlap(c,h,u,d,a.length);let f=0,p=0,g="center",_="middle";c.forEach(m=>{var y;const b=m.attribute,v=(y=b.angle)!==null&&y!==void 0?y:0,x=m.AABBBounds;let S=x.width(),A=x.height();v&&(S=Math.abs(S*Math.cos(v)),A=Math.abs(A*Math.sin(v))),f=Math.max(f,S),p=Math.max(p,A),g=b.textAlign,_=b.textBaseline}),this.axisLabelLayerSize[d]={width:f,height:p,textAlign:g,textBaseline:_}})}t&&t.visible&&this.renderTitle(o)}renderTicks(e){const t=this.getTickLineItems(),i=ce.group({x:0,y:0,pickable:!1});i.name=Fi.tickContainer,i.id=this._getNodeId("tick-container"),e.add(i),t.forEach((r,a)=>{var o;const l=ce.line(Object.assign({},this._getTickLineAttribute("tick",r,a,t)));if(l.name=Fi.tick,l.id=this._getNodeId(r.id),fe((o=this.attribute.tick)===null||o===void 0?void 0:o.state))l.states=To;else{const h=this.data[a],d=re({},To,this.attribute.tick.state);Object.keys(d).forEach(u=>{Y(d[u])&&(d[u]=d[u](h.rawValue,a,h,this.data))}),l.states=d}i.add(l)}),this.tickLineItems=t;const{subTick:s}=this.attribute;if(s&&s.visible){const r=this.getSubTickLineItems();r.length&&r.forEach((a,o)=>{const l=ce.line(Object.assign({},this._getTickLineAttribute("subTick",a,o,t)));if(l.name=Fi.subTick,l.id=this._getNodeId(`${o}`),fe(s.state))l.states=To;else{const h=re({},To,s.state);Object.keys(h).forEach(d=>{Y(h[d])&&(h[d]=h[d](a.value,o,a,t))}),l.states=h}i.add(l)}),this.subTickLineItems=r}}renderLabels(e,t,i){const{dataFilter:s}=this.attribute.label;s&&Y(s)&&(t=s(t,i));const r=this._transformItems(t),a=ce.group({x:0,y:0,pickable:!1});return a.name=`${Fi.labelContainer}-layer-${i}`,a.id=this._getNodeId(`label-container-layer-${i}`),e.add(a),r.forEach((o,l)=>{var h,d,u;const c=this._getLabelAttribute(o,l,r,i);let f;if(c.type==="rich"?(c.textConfig=c.text,c.width=(h=c.width)!==null&&h!==void 0?h:0,c.height=(d=c.height)!==null&&d!==void 0?d:0,f=ce.richtext(c)):c.type==="html"?(c.textConfig=[],c.html=Object.assign(Object.assign({dom:c.text},br),c),f=ce.richtext(c)):f=ce.text(c),f.name=Fi.label,f.id=this._getNodeId(`layer${i}-label-${o.id}`),fe((u=this.attribute.label)===null||u===void 0?void 0:u.state))f.states=To;else{const p=re({},To,this.attribute.label.state);Object.keys(p).forEach(g=>{Y(p[g])&&(p[g]=p[g](o,l,r,i))}),f.states=p}a.add(f)}),a}renderTitle(e){const t=this.getTitleAttribute(),i=new Ss(Object.assign({},t));i.name=Fi.title,i.id=this._getNodeId("title"),e.add(i)}getVerticalCoord(e,t,i){const s=this.getVerticalVector(t,i,e);return{x:e.x+s[0],y:e.y+s[1]}}getTextAlign(e){let t="center";return Qi(e[0],0)?Qi(e[1],0)?Object.is(e[1],-0)?t="start":Object.is(e[0],-0)&&(t="end"):t="center":e[0]>0?t="start":e[0]<0&&(t="end"),t}getTickLineItems(){const{tick:e}=this.attribute,t=this.data,i=[],{alignWithLabel:s,inside:r=!1,length:a,dataFilter:o}=e;let l=1;return t.length>=2&&(l=t[1].value-t[0].value),(o&&Y(o)?o(t):t).forEach(h=>{let d=h.point,u=h.value;if(!s){const f=h.value-l/2;if(this.isInValidValue(f))return;d=this.getTickCoord(f),u=f}const c=this.getVerticalCoord(d,a,r);if(this.mode==="3d"){const f=this.getVerticalVector(a,r,d);let p=0,g=0;Ve(f[0])>Ve(f[1])?p=et/2*(c.x>d.x?1:-1):g=et/2*(c.y>d.y?-1:1),i.push({start:d,end:c,value:u,id:`tick-${h.id}`,anchor:[d.x,d.y],alpha:p,beta:g})}else i.push({start:d,end:c,value:u,id:`tick-${h.id}`})}),i}getSubTickLineItems(){const{subTick:e}=this.attribute,t=[],{count:i=4,inside:s=!1,length:r=2}=e,a=this.tickLineItems,o=a.length;if(o>=2)for(let l=0;l<o-1;l++){const h=a[l],d=a[l+1];for(let u=0;u<i;u++){const c=(u+1)/(i+1),f=(1-c)*h.value+c*d.value,p=this.getTickCoord(f),g=this.getVerticalCoord(p,r,s);t.push({start:p,end:g,value:f,id:`sub-tick-${f}`})}}return t}_getTickLineAttribute(e,t,i,s){let r=Te(this.attribute,`${e}.style`);const a=this.data[i];r=Y(r)?re({},Te(ag,`${e}.style`),e==="tick"?r(a.rawValue,i,a,this.data):r(t.value,i,t,s)):r;const{start:o,end:l,anchor:h,alpha:d,beta:u}=t;return Object.assign({points:[o,l],anchor:h,alpha:d,beta:u},r)}_getLabelAttribute(e,t,i,s){var r,a;const{space:o=4,inside:l=!1,formatMethod:h,type:d="text",text:u}=this.attribute.label;let c=o,f=0;!((r=this.attribute.tick)===null||r===void 0)&&r.visible&&this.attribute.tick.inside===l&&(f=this.attribute.tick.length||4),!((a=this.attribute.subTick)===null||a===void 0)&&a.visible&&this.attribute.subTick.inside===l&&(f=Math.max(f,this.attribute.subTick.length||2)),c+=f;const p=this.getRelativeVector(e.point);s>0&&(p[1]===0?c+=(this.axisLabelLayerSize[s-1].height+Te(this.attribute,"label.space",4))*s:c+=(this.axisLabelLayerSize[s-1].width+Te(this.attribute,"label.space",4))*s);const g=this.getVerticalCoord(e.point,c,l),_=this.getVerticalVector(c||1,l,g),m=h?h(`${e.label}`,e,t,i,s):e.label;let{style:y}=this.attribute.label;y=Y(y)?re({},ag.label.style,y(e,t,i,s)):y;const b=this.getLabelAlign(_,l,y.angle);return y=re(b,y),Y(y.text)&&(y.text=y.text({label:e.label,value:e.rawValue,index:e.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(g,_,m,y)),{text:u??m,lineHeight:y==null?void 0:y.fontSize,type:d}),y)}getLabelPosition(e,t,i,s){return e}_transformItems(e){const t=[];return e.forEach(i=>{var s;t.push(Object.assign(Object.assign({},i),{point:this.getTickCoord(i.value),id:(s=i.id)!==null&&s!==void 0?s:i.label}))}),t}}function Q4(n,e,t,i,s){return{x:(n-i)*Math.cos(t)+(e-s)*Math.sin(t)+i,y:(n-i)*Math.sin(t)+(s-e)*Math.cos(t)+s}}function e$(n){const e=n.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:n.attribute.x,centerY:n.attribute.y,angle:n.attribute.angle}}function PR(n){n.forEach(e=>{if(e.rotatedBounds||!e.attribute.angle)return;const t=e$(e),i=Q4(t.centerX,t.centerY,t.angle,e.attribute.x,e.attribute.y),s=i.x-t.centerX,r=i.y-t.centerY;t.x1+=s,t.x2+=s,t.y1+=r,t.y2+=r,t.centerX+=s,t.centerY+=r,e.rotatedBounds=t})}function t$(n,e){return Dd(n.AABBBounds,e.AABBBounds,!1)&&(!n.rotatedBounds||!e.rotatedBounds||CD(n.rotatedBounds,e.rotatedBounds,!0))}const Nw={parity:function(n){return n.filter((e,t)=>t%2?e.setAttribute("opacity",0):1)},greedy:function(n,e){let t;return n.filter((i,s)=>s&&g0(t,i,e)?i.setAttribute("opacity",0):(t=i,1))}};function g0(n,e,t){const i=n.AABBBounds,s=e.AABBBounds;return t>Math.max(s.x1-i.x2,i.x1-s.x2,s.y1-i.y2,i.y1-s.y2)&&(!n.rotatedBounds||!e.rotatedBounds||t>Math.max(e.rotatedBounds.x1-n.rotatedBounds.x2,n.rotatedBounds.x1-e.rotatedBounds.x2,e.rotatedBounds.y1-n.rotatedBounds.y2,n.rotatedBounds.y1-e.rotatedBounds.y2))}function Uw(n,e){for(let t,i=1,s=n.length,r=n[0];i<s;r=t,++i)if(g0(r,t=n[i],e))return!0}function i$(n){const e=n.AABBBounds;return e.width()>1&&e.height()>1}function n$(n){return n.forEach(e=>e.setAttribute("opacity",1)),n}function s$(n,e){if(fe(n))return;const t=n.filter(i$);if(fe(t))return;let i;i=n$(t),PR(i);const{method:s="parity",separation:r=0}=e,a=Y(s)?s:Nw[s]||Nw.parity;if(i.length>=3&&Uw(i,r)){do i=a(i,r);while(i.length>=3&&Uw(i,r));if(i.length<3||e.lastVisible){const o=ra(t);if(!o.attribute.opacity){const l=i.length;if(l>1){o.setAttribute("opacity",1);for(let h=l-1;h>=0&&g0(i[h],o,r);h--)i[h].setAttribute("opacity",0)}}}}t.forEach(o=>{o.setAttribute("visible",!!o.attribute.opacity)})}function r$(n,e){if(fe(n))return;const{orient:t,labelRotateAngle:i=[0,45,90]}=e;if(i.length===0||n.some(a=>!!a.attribute.angle))return;let s=0,r=0;for(i&&i.length>0&&(r=i.length);s<r;){const a=i[s++];if(n.forEach(o=>{o.attribute.angle=st(a)}),o$(t,n),!a$(n))break}}function a$(n){for(let e=1;e<n.length;e++)if(t$(n[e-1],n[e]))return!0;return!1}function o$(n,e){n!=="bottom"&&n!=="top"||h$(n,e),n!=="left"&&n!=="right"||l$(n,e),PR(e)}function $_(n=0){if(n<0)for(;n<0;)n+=2*Math.PI;if(n>0)for(;n>=2*Math.PI;)n-=2*Math.PI;return n}function l$(n,e){e.forEach((t,i)=>{t.attribute.angle&&t.setAttributes(Object.assign(Object.assign({},RR(n,t.attribute.angle)),{angle:$_(t.attribute.angle)}))})}function h$(n,e){e.forEach(t=>{t.attribute.angle&&t.setAttributes(Object.assign(Object.assign({},ER(n,t.attribute.angle)),{angle:$_(t.attribute.angle)}))})}function ER(n,e=0){let t=["center","left","left","left","center","right","right","right","left"],i=["top","top","middle","bottom","bottom","bottom","middle","top","top"];n==="top"&&(t=["center","right","right","right","center","left","left","left","right"],i=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=$_(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:t[r],textBaseline:i[r]}}function RR(n,e=0){let t=["right","right","center","left","center","left","center","right","right"],i=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];n==="right"&&(t=["left","right","right","right","left","left","left","left","right"],i=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=$_(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:t[r],textBaseline:i[r]}}function d$(n,e){const{limitLength:t,verticalLimitLength:i,ellipsis:s="...",orient:r}=e;!fe(n)&&j(t)&&n.forEach(a=>{if((r==="top"||r==="bottom")&&Math.floor(a.AABBBounds.height())<=t)return;const o=a.attribute.direction;if((r==="left"||r==="right")&&(o==="vertical"&&Math.floor(a.AABBBounds.height())<=i||o!=="vertical"&&Math.floor(a.AABBBounds.width())<=t))return;const l=a.attribute.angle;let h=l===0||C(l)?r==="top"||r==="bottom"?null:o==="vertical"?i:t:Math.abs(t/Math.sin(l));j(a.attribute.maxLineWidth)&&(h=j(h)?Math.min(a.attribute.maxLineWidth,h):a.attribute.maxLineWidth),a.setAttributes({maxLineWidth:h,ellipsis:a.attribute.ellipsis||s})})}function u$(n,e,t,i,s){if(i==="right"||i==="left"){if(s==="left"){const r=i==="right"?0:-1;n.forEach(a=>{a.setAttributes({x:e+t*r,textAlign:"left"})})}else if(s==="right"){const r=i==="right"?1:0;n.forEach(a=>{a.setAttributes({x:e+t*r,textAlign:"right"})})}else if(s==="center"){const r=i==="right"?1:-1;n.forEach(a=>{a.setAttributes({x:e+.5*t*r,textAlign:"center"})})}}else if(i==="bottom"||i==="top"){if(s==="top"){const r=i==="bottom"?0:-1;n.forEach(a=>{a.setAttributes({y:e+t*r,textBaseline:"top"})})}else if(s==="bottom"){const r=i==="bottom"?1:0;n.forEach(a=>{a.setAttributes({y:e+t*r,textBaseline:"bottom"})})}else if(s==="middle"){const r=i==="bottom"?1:-1;n.forEach(a=>{a.setAttributes({y:e+.5*t*r,textBaseline:"middle"})})}}}class OR{isInValidValue(e){return e<0||e>1}getTickCoord(e){const{start:t}=this.attribute,i=this.getRelativeVector();return{x:t.x+i[0]*e,y:t.y+i[1]*e}}getRelativeVector(e){const{start:t,end:i}=this.attribute;return[i.x-t.x,i.y-t.y]}getVerticalVector(e,t=!1,i){const{verticalFactor:s=1}=this.attribute,r=this.getRelativeVector(),a=p4(r),o=[a[1],-1*a[0]];return bR(o,e*(t?1:-1)*s)}}function BR(){zt(),Ca(),Pa(),Ea()}function c$(){BR(),kr()}function f$(){BR(),s4()}function p$(){zt(),Xu()}function g$(){zt(),Xu()}var $w=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};c$();class ru extends CR{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},ru.defaultAttributes,e),t)}_renderInner(e){var t;super._renderInner(e);const{panel:i}=this.attribute;if(i&&i.visible){const s=this.axisContainer,r=s.AABBBounds,a=ce.rect(Object.assign({x:r.x1,y:r.y1,width:r.width(),height:r.height()},i.style));a.name=Fi.background,a.id=this._getNodeId("background"),a.states=re({},Es,(t=i.state)!==null&&t!==void 0?t:{}),s.insertBefore(a,s.firstChild)}}renderLine(e){const{start:t,end:i,line:s}=this.attribute,r=s,{startSymbol:a,endSymbol:o,style:l,breakRange:h,breakShape:d,breakShapeStyle:u,state:c}=r,f=$w(r,["startSymbol","endSymbol","style","breakRange","breakShape","breakShapeStyle","state"]),p=Object.assign({points:[t,i],startSymbol:a,endSymbol:o,lineStyle:l},f);fe(c)||(p.state={line:re({},Es,c),symbol:re({},Es,c)});const g=new kh(p);g.name=Fi.line,g.id=this._getNodeId("line"),e.add(g)}getTitleAttribute(){var e,t,i;const s=this.attribute.title,{position:r="middle",space:a=4,textStyle:o={},autoRotate:l=!0,shape:h,background:d,state:u={}}=s,c=$w(s,["position","space","textStyle","autoRotate","shape","background","state"]);let f=.5;r==="start"?f=0:r==="end"&&(f=1);const{verticalFactor:p=1}=this.attribute,g=-1*p,_=this.getTickCoord(f),m=this.getRelativeVector();let y=0;if(!((e=this.attribute.label)===null||e===void 0)&&e.visible&&this.attribute.label.inside===!1){const T=+Te(this.attribute,"label.space",4);y+=T;const E=Object.keys(this.axisLabelLayerSize).length;if(m[1]===0){const O=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(O)?y+=O+(E-1)*T:y=0}else{if(m[0]===0){const I=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.width():0;isFinite(I)?y+=I+(E-1)*T:y=0}else Object.keys(this.axisLabelLayerSize).forEach((I,F)=>{y+=this.axisLabelLayerSize[I].width+(F>0?T:0)});const O=this.axisLabelLayerSize[0].textAlign,B=O==="start"||O==="left",R=O==="center",L=m[1]>0;y=g===1?L?B?y:R?y/2:T:B?T:R?y/2:y:L?B?T:R?y/2:y:B?y:R?y/2:T}}let b=0;!((t=this.attribute.tick)===null||t===void 0)&&t.visible&&this.attribute.tick.inside===!1&&(b=this.attribute.tick.length||4),!((i=this.attribute.subTick)===null||i===void 0)&&i.visible&&this.attribute.subTick.inside===!1&&(b=Math.max(b,this.attribute.subTick.length||2));const v=b+y+a,x=this.getVerticalCoord(_,v,!1),S=this.getVerticalVector(v,!1,{x:0,y:0});let A,k,{angle:w}=c;if(A=r==="start"?"start":r==="end"?"end":"center",C(w)&&l){w=m4(m,[1,0],!0);const{verticalFactor:T=1}=this.attribute;k=-1*T===1?"bottom":"top"}else A=this.getTextAlign(S),k=this.getTextBaseline(S,!1);const M=Object.assign(Object.assign(Object.assign({},x),c),{textStyle:Object.assign({textAlign:A,textBaseline:k},o),state:{text:re({},Es,u.text),shape:re({},Es,u.shape),panel:re({},Es,u.background)}});return M.angle=w,h&&h.visible&&(M.shape=Object.assign({visible:!0},h.style),h.space&&(M.space=h.space)),d&&d.visible&&(M.panel=Object.assign({visible:!0},d.style)),M}getTextBaseline(e,t){let i="middle";const{verticalFactor:s=1}=this.attribute,r=(t?1:-1)*s;return Qi(e[1],0)?i=!Qi(e[0],0)||Object.is(e[0],-0)||Object.is(e[1],-0)?"middle":r===1?"bottom":"top":e[1]>0?i="top":e[1]<0&&(i="bottom"),i}getLabelAlign(e,t,i){const s=this.attribute.orient;if(j(i)||e[0]===0&&e[1]===0){if(s==="top"||s==="bottom")return ER(s,i);if(s==="left"||s==="right")return RR(s,i)}return{textAlign:this.getTextAlign(e),textBaseline:this.getTextBaseline(e,t)}}beforeLabelsOverlap(e,t,i,s,r){var a,o,l,h;const{flush:d=!1}=this.attribute.label||{};if(d&&e.length){const{orient:u,start:c,end:f}=this.attribute,p=u==="bottom"||u==="top",g=e[0],_=ra(e),m=p?g.attribute.x>_.attribute.x:g.attribute.y<_.attribute.y;if(p){const y=m?_:g,b=m?g:_,v=c.x,x=f.x,S=y.AABBBounds.x1,A=b.AABBBounds.x2;S<v&&(y.attribute.angle?y.setAttributes({dx:((a=y.attribute.dx)!==null&&a!==void 0?a:0)+v-S}):y.setAttributes({x:v,textAlign:"left"})),A>x&&(b.attribute.angle?b.setAttributes({dx:((o=b.attribute.dx)!==null&&o!==void 0?o:0)+x-A}):b.setAttributes({x,textAlign:"right"}))}else{const y=m?_:g,b=m?g:_,v=y.AABBBounds.y2,x=b.AABBBounds.y1,S=c.y,A=f.y;x<S&&(b.attribute.angle?b.setAttributes({dy:((l=b.attribute.dy)!==null&&l!==void 0?l:0)+S-x}):b.setAttributes({y:S,textBaseline:"top"})),v>A&&(y.attribute.angle?y.setAttributes({dy:((h=y.attribute.dy)!==null&&h!==void 0?h:0)+A-v}):y.setAttributes({y:A,textBaseline:"bottom"}))}}}handleLabelsOverlap(e,t,i,s,r){if(fe(e))return;const{verticalLimitSize:a,label:o,orient:l}=this.attribute,h=this._getAxisLabelLimitLength(a,r),{layoutFunc:d,autoRotate:u,autoRotateAngle:c,autoLimit:f,limitEllipsis:p,autoHide:g,autoHideMethod:_,autoHideSeparation:m,lastVisible:y}=o;if(Y(d))d(e,t,s,this);else{if(u&&r$(e,{labelRotateAngle:c,orient:l}),f&&j(h)&&h>0){const b=l!=="left"&&l!=="right"||!e.some(v=>v.attribute.direction==="vertical")?1/0:Math.abs(this.attribute.start.y-this.attribute.end.y)/e.length;d$(e,{limitLength:h,verticalLimitLength:b,ellipsis:p,orient:l})}g&&s$(e,{orient:l,method:_,separation:m,lastVisible:y})}}afterLabelsOverlap(e,t,i,s,r){const{verticalLimitSize:a,orient:o}=this.attribute,l=o==="bottom"||o==="top",h=i.AABBBounds;let d=l?h.height():h.width();const{verticalMinSize:u}=this.attribute;if(j(u)&&(!j(a)||u<=a)){const c=this._getAxisLabelLimitLength(u,r);let f,p;d=Math.max(d,c),o==="left"?(f=h.x2-d,p=h.y1):o==="right"?(f=h.x1,p=h.y1):o==="top"?(f=h.x1,p=h.y2-d):o==="bottom"&&(f=h.x1,p=h.y1);const g=ce.rect({x:f,y:p,width:l?h.width():d,height:l?d:h.height(),pickable:!1});g.name=Fi.axisLabelBackground,g.id=this._getNodeId("axis-label-background"),i.insertBefore(g,i.firstChild)}if(P(this.attribute.label.containerAlign)){let c;o==="left"?c=h.x2:o==="right"?c=h.x1:o==="top"?c=h.y2:o==="bottom"&&(c=h.y1),u$(e,c,d,o,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(e,t){var i,s,r,a;const{label:o,title:l,line:h,tick:d}=this.attribute,u=(i=o.space)!==null&&i!==void 0?i:4;let c=e,f=0,p=0;const g=h&&h.visible?(s=h.style.lineWidth)!==null&&s!==void 0?s:1:0,_=d&&d.visible?(r=d.length)!==null&&r!==void 0?r:4:0;if(l&&l.visible&&typeof l.text=="string"){f=I_(l.text,l.textStyle,(a=this.stage)===null||a===void 0?void 0:a.getTheme().text.fontFamily).height;const m=tn(l.padding);p=l.space+m[0]+m[2]}return c&&(c=(c-u-p-f-g-_)/t),c}}ru.defaultAttributes=ag,li(ru,OR);class LR{isInValidValue(e){const{startAngle:t=rh,endAngle:i=ah}=this.attribute;return Math.abs(i-t)%(2*Math.PI)==0?e>1:e<0||e>1}getTickCoord(e){const{startAngle:t=rh,endAngle:i=ah,center:s,radius:r,inside:a=!1,innerRadius:o=0}=this.attribute;return as(s,a&&o>0?o:r,t+(i-t)*e)}getVerticalVector(e,t=!1,i){const{inside:s=!1}=this.attribute,{center:r}=this.attribute,a=[i.x-r.x,i.y-r.y];return bR(a,(t?-1:1)*(s?-1:1)*e/f4(a))}getRelativeVector(e){const{center:t}=this.attribute;return[e.y-t.y,-1*(e.x-t.x)]}}const Yw=(n=0)=>{if(n<0)for(;n<0;)n+=ei;else if(n>0)for(;n>ei;)n-=ei;return n};function Nc(n,e,t){return!rs(n,e,0,1e-6)&&!Ts(n,t,0,1e-6)}function _$(n,e,t,i){const s=Uu(Object.assign({text:t},i)),r=s.width(),a=s.height(),o=Yw(Math.atan2(e[1],e[0]))-Math.PI,l=3*Math.PI/4,h=Math.PI/4,d=Math.PI/2,u=n.x;let c=0;c=Nc(o,-l,-h)?((o+l)/d-.5)*r:Nc(o,h,l)?(.5-(o-h)/d)*r:Math.cos(o)>=0?.5*r:.5*-r;const f=u-c,p=n.y;let g=0;return g=Nc(o,-l,-h)?.5*-a:Nc(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/d)*a:(.5-Yw(o-l)/d)*a,{x:f,y:p-g}}var m$=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};f$();class au extends CR{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},au.defaultAttributes,e))}renderLine(e){const{startAngle:t=rh,endAngle:i=ah,radius:s,center:r,innerRadius:a=0,line:o={},inside:l=!1}=this.attribute;let h=s,d=a;l&&a>0&&(h=a,d=0);const u=Object.assign(Object.assign(Object.assign({},r),{startAngle:t,endAngle:i,radius:h,innerRadius:d}),o.style),c=ce.circle(u);c.name=Fi.line,c.id=this._getNodeId("line"),fe(o.state)||(c.states=re({},Es,o.state)),e.add(c)}getTitleAttribute(){var e,t,i;const{center:s,radius:r,innerRadius:a=0}=this.attribute,o=this.attribute.title,{space:l=4,textStyle:h={},shape:d,background:u,state:c={}}=o,f=m$(o,["space","textStyle","shape","background","state"]);let p=s,g=0;!((e=this.attribute.label)===null||e===void 0)&&e.visible&&this.attribute.label.inside===!1&&(g=Te(this.attribute.label,"style.fontSize",12)+Te(this.attribute.label,"space",4));let _=0;!((t=this.attribute.tick)===null||t===void 0)&&t.visible&&this.attribute.tick.inside===!1&&(_=this.attribute.tick.length||4),!((i=this.attribute.subTick)===null||i===void 0)&&i.visible&&this.attribute.subTick.inside===!1&&(_=Math.max(_,this.attribute.subTick.length||2));const m=r+_+g+l;let y="middle",{position:b}=this.attribute.title;C(b)&&(b=a===0?"end":"middle"),b==="start"?(y="bottom",p={x:s.x,y:s.y-m}):b==="end"&&(y="top",p={x:s.x,y:s.y+m});const v=Object.assign(Object.assign(Object.assign({},p),f),{textStyle:Object.assign({textBaseline:y,textAlign:"center"},h),state:{text:re({},Es,c.text),shape:re({},Es,c.shape),panel:re({},Es,c.background)}}),{angle:x}=f;return v.angle=x,d&&d.visible&&(v.shape=Object.assign({visible:!0},d.style),d.space&&(v.space=d.space)),u&&u.visible&&(v.panel=Object.assign({visible:!0},u.style)),v}getSubTickLineItems(){var e,t;const{subTick:i}=this.attribute,s=[],{count:r=4,inside:a=!1,length:o=2}=i,l=this.tickLineItems,h=l.length;if(h>=2){const d=this.data[1].value-this.data[0].value,u=(t=(e=this.attribute)===null||e===void 0?void 0:e.tick)===null||t===void 0?void 0:t.alignWithLabel;for(let c=0;c<h;c++){const f=l[c],p=l[c+1];for(let g=0;g<r;g++){const _=(g+1)/(r+1),m=(1-_)*f.value+_*(p?p.value:u?1:f.value+d),y=this.getTickCoord(m),b=this.getVerticalCoord(y,o,a);s.push({start:y,end:b,value:m})}}}return s}getTextBaseline(e){let t="middle";return Qi(e[1],0)?t="middle":e[1]>0&&e[1]>Math.abs(e[0])?t="top":e[1]<0&&Math.abs(e[1])>Math.abs(e[0])&&(t="bottom"),t}beforeLabelsOverlap(e,t,i,s,r){}handleLabelsOverlap(e,t,i,s,r){}afterLabelsOverlap(e,t,i,s,r){}getLabelAlign(e,t,i){return{textAlign:"center",textBaseline:"middle"}}getLabelPosition(e,t,i,s){return _$(e,t,i,s)}}au.defaultAttributes=ag,li(au,LR);function y$(n){const e={};return fs(n,t=>{t.type!=="group"&&t.id&&(e[t.id]=t)}),e}class b$ extends nn{constructor(){super(...arguments),this.mode=ql.NORMAL}onBind(){const e=this.target.getInnerView(),t=this.target.getPrevInnerView();t&&(this._oldElementMap=y$(t),this._newElementAttrMap={},fs(e,i=>{var s,r,a,o,l,h;if(i.type!=="group"&&i.id){const d=this._oldElementMap[i.id];if(d){if(!ft(i.attribute,d.attribute)){const u=ri(i.attribute);this._newElementAttrMap[i.id]={state:"update",node:i,attrs:Object.assign(Object.assign({},u),{opacity:(s=u.opacity)!==null&&s!==void 0?s:1,fillOpacity:(r=u.fillOpacity)!==null&&r!==void 0?r:1,strokeOpacity:(a=u.strokeOpacity)!==null&&a!==void 0?a:1})},i.setAttributes(d.attribute)}}else{const u={opacity:(o=i.attribute.opacity)!==null&&o!==void 0?o:1,fillOpacity:(l=i.attribute.fillOpacity)!==null&&l!==void 0?l:1,strokeOpacity:(h=i.attribute.strokeOpacity)!==null&&h!==void 0?h:1};this._newElementAttrMap[i.id]={state:"enter",node:i,attrs:u},i.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}}))}onStart(){let e=this.duration,t=this.easing;Object.keys(this._newElementAttrMap).forEach(i=>{var s;const{node:r,attrs:a,state:o}=this._newElementAttrMap[i];if(o==="enter"){const{enter:l={}}=(s=this.params)!==null&&s!==void 0?s:{};e=j(l.duration)?l.duration:e,t=l.easing?l.easing:t}r.type==="path"?r.animate({interpolate:(l,h,d,u,c)=>l==="path"&&(c.path=gD(d,u)(h),!0)}).to(a,e,t):r.animate().to(a,e,t)})}onUpdate(e,t,i){}}class v$ extends nn{constructor(e,t,i,s){super(null,null,i,s)}getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:0}})}onEnd(){this.target.setTheme({common:{opacity:1}})}onUpdate(e,t,i){this.target.setTheme({common:{opacity:t}})}}function Jo(n,e){let t="";return n.length===0||(n.forEach((i,s)=>{s===0?t=`M${i.x},${i.y}`:t+=`L${i.x},${i.y}`}),e&&(t+="Z")),t}function Bv(n,e,t,i){let s="";if(!n||e.length===0)return s;const r=e[0],a=wt.distancePP(n,r),o=t?0:1;return i?s+=`M${n.x},${n.y-a}A${a},${a},0,0,${o},${n.x},${n.y+a}A${a},${a},0,0,${o},${n.x},${n.y-a}Z`:e.forEach((l,h)=>{h===0?s=`M${l.x},${l.y}`:s+=`A${a},${a},0,0,${o},${l.x},${l.y}`}),s}function x$(n,e,t){const{type:i,closed:s}=t,r=e.slice(0).reverse();let a="",o="";if(i==="line"&&t.smoothLink&&t.center){const l=n[0],h=r[0],d=t.center;a=Jo(n,!!s),o=Jo(r,!!s);const u=wt.distancePP(h,d),c=wt.distancePP(l,d);a+=`A${u},${u},0,0,1,${h.x},${h.y}L${h.x},${h.y}`,o+=`A${c},${c},0,0,0,${l.x},${l.y}`}else if(i==="circle"){const{center:l}=t;a=Bv(l,n,!1,!!s),o=Bv(l,r,!0,!!s)}else i!=="line"&&i!=="polygon"||(a=Jo(n,!!s),o=Jo(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class Sa extends ti{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=ce.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:e,visible:t}=this.attribute;e&&e.length&&t!==!1&&(this.data=this._transformItems(e),this._renderGrid(this._innerView))}getVerticalCoord(e,t,i){const s=this.getVerticalVector(t,i,e);return{x:e.x+s[0],y:e.y+s[1]}}_transformItems(e){const t=[];return e.forEach(i=>{var s;t.push(Object.assign(Object.assign({},i),{point:this.getTickCoord(i.value),id:(s=i.id)!==null&&s!==void 0?s:i.label}))}),t}_renderGrid(e){const{visible:t}=this.attribute.subGrid||{};t&&this._renderGridByType(!0,e),this._renderGridByType(!1,e)}_renderGridByType(e,t){const i=re({},this.attribute,this.getGridAttribute(e)),{type:s,items:r,style:a,closed:o,alternateColor:l,depth:h=0}=i,d=e?`${Fi.grid}-sub`:`${Fi.grid}`;if(r.forEach((u,c)=>{const{id:f,points:p}=u;let g="";if(s==="line"||s==="polygon")g=Jo(p,!!o);else if(s==="circle"){const{center:m}=this.attribute;g=Bv(m,p,!1,!!o)}const _=ce.path(Object.assign({path:g,z:h},Y(a)?re({},this.skipDefault?null:Sa.defaultAttributes.style,a(u,c)):a));_.name=`${d}-line`,_.id=this._getNodeId(`${d}-path-${f}`),t.add(_)}),h&&s==="line"&&r.forEach((u,c)=>{const{id:f,points:p}=u,g=[];g.push(p[0]);const _=p[1].x-p[0].x,m=p[1].y-p[0].y,y=Math.sqrt(_*_+m*m),b=h/y;g.push({x:p[0].x+_*b,y:p[0].y+m*b});const v=Jo(g,!!o),x=Ve(g[0].x-g[1].x),S=Ve(g[0].y-g[1].y),A=ce.path(Object.assign({path:v,z:0,alpha:x>S?(p[1].x-p[0].x>0?-1:1)*et/2:0,beta:x<S?-et/2:0,anchor3d:x>S?[g[0].x,0]:[0,g[0].y]},Y(a)?re({},this.skipDefault?null:Sa.defaultAttributes.style,a(u,c)):a));A.name=`${d}-line`,A.id=this._getNodeId(`${d}-path-${f}`),t.add(A)}),r.length>1&&l){const u=W(l)?l:[l,"transparent"],c=f=>u[f%u.length];for(let f=0;f<r.length-1;f++){const[p,g]=[r[f].points,r[f+1].points],_=x$(p,g,i),m=ce.path({path:_,fill:c(f)});m.name=`${d}-region`,m.id=this._getNodeId(`${d}-region-${f}`),t.add(m)}}}_getNodeId(e){return`${this.id}-${e}`}}Sa.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};function S$(n,e,t,i,s){const r=[],a=s-i;for(let o=0;o<e;o++){const l=i+o*a/e;r.push(as(n,t,l))}return r}p$();class IR extends Sa{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},Sa.defaultAttributes,e),t)}_getGridPoint(e,t){let i;if(e==="line"){const{length:s}=this.attribute;i=[t,this.getVerticalCoord(t,s,!0)]}else if(e==="circle"||e==="polygon"){const{center:s,sides:r=6,startAngle:a=rh,endAngle:o=ah}=this.attribute;i=S$(s,r,wt.distancePP(s,t),a,o)}return i}getGridAttribute(e){const{type:t,alignWithLabel:i=!0}=this.attribute;let s=1,r;this.data.length>=2&&(s=this.data[1].value-this.data[0].value);let a=[];if(e){r=re({},this.attribute,this.attribute.subGrid);const o=[],{count:l=4}=this.attribute.subGrid||{};if(this.data.length>=2){const h=[];this.data.forEach(d=>{let u=d.value;if(!i){const c=d.value-s/2;if(this.isInValidValue(c))return;u=c}h.push({value:u})});for(let d=0;d<h.length-1;d++){const u=h[d],c=h[d+1];o.push({id:`sub-${d}-0`,points:this._getGridPoint(t,this.getTickCoord(u.value)),datum:{}});for(let f=0;f<l;f++){const p=(f+1)/(l+1),g=(1-p)*u.value+p*c.value,_=this.getTickCoord(g);o.push({id:`sub-${d}-${f+1}`,points:this._getGridPoint(t,_),datum:{}})}d===h.length-2&&o.push({id:`sub-${d}-${l+1}`,points:this._getGridPoint(t,this.getTickCoord(c.value)),datum:{}})}a=o}}else{r=this.attribute;const o=[];this.data.forEach(l=>{let{point:h}=l;if(!i){const d=l.value-s/2;if(this.isInValidValue(d))return;h=this.getTickCoord(d)}o.push({id:l.label,datum:l,points:this._getGridPoint(t,h)})}),a=o}return Object.assign(Object.assign({},r),{items:a})}}li(IR,OR);var A$=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};g$();class DR extends Sa{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},Sa.defaultAttributes,e),t)}getGridAttribute(e){let t,i=[];const s=this.attribute,{radius:r,innerRadius:a=0,startAngle:o=rh,endAngle:l=ah,center:h,subGrid:d}=s,u=A$(s,["radius","innerRadius","startAngle","endAngle","center","subGrid"]),{alignWithLabel:c=!0}=u||{},f=r-a;let p=1;if(this.data.length>=2&&(p=this.data[1].value-this.data[0].value),e){t=re({},u,d);const g=[],{count:_=4}=d||{},m=this.data.length;if(m>=2){const y=[];this.data.forEach(b=>{let v=b.value;if(!c){const x=b.value-p/2;if(this.isInValidValue(x))return;v=x}y.push({value:v})});for(let b=0;b<m;b++){const v=y[b],x=y[b+1];g.push({id:`sub-${b}-0`,points:[this.getTickCoord(v.value),this.getVerticalCoord(this.getTickCoord(v.value),f,!0)],datum:{}});for(let S=0;S<_;S++){const A=(S+1)/(_+1),k=(1-A)*v.value+A*(x?x.value:c?1:v.value+p),w=this.getTickCoord(k),M=this.getVerticalCoord(w,f,!0);g.push({id:`sub-${b}-${S+1}`,points:[w,M],datum:{}})}}Math.abs(l-o)%(2*Math.PI)==0&&g.push(g[0]),i=g}}else{t=u;const g=[];let _;_=Math.abs(l-o)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,_.forEach(m=>{let{point:y}=m;if(!c){const v=m.value-p/2;if(this.isInValidValue(v))return;y=this.getTickCoord(v)}const b=this.getVerticalCoord(y,f,!0);g.push({id:m.id,points:[y,b],datum:m})}),i=g}return Object.assign(Object.assign({},t),{items:i,center:h,type:"line"})}}li(DR,LR);const Xw="M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",k$={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:Xw,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:Xw,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},Er={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}};var Yi;(function(n){n.startHandler="startHandler",n.endHandler="endHandler",n.middleHandler="middleHandler",n.background="background"})(Yi||(Yi={}));function w$(){D_(),kr(),xs(),pR(),Ca()}var Kw=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};const M$={debounce:Us,throttle:Ta};w$();let FR=class zR extends ti{setPropsFromAttrs(){const{start:e,end:t,orient:i,previewData:s,previewPointsX:r,previewPointsY:a,previewPointsX1:o,previewPointsY1:l}=this.attribute;e&&(this.state.start=e),t&&(this.state.end=t);const{width:h,height:d}=this.getLayoutAttrFromConfig();this._spanCache=this.state.end-this.state.start,this._isHorizontal=i==="top"||i==="bottom",this._layoutCache.max=this._isHorizontal?h:d,this._layoutCache.attPos=this._isHorizontal?"x":"y",this._layoutCache.attSize=this._isHorizontal?"width":"height",s&&(this._previewData=s),Y(r)&&(this._previewPointsX=r),Y(a)&&(this._previewPointsY=a),Y(o)&&(this._previewPointsX1=o),Y(l)&&(this._previewPointsY1=l)}constructor(e,t){super(t!=null&&t.skipDefault?e:re({},zR.defaultAttributes,e)),this.name="dataZoom",this._previewData=[],this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",max:0},this.state={start:0,end:1},this._statePointToData=r=>r,this._onHandlerPointerDown=(r,a)=>{r.stopPropagation(),a==="start"?(this._activeTag=Yi.startHandler,this._activeItem=this._startHandlerMask):a==="end"?(this._activeTag=Yi.endHandler,this._activeItem=this._endHandlerMask):a==="middleRect"?(this._activeTag=Yi.middleHandler,this._activeItem=this._middleHandlerRect):a==="middleSymbol"?(this._activeTag=Yi.middleHandler,this._activeItem=this._middleHandlerSymbol):a==="background"&&(this._activeTag=Yi.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(r),this._activeCache.lastPos=this.eventPosToStagePos(r),Fe.env==="browser"&&(Fe.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Fe.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._onHandlerPointerMove=M$[this.attribute.delayType](r=>{r.stopPropagation();const{start:a,end:o,brushSelect:l,realTime:h=!0}=this.attribute,d=this.eventPosToStagePos(r),{attPos:u,max:c}=this._layoutCache,f=(d[u]-this._activeCache.lastPos[u])/c;let{start:p,end:g}=this.state;this._activeState&&(this._activeTag===Yi.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+f):this._activeTag===Yi.startHandler?p+f>g?(p=g,g=p+f,this._activeTag=Yi.endHandler):p+=f:this._activeTag===Yi.endHandler&&(g+f<p?(g=p,p=g+f,this._activeTag=Yi.startHandler):g+=f),this._activeCache.lastPos=d,l&&this.renderDragMask()),p=Math.min(Math.max(p,0),1),g=Math.min(Math.max(g,0),1),a===p&&o===g||(this.setStateAttr(p,g,!0),this._dispatchEvent("change",{start:p,end:g,tag:this._activeTag}))},this.attribute.delayTime);const{position:i,showDetail:s}=e;this._activeCache.startPos=i,this._activeCache.lastPos=i,this._showText=s!=="auto"&&s,this.setPropsFromAttrs()}setAttributes(e,t){super.setAttributes(e,t),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{showDetail:e,brushSelect:t}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",s=>this._onHandlerPointerDown(s,"start")),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",s=>this._onHandlerPointerDown(s,"end")),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",s=>this._onHandlerPointerDown(s,"middleSymbol")),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",s=>this._onHandlerPointerDown(s,"middleRect"));const i=t?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",s=>this._onHandlerPointerDown(s,i)),t&&this._background&&this._background.addEventListener("pointerdown",s=>this._onHandlerPointerDown(s,"background")),t&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",s=>this._onHandlerPointerDown(s,"background")),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",s=>this._onHandlerPointerDown(s,i)),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),e==="auto"&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:e}=this.attribute,{attPos:t,max:i}=this._layoutCache;return this._activeCache.lastPos[t]-e[t]>i?i+e[t]-this._activeCache.startPos[t]:this._activeCache.lastPos[t]-e[t]<0?e[t]-this._activeCache.startPos[t]:this._activeCache.lastPos[t]-this._activeCache.startPos[t]}setStateAttr(e,t,i){const{zoomLock:s=!1,minSpan:r=0,maxSpan:a=1}=this.attribute,o=t-e;o!==this._spanCache&&(s||o<r||o>a)||(this._spanCache=o,this.state.start=e,this.state.end=t,i&&this.setAttributes({start:e,end:t}))}eventPosToStagePos(e){var t,i;const{x:s,y:r}=Fe.mapToCanvasPoint(e);return{x:s-(((t=this.stage)===null||t===void 0?void 0:t.x)||0),y:r-(((i=this.stage)===null||i===void 0?void 0:i.y)||0)}}_onHandlerPointerUp(e){e.preventDefault();const{start:t,end:i,brushSelect:s,realTime:r=!0}=this.attribute;if(this._activeState&&this._activeTag===Yi.background){const a=this.eventPosToStagePos(e);this.backgroundDragZoom(this._activeCache.startPos,a)}this._activeState=!1,s&&this.renderDragMask(),r&&t===this.state.start&&i===this.state.end||(this.setStateAttr(this.state.start,this.state.end,!0),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag})),Fe.env==="browser"&&(Fe.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Fe.removeEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})}_onHandlerPointerEnter(e){e.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(e){e.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(e,t){const{attPos:i,max:s}=this._layoutCache,{position:r}=this.attribute,a=e[i]-r[i],o=t[i]-r[i],l=Math.min(Math.max(Math.min(a,o)/s,0),1),h=Math.min(Math.max(Math.max(a,o)/s,0),1);Math.abs(l-h)<.01?this.moveZoomWithMiddle(l):this.setStateAttr(l,h,!1)}moveZoomWithMiddle(e){let t=e-(this.state.start+this.state.end)/2;t!==0&&(t>0?this.state.end+t>1&&(t=1-this.state.end):t<0&&this.state.start+t<0&&(t=-this.state.start),this.setStateAttr(this.state.start+t,this.state.end+t,!1))}renderDragMask(){const{dragMaskStyle:e}=this.attribute,{position:t,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ai(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,t.x,t.x+i),y:t.y,width:this._activeState&&this._activeTag===Yi.background&&Math.abs(this.dragMaskSize())||0,height:s},e),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:t.x,y:ai(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,t.y,t.y+s),width:i,height:this._activeState&&this._activeTag===Yi.background&&Math.abs(this.dragMaskSize())||0},e),"rect")}isTextOverflow(e,t,i){if(!t)return!1;if(this._isHorizontal){if(i==="start"){if(t.x1<e.x1)return!0}else if(t.x2>e.x2)return!0}else if(i==="start"){if(t.y1<e.y1)return!0}else if(t.y2>e.y2)return!0;return!1}setTextAttr(e,t){const{startTextStyle:i,endTextStyle:s}=this.attribute,{formatMethod:r}=i,a=Kw(i,["formatMethod"]),{formatMethod:o}=s,l=Kw(s,["formatMethod"]),{start:h,end:d}=this.state;this._startValue=this._statePointToData(h),this._endValue=this._statePointToData(d);const{position:u,width:c,height:f}=this.getLayoutAttrFromConfig(),p=r?r(this._startValue):this._startValue,g=o?o(this._endValue):this._endValue,_={x1:u.x,y1:u.y,x2:u.x+c,y2:u.y+f};let m,y,b,v;this._isHorizontal?(m={x:u.x+h*c,y:u.y+f/2},y={x:u.x+d*c,y:u.y+f/2},b={textAlign:this.isTextOverflow(_,e,"start")?"left":"right",textBaseline:"middle"},v={textAlign:this.isTextOverflow(_,t,"end")?"right":"left",textBaseline:"middle"}):(m={x:u.x+c/2,y:u.y+h*f},y={x:u.x+c/2,y:u.y+d*f},b={textAlign:"center",textBaseline:this.isTextOverflow(_,e,"start")?"top":"bottom"},v={textAlign:"center",textBaseline:this.isTextOverflow(_,t,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,re({},a,{text:p,x:m.x,y:m.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:b}),`data-zoom-start-text-${u}`),this._endText=this.maybeAddLabel(this._container,re({},l,{text:g,x:y.x,y:y.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:v}),`data-zoom-end-text-${u}`)}renderText(){let e=null,t=null;this.setTextAttr(e,t),e=this._startText.AABBBounds,t=this._endText.AABBBounds,this.setTextAttr(e,t),e=this._startText.AABBBounds,t=this._endText.AABBBounds;const{x1:i,x2:s,y1:r,y2:a}=e,{dx:o=0,dy:l=0}=this.attribute.startTextStyle;if(new _i().set(i,r,s,a).intersects(t)){const h=this.attribute.orient==="bottom"||this.attribute.orient==="right"?-1:1;this._isHorizontal?this._startText.setAttribute("dy",l+h*Math.abs(t.y1-t.y2)):this._startText.setAttribute("dx",o+h*Math.abs(t.x1-t.x2))}else this._isHorizontal?this._startText.setAttribute("dy",l):this._startText.setAttribute("dx",o)}getLayoutAttrFromConfig(){var e,t,i,s;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:r,size:a,orient:o,middleHandlerStyle:l={},startHandlerStyle:h={},endHandlerStyle:d={}}=this.attribute,{width:u,height:c}=a,f=(t=(e=l.background)===null||e===void 0?void 0:e.size)!==null&&t!==void 0?t:10;let p,g,_;l.visible?this._isHorizontal?(p=u,g=c-f,_={x:r.x,y:r.y+f}):(p=u-f,g=c,_={x:r.x+(o==="left"?f:0),y:r.y}):(p=u,g=c,_=r);const m=(i=h.size)!==null&&i!==void 0?i:this._isHorizontal?g:p,y=(s=d.size)!==null&&s!==void 0?s:this._isHorizontal?g:p;return h.visible&&(this._isHorizontal?(p-=(m+y)/2,_={x:_.x+m/2,y:_.y}):(g-=(m+y)/2,_={x:_.x,y:_.y+m})),this._layoutAttrFromConfig={position:_,width:p,height:g},this._layoutAttrFromConfig}render(){var e,t,i,s,r,a,o,l,h,d,u,c,f,p,g,_,m,y;this._layoutAttrFromConfig=null;const{orient:b,backgroundStyle:v,backgroundChartStyle:x={},selectedBackgroundStyle:S={},selectedBackgroundChartStyle:A={},middleHandlerStyle:k={},startHandlerStyle:w={},endHandlerStyle:M={},brushSelect:T,zoomLock:E}=this.attribute,{start:O,end:B}=this.state,{position:R,width:L,height:I}=this.getLayoutAttrFromConfig(),F=(e=w.triggerMinSize)!==null&&e!==void 0?e:40,H=(t=M.triggerMinSize)!==null&&t!==void 0?t:40,G=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=G,this._background=G.createOrUpdateChild("background",Object.assign(Object.assign({x:R.x,y:R.y,width:L,height:I,cursor:T?"crosshair":"auto"},v),{pickable:!E}),"rect"),!((i=x.line)===null||i===void 0)&&i.visible&&this.setPreviewAttributes("line",G),!((s=x.area)===null||s===void 0)&&s.visible&&this.setPreviewAttributes("area",G),T&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=G.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:R.x+O*L,y:R.y,width:(B-O)*L,height:I,cursor:T?"crosshair":"move"},S),{pickable:!E}),"rect"):this._selectedBackground=G.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:R.x,y:R.y+O*I,width:L,height:(B-O)*I,cursor:T?"crosshair":"move"},S),{pickable:!E}),"rect"),!((r=A.line)===null||r===void 0)&&r.visible&&this.setSelectedPreviewAttributes("line",G),!((a=A.area)===null||a===void 0)&&a.visible&&this.setSelectedPreviewAttributes("area",G),this._isHorizontal){if(k.visible){const ie=((o=k.background)===null||o===void 0?void 0:o.size)||10;this._middleHandlerRect=G.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:R.x+O*L,y:R.y-ie,width:(B-O)*L,height:ie},(l=k.background)===null||l===void 0?void 0:l.style),{pickable:!E}),"rect"),this._middleHandlerSymbol=G.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:R.x+(O+B)/2*L,y:R.y-ie/2,strokeBoundsBuffer:0,angle:0,symbolType:(d=(h=k.icon)===null||h===void 0?void 0:h.symbolType)!==null&&d!==void 0?d:"square"},k.icon),{pickable:!E}),"symbol")}this._startHandler=G.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:R.x+O*L,y:R.y+I/2,size:I,symbolType:(u=w.symbolType)!==null&&u!==void 0?u:"square"},Er.horizontal),w),{pickable:!E}),"symbol"),this._endHandler=G.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:R.x+B*L,y:R.y+I/2,size:I,symbolType:(c=M.symbolType)!==null&&c!==void 0?c:"square"},Er.horizontal),M),{pickable:!E}),"symbol");const U=Math.max(this._startHandler.AABBBounds.width(),F),$=Math.max(this._startHandler.AABBBounds.height(),F),Z=Math.max(this._endHandler.AABBBounds.width(),H),q=Math.max(this._endHandler.AABBBounds.height(),H);this._startHandlerMask=G.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:R.x+O*L-U/2,y:R.y+I/2-$/2,width:U,height:$,fill:"white",fillOpacity:0,zIndex:999},Er.horizontal),{pickable:!E}),"rect"),this._endHandlerMask=G.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:R.x+B*L-Z/2,y:R.y+I/2-q/2,width:Z,height:q,fill:"white",fillOpacity:0,zIndex:999},Er.horizontal),{pickable:!E}),"rect")}else{if(k.visible){const ie=((f=k.background)===null||f===void 0?void 0:f.size)||10;this._middleHandlerRect=G.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:b==="left"?R.x-ie:R.x+L,y:R.y+O*I,width:ie,height:(B-O)*I},(p=k.background)===null||p===void 0?void 0:p.style),{pickable:!E}),"rect"),this._middleHandlerSymbol=G.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:b==="left"?R.x-ie/2:R.x+L+ie/2,y:R.y+(O+B)/2*I,angle:Math.PI/180*90,symbolType:(_=(g=k.icon)===null||g===void 0?void 0:g.symbolType)!==null&&_!==void 0?_:"square",strokeBoundsBuffer:0},k.icon),{pickable:!E}),"symbol")}this._startHandler=G.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:R.x+L/2,y:R.y+O*I,size:L,symbolType:(m=w.symbolType)!==null&&m!==void 0?m:"square"},Er.vertical),w),{pickable:!E}),"symbol"),this._endHandler=G.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:R.x+L/2,y:R.y+B*I,size:L,symbolType:(y=M.symbolType)!==null&&y!==void 0?y:"square"},Er.vertical),M),{pickable:!E}),"symbol");const U=Math.max(this._startHandler.AABBBounds.width(),F),$=Math.max(this._startHandler.AABBBounds.height(),F),Z=Math.max(this._endHandler.AABBBounds.width(),H),q=Math.max(this._endHandler.AABBBounds.height(),H);this._startHandlerMask=G.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:R.x+L/2+U/2,y:R.y+O*I-$/2,width:q,height:Z,fill:"white",fillOpacity:0,zIndex:999},Er.vertical),{pickable:!E}),"rect"),this._endHandlerMask=G.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:R.x+L/2+Z/2,y:R.y+B*I-q/2,width:q,height:Z,fill:"white",fillOpacity:0,zIndex:999},Er.vertical),{pickable:!E}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:e}=this.attribute,{position:t,width:i,height:s}=this.getLayoutAttrFromConfig();let r,a;return this._isHorizontal?(r=[{x:t.x,y:t.y+s}],a=[{x:t.x+i,y:t.y+s}]):e==="left"?(r=[{x:t.x+i,y:t.y}],a=[{x:t.x+i,y:t.y+s}]):(r=[{x:t.x,y:t.y+s}],a=[{x:t.x,y:t.y}]),{basePointStart:r,basePointEnd:a}}getPreviewLinePoints(){const e=this._previewData.map(s=>({x:this._previewPointsX&&this._previewPointsX(s),y:this._previewPointsY&&this._previewPointsY(s)}));if(e.length===0)return e;const{basePointStart:t,basePointEnd:i}=this.computeBasePoints();return t.concat(e).concat(i)}getPreviewAreaPoints(){const e=this._previewData.map(s=>({x:this._previewPointsX&&this._previewPointsX(s),y:this._previewPointsY&&this._previewPointsY(s),x1:this._previewPointsX1&&this._previewPointsX1(s),y1:this._previewPointsY1&&this._previewPointsY1(s)}));if(e.length===0)return e;const{basePointStart:t,basePointEnd:i}=this.computeBasePoints();return t.concat(e).concat(i)}setPreviewAttributes(e,t){this._previewGroup||(this._previewGroup=t.createOrUpdateChild("previewGroup",{pickable:!1},"group")),e==="line"?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;e==="line"&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),e==="area"&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(e,t){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=t.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),e==="line"?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:r}=this.state,{position:a,width:o,height:l}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?a.x+s*o:a.x,y:this._isHorizontal?a.y:a.y+s*l,width:this._isHorizontal?(r-s)*o:o,height:this._isHorizontal?l:(r-s)*l,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?a.x+s*o:a.x),y:-(this._isHorizontal?a.y:a.y+s*l),width:this._isHorizontal?(r-s)*o:o,height:this._isHorizontal?l:(r-s)*l,pickable:!1}),e==="line"&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),e==="area"&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(e,t,i){let s=this.find(r=>r.name===i,!0);return s?s.setAttributes(t):(s=new Ss(t),s.name=i),e.add(s),s}setStartAndEnd(e,t){const{start:i,end:s}=this.attribute;P(e)&&P(t)&&(e!==this.state.start||t!==this.state.end)&&(this.state.start=e,this.state.end=t,i===this.state.start&&s===this.state.end||(this.setStateAttr(e,t,!0),this._dispatchEvent("change",{start:e,end:t,tag:this._activeTag})))}setPreviewData(e){this._previewData=e}setText(e,t){t==="start"?this._startText.setAttribute("text",e):this._endText.setAttribute("text",e)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var e,t,i,s;const{middleHandlerStyle:r={}}=this.attribute,a=(t=(e=r.background)===null||e===void 0?void 0:e.size)!==null&&t!==void 0?t:10,o=(s=(i=r.icon)===null||i===void 0?void 0:i.size)!==null&&s!==void 0?s:10;return Math.max(a,...N(o))}setPreviewPointsX(e){Y(e)&&(this._previewPointsX=e)}setPreviewPointsY(e){Y(e)&&(this._previewPointsY=e)}setPreviewPointsX1(e){Y(e)&&(this._previewPointsX1=e)}setPreviewPointsY1(e){Y(e)&&(this._previewPointsY1=e)}setStatePointToData(e){Y(e)&&(this._statePointToData=e)}};FR.defaultAttributes=k$;var Lv;(function(n){n.start="start",n.middle="middle",n.end="end",n.insideStartTop="insideStartTop",n.insideStartBottom="insideStartBottom",n.insideMiddleTop="insideMiddleTop",n.insideMiddleBottom="insideMiddleBottom",n.insideEndTop="insideEndTop",n.insideEndBottom="insideEndBottom"})(Lv||(Lv={}));var Iv;(function(n){n.left="left",n.right="right",n.top="top",n.bottom="bottom",n.middle="middle",n.insideLeft="insideLeft",n.insideRight="insideRight",n.insideTop="insideTop",n.insideBottom="insideBottom"})(Iv||(Iv={}));var Dv;(function(n){n.top="top",n.bottom="bottom",n.middle="middle",n.insideTop="insideTop",n.insideBottom="insideBottom",n.insideMiddle="insideMiddle"})(Dv||(Dv={}));class _0 extends ti{constructor(){super(...arguments),this.name="marker"}setAttribute(e,t,i){super.setAttribute(e,t,i),e==="visible"&&this.render()}_initContainer(){var e,t;const{limitRect:i={},clipInRange:s}=this.attribute;let r;if(s){const a=ce.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));r=ce.group({x:-((e=i.x)!==null&&e!==void 0?e:0),y:-((t=i.y)!==null&&t!==void 0?t:0),pickable:!1}),a.add(r),this._containerClip=a,this.add(a)}else r=ce.group({x:0,y:0,pickable:!1}),this.add(r);r.name="marker-container",this._container=r}_updateContainer(){var e,t;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-((e=i.x)!==null&&e!==void 0?e:0):0,y:s?-((t=i.y)!==null&&t!==void 0?t:0):0})}render(){var e;this.setAttribute("pickable",!1);const t=(e=this.attribute.visible)===null||e===void 0||e;this.attribute.interactive===!1&&this.setAttribute("childrenPickable",!1),t&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker()):(this._initContainer(),this.initMarker(this._container)):(this._container=null,this.removeAllChild())}}const T$={startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:Lv.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},C$={start:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},P$={label:{position:Iv.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},E$={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},R$={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}},O$={top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}};function jR(n,e){const{x1:t,y1:i,x2:s,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=n.AABBBounds;let d=0,u=0;return a<t&&(d=t-a),o<i&&(u=i-o),l>s&&(d=s-l),h>r&&(u=r-h),{dx:d,dy:u}}function HR(n,e){const{dx:t,dy:i}=jR(n,e),{dx:s=0,dy:r=0}=n.attribute;t&&n.setAttribute("dx",t+s),i&&n.setAttribute("dy",i+r)}function m0(){zt(),D_()}function B$(){m0(),p0()}function L$(){m0(),L_()}function I$(){m0(),p0(),xs(),gR(),Ca()}B$();let GR=class WR extends _0{getLine(){return this._line}getLabel(){return this._label}constructor(e,t){super(t!=null&&t.skipDefault?e:re({},WR.defaultAttributes,e)),this.name="markLine"}setLabelPos(){var e,t;const{label:i={},limitRect:s}=this.attribute,{position:r="end",refX:a=0,refY:o=0,confine:l}=i,h=this._line.getMainSegmentPoints(),d=(e=this._line.getEndAngle())!==null&&e!==void 0?e:0,u=a*Math.cos(d)+o*Math.cos(d-Math.PI/2),c=a*Math.sin(d)+o*Math.sin(d-Math.PI/2);let f;if(f=r.includes("start")||r.includes("Start")?{x:h[0].x+u,y:h[0].y+c}:r.includes("middle")||r.includes("Middle")?{x:(h[0].x+h[h.length-1].x)/2+u,y:(h[0].y+h[h.length-1].y)/2+c}:{x:h[h.length-1].x+u,y:h[h.length-1].y+c},this._label.setAttributes(Object.assign(Object.assign({},f),{angle:i.autoRotate?d+((t=i.refAngle)!==null&&t!==void 0?t:0):0,textStyle:Object.assign(Object.assign({},C$[r]),i.textStyle)})),s&&l){const{x:p,y:g,width:_,height:m}=s;HR(this._label,{x1:p,y1:g,x2:p+_,y2:g+m})}}initMarker(e){const{points:t,startSymbol:i,endSymbol:s,label:r,lineStyle:a,mainSegmentIndex:o,multiSegment:l}=this.attribute,h=new kh({points:t,startSymbol:i,endSymbol:s,lineStyle:a,mainSegmentIndex:o,multiSegment:l,pickable:!1});h.name="mark-line-line",this._line=h,e.add(h);const d=new Ss(Object.assign({},r));d.name="mark-line-label",this._label=d,e.add(d),this.setLabelPos()}updateMarker(){const{points:e,startSymbol:t,endSymbol:i,label:s,lineStyle:r,mainSegmentIndex:a,multiSegment:o}=this.attribute;this._line&&this._line.setAttributes({points:e,startSymbol:t,endSymbol:i,lineStyle:r,mainSegmentIndex:a,multiSegment:o}),this._label&&this._label.setAttributes(Object.assign({dx:0,dy:0},s)),this.setLabelPos()}isValidPoints(){const{points:e}=this.attribute;if(!e||e.length<2)return!1;let t=!0;return e.forEach(i=>{if(i.length)i.forEach(s=>{j(s.x)&&j(s.y)||(t=!1)});else if(!j(i.x)||!j(i.y))return void(t=!1)}),t}};GR.defaultAttributes=T$;L$();let VR=class NR extends _0{getArea(){return this._area}getLabel(){return this._label}constructor(e,t){super(t!=null&&t.skipDefault?e:re({},NR.defaultAttributes,e)),this.name="markArea"}_getPositionByDirection(e,t){const{x1:i,x2:s,y1:r,y2:a}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:i,y:(r+a)/2}:t.includes("right")||t.includes("Right")?{x:s,y:(r+a)/2}:t.includes("top")||t.includes("Top")?{x:(i+s)/2,y:r}:t.includes("bottom")||t.includes("Bottom")?{x:(i+s)/2,y:a}:{x:(i+s)/2,y:(r+a)/2}}setLabelPos(){var e;if(this._label&&this._area){const{label:t={}}=this.attribute,i=(e=t.position)!==null&&e!==void 0?e:"middle",s=this._getPositionByDirection(this._area,i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},E$[i]),t.textStyle)})),this.attribute.limitRect&&t.confine){const{x:r,y:a,width:o,height:l}=this.attribute.limitRect;HR(this._label,{x1:r,y1:a,x2:r+o,y2:a+l})}}}initMarker(e){const{points:t,label:i,areaStyle:s}=this.attribute,r=ce.polygon(Object.assign({points:t},s));r.name="mark-area-area",this._area=r,e.add(r);const a=new Ss(Object.assign({},i));a.name="mark-area-label",this._label=a,e.add(a),this.setLabelPos()}updateMarker(){const{points:e,label:t,areaStyle:i}=this.attribute;this._area&&this._area.setAttributes(Object.assign({points:e},i)),this._area&&this._label.setAttributes(Object.assign({dx:0,dy:0},t)),this.setLabelPos()}isValidPoints(){const{points:e}=this.attribute;if(!e||e.length<3)return!1;let t=!0;return e.forEach(i=>{j(i.x)&&j(i.y)||(t=!1)}),t}};VR.defaultAttributes=P$;I$();let y0=class UR extends _0{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},UR.defaultAttributes,e)),this.name="markPoint"}setLabelPos(){}setItemAttributes(e,t,i,s){var r;if(!e)return;const{autoRotate:a=!0,refX:o=0,refY:l=0,refAngle:h=0,textStyle:d={},richTextStyle:u={},imageStyle:c={},position:f=Dv.middle}=t,p=((r=this._line)===null||r===void 0?void 0:r.getEndAngle())||0,g=o*Math.cos(p)+l*Math.cos(p-Math.PI/2),_=o*Math.sin(p)+l*Math.sin(p-Math.PI/2);s==="text"?e.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},O$[(t==null?void 0:t.position)||"end"]),d.textStyle)})):s==="richText"?e.setAttributes({dx:this.getItemDx(e,f,u)+(u.dx||0),dy:this.getItemDy(e,f,u)+(u.dy||0)}):s==="image"&&e.setAttributes({dx:this.getItemDx(e,f,c)+(c.dx||0),dy:this.getItemDy(e,f,c)+(c.dy||0)}),e.setAttributes({x:i.x+(g||0),y:i.y+(_||0),angle:a&&p+h})}getItemDx(e,t,i){var s,r;const a=(r=(s=e==null?void 0:e.AABBBounds)===null||s===void 0?void 0:s.width())!==null&&r!==void 0?r:(i==null?void 0:i.width)||0;return t.includes("inside")?-a:0}getItemDy(e,t,i){var s,r;const a=(r=(s=e==null?void 0:e.AABBBounds)===null||s===void 0?void 0:s.height())!==null&&r!==void 0?r:(i==null?void 0:i.height)||0;return t.includes("top")||t.includes("Top")?-a:t.includes("middle")||t.includes("Middle")?-a/2:0}initItem(e,t){const{type:i="text",symbolStyle:s,richTextStyle:r,imageStyle:a,renderCustomCallback:o}=e;let l;return i==="symbol"?l=ce.symbol(Object.assign(Object.assign({},t),s)):i==="text"?l=new Ss(Object.assign({},t)):i==="richText"?l=ce.richtext(Object.assign(Object.assign({},t),r)):i==="image"?l=ce.image(Object.assign(Object.assign({},t),a)):i==="custom"&&o&&(l=o()),this.setItemAttributes(l,e,t,i),l}getItemLineAttr(e,t,i){let s=[];const{type:r="type-s"}=e;return s=r==="type-do"?[t,{x:(t.x+i.x)/2,y:i.y},i]:r==="type-po"?[t,{x:i.x,y:t.y},i]:r==="type-op"?[t,{x:t.x,y:i.y},i]:[t,i],s}setItemLineAttr(e,t,i,s){if(this._line){const{startSymbol:r,endSymbol:a,lineStyle:o}=e,l=this.getItemLineAttr(e,t,i);this._line.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:s})}}getDecorativeLineAttr(e,t){var i;const s=((i=e==null?void 0:e.decorativeLine)===null||i===void 0?void 0:i.length)||10,r=this._line.getEndAngle()||0;return{startPointOffsetX:s/2*Math.cos(r-Math.PI/2),startPointOffsetY:s/2*Math.sin(r-Math.PI/2),endPointOffsetX:-s/2*Math.cos(r-Math.PI/2),endPointOffsetY:-s/2*Math.sin(r-Math.PI/2)}}setDecorativeLineAttr(e,t,i){if(this._decorativeLine){const{lineStyle:s}=e,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(e,t);this._decorativeLine.setAttributes(Object.assign(Object.assign({points:[{x:t.x+r,y:t.y+a},{x:t.x+o,y:t.y+l}]},s),{visible:i}))}}setAllOfItemsAttr(e){var t;const{position:i,itemLine:s={},itemContent:r={},limitRect:a}=this.attribute,{type:o="text",confine:l}=r;if(a&&l){const{x:h,y:d,width:u,height:c}=a,{dx:f,dy:p}=jR(this._item,{x1:h,y1:d,x2:h+u,y2:d+c});e.x=e.x+f,e.y=e.y+p}this.setItemAttributes(this._item,r,e,o),this.setItemLineAttr(s,i,e,s.visible),this.setDecorativeLineAttr(s,e,(t=s.decorativeLine)===null||t===void 0?void 0:t.visible)}initMarker(e){const{position:t,itemContent:i={}}=this.attribute,s={x:t.x+(i.offsetX||0),y:t.y+(i.offsetY||0)},r=new kh({points:[],pickable:!1});r.name="mark-point-line",this._line=r,e.add(r);const a=ce.line({points:[]});a.name="mark-point-decorativeLine",this._decorativeLine=a,e.add(a);const o=this.initItem(i,s);this._item=o,this.setAllOfItemsAttr(s),e.add(o)}updateMarker(){const{position:e,itemContent:t={}}=this.attribute,{type:i="text"}=t,s={x:e.x+(t.offsetX||0),y:e.y+(t.offsetY||0)};this.setItemAttributes(this._item,t,s,i),this.setAllOfItemsAttr(s)}isValidPoints(){const{position:e}=this.attribute;return!(!j(e.x)||!j(e.y))}};y0.defaultAttributes=R$;function $R(){zt(),xs(),Ea()}const YR={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};$R();class ou extends ti{getCurrent(){return this._current}constructor(e,t){super(t!=null&&t.skipDefault?e:re({},ou.defaultAttributes,e)),this.name="pager",this._current=1,this._onHover=i=>{const s=i.target;s.hasState("disable")||s.addState("hover")},this._onUnHover=i=>{i.target.removeState("hover")},this._onClick=i=>{const s=i.target;if(s.name==="preHandler"){if(this._current===1)return;this._current-=1,this._current===1?s.addState("disable"):s.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:i})}if(s.name==="nextHandler"){if(this._current===this._total)return;this._current+=1,this._current===this._total?s.addState("disable"):s.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:i})}this._current>1&&this.preHandler.removeState("disable"),this._current<this._total&&this.nextHandler.removeState("disable"),this.text.setAttribute("text",`${this._current}/${this._total}`)}}render(){var e,t;this._reset();const{layout:i="horizontal",handler:s=YR,total:r,defaultCurrent:a=1,textStyle:o,padding:l=0}=this.attribute;this._current=a;const h=tn(l),d=i==="horizontal",u=ce.group({x:0,y:0}),c=s.style||{},f=c.size||15,p=(e=s.space)!==null&&e!==void 0?e:8,g=s.state||{};let{preShape:_,nextShape:m}=s;_||(_=d?"triangleLeft":"triangleUp"),m||(m=d?"triangleRight":"triangleDown");const y=ce.symbol(Object.assign(Object.assign({strokeBoundsBuffer:0,pickMode:"imprecise"},c),{x:0,y:0,symbolType:_,size:f}));y.states=g,y.name="preHandler",this.preHandler=y,u.add(y);const{width:b,height:v}=I_(`${r}/${r}`,Object.assign({textAlign:"center",textBaseline:"middle"},o),(t=this.stage)===null||t===void 0?void 0:t.getTheme().text.fontFamily),x=oe(f)?f:f[0],S=oe(f)?f:f[1],A=ce.text(Object.assign({x:d?x/2+p+b/2:0,y:d?0:S/2+p+v/2,text:`${a}/${r}`,textAlign:"center",textBaseline:"middle",lineHeight:o==null?void 0:o.fontSize},o));this.text=A,u.add(A);const k=ce.symbol(Object.assign(Object.assign({strokeBoundsBuffer:0,pickMode:"imprecise"},c),{x:d?x+2*p+b:0,y:d?0:S+2*p+v,symbolType:m,size:f}));k.name="nextHandler",k.states=g,this.nextHandler=k,u.add(k),this._total===1?(y.addState("disable"),k.addState("disable")):this._current===1?y.addState("disable"):this._current===r&&k.addState("disable");const w=u.AABBBounds,M=w.width(),T=w.height();u.translateTo(0-w.x1+h[3],0-w.y1+h[0]),this.add(u),this.attribute.width=M+h[1]+h[3],this.attribute.height=T+h[0]+h[2],this._bindEvents()}_bindEvents(){this.attribute.disableTriggerEvent||(this.preHandler&&(this.preHandler.addEventListener("pointerenter",this._onHover),this.preHandler.addEventListener("pointerleave",this._onUnHover),this.preHandler.addEventListener("pointerdown",this._onClick)),this.nextHandler&&(this.nextHandler.addEventListener("pointerenter",this._onHover),this.nextHandler.addEventListener("pointerleave",this._onUnHover),this.nextHandler.addEventListener("pointerdown",this._onClick)))}_reset(){this.removeAllChild(),this._current=1,this._total=this.attribute.total,this.preHandler=this.nextHandler=this.text=null}}ou.defaultAttributes={handler:YR,textStyle:{fill:"rgb(51, 51, 51)",fontSize:12}};const og=10,XR=8,KR=8,D$=8,Fv=16,zv=8,Zu=12,qR=12;var Se;(function(n){n.selected="selected",n.unSelected="unSelected",n.selectedHover="selectedHover",n.unSelectedHover="unSelectedHover",n.focus="focus"})(Se||(Se={}));var Dn;(function(n){n.legendItemHover="legendItemHover",n.legendItemUnHover="legendItemUnHover",n.legendItemClick="legendItemClick",n.legendItemAttributeUpdate="legendItemAttributeUpdate"})(Dn||(Dn={}));var xi;(function(n){n.innerView="innerView",n.title="legendTitle",n.item="legendItem",n.itemShape="legendItemShape",n.itemLabel="legendItemLabel",n.itemValue="legendItemValue",n.focus="legendItemFocus"})(xi||(xi={}));class b0 extends ti{constructor(){super(...arguments),this.name="legend",this._title=null}render(){this.removeAllChild();const{interactive:e=!0,title:t,padding:i=0}=this.attribute,s=tn(i),r=ce.group({x:s[3],y:s[0],pickable:e,childrenPickable:e});r.name=xi.innerView,this.add(r),this._innerView=r,t!=null&&t.visible&&this._renderTitle(t),this._renderContent(),this._adjustLayout(),e&&this._bindEvents();const a=this._innerView.AABBBounds;this.attribute.width=a.width()+s[1]+s[3],this.attribute.height=a.height()+s[0]+s[2]}_renderTitle(e){const{text:t="",textStyle:i,padding:s=0,background:r,minWidth:a,maxWidth:o,shape:l}=e,h={x:0,y:0,text:t,textStyle:i,padding:tn(s),minWidth:a,maxWidth:o};l&&l.visible&&(h.shape=Object.assign({visible:!0},l.style),P(l.space)&&(h.space=l.space)),r&&r.visible&&(h.panel=Object.assign({visible:!0},r.style));const d=new Ss(h);d.name=xi.title,this._title=d,this._innerView.add(d)}_adjustLayout(){var e;if(this._title){const t=this._innerView.AABBBounds.width(),i=this._title.AABBBounds.width(),s=(e=this.attribute.title)===null||e===void 0?void 0:e.align;s==="center"?this._title.setAttribute("x",(t-i)/2):s==="end"&&this._title.setAttribute("x",t-i)}}}function Y_(){zt(),Ea(),kr(),xs()}function v0(){zt(),D_()}function F$(){v0(),$R()}function z$(){v0(),Y_()}function j$(){v0(),Y_(),Xu()}var H$=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};const G$={[Se.focus]:{},[Se.selected]:{},[Se.selectedHover]:{},[Se.unSelected]:{},[Se.unSelectedHover]:{}};F$();let ZR=class JR extends b0{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},JR.defaultAttributes,e)),this.name="discreteLegend",this._itemsContainer=null,this._itemHeightByUser=void 0,this._itemHeight=0,this._itemMaxWidth=0,this._onHover=i=>{const s=i.target;if(s&&s.name&&s.name.startsWith(xi.item)){const r=s.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===r.id)return;this._unHover(this._lastActiveItem,i)}this._hover(r,i)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,i),this._lastActiveItem=null)},this._onUnHover=i=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,i),this._lastActiveItem=null)},this._onClick=i=>{var s,r,a,o;const l=i.target;if(l&&l.name&&l.name.startsWith(xi.item)){const h=l.delegate;if(l.name===xi.focus){const d=h.hasState(Se.focus);h.toggleState(Se.focus),d?(s=this._itemsContainer)===null||s===void 0||s.getChildren().forEach(u=>{this._removeLegendItemState(u,[Se.unSelected,Se.unSelectedHover,Se.focus],i),this._setLegendItemState(u,Se.selected,i)}):(this._setLegendItemState(h,Se.selected,i),this._removeLegendItemState(h,[Se.unSelected,Se.unSelectedHover],i),(r=this._itemsContainer)===null||r===void 0||r.getChildren().forEach(u=>{h!==u&&(this._removeLegendItemState(u,[Se.selected,Se.selectedHover,Se.focus],i),this._setLegendItemState(u,Se.unSelected,i))}))}else{(a=this._itemsContainer)===null||a===void 0||a.getChildren().forEach(p=>{p.removeState(Se.focus)});const{selectMode:d="multiple",allowAllCanceled:u=!0}=this.attribute,c=h.hasState(Se.selected),f=this._getSelectedLegends();if(d==="multiple"){if(u===!1&&c&&f.length===1)return void this._dispatchLegendEvent(Dn.legendItemClick,h,i);c?(this._removeLegendItemState(h,[Se.selected,Se.selectedHover],i),this._setLegendItemState(h,Se.unSelected,i)):(this._setLegendItemState(h,Se.selected,i),this._removeLegendItemState(h,[Se.unSelected,Se.unSelectedHover],i))}else this._setLegendItemState(h,Se.selected,i),this._removeLegendItemState(h,[Se.unSelected,Se.unSelectedHover],i),(o=this._itemsContainer)===null||o===void 0||o.getChildren().forEach(p=>{h!==p&&(this._removeLegendItemState(p,[Se.selected,Se.selectedHover],i),this._setLegendItemState(p,Se.unSelected,i))})}this._dispatchLegendEvent(Dn.legendItemClick,h,i)}}}setSelected(e){var t;((t=this._itemsContainer)===null||t===void 0?void 0:t.getChildren()).forEach(i=>{const s=i.data;e.includes(s.label)?(this._setLegendItemState(i,Se.selected),this._removeLegendItemState(i,[Se.unSelected,Se.unSelectedHover])):(this._removeLegendItemState(i,[Se.selected,Se.selectedHover]),this._setLegendItemState(i,Se.unSelected))})}_renderContent(){const{item:e={},items:t,reversed:i,maxCol:s=1,maxRow:r=2}=this.attribute;if(e.visible===!1||fe(t))return;let a=t;i&&(a=t==null?void 0:t.reverse());const o=ce.group({x:0,y:0});this._itemsContainer=o;const{layout:l,maxWidth:h,maxHeight:d,defaultSelected:u=[],autoPage:c}=this.attribute,f=l==="horizontal",{spaceCol:p=Fv,spaceRow:g=zv,maxWidth:_,width:m,height:y}=e;P(_)?P(m)?this._itemWidthByUser=Math.min(_,m):this._itemWidthByUser=_:P(m)&&(this._itemWidthByUser=m),P(y)&&(this._itemHeightByUser=y);let b=!1,v=0,x=0,S=0,A=1,k=1;a.forEach((M,T)=>{M.id||(M.id=M.label),M.index=T;const E=this._renderEachItem(M,!!fe(u)||(u==null?void 0:u.includes(M.label)),T,a),O=E.attribute.width,B=E.attribute.height;this._itemHeight=Math.max(this._itemHeight,B),v=Math.max(O,v),this._itemMaxWidth=Math.max(O,this._itemMaxWidth),f?(A=r,P(h)&&(O>=h?(b=!0,T>0&&(x=0,S+=B+g,k+=1)):h<x+O&&(b=!0,x=0,S+=B+g,k+=1)),T>0&&E.setAttributes({x,y:S}),x+=p+O):(A=s,P(d)&&d<S+B&&(b=!0,S=0,x+=v+p,v=0,k+=1),T>0&&E.setAttributes({x,y:S}),S+=g+B),o.add(E)});let w=!1;b&&c&&k>A&&(w=this._renderPager(f)),w||(o.setAttribute("y",this._title?this._title.AABBBounds.height()+Te(this.attribute,"title.space",8):0),this._innerView.add(o))}_bindEvents(){if(this.attribute.disableTriggerEvent||!this._itemsContainer)return;const{hover:e=!0,select:t=!0}=this.attribute;e&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerleave",this._onUnHover)),t&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(e,t,i,s){var r,a;const{id:o,label:l,value:h,shape:d}=e,{padding:u=0,focus:c,focusIconStyle:f}=this.attribute.item,{shape:p,label:g,value:_,background:m}=this.attribute.item,y=this._handleStyle(p,e,t,i,s),b=this._handleStyle(g,e,t,i,s),v=this._handleStyle(_,e,t,i,s),x=this._handleStyle(m,e,t,i,s),S=tn(u);let A;m.visible===!1?(A=ce.group({x:0,y:0,cursor:(r=x.style)===null||r===void 0?void 0:r.cursor}),this._appendDataToShape(A,xi.item,e,A)):(A=ce.group(Object.assign({x:0,y:0},x.style)),this._appendDataToShape(A,xi.item,e,A,x.state)),A.id=`${o??l}-${i}`,A.addState(t?Se.selected:Se.unSelected);const k=ce.group({x:0,y:0,pickable:!1});A.add(k);let w,M=0,T=0,E=0;if(p&&p.visible!==!1){const U=Te(y,"style.size",og);T=W(U)?U[0]||0:U,E=Te(p,"space",XR);const $=ce.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},d),y.style));Object.keys(y.state||{}).forEach(Z=>{const q=y.state[Z].fill||y.state[Z].stroke;d.fill&&C(y.state[Z].fill)&&q&&(y.state[Z].fill=q),d.stroke&&C(y.state[Z].stroke)&&q&&(y.state[Z].stroke=q)}),this._appendDataToShape($,xi.itemShape,e,A,y.state),$.addState(t?Se.selected:Se.unSelected),k.add($)}let O=0;if(c){const U=Te(f,"size",og);w=ce.symbol(Object.assign(Object.assign({x:0,y:-U/2-1,strokeBoundsBuffer:0},f),{visible:!0,pickMode:"imprecise",boundsPadding:S})),this._appendDataToShape(w,xi.focus,e,A),O=U}const B=ce.text(Object.assign(Object.assign({x:T/2+E,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(a=b.style)===null||a===void 0?void 0:a.fontSize},b.style),{text:g.formatMethod?g.formatMethod(l,e,i):l}));this._appendDataToShape(B,xi.itemLabel,e,A,b.state),B.addState(t?Se.selected:Se.unSelected),k.add(B);const R=Te(g,"space",KR);if(P(h)){const U=Te(_,"space",c?D$:0),$=ce.text(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:v.style.fontSize},v.style),{text:_.formatMethod?_.formatMethod(h,e,i):h}));if(this._appendDataToShape($,xi.itemValue,e,A,v.state),$.addState(t?Se.selected:Se.unSelected),this._itemWidthByUser){const Z=this._itemWidthByUser-S[1]-S[3]-T-E-R-O-U,q=$.AABBBounds,ie=B.AABBBounds,K=q.width(),V=ie.width();V>Z?(Z-K)/V>.4?B.setAttribute("maxLineWidth",Z-K):($.setAttribute("maxLineWidth",.5*Z),B.setAttribute("maxLineWidth",.5*Z)):$.setAttribute("maxLineWidth",Z-V),_.alignRight?$.setAttributes({textAlign:"right",x:this._itemWidthByUser-T/2-S[1]-S[3]-O-U}):$.setAttribute("x",B.AABBBounds.x2+U)}else $.setAttribute("x",B.AABBBounds.x2+U);M=$.AABBBounds.x2+U,k.add($)}else this._itemWidthByUser&&B.setAttribute("maxLineWidth",this._itemWidthByUser-S[1]-S[3]-T-E-O),M=B.AABBBounds.x2+R;w&&(w.setAttribute("x",M),k.add(w));const L=k.AABBBounds,I=L.width(),F=L.height(),H=P(this.attribute.item.width)?this.attribute.item.width:I+S[1]+S[3],G=this._itemHeightByUser||F+S[0]+S[2];return A.attribute.width=H,A.attribute.height=G,w&&w.setAttribute("visible",!1),k.translateTo(-L.x1+S[3],-L.y1+S[0]),A}_renderPager(e){const t=this._title?this._title.AABBBounds.height()+Te(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:s,maxCol:r=1,maxRow:a=2,item:o={},pager:l={},disableTriggerEvent:h}=this.attribute,{spaceCol:d=Fv,spaceRow:u=zv}=o,c=this._itemsContainer,{animation:f=!0,animationDuration:p=450,animationEasing:g="quadIn",space:_=qR,position:m="middle"}=l,y=H$(l,["animation","animationDuration","animationEasing","space","position"]);let b,v=0,x=0,S=0,A=0,k=1;if(e){if(b=new ou(Object.assign(Object.assign({layout:a===1?"horizontal":"vertical",total:99},re({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},y)),{disableTriggerEvent:h})),this._pager=b,this._innerView.add(b),v=(a-1)*u+this._itemHeight*a,x=i-b.AABBBounds.width()-_,x<=0)return this._innerView.removeChild(b),!1;let T;c.getChildren().forEach((E,O)=>{const{width:B,height:R}=E.attribute;x<S+B&&(S=0,A+=R+u,k+=1),O>0&&E.setAttributes({x:S,y:A}),S+=d+B}),b.setAttribute("total",Math.ceil(k/a)),T=m==="start"?t:m==="end"?t+v-b.AABBBounds.height()/2:t+v/2-b.AABBBounds.height()/2,b.setAttributes({x,y:T})}else{if(b=new ou(Object.assign({layout:"horizontal",total:99,disableTriggerEvent:h},y)),this._pager=b,this._innerView.add(b),x=this._itemMaxWidth*r+(r-1)*d,v=s-b.AABBBounds.height()-_-t,v<=0)return this._innerView.removeChild(b),!1;let T;c.getChildren().forEach((E,O)=>{const{height:B}=E.attribute;v<A+B&&(A=0,S+=this._itemMaxWidth+d,k+=1),O>0&&E.setAttributes({x:S,y:A}),A+=u+B}),b.setAttribute("total",Math.ceil(k/r)),T=m==="start"?0:m==="end"?x-b.AABBBounds.width():(x-b.AABBBounds.width())/2,b.setAttributes({x:T,y:s-b.AABBBounds.height()})}l.defaultCurrent>1&&(e?c.setAttribute("y",-(l.defaultCurrent-1)*(v+u)):c.setAttribute("x",-(l.defaultCurrent-1)*(x+d)));const w=ce.group({x:0,y:t,width:x,height:v,clip:!0,pickable:!1});w.add(c),this._innerView.add(w);const M=T=>{const{current:E}=T.detail;f?c.animate().to(e?{y:-(E-1)*(v+u)}:{x:-(E-1)*(x+d)},p,g):e?c.setAttribute("y",-(E-1)*(v+u)):c.setAttribute("x",-(E-1)*(x+d))};return this._pager.addEventListener("toPrev",M),this._pager.addEventListener("toNext",M),!0}_hover(e,t){this._lastActiveItem=e,e.hasState(Se.selected)?this._setLegendItemState(e,Se.selectedHover,t):this._setLegendItemState(e,Se.unSelectedHover,t);const i=e.getChildren()[0].find(s=>s.name===xi.focus,!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(Dn.legendItemHover,e,t)}_unHover(e,t){let i=!1;(e.hasState(Se.unSelectedHover)||e.hasState(Se.selectedHover))&&(i=!0),e.removeState(Se.unSelectedHover),e.removeState(Se.selectedHover),e.getChildren()[0].getChildren().forEach(r=>{i||!r.hasState(Se.unSelectedHover)&&!r.hasState(Se.selectedHover)||(i=!0),r.removeState(Se.unSelectedHover),r.removeState(Se.selectedHover)});const s=e.getChildren()[0].find(r=>r.name===xi.focus,!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(Dn.legendItemAttributeUpdate,e,t),this._dispatchLegendEvent(Dn.legendItemUnHover,e,t)}_setLegendItemState(e,t,i){let s=!1;e.hasState(t)||(s=!0),e.addState(t,!0),e.getChildren()[0].getChildren().forEach(r=>{r.name!==xi.focus&&(s||r.hasState(t)||(s=!0),r.addState(t,!0))}),s&&this._dispatchLegendEvent(Dn.legendItemAttributeUpdate,e,i)}_removeLegendItemState(e,t,i){let s=!1;t.forEach(r=>{!s&&e.hasState(r)&&(s=!0),e.removeState(r)}),e.getChildren()[0].getChildren().forEach(r=>{r.name!==xi.focus&&t.forEach(a=>{!s&&r.hasState(a)&&(s=!0),r.removeState(a)})}),s&&this._dispatchLegendEvent(Dn.legendItemAttributeUpdate,e,i)}_getSelectedLegends(){var e;const t=[];return(e=this._itemsContainer)===null||e===void 0||e.getChildren().forEach(i=>{i.hasState(Se.selected)&&t.push(i.data)}),t}_appendDataToShape(e,t,i,s,r={}){e.name=t,e.data=i,e.delegate=s,e.states=re({},G$,r)}_dispatchLegendEvent(e,t,i){const s=this._getSelectedLegends();s.sort((a,o)=>a.index-o.index);const r=s.map(a=>a.label);this._dispatchEvent(e,{item:t,data:t.data,selected:t.hasState(Se.selected),currentSelectedItems:s,currentSelected:r,event:i})}_handleStyle(e,t,i,s,r){const a={};return e.style&&(Y(e.style)?a.style=e.style(t,i,s,r):a.style=e.style),e.state&&(a.state={},Object.keys(e.state).forEach(o=>{e.state[o]&&(Y(e.state[o])?a.state[o]=e.state[o](t,i,s,r):a.state[o]=e.state[o])})),a}};ZR.defaultAttributes={layout:"horizontal",title:{align:"start",space:Zu,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:Fv,spaceRow:zv,shape:{space:XR,style:{size:og,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:KR,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:og,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:qR,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};var vi;(function(n){n.innerView="innerView",n.railContainer="sliderRailContainer",n.rail="sliderRail",n.startText="sliderStartText",n.endText="sliderEndText",n.startHandler="sliderStartHandler",n.startHandlerText="startHandlerText",n.endHandler="sliderEndHandler",n.endHandlerText="sliderEndHandlerText",n.track="sliderTrack",n.trackContainer="sliderTrackContainer"})(vi||(vi={}));function hy(n){return W(n)?n:[n,n]}function Uc(n){return n?"ew-resize":"ns-resize"}Y_();class wh extends ti{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e,t){super(t!=null&&t.skipDefault?e:re({},wh.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=i=>{i.stopPropagation(),this._currentHandler=i.target,this._prePos=this._isHorizontal?i.clientX:i.clientY,Fe.env==="browser"?(Fe.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Fe.addEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onHandlerPointerUp),this.stage.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=i=>{var s,r;i.stopPropagation();const{railWidth:a,railHeight:o,min:l,max:h}=this.attribute;if(h===l)return;let d,u,c,f=0;this._isHorizontal?(d=i.clientX,f=d-this._prePos,u=(r=this._currentHandler)===null||r===void 0?void 0:r.attribute.x,c=a):(d=i.clientY,f=d-this._prePos,u=(s=this._currentHandler)===null||s===void 0?void 0:s.attribute.y,c=o);const p=ai(u+f,0,c),g=p/c*(h-l)+l;this._currentHandler.type==="text"?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=d,this._dispatchChangeEvent()},this._onHandlerPointerUp=i=>{i.preventDefault(),this._currentHandler=null,Fe.env==="browser"?(Fe.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Fe.removeEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onHandlerPointerUp),this.stage.removeEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onTrackPointerdown=i=>{i.stopPropagation(),this._prePos=this._isHorizontal?i.clientX:i.clientY,Fe.env==="browser"?(Fe.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Fe.addEventListener("pointerup",this._onTrackPointerUp)):(this.stage.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onTrackPointerUp),this.stage.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=i=>{i.stopPropagation();const{railWidth:s,railHeight:r,min:a,max:o}=this.attribute;if(o===a)return;const{startHandler:l,endHandler:h}=this._getHandlers();let d,u,c;this._isHorizontal?(d=i.clientX,u=this._track.attribute.width,c=s):(d=i.clientY,u=this._track.attribute.height,c=r);const f=d-this._prePos;if(l){const p=this._isHorizontal?l.attribute.x:l.attribute.y,g=ai(p+f,0,c-u),_=g/c*(o-a)+a;this._updateHandler(l,g,_)}if(h){const p=this._isHorizontal?h.attribute.x:h.attribute.y,g=ai(p+f,u,c),_=g/c*(o-a)+a,m=l==null?void 0:l.attribute;this._updateHandler(h,g,_),this._track.setAttributes(this._isHorizontal?{x:Math.min(m.x,h.attribute.x),width:Math.abs(m.x-h.attribute.x)}:{y:Math.min(m.y,h.attribute.y),height:Math.abs(m.y-h.attribute.y)})}this._prePos=d,this._dispatchChangeEvent()},this._onTrackPointerUp=i=>{i.preventDefault(),Fe.env==="browser"?(Fe.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Fe.removeEventListener("pointerup",this._onTrackPointerUp)):(this.stage.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onTrackPointerUp),this.stage.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=i=>{i.stopPropagation();const{railWidth:s,railHeight:r,min:a,max:o}=this.attribute;if(o===a)return;const l=this._startHandler,h=this._endHandler;let d,u,c,f;this._isHorizontal?(d=i.viewX-this._rail.globalAABBBounds.x1,u=l==null?void 0:l.attribute.x,c=h==null?void 0:h.attribute.x,f=s):(d=i.viewY-this._rail.globalAABBBounds.y1,u=l==null?void 0:l.attribute.y,c=h==null?void 0:h.attribute.y,f=r);const p=d/f*(o-a)+a;if(P(c)){const g=Math.abs(d-u)>Math.abs(d-c)?h:l;this._updateHandler(g,d,p)}else this._updateHandler(l,d,p);this._updateTrack(),this._dispatchChangeEvent()}}setValue(e){const{layout:t,railWidth:i,railHeight:s,min:r,max:a}=this.attribute;if(a===r)return;const[o,l]=N(e),{startHandler:h,endHandler:d}=this._getHandlers(),u=t==="vertical"?s:i,c=(o-r)/(a-r)*u;if(h&&this._updateHandler(h,c,o),d){const f=(l-r)/(a-r)*u;this._updateHandler(d,f,l)}this._updateTrack()}render(){var e,t;this.removeAllChild();const{layout:i="horizontal",railWidth:s,railHeight:r,startText:a,endText:o,min:l,max:h,showHandler:d=!0}=this.attribute;let{value:u}=this.attribute;C(u)&&(u=[l,h]),this._currentValue={startValue:hy(u)[0],endValue:hy(u)[1]};const c=i==="horizontal";this._isHorizontal=c;const f=ce.group({x:0,y:0});f.name=vi.innerView,this.add(f),this._innerView=f;let p,g=0;if(a&&a.visible){p=ce.text(Object.assign({x:c?0:s/2,y:c?r/2:0,textAlign:c?"start":"center",textBaseline:c?"middle":"top",text:a.text,lineHeight:(e=a.style)===null||e===void 0?void 0:e.fontSize},a.style)),p.name=vi.startText,f.add(p);const b=P(a.space)?a.space:0;g+=(c?p.AABBBounds.width():p.AABBBounds.height())+b}const _=ce.group({x:c?g:0,y:c?0:g});f.add(_);const m=ce.group({x:0,y:0});let y;if(m.name=vi.railContainer,this._railContainer=m,_.add(m),this._renderRail(m),g+=c?s:r,o&&o.visible){const b=P(o.space)?o.space:0;y=ce.text(Object.assign({x:c?g+b:s/2,y:c?r/2:g+b,textAlign:c?"start":"center",textBaseline:c?"middle":"top",text:o.text,lineHeight:(t=o.style)===null||t===void 0?void 0:t.fontSize},o.style)),y.name=vi.endText,f.add(y)}this._renderTrack(m),d&&(this._renderHandlers(_),this._bindEvents())}_renderRail(e){const{railWidth:t,railHeight:i,railStyle:s,slidable:r}=this.attribute;let a="default";r!==!1&&(a="pointer");const o=ce.rect(Object.assign({x:0,y:0,width:t,height:i,cursor:a},s));return o.name=vi.rail,e.add(o),this._rail=o,o}_renderHandlers(e){const{range:t,min:i,max:s,handlerSize:r=14,handlerStyle:a,handlerText:o,railHeight:l,railWidth:h,slidable:d}=this.attribute;let{value:u}=this.attribute;C(u)&&(u=[i,s]);const c=o&&o.visible,f=this._isHorizontal,p=f?h:l,[g,_]=hy(u),m=s===i?t?0:p:(g-i)/(s-i)*p,y=this._renderHandler(Object.assign({x:f?m:h/2,y:f?l/2:m,size:r,strokeBoundsBuffer:0,cursor:d===!1?"default":Uc(f)},a));if(y.name=vi.startHandler,this._startHandler=y,e.add(y),this._currentValue.startPos=m,c){const b=this._renderHandlerText(g,t?"start":"end");b.name=vi.startHandlerText,e.add(b),this._startHandlerText=b}if(t){const b=s===i?p:(_-i)/(s-i)*p,v=this._renderHandler(Object.assign({x:f?b:h/2,y:f?l/2:b,size:r,strokeBoundsBuffer:0,cursor:d===!1?"default":Uc(f)},a));if(v.name=vi.endHandler,this._endHandler=v,e.add(v),this._currentValue.endPos=b,c){const x=this._renderHandlerText(_,"end");x.name=vi.endHandlerText,e.add(x),this._endHandlerText=x}}}_renderTrack(e){const{range:t,min:i,max:s,railHeight:r,railWidth:a,trackStyle:o,railStyle:l,slidable:h,value:d}=this.attribute;let u,c;if(C(d))t?(u=i,c=s):u=c=i;else if(t){const x=Ir(d,i,s);u=x[0],c=x[1]}else u=i,c=ai(d,i,s);const f=this._isHorizontal,p=f?a:r;t||(u=i);const g=ce.group({x:0,y:0,width:a,height:r,cornerRadius:l==null?void 0:l.cornerRadius,clip:!0,pickable:!1});g.name=vi.trackContainer;const _=He(t)&&t.draggableTrack===!0;let m;m=h===!1?"default":t===!1||_===!1?"pointer":Uc(f);const y=s===i?p:(c-u)/(s-i)*p,b=s===i?0:(u-i)/(s-i)*p,v=ce.rect(Object.assign({x:f?b:0,y:f?0:b,width:f?y:a,height:f?r:y,cursor:m},o));v.name=vi.track,this._track=v,g.add(v),e.add(g)}_renderHandler(e){return ce.symbol(e)}_renderHandlerText(e,t){var i,s,r;const{align:a,min:o,max:l,handlerSize:h=14,handlerText:d={},railHeight:u,railWidth:c,slidable:f}=this.attribute,p=this._isHorizontal,g=p?c:u,_=l===o?t==="start"?0:g:(e-o)/(l-o)*g,m=(i=d.space)!==null&&i!==void 0?i:4,y={text:d.formatter?d.formatter(e):e.toFixed((s=d.precision)!==null&&s!==void 0?s:0),lineHeight:(r=d.style)===null||r===void 0?void 0:r.lineHeight,cursor:f===!1?"default":Uc(p)};return p?a==="top"?(y.textBaseline="bottom",y.textAlign="center",y.x=_,y.y=(u-h)/2-m):(y.textBaseline="top",y.textAlign="center",y.x=_,y.y=(u+h)/2+m):a==="left"?(y.textBaseline="middle",y.textAlign="end",y.x=(c-h)/2-m,y.y=_):(y.textBaseline="middle",y.textAlign="start",y.x=(c+h)/2+m,y.y=_),ce.text(Object.assign(Object.assign({},y),d.style))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:e,range:t}=this.attribute;e&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),He(t)&&t.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const e=this._startHandler,t=this._endHandler;if(this._isHorizontal){const i=e==null?void 0:e.attribute.x;if(t){const s=t==null?void 0:t.attribute.x;this._track.setAttributes({x:Math.min(i,s),width:Math.abs(i-s)})}else this._track.setAttributes({width:i})}else{const i=e==null?void 0:e.attribute.y;if(t){const s=t==null?void 0:t.attribute.y;this._track.setAttributes({y:Math.min(i,s),height:Math.abs(i-s)})}else this._track.setAttributes({height:i})}}_updateHandler(e,t,i){var s;const r=this._isHorizontal;e.setAttribute(r?"x":"y",t);const a=e.name===vi.startHandler?this._startHandlerText:this._endHandlerText;if(a){const{handlerText:o={}}=this.attribute;a.setAttributes({text:o.formatter?o.formatter(i):i.toFixed((s=o.precision)!==null&&s!==void 0?s:0),[r?"x":"y"]:t})}e.name===vi.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=t):(this._currentValue.endValue=i,this._currentValue.endPos=t)}_updateHandlerText(e,t,i){var s;const r=this._isHorizontal,{handlerText:a={}}=this.attribute;e.setAttributes({[r?"x":"y"]:t,text:a.formatter?a.formatter(i):i.toFixed((s=a.precision)!==null&&s!==void 0?s:0)});const o=e.name===vi.startHandlerText?this._startHandler:this._endHandler;o&&o.setAttributes({[r?"x":"y"]:t}),e.name===vi.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=t):(this._currentValue.endValue=i,this._currentValue.endPos=t)}_dispatchChangeEvent(){const e=!!this.attribute.range,t=this._currentValue;this._dispatchEvent("change",{value:e?[Math.min(t.endValue,t.startValue),Math.max(t.endValue,t.startValue)]:t.startValue,position:e?[Math.min(t.endPos,t.startPos),Math.max(t.endPos,t.startPos)]:t.startPos})}_getHandlers(){let e,t=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(t==null?void 0:t.attribute.x)&&(e=t,t=i,i=e):i&&i.attribute.y<(t==null?void 0:t.attribute.y)&&(e=t,t=i,i=e),{startHandler:t,endHandler:i}}}wh.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}};z$();class X_ extends b0{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},X_.defaultAttributes,e)),this.name="colorLegend",this._onSliderChange=i=>{this._updateColor(),this.dispatchEvent(i)}}setSelected(e){this._slider&&(this._slider.setValue(e),this._updateColor())}_renderContent(){const{colors:e,slidable:t,layout:i,align:s,min:r,max:a,value:o,railWidth:l,railHeight:h,showHandler:d=!0,handlerSize:u,handlerStyle:c,railStyle:f,trackStyle:p,startText:g,endText:_,handlerText:m,showTooltip:y,tooltip:b,disableTriggerEvent:v}=this.attribute,x=[],S=(a-r)/(e.length-1);for(let k=0;k<e.length;k++)x.push(r+S*k);this._colorScale=new qn().domain(x,!0).range(e),this._color=this._getTrackColor();const A=new wh({x:0,y:0,range:{draggableTrack:!0},slidable:t,layout:i,align:s,min:r,max:a,value:o,railWidth:l,railHeight:h,showHandler:d,handlerSize:u,handlerStyle:c,railStyle:f,trackStyle:Object.assign({fill:this._color},p),startText:g,endText:_,handlerText:m,showTooltip:y,tooltip:b,disableTriggerEvent:v});this._innerView.add(A),this._slider=A,A.translateTo(0-A.AABBBounds.x1,(this._title?this._title.AABBBounds.height()+Te(this.attribute,"title.space",Zu):0)-A.AABBBounds.y1),this._updateColor()}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&this._slider.addEventListener("change",this._onSliderChange)}_getTrackColor(){const{colors:e,layout:t}=this.attribute;if(fe(e))return;const i=e.length;if(i===1)return e[0];const s=[];for(let a=0;a<i;a++){const o=a/(i-1);s.push({offset:o,color:e[a]})}const r=t==="horizontal";return{gradient:"linear",stops:s,x0:0,y0:0,x1:r?1:0,y1:r?0:1}}_updateColor(){const{layout:e="horizontal",colors:t,railWidth:i,railHeight:s}=this.attribute,{startHandler:r,endHandler:a,track:o}=this._slider,{startValue:l,endValue:h,startPos:d,endPos:u}=this._slider.currentValue,c=this._colorScale.scale(l),f=this._colorScale.scale(h);r==null||r.setAttribute("fill",c),a==null||a.setAttribute("fill",f);const p=e==="horizontal"?i:s;if(Math.abs(d-u)!==p&&t&&t.length>1){const g=this._color.stops,_=Math.min(d,u),m=Math.max(d,u),y=_/p,b=m/p,v=b-y,x=g.filter(T=>T.offset>y&&T.offset<b),S=Math.min(l,h),A=Math.max(l,h),k=this._colorScale.scale(S),w=this._colorScale.scale(A),M=[{offset:0,color:k}];x.forEach(T=>{M.push({offset:(T.offset-y)/v,color:T.color})}),M.push({offset:1,color:w}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:M}))}}}X_.defaultAttributes={layout:"horizontal",title:{align:"start",space:Zu,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};function W$(n="bottom"){let e=0;return n==="top"?`
  18. M${e},-6L${e-3.5},-2.5
  19. v5
  20. h7
  21. v-5
  22. Z
  23. `:n==="left"?(e=1,`
  24. M${e-6},0L${e-6+2.5},-3.5
  25. h5
  26. v7
  27. h-5
  28. Z
  29. `):n==="right"?(e=-1,`
  30. M${e+6},0L${e+6-2.5},-3.5
  31. h-5
  32. v7
  33. h5
  34. Z
  35. `):`
  36. M${e},6L${e-3.5},2.5
  37. v-5
  38. h7
  39. v5
  40. Z
  41. `}j$();class K_ extends b0{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},K_.defaultAttributes,e)),this.name="sizeLegend",this._onSliderChange=i=>{this.dispatchEvent(i)}}setSelected(e){this._slider&&this._slider.setValue(e)}_renderContent(){const{slidable:e,layout:t,align:i,min:s,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:d,handlerStyle:u,railStyle:c,trackStyle:f,startText:p,endText:g,handlerText:_,showTooltip:m,tooltip:y,sizeBackground:b,disableTriggerEvent:v}=this.attribute,x=ce.group({x:0,y:0});this._innerView.add(x);const S=new wh({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:e,layout:t,align:i,min:s,max:r,value:a,railWidth:o,railHeight:l,showHandler:h,handlerSize:d,handlerStyle:Object.assign({symbolType:W$(i)},u),railStyle:c,trackStyle:f,startText:p,endText:g,handlerText:_,showTooltip:m,tooltip:y,disableTriggerEvent:v});x.add(S);let A,k=0;t==="horizontal"?i==="top"?(A=`M0,0L${o},0L${o},12Z`,k=l):(A=`M0,12L${o},12L${o},0Z`,S.setAttribute("y",12)):i==="left"?A=`M${o},0L${o},0L${o+12},${l}L${o},${l}Z`:(A=`M0,${l}L12,${l}L12,0Z`,S.setAttribute("x",12));const w=ce.path(Object.assign(Object.assign({x:0,y:k,path:A},b),{zIndex:0}));x.add(w);const M=this._title?this._title.AABBBounds.height()+Te(this.attribute,"title.space",Zu):0;x.translate(0-x.AABBBounds.x1,M-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}K_.defaultAttributes={layout:"horizontal",title:{align:"start",space:Zu,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}};function V$(){zt(),_R(),Pa()}V$();let QR=class eO extends ti{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},eO.defaultAttributes,e)),this.name="title"}render(){var e,t,i,s,r,a,o,l,h,d,u,c,f,p,g,_,m,y,b,v,x,S,A,k,w,M,T,E,O,B,R,L,I,F,H,G,U,$,Z,q,ie,K;const{textType:V,text:te,subtextType:le,textStyle:he={},subtext:Ce,subtextStyle:ge={},width:ke,height:xe,minWidth:Re,maxWidth:Pe,minHeight:Ei,maxHeight:Tt,align:Mn,verticalAlign:fi,padding:Tn=0}=this.attribute,dt=tn(Tn),Ct=this.createOrUpdateChild("title-container",{x:dt[3],y:dt[0],zIndex:1},"group");if(this.attribute.visible!==!1&&he.visible!==!1)if(V==="rich"||P(he.character)){const tt=Object.assign({x:(e=he.x)!==null&&e!==void 0?e:0,y:(t=he.y)!==null&&t!==void 0?t:0,width:(s=(i=he.width)!==null&&i!==void 0?i:ke)!==null&&s!==void 0?s:0,height:(a=(r=he.height)!==null&&r!==void 0?r:xe)!==null&&a!==void 0?a:0,ellipsis:(o=he.ellipsis)===null||o===void 0||o,wordBreak:(l=he.wordBreak)!==null&&l!==void 0?l:"break-word",maxHeight:he.maxHeight,maxWidth:he.maxWidth,textConfig:(h=he.character)!==null&&h!==void 0?h:te},he);this._mainTitle=Ct.createOrUpdateChild("mainTitle",tt,"richtext")}else if(V==="html"){const tt=Object.assign({html:Object.assign(Object.assign({dom:te},br),he),x:(d=he.x)!==null&&d!==void 0?d:0,y:(u=he.y)!==null&&u!==void 0?u:0,width:(f=(c=he.width)!==null&&c!==void 0?c:ke)!==null&&f!==void 0?f:0,height:(g=(p=he.height)!==null&&p!==void 0?p:xe)!==null&&g!==void 0?g:0,ellipsis:(_=he.ellipsis)===null||_===void 0||_,wordBreak:(m=he.wordBreak)!==null&&m!==void 0?m:"break-word",maxHeight:he.maxHeight,maxWidth:he.maxWidth,textConfig:[]},he);this._mainTitle=Ct.createOrUpdateChild("mainTitle",tt,"richtext")}else P(te)&&(this._mainTitle=Ct.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:W(te)?te:[te]},he),{maxLineWidth:(y=he.maxLineWidth)!==null&&y!==void 0?y:ke,heightLimit:he.heightLimit,lineClamp:he.lineClamp,ellipsis:(b=he.ellipsis)===null||b===void 0||b,x:0,y:0}),"wrapText"));const ts=this._mainTitle?this._mainTitle.AABBBounds.height():0,Cn=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(this.attribute.visible!==!1&&ge.visible!==!1)if(le==="rich"||P(ge.character)){const tt=Object.assign({x:(v=ge.x)!==null&&v!==void 0?v:0,y:(x=ge.y)!==null&&x!==void 0?x:0,width:(A=(S=ge.width)!==null&&S!==void 0?S:ke)!==null&&A!==void 0?A:0,height:(w=(k=ge.height)!==null&&k!==void 0?k:xe)!==null&&w!==void 0?w:0,ellipsis:(M=ge.ellipsis)===null||M===void 0||M,wordBreak:(T=ge.wordBreak)!==null&&T!==void 0?T:"break-word",maxHeight:ge.maxHeight,maxWidth:ge.maxWidth,textConfig:(E=ge.character)!==null&&E!==void 0?E:Ce},ge);this._subTitle=Ct.createOrUpdateChild("subTitle",tt,"richtext")}else if(le==="html"){const tt=Object.assign({html:Object.assign(Object.assign({dom:Ce},br),ge),x:(O=ge.x)!==null&&O!==void 0?O:0,y:(B=ge.y)!==null&&B!==void 0?B:0,width:(L=(R=ge.width)!==null&&R!==void 0?R:ke)!==null&&L!==void 0?L:0,height:(F=(I=ge.height)!==null&&I!==void 0?I:xe)!==null&&F!==void 0?F:0,ellipsis:(H=ge.ellipsis)===null||H===void 0||H,wordBreak:(G=ge.wordBreak)!==null&&G!==void 0?G:"break-word",maxHeight:ge.maxHeight,maxWidth:ge.maxWidth,textConfig:[]},ge);this._subTitle=Ct.createOrUpdateChild("subTitle",tt,"richtext")}else P(Ce)&&(this._subTitle=Ct.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:W(Ce)?Ce:[Ce]},ge),{maxLineWidth:(U=ge.maxLineWidth)!==null&&U!==void 0?U:ke,heightLimit:ge.heightLimit,lineClamp:ge.lineClamp,ellipsis:($=ge.ellipsis)===null||$===void 0||$,x:0,y:ts}),"wrapText"));const Ia=this._subTitle?this._subTitle.AABBBounds.height():0,Cr=this._subTitle?this._subTitle.AABBBounds.width():0;let pi=Math.max(Cn,Cr),Bt=ts+((Z=ge.height)!==null&&Z!==void 0?Z:Ia);if(P(ke)&&(pi=ke,this._mainTitle&&this._mainTitle.setAttribute("maxLineWidth",ke),this._subTitle&&this._subTitle.setAttribute("maxLineWidth",ke)),P(xe)&&(Bt=xe),P(Re)&&pi<Re&&(pi=Re),P(Pe)&&(this._mainTitle&&this._mainTitle.setAttribute("maxLineWidth",Pe),this._subTitle&&this._subTitle.setAttribute("maxLineWidth",Pe),this._mainTitle&&this._mainTitle.setAttribute("maxWidth",Pe),this._subTitle&&this._subTitle.setAttribute("maxWidth",Pe),pi>Pe&&(pi=Pe)),P(Ei)&&Bt<Ei&&(Bt=Ei),P(Tt)&&(this._mainTitle&&this._mainTitle.setAttribute("maxHeight",Tt),this._subTitle&&this._subTitle.setAttribute("maxHeight",Tt-ts),Bt>Tt&&(Bt=Tt)),Ct.attribute.width=pi,Ct.attribute.height=Bt,Ct.attribute.boundsPadding=dt,this._mainTitle){if(P(Mn)||P(he.align)){const tt=he.align?he.align:Mn,Ut=(q=he.width)!==null&&q!==void 0?q:Cn;tt==="left"?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):tt==="center"?(this._mainTitle.setAttribute("x",Ut/2),this._mainTitle.setAttribute("textAlign","center")):tt==="right"&&(this._mainTitle.setAttribute("x",Ut),this._mainTitle.setAttribute("textAlign","right"))}if(P(fi)||P(he.verticalAlign)){const tt=he.verticalAlign?he.verticalAlign:fi,Ut=he.height?he.height:Bt;tt==="top"?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):tt==="middle"?(this._mainTitle.setAttribute("y",Ut/2),this._mainTitle.setAttribute("textBaseline","middle")):tt==="bottom"&&(this._mainTitle.setAttribute("y",Ut),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(P(Mn)||P(ge.align)){const tt=ge.align?ge.align:Mn,Ut=(ie=ge.width)!==null&&ie!==void 0?ie:Cr;tt==="left"?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):tt==="center"?(this._subTitle.setAttribute("x",Ut/2),this._subTitle.setAttribute("textAlign","center")):tt==="right"&&(this._subTitle.setAttribute("x",Ut),this._subTitle.setAttribute("textAlign","right"))}if(P(fi)||P(he.verticalAlign)){const tt=ge.verticalAlign?ge.verticalAlign:fi,Ut=ts,So=(K=ge.height)!==null&&K!==void 0?K:0;tt==="top"?(this._subTitle.setAttribute("y",Ut),this._subTitle.setAttribute("textBaseline","top")):tt==="middle"?(this._subTitle.setAttribute("y",Ut+So/2),this._subTitle.setAttribute("textBaseline","middle")):tt==="bottom"&&(this._subTitle.setAttribute("y",Ut+So),this._subTitle.setAttribute("textBaseline","bottom"))}}}};QR.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const qw={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};function N$(){zt(),Ea(),Pa()}N$();let U$=class extends ti{constructor(){super(...arguments),this.name="indicator"}render(){var e,t,i;const{visible:s,title:r={},content:a,size:o,limitRatio:l=1/0}=this.attribute,h=Math.min(o.width,o.height)*l,d=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(s!==!0)return void(d&&d.hideAll());if(P(r))if(r.visible!==!1){const c=re({},Te(qw,"title.style"),r.style);c.type==="rich"?this._title=d.createOrUpdateChild("indicator-title",Object.assign(Object.assign({textConfig:c.text},c),{visible:r.visible,x:0,y:0,width:(e=c.width)!==null&&e!==void 0?e:0,height:(t=c.height)!==null&&t!==void 0?t:0}),"richtext"):c.type==="html"?this._title=d.createOrUpdateChild("indicator-title",Object.assign(Object.assign({textConfig:[],html:Object.assign(Object.assign({dom:c.text},br),c)},c),{visible:r.visible,x:0,y:0}),"richtext"):this._title=d.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},c),{lineHeight:P(c.lineHeight)?c.lineHeight:c.fontSize,visible:r.visible,x:0,y:0}),"text"),r.autoFit&&j(h)&&this._setLocalAutoFit(h,this._title,r),r.autoLimit&&j(l)&&this._title.setAttribute("maxLineWidth",h)}else{const c=d.find(f=>f.name==="indicator-title",!1);c&&d.removeChild(c),this._title=void 0}if(P(a)){const c=N(a),f=[];c.forEach((p,g)=>{var _,m;if(p.visible!==!1){const y=re({},Te(qw,"content.style"),p.style);let b;b=y.type==="rich"?d.createOrUpdateChild("indicator-content-"+g,Object.assign(Object.assign({textConfig:y.text},y),{visible:r.visible,x:0,y:0,width:(_=y.width)!==null&&_!==void 0?_:0,height:(m=y.height)!==null&&m!==void 0?m:0}),"richtext"):y.type==="html"?d.createOrUpdateChild("indicator-content-"+g,Object.assign(Object.assign({textConfig:[],html:Object.assign(Object.assign({dom:y.text},br),y)},y),{visible:r.visible,x:0,y:0}),"richtext"):d.createOrUpdateChild("indicator-content-"+g,Object.assign(Object.assign({},y),{lineHeight:P(y.lineHeight)?y.lineHeight:y.fontSize,visible:p.visible,x:0,y:0}),"text"),p.autoFit&&j(h)&&this._setLocalAutoFit(h,b,p),p.autoLimit&&j(l)&&b.setAttribute("maxLineWidth",h),f.push(b)}else{const y=d.find(b=>b.name==="indicator-content-"+g,!1);y&&d.removeChild(y)}}),this._content=f}this._setGlobalAutoFit(h),this._setYPosition();const u=(i=d==null?void 0:d.AABBBounds.height())!==null&&i!==void 0?i:0;d.setAttribute("y",o.height/2-u/2),d.setAttribute("x",o.width/2)}_setLocalAutoFit(e,t,i){var s,r,a,o,l,h,d,u;if(((s=i.fitStrategy)!==null&&s!==void 0?s:"default")!=="default")return;const c=I_((a=(r=i.style)===null||r===void 0?void 0:r.text)!==null&&a!==void 0?a:"",(o=i.style)!==null&&o!==void 0?o:{},(l=this.stage)===null||l===void 0?void 0:l.getTheme().text.fontFamily).width;if(c>0){const f=e*((h=i.fitPercent)!==null&&h!==void 0?h:.5)/c,p=Math.floor(((u=(d=i.style)===null||d===void 0?void 0:d.fontSize)!==null&&u!==void 0?u:20)*f);t.setAttribute("fontSize",p),t.setAttribute("lineHeight",P(i.style.lineHeight)?i.style.lineHeight:p)}}_setGlobalAutoFit(e){var t,i,s,r,a,o,l;const h=e/2,d=[];let u=0;const c=(t=this.attribute.title)!==null&&t!==void 0?t:{};c.autoFit&&c.fitStrategy==="inscribed"?(this._title.setAttribute("fontSize",12),d.push({text:this._title,spec:(i=this.attribute.title)!==null&&i!==void 0?i:{}})):u+=(o=(a=(r=(s=this._title)===null||s===void 0?void 0:s.AABBBounds)===null||r===void 0?void 0:r.height)===null||a===void 0?void 0:a.call(r))!==null&&o!==void 0?o:0;const f=(l=c.space)!==null&&l!==void 0?l:0;if(u+=f,N(this.attribute.content).filter(x=>x.visible!==!1).forEach((x,S)=>{var A,k,w,M;const T=this._content[S];x.autoFit&&x.fitStrategy==="inscribed"?(T.setAttribute("fontSize",12),d.push({text:T,spec:x})):u+=(w=(k=(A=T==null?void 0:T.AABBBounds)===null||A===void 0?void 0:A.height)===null||k===void 0?void 0:k.call(A))!==null&&w!==void 0?w:0;const E=(M=x.space)!==null&&M!==void 0?M:0;u+=E}),d.length<=0)return;const p=12/d.reduce((x,S)=>Math.max(x,S.text.AABBBounds.width()),0)*d.length,g=u/2,_=p**2+1,m=2*g*p,y=g**2-h**2,b=2*(p*((-m+Math.sqrt(m**2-4*_*y))/(2*_))+g),v=(b-u)/d.length;j(b)&&d.forEach(x=>{var S;const A=(S=x.spec.style)===null||S===void 0?void 0:S.lineHeight;x.text.setAttribute("fontSize",v),x.text.setAttribute("lineHeight",P(A)?A:v)})}_setYPosition(){var e,t,i,s,r,a;let o=0;const l=(s=(i=(t=(e=this._title)===null||e===void 0?void 0:e.AABBBounds)===null||t===void 0?void 0:t.height)===null||i===void 0?void 0:i.call(t))!==null&&s!==void 0?s:0,h=(a=(r=this.attribute.title)===null||r===void 0?void 0:r.space)!==null&&a!==void 0?a:0;N(this.attribute.content).filter(d=>d.visible!==!1).forEach((d,u)=>{var c;const f=this._content[u];f.setAttribute("y",l+h+o);const p=(c=d.space)!==null&&c!==void 0?c:0;o+=f.AABBBounds.height()+p})}};const $$="M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z",Y$="M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z",X$="M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",K$="M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z",q$="m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",Z$="M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z";class dy extends Ud{constructor(e){super(e)}}var js;(function(n){n.OnPlay="onPlay",n.OnPause="onPause",n.OnForward="onForward",n.OnBackward="onBackward"})(js||(js={}));var Qo;(function(n){n.Start="start",n.Pause="pause",n.Forward="forward",n.Backward="backward"})(Qo||(Qo={}));class ar extends ti{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},ar.defaultAttributes,e)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:$$},ar.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:Y$},ar.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},ar.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},ar.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var i,s,r,a;this._layout=this.attribute.layout,this._layout==="horizontal"?(this._backwardAttr.style.symbolType=(i=this._backwardAttr.style.symbolType)!==null&&i!==void 0?i:X$,this._forwardAttr.style.symbolType=(s=this._forwardAttr.style.symbolType)!==null&&s!==void 0?s:Z$):this._layout==="vertical"&&(this._backwardAttr.style.symbolType=(r=this._backwardAttr.style.symbolType)!==null&&r!==void 0?r:q$,this._forwardAttr.style.symbolType=(a=this._forwardAttr.style.symbolType)!==null&&a!==void 0?a:K$)},this._initPlay=()=>{C(this._playController)&&(this._playController=new dy(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{C(this._backwardController)&&(this._backwardController=new dy(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{C(this._forwardController)&&(this._forwardController=new dy(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",i=>{i.stopPropagation(),this._isPaused===!0?this.play():this.pause()}),this._backwardController.addEventListener("pointerdown",i=>{i.stopPropagation(),this.backward()}),this._forwardController.addEventListener("pointerdown",i=>{i.stopPropagation(),this.forward()}))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent("ControllerEventEnum.OnPlay")},this.pause=()=>{this._dispatchEvent("ControllerEventEnum.OnPause")},this.forward=()=>{this._dispatchEvent("ControllerEventEnum.OnForward")},this.backward=()=>{this._dispatchEvent("ControllerEventEnum.OnBackward")},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}ar.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},ar.defaultAttributes={[Qo.Start]:{},[Qo.Pause]:{},[Qo.Backward]:{},[Qo.Forward]:{}};const $c={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},uy=[200,10];var Aa;(function(n){n.Default="default",n.Reverse="reverse"})(Aa||(Aa={}));var Pt;(function(n){n.change="change",n.play="play",n.pause="pause",n.backward="backward",n.forward="forward",n.end="end",n.OnChange="change",n.OnPlay="play",n.OnPause="pause",n.OnBackward="backward",n.OnForward="forward",n.OnEnd="end"})(Pt||(Pt={}));const J$=({direction:n,maxIndex:e,dataIndex:t})=>n===Aa.Default&&t===e,Q$=({direction:n,minIndex:e,dataIndex:t})=>n===Aa.Reverse&&t===e,eY=({direction:n,maxIndex:e,minIndex:t,dataIndex:i})=>J$({direction:n,maxIndex:e,dataIndex:i})||Q$({direction:n,minIndex:t,dataIndex:i}),tY=({direction:n,minIndex:e,dataIndex:t})=>n===Aa.Default&&t===e,iY=({direction:n,maxIndex:e,dataIndex:t})=>n===Aa.Reverse&&t===e,nY=({direction:n,maxIndex:e,minIndex:t,dataIndex:i})=>tY({direction:n,minIndex:t,dataIndex:i})||iY({direction:n,maxIndex:e,dataIndex:i}),ws=n=>n==="top"||n==="bottom",sY=(n,e,t,i)=>n==="default"?Math.min(e+1,i):Math.max(e-1,t);class Ju extends ti{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},Ju.defaultAttributes,e)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var i,s,r;let a;j(this._handlerStyle.size)?a=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(a=Ji(this._handlerStyle.size[0],this._handlerStyle.size[1]));const o={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:(i=this.attribute.dataIndex)!==null&&i!==void 0?i:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:j(a)?a:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(ws(this._orient)){const l=Math.max(0,this._layoutInfo.slider.size),h=(s=this._railStyle.height)!==null&&s!==void 0?s:uy[1];o.layout="horizontal",o.railHeight=h,o.railWidth=l,o.x=this._layoutInfo.slider.x,o.y=this._layoutInfo.slider.y}else{const l=Math.max(0,this._layoutInfo.slider.size),h=(r=this._railStyle.width)!==null&&r!==void 0?r:uy[1];o.layout="vertical",o.railWidth=h,o.railHeight=l,o.x=this._layoutInfo.slider.x,o.y=this._layoutInfo.slider.y}return o},this._initSlider=()=>{const i=this._updateSliderAttrs();this._slider=new wh(i),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const i={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return ws(this._orient)?(i.layout="horizontal",i.start=Object.assign(Object.assign({},i.start),{style:Object.assign(Object.assign({},i.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),i.pause=Object.assign(Object.assign({},i.pause),{style:Object.assign(Object.assign({},i.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),i.backward=Object.assign(Object.assign({},i.backward),{style:Object.assign(Object.assign({},i.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),i.forward=Object.assign(Object.assign({},i.forward),{style:Object.assign(Object.assign({},i.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})):(i.layout="vertical",i.start=Object.assign(Object.assign({},i.start),{style:Object.assign(Object.assign({},i.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),i.pause=Object.assign(Object.assign({},i.pause),{style:Object.assign(Object.assign({},i.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),i.backward=Object.assign(Object.assign({},i.backward),{style:Object.assign(Object.assign({},i.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),i.forward=Object.assign(Object.assign({},i.forward),{style:Object.assign(Object.assign({},i.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})),i},this._initController=()=>{const i=this._updateControllerAttrs();this._controller=new ar(i),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:e={},controller:t={}}=this.attribute;this._sliderVisible=e.visible,this._railStyle=Object.assign({},e.railStyle),this._trackStyle=Object.assign({},e.trackStyle),this._handlerStyle=Object.assign({},e.handlerStyle),this._controllerVisible=t.visible,this._start=Object.assign({},t.start),this._pause=Object.assign({},t.pause),this._forward=Object.assign({},t.forward),this._backward=Object.assign({},t.backward)}_initLayoutInfo(){var e,t,i;const s=[this._start,this._backward,this._forward].sort((c,f)=>c.order-f.order),r=s.filter(c=>c.position!=="end"),a=s.filter(c=>c.position==="end"),o=(e=ws(this._orient)?this._railStyle.height:this._railStyle.width)!==null&&e!==void 0?e:uy[1],l=s.reduce((c,f)=>{const p=f.style.size,g=oe(p)?p:Ji(p[0],p[1]);return c+f.space+g},0),h=this._sliderVisible?(ws(this._orient)?(t=this._size)===null||t===void 0?void 0:t.width:(i=this._size)===null||i===void 0?void 0:i.height)-l:0,d=h-this.attribute.slider.space,u=r.reduce((c,f)=>{const{key:p,space:g,style:{size:_}}=f,m=oe(_)?_:Ji(_[0],_[1]);return this._layoutInfo[p]=Object.assign(Object.assign({},this._layoutInfo[p]),{size:m,x:ws(this._orient)?c+g:(this._size.width-m)/2,y:ws(this._orient)?(this._size.height-m)/2:c+g}),c+g+m},0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:d,x:ws(this._orient)?u+this.attribute.slider.space:(this._size.width-o)/2,y:ws(this._orient)?(this._size.height-o)/2:u+this.attribute.slider.space}),a.reduce((c,f)=>{const{key:p,space:g,style:{size:_}}=f,m=oe(_)?_:Ji(_[0],_[1]);return this._layoutInfo[p]=Object.assign(Object.assign({},this._layoutInfo[p]),{size:m,x:ws(this._orient)?c+g:(this._size.width-m)/2,y:ws(this._orient)?(this._size.height-m)/2:c+g}),c+g+m},u+h)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const e=this._updateSliderAttrs();this._slider.setAttributes(e)}renderController(){const e=this._updateControllerAttrs();this._controller.setAttributes(e)}dispatchCustomEvent(e,t){this._dispatchEvent(e,{eventType:e,index:t,value:this._data[t]})}}Ju.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{visible:!0,space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{visible:!0,start:Object.assign(Object.assign({},$c),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},$c),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},$c),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},$c),{key:"backward",position:"start"})}};function tO(){Y_(),zt(),xs()}function rY(){tO()}function aY(){tO()}rY();class oY extends Ju{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},e)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var i,s,r,a;super._initAttributes(),this._alternate=(i=this.attribute.alternate)!==null&&i!==void 0&&i,this._interval=(s=this.attribute.interval)!==null&&s!==void 0?s:1e3,this._direction=(r=this.attribute.direction)!==null&&r!==void 0?r:Aa.Default,this._dataIndex=C(this.attribute.dataIndex)?this._direction==="default"?this._minIndex:this._maxIndex:(a=this.attribute.dataIndex)!==null&&a!==void 0?a:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(js.OnPlay,i=>{i.stopPropagation(),this.play()}),this._controller.addEventListener(js.OnPause,i=>{i.stopPropagation(),this.pause()}),this._controller.addEventListener(js.OnForward,i=>{i.stopPropagation(),this.forward()}),this._controller.addEventListener(js.OnBackward,i=>{i.stopPropagation(),this.backward()}),this._slider.addEventListener("change",i=>{const s=Math.floor(i.detail.value)+.5;this._dataIndex=i.detail.value>=s?Math.ceil(i.detail.value):Math.floor(i.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(Pt.change)}))},this.play=()=>{this._isPlaying||this._data.length!==1&&(this._controller.togglePause(),this._isPlaying=!0,(eY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||nY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===Aa.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(Pt.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=Fe.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=i=>{const s=Date.now();if(this._isReachEnd&&s-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();i&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(Pt.change),this._activeIndex=this._dataIndex):s-this._tickTime>=this._interval&&(this._tickTime=s,this._updateDataIndex(sY(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(Pt.change)),(this._direction==="default"&&this._dataIndex>=this._maxIndex||this._direction==="reverse"&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=Fe.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=i=>{this._dataIndex=i,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),Fe.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(Pt.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,Fe.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(Pt.pause))},this.backward=()=>{const i=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(i),this.dispatchCustomEvent(Pt.change),this.dispatchCustomEvent(Pt.backward)},this.forward=()=>{const i=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(i),this.dispatchCustomEvent(Pt.change),this.dispatchCustomEvent(Pt.forward)},this._initAttributes(),this._initEvents()}setAttributes(e,t){super.setAttributes(e,t),this._initAttributes()}dispatchCustomEvent(e){super.dispatchCustomEvent(e,this._dataIndex)}}var lY=function(n,e,t,i){return new(t||(t=Promise))(function(s,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?s(h.value):(d=h.value,d instanceof t?d:new t(function(u){u(d)})).then(a,o)}l((i=i.apply(n,e||[])).next())})};aY();class hY extends Ju{constructor(e){super(e),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,i;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=(t=this.attribute.interval)!==null&&t!==void 0?t:1e3,this._dataIndex=(i=this.attribute.dataIndex)!==null&&i!==void 0?i:this._minIndex;const s=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(s??1)):(this._totalDuration=this._interval*s,this._interval=this.attribute.interval)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(js.OnPlay,t=>{t.stopPropagation(),this.play()}),this._controller.addEventListener(js.OnPause,t=>{t.stopPropagation(),this.pause()}),this._controller.addEventListener(js.OnForward,t=>{t.stopPropagation(),this.forward()}),this._controller.addEventListener(js.OnBackward,t=>{t.stopPropagation(),this.backward()}),this._slider.addEventListener("change",t=>{var i;t.stopPropagation();const s=(i=t.detail)===null||i===void 0?void 0:i.value,r=s/this._maxIndex;this._elapsed=r*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(s)}))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const i=Math.floor(t);i!==this._activeIndex&&(this._dataIndex=i,this._activeIndex=i,i!==this._maxIndex&&this.dispatchCustomEvent(Pt.change))},this.play=()=>lY(this,void 0,void 0,function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(Pt.play),this._rafId=Fe.getRequestAnimationFrame()(this._play.bind(this)))}),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=Fe.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,Fe.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(Pt.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,Fe.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(Pt.pause))},this.backward=()=>{const t=Date.now(),i=1*this._interval,s=this._elapsed-i;s<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=s,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(Pt.backward)},this.forward=()=>{const t=Date.now(),i=1*this._interval,s=this._elapsed+i;s>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-i,this._elapsed=s),this._updateSlider(),this.dispatchCustomEvent(Pt.forward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(e){super.dispatchCustomEvent(e,this._dataIndex)}render(){super.render()}}var zi;(function(n){n.drawStart="drawStart",n.drawEnd="drawEnd",n.drawing="drawing",n.moving="moving",n.moveStart="moveStart",n.moveEnd="moveEnd",n.brushClear="brushClear"})(zi||(zi={}));const Qs={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:"pointerup",resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{y1:-1/0,y2:1/0,x1:-1/0,x2:1/0}},dY=5;function uY(){zt(),L_()}const Zw={debounce:Us,throttle:Ta};uY();let iO=class nO extends ti{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},nO.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=i=>{var s;if(this._outOfInteractiveRange(i))return;i.stopPropagation();const r=(s=this.attribute.brushMoved)===null||s===void 0||s;this._activeMoveState=r&&this._isPosInBrushMask(i),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(i),this._activeMoveState&&this._initMove(i)},this._onBrushing=i=>{this._outOfInteractiveRange(i)||((this._activeDrawState||this._activeMoveState)&&i.stopPropagation(),this._activeDrawState&&this._drawing(i),this._activeMoveState&&this._moving(i))},this._onBrushEnd=i=>{i.preventDefault();const{removeOnClick:s=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&s?(this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={},this._dispatchEvent(zi.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:i})):(this._activeDrawState&&this._dispatchEvent(zi.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:i}),this._activeMoveState&&this._dispatchEvent(zi.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:i})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:e="throttle",delayTime:t=0,trigger:i=Qs.trigger,updateTrigger:s=Qs.updateTrigger,endTrigger:r=Qs.endTrigger,resetTrigger:a=Qs.resetTrigger}=this.attribute;this.stage.addEventListener(i,this._onBrushStart),this.stage.addEventListener(s,Zw[e](this._onBrushing,t)),this.stage.addEventListener(r,this._onBrushEnd),this.stage.addEventListener(a,this._onBrushEnd)}_isPosInBrushMask(e){const t=this.eventPosToStagePos(e),i=this._container.getChildren();for(let s=0;s<i.length;s++){const{points:r=[],dx:a=0,dy:o=0}=i[s].attribute,l=r.map(h=>({x:h.x+a,y:h.y+o}));if(Va(l,t.x,t.y))return this._operatingMask=i[s],!0}return!1}_initDraw(e){const{brushMode:t}=this.attribute,i=this.eventPosToStagePos(e);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,t==="single"&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(zi.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:e})}_initMove(e){var t,i;this._cacheMovePoint=this.eventPosToStagePos(e),this._operatingMaskMoveDx=(t=this._operatingMask.attribute.dx)!==null&&t!==void 0?t:0,this._operatingMaskMoveDy=(i=this._operatingMask.attribute.dy)!==null&&i!==void 0?i:0;const{interactiveRange:s}=this.attribute,{minY:r=-1/0,maxY:a=1/0,minX:o=-1/0,maxX:l=1/0}=s,{x1:h,x2:d,y1:u,y2:c}=this._operatingMask.globalAABBBounds,f=o-h,p=l-d,g=r-u,_=a-c;this._operatingMaskMoveRangeX=[f,p],this._operatingMaskMoveRangeY=[g,_],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(zi.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:e})}_drawing(e){var t,i;const s=this.eventPosToStagePos(e),{x1:r=0,x2:a=0,y1:o=0,y2:l=0}=(t=this._operatingMask)===null||t===void 0?void 0:t._AABBBounds,{sizeThreshold:h=dY,brushType:d}=this.attribute,u=this._cacheDrawPoints.length;if(this._isDrawedBeforeEnd=Math.abs(a-r)>h||Math.abs(o-l)>h,u>0){const f=(i=this._cacheDrawPoints[this._cacheDrawPoints.length-1])!==null&&i!==void 0?i:{};if(s.x===f.x&&s.y===f.y)return}d==="polygon"||u<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[u-1]=s;const c=this._computeMaskPoints();this._operatingMask.setAttribute("points",c),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(zi.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:e})}_moving(e){const t=this._cacheMovePoint,i=this.eventPosToStagePos(e);if(i.x===(t==null?void 0:t.x)&&i.y===(t==null?void 0:t.y))return;const s=i.x-t.x,r=i.y-t.y,a=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,o=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],r))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:a,dy:o}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(zi.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:e})}_computeMaskPoints(){const{brushType:e,xRange:t=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const r=this._cacheDrawPoints[0],a=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s=e==="rect"?[r,{x:a.x,y:r.y},a,{x:r.x,y:a.y}]:e==="x"?[{x:r.x,y:i[0]},{x:a.x,y:i[0]},{x:a.x,y:i[1]},{x:r.x,y:i[1]}]:e==="y"?[{x:t[0],y:r.y},{x:t[0],y:a.y},{x:t[1],y:a.y},{x:t[1],y:r.y}]:ri(this._cacheDrawPoints),s}_addBrushMask(){var e;const{brushStyle:t,hasMask:i}=this.attribute,s=ce.polygon(Object.assign(Object.assign({points:ri(this._cacheDrawPoints),cursor:"move",pickable:!1},t),{opacity:i?(e=t.opacity)!==null&&e!==void 0?e:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(e){const{interactiveRange:t}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:r=-1/0,maxX:a=1/0}=t,o=this.eventPosToStagePos(e);return o.x>a||o.x<r||o.y>s||o.y<i}eventPosToStagePos(e){var t,i;const{x:s,y:r}=Fe.mapToCanvasPoint(e);return{x:s-(((t=this.stage)===null||t===void 0?void 0:t.x)||0),y:r-(((i=this.stage)===null||i===void 0?void 0:i.y)||0)}}render(){this._bindBrushEvents();const e=this.createOrUpdateChild("brush-container",{},"group");this._container=e}releaseBrushEvents(){const{delayType:e="throttle",delayTime:t=0,trigger:i=Qs.trigger,updateTrigger:s=Qs.updateTrigger,endTrigger:r=Qs.endTrigger,resetTrigger:a=Qs.resetTrigger}=this.attribute;this.stage.removeEventListener(i,this._onBrushStart),this.stage.removeEventListener(s,Zw[e](this._onBrushing,t)),this.stage.removeEventListener(r,this._onBrushEnd),this.stage.removeEventListener(a,this._onBrushEnd)}};iO.defaultAttributes=Qs;const Jw=(n,...e)=>{const t=[n.shape,...e.map(r=>r==null?void 0:r.shape)],i=[n.key,...e.map(r=>r==null?void 0:r.key)],s=[n.value,...e.map(r=>r==null?void 0:r.value)];return re(n,...e,{shape:t.every(C)?void 0:re({},...t),key:i.every(C)?void 0:re({},...i),value:s.every(C)?void 0:re({},...s)})},Co=n=>{const{width:e,height:t,wordBreak:i="break-word",textAlign:s,textBaseline:r,text:a}=n;return Array.isArray(a)?{width:e,height:t,wordBreak:i,textAlign:s,textBaseline:r,singleLine:!1,textConfig:N(a).map(o=>Object.assign(Object.assign({},n),{text:o}))}:{width:e,height:t,wordBreak:i,textAlign:s,textBaseline:r,singleLine:!1,textConfig:a.text}},cY={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:md,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:md,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:md,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:new St().setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},fY=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];function pY(){zt(),kr(),xs(),Ea(),Pa()}pY();let sO=class cn extends ti{constructor(e,t){super(t!=null&&t.skipDefault?e:re({},cn.defaultAttributes,e),t),this.name="tooltip"}render(){var e;const{visible:t,content:i,panel:s,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h}=this.attribute;if(!t)return void this.hideAll();h&&cn.measureTooltip(this.attribute),l&&cn.calculateTooltipPosition(this.attribute);const d=tn(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},s),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=cn.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",re({symbolType:"circle"},u.shape,{visible:Ht(u)&&Ht(u.shape)}),"symbol"),typeof u.value.text!="object"||u.value.text===null||u.value.text.type!=="rich"&&u.value.text.type!=="html"?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:Ht(u)&&Ht(u.value)},Co(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:(e=u.value.text)!==null&&e!==void 0?e:"",visible:Ht(u)&&Ht(u.value)},u.value),"text"):u.value.text.type==="rich"?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:Ht(u)&&Ht(u.value)},Co(u.value)),"richtext"):u.value.text.type==="html"&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},br),u.value),visible:Ht(u)&&Ht(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const c=Ht(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:p}=u.value,g=s.width-d[3]-d[0]-c;f==="center"?this._tooltipTitle.setAttribute("x",c+g/2):f==="right"||f==="end"?this._tooltipTitle.setAttribute("x",c+g):this._tooltipTitle.setAttribute("x",c),p==="bottom"?this._tooltipTitle.setAttribute("y",u.height):p==="middle"?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=Ht(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),i&&i.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let m=0;i.forEach((y,b)=>{var v,x,S;const A=cn.getContentAttr(this.attribute,b);if(!Ht(A))return;const k=`tooltip-content-${b}`,w=this._tooltipContent.createOrUpdateChild(k,{visible:!0,x:0,y:m},"group");let M=0;if(Ht(A.shape)&&w.createOrUpdateChild(`${k}-shape`,Object.assign({visible:!0,x:A.shape.size/2,y:A.shape.size/2+(((v=Bs(A.key.lineHeight,A.key.fontSize))!==null&&v!==void 0?v:A.key.fontSize)-A.shape.size)/2},A.shape),"symbol"),o&&(M+=A.shape.size+A.shape.spacing),Ht(A.key)){let T;T=A.key.multiLine?w.createOrUpdateChild(`${k}-key`,Object.assign(Object.assign({visible:!0},Co(A.key)),{textBaseline:"top"}),"richtext"):typeof A.key.text!="object"||A.key.text===null||A.key.text.type!=="rich"&&A.key.text.type!=="html"?w.createOrUpdateChild(`${k}-key`,Object.assign(Object.assign({visible:!0,text:(x=A.key.text)!==null&&x!==void 0?x:""},A.key),{textBaseline:"top"}),"text"):A.key.text.type==="rich"?w.createOrUpdateChild(`${k}-value`,Object.assign(Object.assign({visible:!0},Co(A.key)),{textBaseline:"top"}),"richtext"):w.createOrUpdateChild(`${k}-value`,{html:Object.assign(Object.assign({dom:A.key.text.text},br),A.key)},"richtext");const{textAlign:E}=A.key;E==="center"?T.setAttribute("x",M+r/2):E==="right"||E==="end"?T.setAttribute("x",M+r):T.setAttribute("x",M),T.setAttribute("y",0),M+=r+A.key.spacing}if(Ht(A.value)){let T;T=A.value.multiLine?w.createOrUpdateChild(`${k}-value`,Object.assign(Object.assign({visible:!0},Co(A.value)),{textBaseline:"top"}),"richtext"):typeof A.value.text!="object"||A.value.text===null||A.value.text.type!=="rich"&&A.value.text.type!=="html"?w.createOrUpdateChild(`${k}-value`,Object.assign(Object.assign({visible:!0,text:(S=A.value.text)!==null&&S!==void 0?S:""},A.value),{textBaseline:"top"}),"text"):A.value.text.type==="rich"?w.createOrUpdateChild(`${k}-value`,Object.assign(Object.assign({visible:!0},Co(A.value)),{textBaseline:"top"}),"richtext"):w.createOrUpdateChild(`${k}-value`,{html:Object.assign({dom:A.value.text.text,container:"",width:30,height:30,style:{}},A.value)},"richtext");let E="right";P(A.value.textAlign)?E=A.value.textAlign:Ht(A.key)||(E="left"),T.setAttribute("textAlign",E),E==="center"?T.setAttribute("x",M+a/2):E==="right"||E==="end"?T.setAttribute("x",M+a):T.setAttribute("x",M),M+=a,T.setAttribute("y",0),w.add(T)}m+=A.height+A.spaceRow})}}setAttributes(e,t){const i=Object.keys(e);this.attribute.autoCalculatePosition&&i.every(s=>fY.includes(s))?(this._mergeAttributes(e,i),C(this.attribute.panel.width)&&this.attribute.autoMeasure&&cn.measureTooltip(this.attribute),cn.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},t)):super.setAttributes(e,t)}static calculateTooltipPosition(e){const{width:t=0,height:i=0}=e.panel,{offsetX:s,offsetY:r,pointerX:a,pointerY:o,positionX:l,positionY:h,parentBounds:d}=e;let u=a,c=o;return l==="left"?u-=t+s:l==="center"?u-=t/2:u+=s,h==="top"?c-=i+r:h==="middle"?c-=i/2:c+=r,u+t>d.x2&&(u-=t+s),c+i>d.y2&&(c-=i+r),u<d.x1&&(u=d.x1),c<d.y1&&(c=d.y1),e.x=u,e.y=c,e}static measureTooltip(e){const{content:t,contentStyle:i}=e,s=tn(e.padding),r=cn.getTitleAttr(e);let a=0,o=s[0]+s[2],l=0;const{value:h,shape:d}=r,{visible:u=!1,symbolType:c=""}=d??{};if(P(h)&&typeof r.value.text!="object"){const{width:f,height:p}=ay(h).quickMeasure(h.text);a=f,l=p}if(u&&$f[c]&&(a+=d.size+d.spacing,l=Math.max(d.size,l)),e.title&&(e.title.width=a,e.title.height=l),Ht(r)&&(o+=l+r.spaceRow),t&&t.length){const f=[];if(t.forEach((p,g)=>{const _=cn.getContentAttr(e,g);(p.key||p.value)&&Ht(_)&&f.push([p,_])}),f.length){let p=!1;const g=[],_=[],m=[];f.forEach(([x,S],A)=>{var k;const{key:w,value:M,shape:T,spaceRow:E}=S,O=Ht(T),B=(k=T==null?void 0:T.symbolType)!==null&&k!==void 0?k:"",R=ay(w),L=ay(M);let I=0;if(Ht(w)){const{width:F,height:H}=R.quickMeasure(w.text);_.push(F),I=Math.max(I,H)}if(Ht(M)){const{width:F,height:H}=L.quickMeasure(M.text);m.push(F),I=Math.max(I,H)}O&&$f[B]&&(p=!0,g.push(T.size),I=Math.max(T.size,I)),x.height=I,o+=I,A<f.length-1&&(o+=E??i.spaceRow)});const y=g.length?Math.max(...g):0,b=_.length?Math.max(..._):0,v=m.length?Math.max(...m):0;a=Math.max(b+v+i.key.spacing+i.value.spacing+(p?y+i.shape.spacing:0),a),t.forEach(x=>{x.width=a}),e.hasContentShape=p,e.keyWidth=b,e.valueWidth=v}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return Jw({},cn.defaultAttributes.titleStyle,cn.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,t){return Jw({},cn.defaultAttributes.contentStyle,e.contentStyle,e.content[t])}};sO.defaultAttributes=cY;function Qw(n){if(n)return n.type===Rt.Band?n.bandwidth():n.type===Rt.Point?n.step():void 0}const eM=(n,e)=>Yu(n)?n.output():n&&He(n)?Y(n.callback)?t=>n.callback(t,e):Y(n.value)?n.value(e):n:n,tM=(n,e)=>n&&(He(n)?Object.keys(n).reduce((t,i)=>{const s=n[i];return t[i]=eM(s,e),t},{}):n.map(t=>eM(t,e)));var gY=function(n,e,t,i){return new(t||(t=Promise))(function(s,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?s(h.value):(d=h.value,d instanceof t?d:new t(function(u){u(d)})).then(a,o)}l((i=i.apply(n,e||[])).next())})};let _Y=-1;class q_ extends po{constructor(e){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=e,this.uid=++_Y}parse(e){return this.id(e.id),this.name(e.name),this.depend(e.dependency),this}depend(e){var t;if(!((t=this.spec)===null||t===void 0)&&t.dependency){const s=N(this.spec.dependency).map(r=>ae(r)?this.view.getGrammarById(r):r);this.detach(s)}this.spec.dependency=e;const i=N(e).map(s=>ae(s)?this.view.getGrammarById(s):s);return this.attach(i),this.commit(),this}addEventListener(e,t,i){let s=t;return i&&i.trap===!1||(s=t,s.raw=t),i&&i.target&&(s.target=i.target),this.on(e,s),this}removeEventListener(e,t){return t?this.off(e,t):this.off(e),this}emit(e,...t){var i,s;return(s=(i=this.view)===null||i===void 0?void 0:i.emit)===null||s===void 0||s.call(i,e,...t),super.emit(e,...t)}emitGrammarEvent(e,...t){return super.emit(e,...t)}evaluateTransform(e,t,i){return gY(this,void 0,void 0,function*(){if(!e||!e.length)return t;let s=t,r=0;const a=e.length;for(;r<a;){const o=e[r];this.emit(de.BEFORE_TRANSFORM,o.type),s=o.transform(o.isRawOptions?o.options:tM(o.options,i),s,i,this.view),s!=null&&s.then&&(s=yield s),r++,this.emit(de.AFTER_TRANSFORM,o.type)}return s})}evaluateTransformSync(e,t,i){if(!e||!e.length)return t;let s=t,r=0;const a=e.length;for(;r<a;){const o=e[r];this.emit(de.BEFORE_TRANSFORM,o.type),s=o.transform(o.isRawOptions?o.options:tM(o.options,i),s,i,this.view),r++,this.emit(de.AFTER_TRANSFORM,o.type)}return s}set(e){return!1}id(e){return arguments.length?(this.view.grammars.unrecord(this),this._id=e,this.view.grammars.record(this),this):this._id}name(e){return arguments.length?(this._name=e,this):this._name}attach(e,t=1){return N(e).filter(i=>!C(i)).forEach(i=>{var s;C(e)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,((s=this.references.get(i))!==null&&s!==void 0?s:0)+t))}),this}detach(e,t=1){return N(e).filter(i=>!C(i)).forEach(i=>{const s=this.references.get(i)-t;s>0?this.references.set(i,s-1):(this.references.delete(i),i.targets.includes(this)&&(i.targets=i.targets.filter(r=>r!==this)))}),this}detachAll(){this.references.forEach((e,t)=>{this.detach(t,e)})}link(e){this.grammarSource=e}run(){var e;const t=(e=this.grammarSource)===null||e===void 0?void 0:e.output(),i=this.parameters();return this.evaluate(t,i)}runSync(){var e;const t=(e=this.grammarSource)===null||e===void 0?void 0:e.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(t,i):this.evaluate(t,i)}commit(){this.view.commit(this)}parameters(){const e={};return this.references.forEach((t,i)=>{P(i.id())&&(e[i.id()]=i.output())}),e}getSpec(){return this.spec}reuse(e){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(e,t){return C(this.spec[t])||this.detach(Di(this.spec[t],this.view)),this.spec[t]=e,this.attach(Di(e,this.view)),this.commit(),this}}const iM=(n,e,t)=>{var i;if(n==="callback"&&Y(e))return{references:[],value:{callback:e,dependency:[]}};if(!C(e.data)){const s=t.getDataById(e.data);return{references:[s],value:s}}if(!C(e.customized)){const s=t.getCustomizedById(e.customized);return{references:[s],value:s}}if(!C(e.scale)){const s=t.getScaleById(e.scale);return{references:[s],value:s}}if(gV(e)){const s=Di(e,t);return{references:s,value:e.callback?{value:e.callback,dependency:s}:(i=s==null?void 0:s[0])!==null&&i!==void 0?i:e}}return{value:e}},mY=(n,e,t)=>{if(C(e))return{value:e};if(W(e)){const i=e.map(s=>iM(n,s,t));return{references:i.reduce((s,r)=>(r.references&&s.concat(r.references),s),[]),value:i.map(s=>s.value)}}return iM(n,e,t)},yY=(n,e)=>{const t=ee.getTransform(n.type);if(!t)return;const i={};let s=[];return Object.keys(n).forEach(r=>{var a;if(r==="type")return;const o=n[r];if(r==="dependency")return void((o==null?void 0:o.length)&&(s=s.concat(d0(o,e))));const l=mY(r,o,e);l&&(!((a=l.references)===null||a===void 0)&&a.length&&(s=s.concat(l.references)),i[r]=l.value)}),{markPhase:t.markPhase,transform:t.transform,canProgressive:t.canProgressive,type:t.type,options:i,references:s}},lg=(n,e)=>{if(n!=null&&n.length){const t=[];let i=[];return n.forEach(s=>{var r;const a=yY(s,e);a&&(!((r=a.references)===null||r===void 0)&&r.length&&(i=i.concat(a.references)),t.push(a))}),{transforms:t,refs:i}}return null};var bY=function(n,e,t,i){return new(t||(t=Promise))(function(s,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?s(h.value):(d=h.value,d instanceof t?d:new t(function(u){u(d)})).then(a,o)}l((i=i.apply(n,e||[])).next())})};const vY=(n,e={},t)=>{if(!ae(n))return N(n);try{return N(JSON.parse(n))}catch{return[]}},nM={csv:fP,dsv:cP,tsv:pP,json:vY},xY=(n,e)=>{if(!e||!nM[e.type])return N(n);const t=e.type==="dsv"?{delimiter:e.delimiter}:{};return nM[e.type](n,t,new Ye(new to))},SY=n=>bY(void 0,void 0,void 0,function*(){try{return(yield fetch(n)).text()}catch{return null}});var AY=function(n,e,t,i){return new(t||(t=Promise))(function(s,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?s(h.value):(d=h.value,d instanceof t?d:new t(function(u){u(d)})).then(a,o)}l((i=i.apply(n,e||[])).next())})};class kY extends q_{constructor(e,t,i){super(e),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=s=>{const r=iy(s.format,this.parameters());return this._input=xY(s.values,r),this._input},this.load=s=>{var r;if(s.values)return this.ingest(s);const a=iy(s.url,this.parameters()),o=(r=iy(s.format,this.parameters()))!==null&&r!==void 0?r:{type:"json"};return SY(a).then(l=>this.ingest({values:l,format:o}))},this.relay=s=>s[0],this.evaluateSync=(s,r)=>{this.view.emit(de.BEFORE_EVALUATE_DATA);const a=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),o=this.evaluateTransformSync(a,this.grammarSource?s:this._input,r),l=this._evaluateFilter(o,r);return this.setValues(l),this._isLoaded=!0,this.view.emit(de.AFTER_EVALUATE_DATA),this},this._loadTasks=[],C(t)||this.values(t,i)}parse(e){return super.parse(e),this._isLoaded=!1,this.source(e.source,e.format,!1),this.url(e.url,e.format,!1),this.values(e.values,e.format,!1),this.transform(e.transform),this.parseLoad(e),this.commit(),this}parseDataSource(e){const t=[],i=[],s=e.format?Di(e.format,this.view)[0]:null;if(s&&t.push(s),e.values){const r=Di(e.values,this.view)[0];r&&t.push(r),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:e.values,format:e.format}})}else if(e.url){const r=Di(e.url,this.view)[0];r&&t.push(r),i.push({type:"load",transform:this.load,options:{url:r??e.url,format:s??e.format}})}else if(e.source){const r=[];N(e.source).forEach(a=>{const o=Yu(a)?a:this.view.getDataById(a);o&&(t.push(o),r.push(o))}),r.length&&(i.push({type:"relay",transform:this.relay,options:r}),this.grammarSource=r[0])}return{transforms:i,refs:t}}evaluate(e,t){return AY(this,void 0,void 0,function*(){this.view.emit(de.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=e);const s=yield this.evaluateTransform(i,this._input,t),r=this._evaluateFilter(s,t);return this.setValues(r),this._isLoaded=!0,this.view.emit(de.AFTER_EVALUATE_DATA),this})}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(e,t,i=!0){const s=Object.assign({},this.spec,{values:e,format:t});return C(e)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(e,t,i=!0){const s=Object.assign({},this.spec,{url:e,format:t});return C(e)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(e,t,i=!0){const s=Object.assign({},this.spec,{source:e,format:t});return C(e)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(e){this.detach(this.parseDataSource(this.spec).refs),this.spec=e;const t=this.parseDataSource(this.spec);return this.attach(t.refs),this._loadTasks=t.transforms,this._isLoaded=!1,this.commit(),this}setValues(e){this._values=N(e).map((t,i)=>{const s=t===Object(t)?t:{data:t};return s[this._dataIDKey]=i,s})}field(e){return this._values.map(t=>t[e])}transform(e){const t=lg(this.spec.transform,this.view);t&&(this.detach(t.refs),this.transforms=[]),this.spec.transform=e;const i=lg(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(e){return this._postFilters=this._postFilters.concat(N(e)),this._postFilters.sort((t,i)=>{var s,r;return((s=t.rank)!==null&&s!==void 0?s:0)-((r=i.rank)!==null&&r!==void 0?r:0)}),this}removeDataFilter(e){const t=N(e);return this._postFilters=this._postFilters.filter(i=>!t.includes(i)),this}_evaluateFilter(e,t){return this._postFilters.reduce((i,s)=>s.filter(i,t),e)}reuse(e){return e.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=e.output()),this}clear(){super.clear(),this._input=null,this._values=null}}const Za="window",Ua="view",wY="browser",MY={trap:!1},Kr="width",qr="height",zl="viewWidth",jl="viewHeight",Ln="padding",x0="viewBox",xd="autoFit";function TY(n){const e=Object.assign({defaults:{}},n),t=(i,s)=>{s.forEach(r=>{W(i[r])&&(i[r]=i[r].reduce((a,o)=>(a[o]=!0,a),{}))})};return t(e.defaults,["prevent","allow"]),t(e,[Ua,Za]),e}function CY(n,e){const t=n.defaults,i=t.prevent,s=t.allow;return i!==!1&&s!==!0&&(i===!0||s===!1||(i?i[e]:!!s&&!s[e]))}function PY(n,e,t){const i=n==null?void 0:n[e];return!(i===!1||He(i)&&!i[t])}function mf(n,e,t,i){let s,r;const a=n[e];for(;e>t&&(r=Math.floor((e-1)/2),s=n[r],a&&s&&i(a,s)<0);)n[e]=s,e=r;return n[e]=a}function cy(n,e,t,i){const s=e,r=n.length,a=n[e];let o,l=2*e+1;for(;l<r;)o=l+1,o<r&&i(n[l],n[o])>=0&&(l=o),n[e]=n[l],l=2*(e=l)+1;return n[e]=a,mf(n,e,s,i)}class EY{constructor(e){this.compare=e,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let e=this.nodes.length-1;e>0;e-=1){const t=Math.floor((e-1)/2);if(this.compare(this.nodes[t],this.nodes[e])>0)return!1}return!0}push(e){if(this.nodes.includes(e)){const t=this.nodes.indexOf(e);return mf(this.nodes,t,0,this.compare),cy(this.nodes,t,null,this.compare)}return this.nodes.push(e),mf(this.nodes,this.nodes.length-1,0,this.compare)}remove(e){if(this.nodes.includes(e)){const t=this.nodes.indexOf(e);this.nodes=this.nodes.slice(0,t).concat(this.nodes.slice(t+1)),mf(this.nodes,t,0,this.compare),cy(this.nodes,t,null,this.compare)}}pop(){const e=this.nodes.pop();let t;return this.nodes.length?(t=this.nodes[0],this.nodes[0]=e,cy(this.nodes,0,null,this.compare)):t=e,t}clear(){this.nodes=[]}}class sM{constructor(e){this.list=[],this.ids={},this.idFunc=e||c5}add(e){const t=this.idFunc(e);return this.ids[t]||(this.ids[t]=1,this.list.push(e)),this}remove(e){const t=this.idFunc(e);return this.ids[t]&&(this.ids[t]=0,this.list=this.list.filter(i=>i!==e)),this}forEach(e,t){t?this.list.slice().reverse().forEach(e):this.list.forEach(e)}filter(e){return this.list.filter(e)}get length(){return this.list.length}getElementByIndex(e){return this.list[e]}}var rM=function(n,e,t,i){return new(t||(t=Promise))(function(s,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?s(h.value):(d=h.value,d instanceof t?d:new t(function(u){u(d)})).then(a,o)}l((i=i.apply(n,e||[])).next())})};class RY{constructor(){this.grammars=[],this.logger=De.getInstance(),this._curRank=0,this._committed=new sM(e=>e.uid),this._heap=new EY((e,t)=>(e==null?void 0:e.qrank)-(t==null?void 0:t.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(e){return rM(this,void 0,void 0,function*(){try{yield e(this)}catch(t){this.logger.error(t)}})}add(e){if(e)return this._setRankOfGrammar(e),this.commit(e),!this.grammars.includes(e)&&(this.grammars.push(e),!0)}remove(e){e&&(this._committed.remove(e),this._heap.remove(e),this.grammars=this.grammars.filter(t=>t!==e))}_setRankOfGrammar(e){e&&(e.rank=++this._curRank)}_reRank(e){const t=[e];for(;t.length;){const i=t.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach(r=>{t.push(r),r===e&&this.logger.error("Cycle detected in dataflow graph.")})}}_enqueue(e){e&&(e.qrank=e.rank,this._heap.push(e))}_logGrammarRunInfo(e){if(this.logger.canLogError()){const t=[{key:"id",value:e.id()},{key:"name",value:e.name()}].reduce((i,s,r)=>C(s.value)?i:`${i}${r?" , ":""}${s.key}: ${s.value}`,"");this.logger.debug("Run Operator: ",e,t)}}hasCommitted(){return!!this._committed.length}commit(e){return this._isRunning?this._enqueue(e):this._committed.add(e),this}_beforeEvaluate(){this.grammars.forEach(e=>{e.targets.some(t=>(t==null?void 0:t.rank)<(e==null?void 0:e.rank))&&this._reRank(e)}),this._committed.forEach(e=>this._enqueue(e)),this._committed=new sM(e=>e.uid)}_enqueueTargets(e){e.targets&&e.targets.length&&this._finishFirstRender&&e.targets.forEach(t=>this._enqueue(t))}evaluate(){return rM(this,void 0,void 0,function*(){if(this._isReleased)return;if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let e,t,i,s,r=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0&&!this._isReleased;)if(e=this._heap.pop(),e)if(e.rank===e.qrank){if(t=e.run(),t&&t.then&&(t=yield t),!this._isRunning)return!1;this._logGrammarRunInfo(e),this._enqueueTargets(e),r+=1}else this._enqueue(e)}catch(a){this._heap.clear(),s=a}return!this._isReleased&&(this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${r} grammars; ${i} ms`)),s?this.logger.error(s):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0)})}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let e,t,i=0;for(this.logger.canLogInfo()&&(t=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)e=this._heap.pop(),e&&(e.rank===e.qrank?(e.runSync(),this._logGrammarRunInfo(e),this._enqueueTargets(e),i+=1):this._enqueue(e));return this._isRunning=!1,this.logger.canLogInfo()&&(t=Date.now()-t,this.logger.info(`> ${i} grammars updated; ${t} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}stop(){this._isRunning&&(this._isRunning=!1)}runBefore(e){this._beforeRunner=e}runAfter(e){this._afterRunner=e}release(){this.stop(),this._isReleased=!0,this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const fy=(n,e,t,i,s)=>{const r=a=>{if(s||!a||i&&!i(a)||t.call(null,a),a.markType===ne.group){const o=a[e];o&&o.forEach(l=>{r(l)})}s&&(!a||i&&!i(a)||t.call(null,a))};r(n)};class OY{constructor(e){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(de.AFTER_VRENDER_DRAW),this._view.emit(de.AFTER_VRENDER_NEXT_RENDER)},this._view=e}initialize(e,t,i,s){return this._width=e,this._height=t,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var e;return(e=this._stage)!==null&&e!==void 0?e:null}gestureController(){var e;return(e=this._gestureController)!==null&&e!==void 0?e:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&Sz(this._stage).then(()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}),this}background(e){if(this._stage)return this._stage.background=e,this}setDpr(e,t){var i,s;return(s=(i=this._stage)===null||i===void 0?void 0:i.setDpr)===null||s===void 0||s.call(i,e),t&&this.renderNextFrame(),this}shouldResize(e,t){return e!==this._width||t!==this._height}resize(e,t){return this._view.emit(de.BEFORE_STAGE_RESIZE),this.shouldResize(e,t)&&(this._width=e,this._height=t,this._stage&&this._stage.resize(e,t)),this._view.emit(de.AFTER_STAGE_RESIZE),this}setViewBox(e,t=!0){return this._stage?(!e||this._viewBox&&e.x1===this._viewBox.x1&&e.x2===this._viewBox.x2&&e.y1===this._viewBox.y1&&e.y2===this._viewBox.y2||(this._viewBox=e,this._stage.setViewBox(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1,t)),this):this}render(e=!1){return this._view.emit(de.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),e&&(this._stage.render(),this._view.emit(de.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(e){this._stage&&this._stage.preventRender(e)}release(){var e;this._view.traverseMarkTree(t=>{t.release()}),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==((e=this._viewOptions)===null||e===void 0?void 0:e.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var e,t,i,s,r;this._view.emit(de.BEFORE_CREATE_VRENDER_STAGE);const a=this._viewOptions,o=(e=a.stage)!==null&&e!==void 0?e:pW({width:this._width,height:this._height,renderStyle:a.renderStyle,viewBox:a.viewBox,dpr:a.dpr,canvas:a.renderCanvas,canvasControled:a.canvasControled,container:a.container,title:a.rendererTitle,beforeRender:a.beforeRender,afterRender:a.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:a.pluginList,enableHtmlAttribute:a.enableHtmlAttribute,optimize:a.optimize,supportsTouchEvents:a.supportsTouchEvents,supportsPointerEvents:a.supportsPointerEvents});!((t=a.options3d)===null||t===void 0)&&t.enable&&o.set3dOptions(a.options3d),o.enableIncrementalAutoRender(),this._viewBox=a.viewBox,this._view.emit(de.AFTER_CREATE_VRENDER_STAGE),this._view.emit(de.BEFORE_CREATE_VRENDER_LAYER);const l=(i=a.layer)!==null&&i!==void 0?i:o.defaultLayer;if(this._view.emit(de.AFTER_CREATE_VRENDER_LAYER),!((s=this._eventConfig)===null||s===void 0)&&s.drag&&(this._dragController=new LV(o)),(r=this._eventConfig)===null||r===void 0?void 0:r.gesture){const h=He(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new DV(o,h)}return{stage:o,layer:l}}initStage(){if(!this._stage){const{stage:e,layer:t}=this.createStage();this._stage=e,this._layer=t;const i=this._view.background();this.background(i)}}}function BY(n){["touches","changedTouches","targetTouches"].forEach(t=>{n[t]&&n[t].length&&Array.from(n[t]).forEach(i=>{oM(i,aM(i),!1)})});const e=aM(n);return oM(n,e)}function aM(n){return C(n.offsetX)?C(n.x)?n.changedTouches&&n.changedTouches.length?DY(n):{canvasX:0,canvasY:0}:IY(n):LY(n)}function LY(n){return{canvasX:n.offsetX,canvasY:n.offsetY}}function IY(n){return{canvasX:n.x,canvasY:n.y}}function DY(n){return{canvasX:n.changedTouches[0].x,canvasY:n.changedTouches[0].y}}function oM(n,e,t=!0){return j(e.canvasX)&&Object.defineProperty(n,"canvasX",{value:e.canvasX,writable:!0}),j(e.canvasY)&&Object.defineProperty(n,"canvasY",{value:e.canvasY,writable:!0}),t&&j(e.clientX)&&Object.defineProperty(n,"clientX",{value:e.clientX,writable:!0}),t&&j(e.clientY)&&Object.defineProperty(n,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}function jv(n,e,t,i,s){if(s===Za){const r=e.changedTouches?e.changedTouches[0]:e;BY(r)}return e.element=t,e}class FY extends q_{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(e){return super.parse(e),this.value(e.value),this.update(e.update),this.commit(),this}evaluate(e,t){return this._signal=this.spec.update?Ot(this.spec.update,t,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(e){if(W(e)&&W(this.value)&&e.length===this.value.length){for(let t=0;t<e.length;t++)if(this.value[t]!==e[t])return this._signal=e,this.spec.value=e,!0;return!1}return this._signal!==e&&(this._signal=e,this.spec.value=e,!0)}update(e){return C(e)||this.value(void 0),this.setFunctionSpec(e,"update")}value(e){return C(e)||this.update(void 0),this.spec.value=e,this.commit(),this}reuse(e){return e.grammarType!==this.grammarType||(this._signal=e.output()),this}clear(){super.clear(),this._signal=null}}let zY=-1;const lM=[Kr,qr,Ln,zl,jl,x0,xd],jY=(n,e,t)=>{var i,s,r,a,o;return[{id:Kr,value:(i=n[Kr])!==null&&i!==void 0?i:0},{id:qr,value:(s=n[qr])!==null&&s!==void 0?s:0},{id:Ln,value:Zr((a=(r=n[Ln])!==null&&r!==void 0?r:e[Ln])!==null&&a!==void 0?a:t==null?void 0:t.padding)},{id:zl,update:{callback:(l,h)=>{const d=Zr(h[Ln]);return h[Kr]-d.left-d.right},dependency:[Kr,Ln]}},{id:jl,update:{callback:(l,h)=>{const d=Zr(h[Ln]);return h[qr]-d.top-d.bottom},dependency:[qr,Ln]}},{id:x0,update:{callback:(l,h)=>{const d=Zr(h[Ln]);return(l||new _i).setValue(d.left,d.top,d.left+h[zl],d.top+h[jl])},dependency:[zl,jl,Ln]}},{id:xd,value:(o=n[xd])!==null&&o!==void 0?o:e[xd]}]},Zr=n=>{var e,t,i,s;return oe(n)?{top:n,bottom:n,left:n,right:n}:{top:(e=n==null?void 0:n.top)!==null&&e!==void 0?e:0,bottom:(t=n==null?void 0:n.bottom)!==null&&t!==void 0?t:0,left:(i=n==null?void 0:n.left)!==null&&i!==void 0?i:0,right:(s=n==null?void 0:n.right)!==null&&s!==void 0?s:0}},HY=n=>{var e;const t=(i,s)=>{var r,a;i.group=s;const o=(r=i.id)!==null&&r!==void 0?r:"VGRAMMAR_MARK_"+ ++zY;i.id=o,((a=i.marks)!==null&&a!==void 0?a:[]).forEach(l=>t(l,o))};return((e=n.marks)!==null&&e!==void 0?e:[]).forEach(i=>t(i,"root")),n},hM=n=>{var e,t,i,s,r;const{reuse:a=oV,morph:o=lV,morphAll:l=hV,animation:h={},enableExitAnimation:d=uV}=n??{};return{reuse:a,morph:o,morphAll:l,animation:{easing:(e=h.easing)!==null&&e!==void 0?e:ov,delay:(t=h.delay)!==null&&t!==void 0?t:rv,duration:(i=h.duration)!==null&&i!==void 0?i:lR,oneByOne:(s=h.oneByOne)!==null&&s!==void 0?s:av,splitPath:(r=h.splitPath)!==null&&r!==void 0?r:dV},enableExitAnimation:d}},GY=n=>C(n.markId)?e=>e&&e.mark.id()===n.markId:C(n.markName)?e=>e&&e.mark.name()===n.markName:C(n.type)?e=>e&&e.mark.markType===n.type:()=>!0,WY=(n,e)=>e.debounce?Us(n,e.debounce):e.throttle?Ta(n,e.throttle):n,VY="@",NY="#",UY=(n,e=Ua)=>{const t={},i=n.split(":");if(i.length===2){const[s,r]=i;s[0]==="#"?(t.markId=s.slice(1),t.source=e):s[0]==="@"?(t.markName=s.slice(1),t.source=e):hR(s)?(t.markType=s,t.source=e):t.source=s===Za?Za:e,t.type=r}else i.length===1&&(t.type=n,t.source=e);return t};function $Y(n){n.mode&&Fe.setEnv(n.mode,n.modeParams||{})}class YY extends cR{constructor(e){super(e),this.getStateAttrs=(t,i)=>{var s,r,a;const o=!C((s=this.runtimeStatesEncoder)===null||s===void 0?void 0:s[t]),l=o?this.runtimeStatesEncoder[t]:(r=this.mark.getSpec().encode)===null||r===void 0?void 0:r[t],h={};if(!l)return h;if(Y(l))return h.attributes=l(this.getDatum(),this,t,i),h;if(!o&&(!((a=this.graphicItem.glyphStates)===null||a===void 0)&&a[t]))return this.graphicItem.glyphStates[t];if(l){const d=this.items[0],u=[Object.assign({},d,{nextAttrs:{}})];return tr(this,u,l,this.mark.parameters()),this.coordinateTransformEncode(u),h.attributes=u[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=h):this.graphicItem.glyphStates={[t]:h},h}return h},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(e={}){if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[ao]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const t=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach(i=>{const s=t[i.name];this.glyphGraphicItems[i.name]=i,i.onBeforeAttributeUpdate=r=>this.mark?iu(s,r,this,i.name):r}),this.clearGraphicAttributes()}useStates(e,t){if(!this.graphicItem)return!1;this.mark.emit(de.BEFORE_ELEMENT_STATE,{states:e},this),this.states=e.slice();const i=ht(t)?t:this.mark.animate.getAnimationConfigs("state").length!==0;return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,i),this.mark.emit(de.AFTER_ELEMENT_STATE,{states:e},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===Je.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(e),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(e),this.diffState!==Je.enter&&this.diffState!==Je.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach(t=>{t.states={}}),this.useStates(this.states)),this.items.map(t=>{t.nextAttrs={}})}encodeCustom(e){var t;let i={};const s=this.glyphMeta.getChannelEncoder(),r=this.glyphMeta.getFunctionEncoder();if(r&&(i=r.call(null,Object.assign({},(t=this.graphicItem)===null||t===void 0?void 0:t.attribute,e),this.getDatum(),this,this.mark.getGlyphConfig())),s){let a;Object.keys(s).forEach(o=>{var l;if(!C(e[o])){a||(a=Object.assign({},(l=this.graphicItem)===null||l===void 0?void 0:l.attribute,e));const h=s[o].call(null,o,e[o],a,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(h??{}).forEach(d=>{var u;i[d]=Object.assign((u=i[d])!==null&&u!==void 0?u:{},h[d])})}})}return i}encodeDefault(){const e={};if(this.diffState===Je.enter&&this.glyphMeta.getDefaultEncoder()){const t=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(e,t)}return e}_onGlyphAttributeUpdate(e=!1){return t=>{if(!this.mark)return t;const i=this.glyphMeta.getMarks(),s=iu(this.mark.getAttributeTransforms(),t,this),r=e?this.encodeDefault():null,a=this.encodeCustom(t);return Object.keys(i).forEach(o=>{const l=i[o],h=this.glyphGraphicItems[o],d=a==null?void 0:a[o],u=Object.assign({},d);if(e){const g=r==null?void 0:r[o];Object.keys(g??{}).forEach(_=>{Fn(this.items[0].nextAttrs,_)||Fn(u,_)||(u[_]=g[_])})}const c=Object.assign({},wV(l,t),u),f=this._generateGlyphItems(l,this.items,c);this.coordinateTransformEncode(f);const p=this.transformElementItems(f,l);this.applyGlyphGraphicAttributes(p,o,h),l===ne.shape&&(h.datum=f[0].datum)}),s}}_generateGlyphItems(e,t,i){const s=t.map(r=>Object.assign({},r,{nextAttrs:i}));return oR.includes(e)&&this.mark.getSpec().enableSegments&&s.forEach((r,a)=>{r.nextAttrs=Object.assign({},t[a].nextAttrs,i)}),s}getGraphicAttribute(e,t=!1,i){if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return t&&Fn(s,e)?s[e]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[e]}setGraphicAttribute(e,t,i=!0,s){if(!this.graphicItem)return;const r=s?this.glyphGraphicItems[s]:this.graphicItem,a=this.getFinalGraphicAttributes(s),o=this.getPrevGraphicAttributes(s);i&&(a[e]=t),Fn(o,e)||(o[e]=r.attribute[e]),r.setAttribute(e,t)}setGraphicAttributes(e,t=!0,i){if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,r=this.getFinalGraphicAttributes(i),a=this.getPrevGraphicAttributes(i);Object.keys(e).forEach(o=>{t&&(r[o]=e[o]),Fn(a,o)||(a[o]=s.attribute[o])}),s.setAttributes(e)}diffAttributes(e,t){const i={},s=this.getFinalGraphicAttributes(t);for(const r in e)R_(r,s,e)||(i[r]=e[r]);return i}applyGlyphGraphicAttributes(e,t,i){var s,r;if(this.mark.needAnimate()){const a=this.diffAttributes(e,t),o=(s=this.getPrevGraphicAttributes(t))!==null&&s!==void 0?s:{},l=(r=this.getFinalGraphicAttributes(t))!==null&&r!==void 0?r:{};Object.keys(a).forEach(h=>{o[h]=i.attribute[h],l[h]=a[h]}),this.setNextGraphicAttributes(a,t),this.setPrevGraphicAttributes(o,t),this.setFinalGraphicAttributes(l,t),i.setAttributes(a)}else i.setAttributes(e)}getFinalGraphicAttributes(e){return(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(e,t){(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs=e}getPrevGraphicAttributes(e){return(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(e,t){(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs=e}getNextGraphicAttributes(e){return(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs}setNextGraphicAttributes(e,t){(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs=e}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach(e=>{this.setPrevGraphicAttributes(null,e),this.setNextGraphicAttributes(null,e)})}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach(e=>{this.setPrevGraphicAttributes(null,e),this.setNextGraphicAttributes(null,e),this.setFinalGraphicAttributes(null,e)})}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach(e=>{e[ao]=null}),this.glyphGraphicItems=null),super.release()}}const yf=n=>n.markType===ne.glyph?new YY(n):new cR(n);function dr(n,e,t){const i=new Map;if(!n||n.length===0)return{keys:[],data:i};if(!e)return i.set(zs,t?n.slice().sort(t):n.slice()),{keys:aV,data:i};const s=Bl(e);if(n.length===1){const a=s(n[0]);return i.set(a,[n[0]]),{keys:[a],data:i}}const r=new Set;return n.forEach(a=>{var o;const l=s(a),h=(o=i.get(l))!==null&&o!==void 0?o:[];h.push(a),i.set(l,h),r.add(l)}),t&&r.forEach(a=>{i.get(a).sort(t)}),{keys:Array.from(r),data:i}}class S0{constructor(e,t,i){this.prevData=e!=null&&e.length?dr(e,t??null,i):null}setCurrentData(e){this.currentData=e}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const e=new Map(this.prevData.data);this.currentData.keys.forEach(t=>{this.callback(t,this.currentData.data.get(t),e.get(t)),e.delete(t)}),this.prevData.keys.forEach(t=>{e.has(t)&&this.callback(t,null,e.get(t))})}else this.currentData?this.currentData.keys.forEach(e=>{this.callback(e,this.currentData.data.get(e),null)}):this.prevData&&this.prevData.keys.forEach(e=>{this.callback(e,null,this.prevData.data.get(e))})}setCallback(e){this.callback=e}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}function XY(n,e,t){const i={enter:[],exit:[],update:[]},s=new S0(n,t);return s.setCallback((r,a,o)=>{C(a)?i.exit.push({prev:o[0]}):C(o)?i.enter.push({next:a[0]}):i.update.push({next:a[0],prev:o[0]})}),s.setCurrentData(dr(e,t)),s.doDiff(),i}function KY(n,e,t){const i={enter:[],exit:[],update:[]},s=new S0(n,t);return s.setCallback((r,a,o)=>{C(a)?i.exit.push({prev:o}):C(o)?i.enter.push({next:a}):i.update.push({next:a,prev:o})}),s.setCurrentData(dr(e,t)),s.doDiff(),i}const rO=(n,e)=>{if(!n)return null;if(n.from){const t=n.from,i=Object.keys(t);i.forEach(r=>{C(t[r])&&delete t[r]});const s=Ep(i,e.mark.markType)&&!P(t.segments);if(s){const r=e.items.map(a=>Object.assign({},a,{nextAttrs:Object.assign({},t)}));n.from=e.transformElementItems(r,e.mark.markType,s)}}if(n.to){const t=n.to,i=Object.keys(t);i.forEach(r=>{C(t[r])&&delete t[r]});const s=Ep(i,e.mark.markType)&&!P(t.segments);if(s){const r=e.items.map(a=>Object.assign({},a,{nextAttrs:Object.assign({},t)}));n.to=e.transformElementItems(r,e.mark.markType,s)}}return n};function qY(n,e,t,i){const s=Y(e.options)?e.options.call(null,n.getDatum(),n,i):e.options;if(!e.type||!ee.getAnimationType(e.type))return null;const r=ee.getAnimationType(e.type)(n,s,t);return rO(r,n)}const dM=(n,e,t,i,s)=>Y(t)?t(n.getDatum(),n,s):t;function ZY(n,e,t,i){const s=e.channel;let r=null;return W(s)?r=s.reduce((a,o)=>(a.from[o]=n.getGraphicAttribute(o,!0),a.to[o]=n.getGraphicAttribute(o,!1),a),{from:{},to:{}}):He(s)&&(r=Object.keys(s).reduce((a,o)=>{var l,h;const d=!C((l=s[o])===null||l===void 0?void 0:l.from),u=!C((h=s[o])===null||h===void 0?void 0:h.to);return(d||u)&&(a.from[o]=d?dM(n,0,s[o].from,0,i):void 0,a.to[o]=u?dM(n,0,s[o].to,0,i):n.getGraphicAttribute(o,!1)),a},{from:{},to:{}})),rO(r,n)}class JY extends nn{constructor(e,t,i,s,r){super(e,t,i,s,r),this._interpolator=r==null?void 0:r.interpolator,this._element=r==null?void 0:r.element}onBind(){var e,t;this.from=(e=this.from)!==null&&e!==void 0?e:{},this.to=(t=this.to)!==null&&t!==void 0?t:{}}getEndProps(){return this.to}onUpdate(e,t,i){this._interpolator&&this._element&&this._interpolator.call(this,t,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class QY extends nn{getEndProps(){return this.to}onBind(){var e,t;this.from=(e=this.from)!==null&&e!==void 0?e:{},this.to=(t=this.to)!==null&&t!==void 0?t:{}}onStart(){var e;const t=(e=this.target.constructor.NOWORK_ANIMATE_ATTR)!==null&&e!==void 0?e:Ci,i=Object.keys(t).filter(a=>t[a]!==0);this.subAnimate.animate.preventAttrs(i);const s=Object.assign({},this.from),r=Object.assign({},this.to);Object.keys(r).forEach(a=>{i.includes(a)?(s[a]=r[a],this.from[a]=r[a]):C(s[a])&&(s[a]=this.target.getComputedAttribute(a))}),this.target.setAttributes(s,!1,{type:kt.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=s,this._toAttribute=r}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:kt.ANIMATE_END})}update(e,t,i){this.updateCount===0&&this.onFirstRun(),this.updateCount+=1;const s=this.step.getLastProps();Object.keys(s).forEach(r=>{this.subAnimate.animate.validAttr(r)&&(i[r]=s[r])}),this.onUpdate(e,t,i),e&&this.onEnd()}onUpdate(e,t,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,t,e,this._toAttribute,this._fromAttribute)}}Nf.mode|=ql.SET_ATTR_IMMEDIATELY;let e8=0;const uM=n=>!C(n)&&n.prototype instanceof nn;class t8{constructor(e,t,i){this.id=e8++,this.isAnimating=!1,this.runnings=[],this.element=e,this.animationOptions=i,this.unit=t}callback(e){return this.callbackFunction=e,this}animate(e,t){return this.isAnimating=!0,this.animateElement(e,t),this.runnings.length===0&&this.animationEnd(),this}stop(e="end",t=!0){return this.runnings.forEach(i=>i.stop(e)),this.animationEnd(t),this}pause(){return this.runnings.forEach(e=>e.pause()),this}resume(){return this.runnings.forEach(e=>e.resume()),this}startAt(e){return this.runnings.forEach(t=>{const i=this.unit.initialDelay;t.startAt(i+e)}),this}getTotalAnimationTime(){var e;const t=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return(e=this.unit.totalTime)!==null&&e!==void 0?e:t}getEndAttributes(){return this.runnings.reduce((e,t)=>Object.assign(e,t.getEndProps()),{})}animationEnd(e=!0){var t;this.isAnimating=!1,this.runnings=null,e&&((t=this.callbackFunction)===null||t===void 0||t.call(null))}animateElement(e,t){const i=this.element.getGraphicItem();if(!i)return;const s=i.animate();this.runnings.push(s),s.startAt(this.unit.initialDelay),s.wait(this.unit.loopDelay),this.unit.timeSlices.forEach(r=>{this.animateTimeSlice(s,r,e,t)}),s.wait(this.unit.loopDelayAfter),s.loop(this.unit.loopCount-1),j(this.unit.totalTime)&&setTimeout(()=>{s&&s.stop("end")},this.unit.totalTime),s.onEnd(()=>{this.runnings=this.runnings.filter(r=>r!==s),this.runnings.length===0&&this.animationEnd()})}animateTimeSlice(e,t,i,s){const r=t.delay,a=t.delayAfter,o=t.duration,l=t.effects;if(r>0&&e.wait(r),l.length<0)e.wait(o);else{const h=l.map((d,u)=>{var c;const f=(c=d.type?qY(this.element,d,i,s):d.channel?ZY(this.element,d,i,s):void 0)!==null&&c!==void 0?c:{},p=f.custom||(d==null?void 0:d.custom),g=(f==null?void 0:f.customParameters)||(d==null?void 0:d.customParameters);f.from&&Object.keys(f.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&this.element.mark.markType!=="component"&&this.element.getGraphicItem().setAttributes(f.from);const _=uM(p);return!C(p)&&!uM(p)?new JY(f.from,f.to,o,d.easing,{interpolator:p,element:this.element,parameters:g}):_?new p(f.from,f.to,o,d.easing,g):f.to?new QY(f.from,f.to,o,d.easing):void 0}).filter(d=>!C(d));h.length===1?e.play(h[0]):h.length>1&&e.play(new H3(o,h))}a>0&&e.wait(a)}}function i8(n){var e,t,i,s,r,a,o,l,h,d,u,c;if(C(n.timeSlices)){const p=n;return{startTime:(e=p.startTime)!==null&&e!==void 0?e:Ck,totalTime:p.totalTime,oneByOne:(t=p.oneByOne)!==null&&t!==void 0?t:av,loop:(i=p.loop)!==null&&i!==void 0?i:Ek,controlOptions:re({},Rk,(s=p.controlOptions)!==null&&s!==void 0?s:{}),timeSlices:[{duration:(r=p.duration)!==null&&r!==void 0?r:lR,delay:(a=p.delay)!==null&&a!==void 0?a:rv,delayAfter:(o=p.delayAfter)!==null&&o!==void 0?o:Pk,effects:[{type:p.type,channel:p.channel,custom:p.custom,easing:(l=p.easing)!==null&&l!==void 0?l:ov,customParameters:p.customParameters,options:p.options}]}]}}const f=N(n.timeSlices).filter(p=>p.effects&&N(p.effects).filter(g=>g.channel||g.type).length);if(f.length)return{startTime:(h=n.startTime)!==null&&h!==void 0?h:Ck,totalTime:n.totalTime,oneByOne:(d=n.oneByOne)!==null&&d!==void 0?d:av,loop:(u=n.loop)!==null&&u!==void 0?u:Ek,controlOptions:re({},Rk,(c=n.controlOptions)!==null&&c!==void 0?c:{}),timeSlices:f.map(p=>{var g,_;return{duration:p.duration,delay:(g=p.delay)!==null&&g!==void 0?g:rv,delayAfter:(_=p.delayAfter)!==null&&_!==void 0?_:Pk,effects:N(p.effects).filter(m=>m.channel||m.type).map(m=>{var y;return{type:m.type,channel:m.channel,custom:m.custom,easing:(y=m.easing)!==null&&y!==void 0?y:ov,customParameters:m.customParameters,options:m.options}})}}),partitioner:n.partitioner,sort:n.sort}}function cM(n){let e=[];return Object.keys(n).forEach(t=>{e=e.concat(aO(t,n[t]))}),e}function aO(n,e,t=0){const i=[];let s=t;return N(e).forEach(r=>{var a;const o=i8(r);o&&(i.push({state:n,id:(a=o.id)!==null&&a!==void 0?a:`${n}-${s}`,timeline:o,originConfig:r}),s+=1)}),i}function Rr(n,e,t){return Y(n)?n.call(null,e.getDatum(),e,t):n}class fM{constructor(e){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=e.filter(t=>!C(t)),this.totalTime=this.animators.reduce((t,i)=>Math.max(t,i.getTotalAnimationTime()),0)}parallel(e){const t=Array.from(new Set(this.parallelArrangers.concat(e.parallelArrangers)));return t.forEach(i=>{i.parallelArrangers=t}),this.arrangeTime(),this}after(e){return this.afterArranger=e,this.arrangeTime(),this}arrangeTime(){const e=this.parallelArrangers.reduce((i,s)=>Math.max(i,s.totalTime),this.totalTime),t=this.parallelArrangers.reduce((i,s)=>{var r,a;return Math.max(i,(a=(r=s.afterArranger)===null||r===void 0?void 0:r.endTime)!==null&&a!==void 0?a:0)},0);this.parallelArrangers.forEach(i=>{i.startTime=t,i.endTime=t+e,i.animators.forEach(s=>{s.startAt(t)})})}}class pM{constructor(e,t){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=e,this.configs=cM(t??{})}getAnimationConfigs(e){var t;return this.isEnabled?((t=this.configs)!==null&&t!==void 0?t:[]).filter(i=>i.state===e):[]}updateConfig(e){this.configs=cM(e??{})}updateState(e){this.state=e}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const e=this.mark.getAllElements(),t=this.mark.parameters();return e.forEach(i=>{var s;i.isReserved&&i.diffState!==Je.exit&&(i.isReserved=!1);const r=(s=this.elementRecorder.get(i))===null||s===void 0?void 0:s.prevState;this.configs.some(a=>r!==i.diffState&&a.state===r&&a.timeline.controlOptions.stopWhenStateChange)&&this.clearElementAnimation(i,!1)}),this.configs.forEach(i=>{this.animateByTimeline(i,e,t)}),this.mark.cleanExitElements(),this}runAnimationByState(e){if(!this.isEnabled)return;const t=this.configs.filter(a=>a.state===e),i=this.mark.getAllElements(),s=this.mark.parameters(),r=t.reduce((a,o)=>a.concat(this.animateByTimeline(o,i,s,!0)),[]);return new fM(r)}stopAnimationByState(e){const t=this.animators.get(e);return t&&t.forEach(i=>i.stop()),this}pauseAnimationByState(e){const t=this.animators.get(e);return t&&t.forEach(i=>i.pause()),this}resumeAnimationByState(e){const t=this.animators.get(e);return t&&t.forEach(i=>i.resume()),this}run(e){if(!this.isEnabled)return;const t=aO(Tk,e,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(t);const i=this.mark.getAllElements(),s=this.mark.parameters(),r=t.reduce((a,o)=>a.concat(this.animateByTimeline(o,i,s,!0)),[]);return new fM(r)}stop(){return this.animators.forEach(e=>{e.forEach(t=>t.stop())}),this}pause(){return this.animators.forEach(e=>e.forEach(t=>t.pause())),this}resume(){return this.animators.forEach(e=>e.forEach(t=>t.resume())),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let e=!1;return this.animators.forEach(t=>{e=e||t.some(i=>i.isAnimating)}),e}isElementAnimating(e){var t;const i=(t=this.elementRecorder.get(e))===null||t===void 0?void 0:t.count;return C(i)||Object.values(i).every(s=>s===0)}getAnimatorCount(){let e=0;return this.animators.forEach(t=>e+=t.length),e}getAllAnimators(){const e=[];return this.animators.forEach(t=>{e.push(...t)}),e}getElementAnimators(e,t){var i;const s=N(e);let r=[];return t?r=(i=this.animators.get(t))!==null&&i!==void 0?i:[]:this.animators.forEach(a=>{r=r.concat(a)}),r.filter(a=>s.includes(a.element))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(e){const t=N(e);return this.disabledStates=this.disabledStates.filter(i=>!t.includes(i)),this}disableAnimationState(e){const t=N(e);return this.disabledStates=this.disabledStates.concat(t),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(e,t,i,s=!1){var r;const a=[],o=t.filter(l=>{const h=!(l.isReserved&&l.diffState===Je.exit),d=this.getAnimationState(l),u=!this.disabledStates.includes(d),c=s||d===e.state,f=!e.timeline.partitioner||e.timeline.partitioner(l.getDatum(),l,i);return h&&u&&c&&f});if(o.length){C(this.timelineCount[e.id])&&(this.timelineCount[e.id]=0),e.timeline.sort&&o.sort((h,d)=>e.timeline.sort(h.getDatum(),d.getDatum(),h,d,i));const l={width:this.mark.view.width(),height:this.mark.view.height(),group:(r=this.mark.group)!==null&&r!==void 0?r:null,mark:this.mark,view:this.mark.view,elementCount:o.length,elementIndex:0};o.forEach((h,d)=>{l.elementIndex=d;const u=Object.assign({[cV]:l},i),c=this.getAnimationUnit(e.timeline,h,d,o.length,u);a.push(this.animateElement(e,c,h,l,u))})}return a}animateElement(e,t,i,s,r){var a,o;const l=new t8(i,t,e);if(l.animate(s,r),!l.isAnimating)return;i.diffState===Je.exit&&(i.isReserved=!0);const h=this.timelineCount[e.id]===0;this.timelineCount[e.id]+=1;const d=(a=this.elementRecorder.get(i))!==null&&a!==void 0?a:{prevState:e.state,count:{}};d.prevState=e.state,d.count[e.state]=((o=d.count[e.state])!==null&&o!==void 0?o:0)+1,this.elementRecorder.set(i,d);const u=this.animators.get(e.state);u?u.push(l):this.animators.set(e.state,[l]),l.callback(()=>{this.handleAnimatorEnd(l)});const c={mark:this.mark,animationState:e.state,animationConfig:e.originConfig};return h&&this.mark.emit(de.ANIMATION_START,c),this.mark.emit(de.ELEMENT_ANIMATION_START,c,i),l}getAnimationState(e){const t=Ot(this.state,this.mark.parameters(),e.getDatum(),e);return t??e.diffState}getAnimationUnit(e,t,i,s,r){const a=[],o=Rr(e.startTime,t,r),l=Rr(e.totalTime,t,r),h=Rr(e.oneByOne,t,r),d=Rr(e.loop,t,r);let u=0;e.timeSlices.forEach(f=>{var p;const g=Rr(f.delay,t,r),_=Rr(f.delayAfter,t,r),m=(p=Rr(f.duration,t,r))!==null&&p!==void 0?p:l/s,y=N(f.effects).map(b=>Object.assign({},b,{customParameters:Rr(b.customParameters,t,r)}));a.push({effects:y,duration:m,delay:g,delayAfter:_}),u+=g+m+_});const c=oe(h)?h:h===!0?u:0;return{initialDelay:o,loopCount:oe(d)?d:d===!0?1/0:1,loopDelay:c*i,loopDelayAfter:c*(s-i-1),loopAnimateDuration:u,loopDuration:u+c*(s-1),totalTime:l,timeSlices:a}}clearElementAnimation(e,t=!0){this.animators.forEach(i=>{i.forEach(s=>{s.element===e&&(s.animationOptions.state===Je.exit?s.stop("start",!1):s.stop("end",!1),this.handleAnimatorEnd(s,t))})}),this.elementRecorder.delete(e)}clearAllElements(){const e=this.mark.getAllElements();e&&e.forEach((t,i)=>{this.clearElement(t,i===e.length-1)})}clearElement(e,t=!0){this.clearElementAnimation(e),e.getGraphicItem()&&(e.clearGraphicAttributes(),e.diffState===Je.exit&&(e.isReserved=!1),t&&this.mark.cleanExitElements())}handleAnimatorEnd(e,t=!0){const i=e.element,s=e.animationOptions,r=s.state,a=r===Tk,o=this.elementRecorder.get(i).count;o[r]-=1,this.animators.set(r,this.animators.get(r).filter(u=>u!==e)),this.animators.get(r).length===0&&this.animators.delete(r),this.timelineCount[s.id]-=1;const l=this.timelineCount[s.id]===0,h=a?this.immediateConfigs.find(u=>u.id===s.id).originConfig:this.configs.find(u=>u.id===s.id).originConfig;l&&(delete this.timelineCount[s.id],a&&(this.immediateConfigs=this.immediateConfigs.filter(u=>u.id!==s.id))),t&&(Object.keys(this.timelineCount).length===0?this.clearAllElements():r===Je.exit&&o[Je.exit]===0&&this.clearElement(i));const d={mark:this.mark,animationState:r,animationConfig:h};l&&this.mark.emit(de.ANIMATION_END,d),this.mark.emit(de.ELEMENT_ANIMATION_END,d,i)}}var n8=function(n,e,t,i){return new(t||(t=Promise))(function(s,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?s(h.value):(d=h.value,d instanceof t?d:new t(function(u){u(d)})).then(a,o)}l((i=i.apply(n,e||[])).next())})};class Mh extends q_{constructor(e,t,i){super(e),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new pM(this,{}),this.differ=new S0([]),this.evaluateSync=(s,r)=>{var a;return this.evaluateMainTasks(s,r),!((a=this.renderContext)===null||a===void 0)&&a.progressive||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,r),this},this.markType=t,this.spec.type=t,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(e){var t,i,s;if(super.parse(e),this.spec.group){const a=ae(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(a)}const r=ae(e.group)?this.view.getMarkById(e.group):e.group;return this.attach(r),this.join((t=e.from)===null||t===void 0?void 0:t.data,e.key,e.sort,e.groupBy,e.groupSort),this.coordinate(e.coordinate),this.state(e.state,this.spec.stateSort),Object.keys((i=this.spec.encode)!==null&&i!==void 0?i:{}).forEach(a=>{this.encodeState(a,{},!0)}),Object.keys((s=e.encode)!==null&&s!==void 0?s:{}).forEach(a=>{this.encodeState(a,e.encode[a])}),this.animation(e.animation),this.animationState(e.animationState),this.morph(e.morph,e.morphKey,e.morphElementKey),this.layout(e.layout),this.configure(e),this.transform(e.transform),this.parseAddition(e),this.spec=e,this.markType=e.type,this.commit(),this}parameters(){var e;return(e=this._finalParameters)!==null&&e!==void 0?e:super.parameters()}parseAddition(e){return this}reuse(e){if(e.grammarType!==this.grammarType)return this;const t=e;return this.markType=t.markType,this.coord=t.coord,this.elementMap=t.elementMap,this.elements=t.elements,this.elementMap.forEach(i=>i.mark=this),this.differ=t.differ,this.animate=t.animate,this.animate.mark=this,this._context=t._context,this.graphicItem=t.graphicItem,this.graphicIndex=t.graphicIndex,this.graphicParent=t.graphicParent,this.needClear=t.needClear,this.isUpdated=t.isUpdated,this}needLayout(){return!C(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach(e=>{e.diffState===Je.exit?e.clearGraphicAttributes():e.clearChangedGraphicAttributes()}),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,t){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===Bn.before)return this;const s=(i=this.view.renderer)===null||i===void 0?void 0:i.stage();this.init(s,t);const r=this.evaluateTransformSync(this._getTransformsBeforeJoin(),e??gf,t);let a=r!=null&&r.progressive?e:r;return this.evaluateGroup(a),this.renderContext=this.parseRenderContext(a,t),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):(r!=null&&r.progressive&&(this.renderContext.parameters=t,this.renderContext.beforeTransformProgressive=r.progressive,a=r.progressive.output()),this.emit(de.BEFORE_MARK_JOIN),this.evaluateJoin(a),this.emit(de.AFTER_MARK_JOIN),this.emit(de.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,t),this.emit(de.AFTER_MARK_STATE),this.emit(de.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),t),this.emit(de.AFTER_MARK_ENCODE)),this.emit(de.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(de.AFTER_MARK_UPDATE),this}evaluateGroup(e){if(this.markType===ne.group)return;const t=dr(e??gf,this.spec.groupBy,this.spec.groupSort),i=t.keys;this._groupKeys=i,this.differ.setCurrentData(t)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter(e=>e.markPhase==="afterEncodeItems")}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter(e=>C(e.markPhase)||e.markPhase==="afterEncode")}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter(e=>e.markPhase==="beforeJoin"):[]}evaluate(e,t){var i;return n8(this,void 0,void 0,function*(){return this.evaluateMainTasks(e,t),!((i=this.renderContext)===null||i===void 0)&&i.progressive||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,t)),this})}output(){return this}join(e,t,i,s,r){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,C(e)||(ae(e)?this.grammarSource=this.view.getDataById(e):this.grammarSource=e,this.spec.from={data:e},this.attach(this.grammarSource)),this.spec.key=t,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=r,this.commit(),this}coordinate(e){return ae(e)?this.coord=this.view.getCoordinateById(e):this.coord=e,this.attach(this.coord),this.commit(),this}state(e,t){return this.spec.stateSort=t,this.setFunctionSpec(e,"state")}encode(e,t,i){return this.encodeState(Je.update,e,t,i)}encodeState(e,t,i,s){if(e===Je.enter&&(this._isReentered=!0),this.spec.encode[e]){const r=this.spec.encode[e];if(Xr(r))this.detach(Da(r,this.view));else{const a=ae(t);a&&s||!a&&i?(Object.keys(r).forEach(o=>{this.detach(Da(r[o],this.view))}),this.spec.encode[e]={}):a?this.detach(Da(r[t],this.view)):Object.keys(t).forEach(o=>{this.detach(Da(r[o],this.view))})}}return t&&(this.spec.encode[e]||(this.spec.encode[e]={}),ae(t)?(this.spec.encode[e][t]=i,this.attach(Da(i,this.view))):Xr(t)?(this.spec.encode[e]=t,this.attach(Da(t,this.view))):t&&(Object.assign(this.spec.encode[e],t),Object.values(t).forEach(r=>{this.attach(Da(r,this.view))}))),this.commit(),this}_getEncoders(){var e;return(e=this.spec.encode)!==null&&e!==void 0?e:{}}animation(e){return this.spec.animation=e,this}animationState(e){return this.setFunctionSpec(e,"animationState")}layout(e){return this.spec.layout=e,this.commit(),this}morph(e,t,i){return this.spec.morph=e,this.spec.morphKey=t,this.spec.morphElementKey=i,this}transform(e){const t=lg(this.spec.transform,this.view);t&&(this.detach(t.refs),this.transforms=[]);const i=lg(e,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=e,this.commit(),this}configure(e){const t=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments"];return e===null?(t.forEach(i=>{C(this.spec[i])||(this.spec[i]=void 0)}),this):(t.forEach(i=>{C(e[i])||(this.spec[i]=e[i])}),this)}context(e){return this.spec.context=e,this._context=e,this}isCollectionMark(){return oR.includes(this.markType)}needAnimate(){var e;return!(!((e=this.renderContext)===null||e===void 0)&&e.progressive)&&!C(this.spec.animation)}getAllElements(){const e=this.elements.slice();return this.elementMap.forEach(t=>{t.diffState!==Je.exit||e.includes(t)||e.push(t)}),this.spec.sort&&e.sort((t,i)=>this.spec.sort(t.getDatum(),i.getDatum())),e}getScales(){const e={};return this.references.forEach((t,i)=>{i.grammarType===sv.scale&&(e[i.id()]=i.output())}),e}getScalesByChannel(){const e=this.spec.encode;if(!e)return{};const t={},i=this.parameters();return Object.keys(e).forEach(s=>{const r=e[s];r&&!Xr(r)&&Object.keys(r).forEach(a=>{B_(r[a])&&(t[a]=tu(r[a].scale,i))})}),t}getFieldsByChannel(){const e=this.spec.encode;if(!e)return{};const t={};return Object.keys(e).forEach(i=>{const s=e[i];Xr(s)||Object.keys(s).forEach(r=>{u0(s[r])&&(t[r]=s[r].field)})}),t}init(e,t){var i,s,r,a;if(this._delegateEvent||(this._delegateEvent=(h,d)=>{var u;const c=(u=h.target)===null||u===void 0?void 0:u[ao];if((c==null?void 0:c.mark)===this){const f=jv(this.view,h,c,d,Ua);this.emitGrammarEvent(d,f,c)}},this.initEvent()),this.animate||(this.animate=new pM(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const h=tu(this.spec.group,t);this.group=h,h&&h.appendChild(this)}const o=this.group?this.group.getGroupGraphicItem():e.defaultLayer,l=(r=(s=(i=this.group)===null||i===void 0?void 0:i.children)===null||s===void 0?void 0:s.indexOf(this))!==null&&r!==void 0?r:0;if(this.markType!==ne.group){if(!this.graphicItem){const h=gd(this,ne.group,{pickable:!1,zIndex:(a=this.spec.zIndex)!==null&&a!==void 0?a:0});(this.spec.support3d||rV.includes(this.markType))&&h.setMode("3d"),h.name=`${this.id()||this.markType}`,this.graphicItem=h}this.graphicParent=this.graphicItem,!o||this.graphicIndex===l&&this.graphicItem.parent===o||o.insertIntoKeepIdx(this.graphicItem,l)}else this.graphicParent=o;this.graphicIndex=l}update(e){this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(e.animation&&this.animate.updateConfig(e.animation),this.animate.updateState(e.animationState)),this.markType!==ne.group?(C(e.zIndex)||this.graphicItem.setAttribute("zIndex",e.zIndex),C(e.clip)||this.graphicItem.setAttribute("clip",e.clip),this.elementMap.forEach(t=>{t.updateGraphicItem({interactive:e.interactive})})):this.elementMap.forEach(t=>{t.updateGraphicItem({clip:e.clip,zIndex:e.zIndex,interactive:e.interactive})})}evaluateJoin(e){var t,i,s,r;this.needClear=!0;const a=Bl((s=(t=this.spec.key)!==null&&t!==void 0?t:(i=this.grammarSource)===null||i===void 0?void 0:i.getDataIDKey())!==null&&s!==void 0?s:()=>zs),o=Bl((r=this.spec.groupBy)!==null&&r!==void 0?r:()=>zs),l=this.spec.sort,h=this.isCollectionMark(),d=new Set(this.elements.filter(f=>f.diffState===Je.enter)),u=[];this.differ.setCallback((f,p,g)=>{const _=f;let m;if(C(p))m=this.elementMap.get(_),m&&(m.diffState=Je.exit);else if(C(g)){m=this.elementMap.has(_)?this.elementMap.get(_):yf(this),m.diffState===Je.exit&&(m.diffState=Je.enter,this.animate.getElementAnimators(m,Je.exit).forEach(b=>b.stop("start"))),m.diffState=Je.enter;const y=h?f:o(p[0]);m.updateData(y,p,a,this.view),this.elementMap.set(_,m),u.push(m)}else if(m=this.elementMap.get(_),m){m.diffState=Je.update;const y=h?f:o(p[0]);m.updateData(y,p,a,this.view),u.push(m)}d.delete(m)});const c=e??gf;h||this.differ.setCurrentData(dr(c,f=>`${o(f)}-${a(f)}`,void 0)),this.differ.doDiff(),d.forEach(f=>{this.elementMap.delete(h?f.groupKey:`${f.groupKey}-${f.key}`),f.remove(),f.release()}),this.elements=u,l&&this.elements.length>=2&&this.elements.sort((f,p)=>l(f.getDatum(),p.getDatum()))}evaluateState(e,t,i){t&&e.forEach(s=>{s.state(t,i)})}evaluateGroupEncode(e,t,i){var s;if(this.markType===ne.group){const a=this.elements[0],o={},l=[Object.assign({},(s=a.items)===null||s===void 0?void 0:s[0],{nextAttrs:o})];return tr(a,l,t,i),o}if(!this._groupKeys||!t)return;const r={};return this._groupKeys.forEach(a=>{const o=e.find(l=>l.groupKey===a);o&&(r[a]=qa(t,o.items&&o.items[0]&&o.items[0].datum,o,i))}),r}evaluateEncode(e,t,i){if(t){this.emit(de.BEFORE_ELEMENT_ENCODE,{encoders:t,parameters:i},this);const s=this.evaluateGroupEncode(e,t[Ls.group],i);e.forEach(r=>{this.markType===ne.group&&s?r.items.forEach(a=>{a.nextAttrs=Object.assign(a.nextAttrs,s)}):s!=null&&s[r.groupKey]&&!this.isCollectionMark()&&r.items.forEach(a=>{a.nextAttrs=Object.assign(a.nextAttrs,s[r.groupKey])}),r.encodeItems(r.items,t,this._isReentered,i)}),this._isReentered=!1,this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),e,i),e.forEach(r=>{r.encodeGraphic(this.isCollectionMark()?s==null?void 0:s[r.groupKey]:null)}),this.emit(de.AFTER_ELEMENT_ENCODE,{encoders:t,parameters:i},this)}else e.forEach(s=>{s.initGraphicItem()})}addGraphicItem(e,t,i){var s;const r=i??gd(this,this.markType,e);if(r){if(!((s=this.renderContext)===null||s===void 0)&&s.progressive){let a;if(this._groupKeys){const o=this._groupKeys.indexOf(t);o>=0&&(a=this.graphicParent.getChildAt(o))}else a=this.graphicParent.at(0);this.isCollectionMark()?(r.incremental=1,a.appendChild(r)):a.incrementalAppendChild(r)}else this.graphicParent.appendChild(r);return r}}parseRenderContext(e,t){const i=this.markType!==ne.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep<this.spec.progressiveThreshold,s=this.spec.large&&this.spec.largeThreshold>0&&e.length>=this.spec.largeThreshold;if(i){const r=this.differ.getCurrentData();return r&&r.keys&&r.keys.some(a=>r.data.get(a).length>this.spec.progressiveThreshold)?{large:s,parameters:t,progressive:{data:e,step:this.spec.progressiveStep,currentIndex:0,totalStep:r.keys.reduce((a,o)=>Math.max(Math.ceil(r.data.get(o).length/this.spec.progressiveStep),a),1),groupedData:r.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}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.elements=[],this.graphicParent.children.forEach(e=>{e.incrementalClearChild()}),this.graphicParent.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var e,t,i;const s=this.renderContext.progressive.currentIndex,r=Bl((i=(e=this.spec.key)!==null&&e!==void 0?e:(t=this.grammarSource)===null||t===void 0?void 0:t.getDataIDKey())!==null&&i!==void 0?i:()=>zs),a=[];if(this.isCollectionMark())return this._groupKeys.forEach((l,h)=>{const d=this.renderContext.progressive.groupedData.get(l),u=this.renderContext.progressive.step,c=d.slice(s*u,(s+1)*u);if(s===0){const f=yf(this);f.diffState=Je.enter,f.updateData(l,c,r,this.view),a.push(f)}else{const f=this.elements[h];f.updateData(l,c,r,this.view),a.push(f)}}),a;const o={};return this._groupKeys.forEach(l=>{const h=this.renderContext.progressive.groupedData.get(l),d=this.renderContext.progressive.step,u=h.slice(s*d,(s+1)*d),c=[];u.forEach(f=>{const p=yf(this);p.diffState=Je.enter,p.updateData(l,[f],r,this.view),c.push(p),a.push(p)}),o[l]=c}),{groupElements:o,elements:a}}evaluateEncodeProgressive(e,t,i){if(!t)return void e.forEach(l=>{l.initGraphicItem()});const s=Object.keys(t).reduce((l,h)=>(!t[h]||h!==Ls.enter&&h!==Ls.exit&&h!==Ls.update||(l[h]=SV(this.markType,t[h],this.glyphType).positionEncoder),l),{}),r=this.renderContext.progressive.currentIndex,a=this.isCollectionMark();this.emit(de.BEFORE_ELEMENT_ENCODE,{encoders:t,parameters:i},this);const o=this.evaluateGroupEncode(e,t[Ls.group],i);if(e.forEach((l,h)=>{const d=r>0||!a&&h>0;!d&&(o!=null&&o[l.groupKey])&&l.items.forEach(u=>{u.nextAttrs=Object.assign(u.nextAttrs,o[l.groupKey])}),l.encodeItems(l.items,d?s:t,this._isReentered,i)}),this._isReentered=!1,this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),e,i),e.forEach(l=>{l.encodeGraphic()}),this.emit(de.AFTER_ELEMENT_ENCODE,{encoders:t,parameters:i},this),r===0&&!a){const l=e[0].getGraphicItem(),h=l==null?void 0:l.parent;if(h){const d=l.attribute,u={},c={};Object.keys(d).forEach(f=>{["pickable","zIndex"].includes(f)||(Rp(this.markType,f)?c[f]=d[f]:u[f]=d[f])}),h.setTheme({common:u}),l.initAttributes(c)}}}evaluateProgressive(){var e,t,i;if(!((e=this.renderContext)===null||e===void 0)&&e.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const l=this.renderContext.beforeTransformProgressive.output();return this.emit(de.BEFORE_MARK_JOIN),this.evaluateJoin(l),this.emit(de.AFTER_MARK_JOIN),this.emit(de.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(de.AFTER_MARK_STATE),this.emit(de.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(de.AFTER_MARK_ENCODE)}if(!(!((t=this.renderContext)===null||t===void 0)&&t.progressive))return;const s=this.renderContext.parameters;this.emit(de.BEFORE_MARK_JOIN);const r=this.evaluateJoinProgressive(),a=Array.isArray(r)?r:r.elements;if(this.emit(de.AFTER_MARK_JOIN),this.renderContext.progressive.currentIndex===0?(this.graphicParent.removeAllChild(),this._groupKeys.forEach(l=>{const h=gd(this,ne.group,{pickable:!1,zIndex:this.spec.zIndex});h.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(h)}),this.elements=a):this.elements=this.elements.concat(a),this.emit(de.BEFORE_MARK_STATE),this.evaluateState(a,this.spec.state,s),this.emit(de.AFTER_MARK_STATE),this.emit(de.BEFORE_MARK_ENCODE),Array.isArray(r))this.evaluateEncodeProgressive(a,this._getEncoders(),s);else{const l=r.groupElements;Object.keys(l).forEach(h=>{this.evaluateEncodeProgressive(l[h],this._getEncoders(),s)})}this.emit(de.AFTER_MARK_ENCODE);const o=(i=this._getTransformsAfterEncode())===null||i===void 0?void 0:i.filter(l=>l.canProgressive===!0);o!=null&&o.length&&this.evaluateTransformSync(o,this.elements,s),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach((e,t)=>{e.diffState!==Je.exit||e.isReserved||(this.elementMap.delete(t),e.remove(),e.release())})}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var e;return this.graphicItem?this.graphicItem.AABBBounds:(e=this.getGroupGraphicItem())===null||e===void 0?void 0:e.AABBBounds}getMorphConfig(){var e;return{morph:(e=this.spec.morph)!==null&&e!==void 0&&e,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var e;return(e=this.spec.attributeTransforms)!==null&&e!==void 0?e:oo[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var e,t;if(((e=this.spec.layout)===null||e===void 0?void 0:e.skipBeforeLayouted)===!0)return!0;let i=this.group;for(;i;){if(((t=i.getSpec().layout)===null||t===void 0?void 0:t.skipBeforeLayouted)===!0)return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){if(this._delegateEvent){const e=this.view.renderer.stage();e&&e.off("*",this._delegateEvent)}}clear(){var e;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,(e=this.group)===null||e===void 0||e.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach(e=>e.diffState=Je.exit),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach(e=>e.release()),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&Op(this.graphicItem),this.detachAll(),super.release()}}let s8=class extends Mh{constructor(e,t){super(e,ne.group,t),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(e){return this.children.push(e),this}removeChild(e){return this.children=this.children.filter(t=>t!==e),this}includesChild(e,t=!0){return!!this.children.includes(e)||!!t&&this.children.some(i=>i.markType===ne.group&&i.includesChild(e,!0))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter(e=>e.needLayout()),this):this}getAttributeTransforms(){return oo.rect}evaluateJoin(e){if(!this.elements.length){const t=yf(this);t.updateData(zs,gf,()=>"",this.view),this.elements=[t],this.elementMap.set(zs,t)}}addGraphicItem(e,t,i){const s=i??gd(this,this.markType,e);if(s)return this.emit(de.BEFORE_ADD_VRENDER_MARK),s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex),this.emit(de.AFTER_ADD_VRENDER_MARK),s}};function gM(n,e){if(j(n))return n;const t=n.trim();if(t==="auto")return 0;if(t.endsWith("%")){const i=parseFloat(t.substring(0,t.length-1));return j(i)?i*e:0}return 0}function r8(n,e,t){var i,s,r,a;const o=(i=n.gridTemplateRows)!==null&&i!==void 0?i:[t],l=(s=n.gridTemplateColumns)!==null&&s!==void 0?s:[e],h=(r=n.gridRowGap)!==null&&r!==void 0?r:0,d=(a=n.gridColumnGap)!==null&&a!==void 0?a:0,u=o.map(b=>gM(b,t)),c=l.map(b=>gM(b,e)),f=Math.max(0,u.reduce((b,v)=>b-v,t)-u.length*h)/o.filter(b=>b==="auto").length,p=Math.max(0,c.reduce((b,v)=>b-v,e)-c.length*d)/l.filter(b=>b==="auto").length;let g=0;const _=u.map((b,v)=>{const x=o[v]==="auto"?f:b,S=g;return g+=x+h,S});_.push(g);let m=0;const y=c.map((b,v)=>{const x=l[v]==="auto"?p:b,S=m;return m+=x+d,S});return y.push(m),{rows:_,columns:y,rowGap:h,columnGap:d}}function Yc(n,e){return Math.min(n<0?n+e:n-1,e)}function _M(n,e,t){let i=Yc(n,t),s=Yc(e,t);if(j(n)||j(e)?j(n)?j(e)||(i=Yc(Math.max(0,s-1),t)):s=Yc(i+1,t):(i=1,s=2),i>s){const r=s;s=i,i=r}return{start:i,end:s}}function a8(n,e,t,i,s){const r=n.rows.length,a=n.columns.length,{start:o,end:l}=_M(e,t,r),{start:h,end:d}=_M(i,s,a),u=n.columns[o],c=n.columns[l]-(d===a?0:n.columnGap),f=n.rows[h],p=n.rows[d]-(l===r?0:n.rowGap);return new _i().set(u,f,c,p)}const o8=(n,e,t,i)=>{const s=r8(n.getSpec().layout,t.width(),t.height());e&&e.forEach(r=>{const a=r.getSpec().layout;r.layoutBounds=a8(s,a.gridRowStart,a.gridRowEnd,a.gridColumnStart,a.gridColumnEnd),r.commit()})},l8={[ut.axis]:0,[ut.legend]:1,[ut.slider]:2,[ut.player]:3,[ut.datazoom]:4},mM=n=>{var e,t,i;return(t=(e=n.getSpec().layout)===null||e===void 0?void 0:e.order)!==null&&t!==void 0?t:n.markType==="component"&&(i=l8[n.componentType])!==null&&i!==void 0?i:1/0},yM=(n,e,t,i)=>{const s=t.clone(),r=n.getSpec().layout,a=bn(r.maxChildWidth,s.width()),o=bn(r.maxChildHeight,s.width());let l=0,h=0,d=0,u=0;e.forEach(m=>{const y=m.getSpec().layout,b=Zr(y.padding),v=i.parseMarkBounds?i.parseMarkBounds(m.getBounds(),m):m.getBounds();if(y.position==="top"||y.position==="bottom"){const x=Math.min(v.height()+b.top+b.bottom,o);y.position==="top"?s.y1+=x:s.y2-=x,v.x1<t.x1&&(l=Math.max(l,t.x1-v.x1)),v.x2>t.x2&&(h=Math.max(h,v.x2-t.x2))}if(y.position==="left"||y.position==="right"){const x=Math.min(v.width()+b.left+b.right,a);y.position==="left"?s.x1+=x:s.x2-=x,v.y1<t.y1&&(d=Math.max(d,t.y1-v.y1)),v.y2>t.y2&&(u=Math.max(u,v.y2-t.y2))}y.position==="outside"&&(s.x1+=Math.max(t.x1-v.x1,0)+b.left,s.x2-=Math.max(v.x2-t.x2,0)+b.right,s.y1+=Math.max(t.y1-v.y1,0)+b.top,s.y2-=Math.max(v.y2-t.y2)+b.bottom)}),l>s.x1-t.x1&&l<t.width()&&(s.x1=t.x1+l),h>t.x2-s.x2&&h<t.width()&&(s.x2=t.x2-h),d>s.y1-t.y1&&d<t.height()&&(s.y1=t.y1+d),u>t.y2-s.y2&&u<t.height()&&(s.y2=t.y2-u);let c=s.y1,f=s.y2,p=s.x1,g=s.x2;const _=e.slice().sort((m,y)=>mM(m)-mM(y));for(let m=0,y=_.length;m<y;m++){const b=_[m],v=b.getSpec().layout,x=Zr(v.padding),S=i.parseMarkBounds?i.parseMarkBounds(b.getBounds(),b):b.getBounds();if(v.position==="top"||v.position==="bottom"){const A=Math.min(S.height()+x.top+x.bottom,o);if(v.position==="top"?(b.layoutBounds=new _i().set(s.x1,c-A,s.x2,c),c-=A):(b.layoutBounds=new _i().set(s.x1,f,s.x2,f+A),f+=A),b.relativePosition={top:b.layoutBounds.y1-s.y1,bottom:b.layoutBounds.y1-s.y2},v.align){const k=S.width()+x.left+x.right;k<s.width()&&(v.align==="center"?(b.layoutBounds.x1=(s.x1+s.x2)/2-k/2,b.layoutBounds.x2=b.layoutBounds.x1+k,b.relativePosition.left=b.relativePosition.right=(s.width()-k)/2):v.align==="right"?(b.layoutBounds.x1=s.x2-k,b.layoutBounds.x2=s.x2,b.relativePosition.right=0,b.relativePosition.left=s.width()-k):v.align==="left"&&(b.layoutBounds.x1=s.x1,b.layoutBounds.x2=s.x1+k,b.relativePosition.left=0,b.relativePosition.right=s.width()-k))}}else if(v.position==="left"||v.position==="right"){const A=Math.min(S.width()+x.left+x.right,a);if(v.position==="left"?(b.layoutBounds=new _i().set(p-A,s.y1,p,s.y2),p-=A):(b.layoutBounds=new _i().set(g,s.y1,g+A,s.y2),g+=A),b.relativePosition={left:b.layoutBounds.x1-s.x1,right:b.layoutBounds.x1-s.x2},v.align){const k=S.height()+x.top+x.bottom;A<s.width()&&(v.align==="middle"?(b.layoutBounds.y1=(s.y1+s.y2)/2-k/2,b.layoutBounds.y2=b.layoutBounds.y1+k,b.relativePosition.top=b.relativePosition.bottom=(s.height()-k)/2):v.align==="bottom"?(b.layoutBounds.y1=s.y2-k,b.layoutBounds.y2=s.y2,b.relativePosition.top=s.height()-k,b.relativePosition.bottom=0):v.align==="top"&&(b.layoutBounds.y1=s.y1,b.layoutBounds.y2=s.y1+k,b.relativePosition.bottom=s.height()-k,b.relativePosition.top=0))}}else v.position==="outside"?(p-=Math.max(t.x1-S.x1,0)+x.left,g-=Math.max(S.x2-t.x2,0)+x.right,c-=Math.max(t.y1-S.y1,0)+x.top,f+=Math.max(S.y2-t.y2)+x.bottom):b.layoutBounds=s}return s},oO=(n,e,t)=>{n==null||n.forEach(i=>{var s;if(i.markType!==ne.group)return;const r=i.layoutChildren,a=i.getSpec().layout,o=(s=i.layoutBounds)!==null&&s!==void 0?s:i.getBounds();if(o){if(Y(a))a.call(null,i,r,o,e);else if(Y(a.callback))a.callback.call(null,i,r,o,e);else if(a.display==="relative")if(a.updateViewSignals){const l=t.getViewBox();l&&o.intersect(l);const h=yM(i,r,o,e),d=h.width(),u=h.height(),c={top:h.y1,right:t.width()-h.x2,left:h.x1,bottom:t.height()-h.y2};t.updateSignal(zl,d),t.updateSignal(jl,u),t.updateSignal(Ln,c)}else yM(i,r,o,e);else a.display==="grid"&&o8(i,r,o);oO(r,e,t)}})};class h8 extends Mh{constructor(e,t,i){super(e,ne.glyph,i),this.glyphType=t,this.glyphMeta=ee.getGlyph(t)}configureGlyph(e){return this.spec.glyphConfig=e,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(e,t){const i=AV(this,this.glyphMeta,e);return super.addGraphicItem(e,t,i)}}const py=Symbol.for("key");class d8{diffGrammar(e,t){return XY(e,t,i=>{var s;return(s=i.id())!==null&&s!==void 0?s:Symbol()})}diffMark(e,t,i){const s={enter:[],exit:[],update:[]};let r=[],a=[];e.forEach(u=>{u.markType!==ne.group&&(i.morph&&u.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(u):s.exit.push({prev:[u]})}),t.forEach(u=>{u.markType!==ne.group&&(i.morph&&u.getMorphConfig().morph||i.morphAll||i.reuse)?a.push(u):s.enter.push({next:[u]})});const o=this.diffUpdateByGroup(r,a,u=>u.getMorphConfig().morphKey,u=>u.getMorphConfig().morphKey);r=o.prev,a=o.next,s.update=s.update.concat(o.update);const l=this.diffUpdateByGroup(r,a,u=>u.id(),u=>u.id());r=l.prev,a=l.next,s.update=s.update.concat(l.update);const h=dr(r,u=>{var c,f;return(f=(c=u.group)===null||c===void 0?void 0:c.id)===null||f===void 0?void 0:f.call(c)}),d=dr(a,u=>{var c,f;return(f=(c=u.group)===null||c===void 0?void 0:c.id)===null||f===void 0?void 0:f.call(c)});return Object.keys(d).forEach(u=>{const c=h.data.get(u),f=d.data.get(u);if(c&&f){for(let p=0;p<Math.max(c.length,f.length);p+=1){const g=c[p],_=f[p];g&&_?s.update.push({prev:[g],next:[_]}):g?s.exit.push({prev:[g]}):_&&s.enter.push({next:[_]})}r=r.filter(p=>!c.includes(p)),a=a.filter(p=>!f.includes(p))}}),r.forEach(u=>s.exit.push({prev:[u]})),a.forEach(u=>s.enter.push({next:[u]})),s}_appendMorphKeyToElements(e){const t=e.getMorphConfig();if(!C(t.morphElementKey)){const i=Bl(t.morphElementKey);e.elements&&e.elements.forEach(s=>{s.morphKey=i(s.getDatum())})}}morph(e,t,i){const s=e.reduce((d,u)=>(this._appendMorphKeyToElements(u),d.concat(u.elements)),[]),r=t.reduce((d,u)=>(this._appendMorphKeyToElements(u),d.concat(u.elements)),[]),a=KY(s,r,d=>{var u;return(u=d.morphKey)!==null&&u!==void 0?u:d.key});e.forEach(d=>{var u,c;return(c=(u=d.animate)===null||u===void 0?void 0:u.disable)===null||c===void 0?void 0:c.call(u)}),t.forEach(d=>{var u,c;return(c=(u=d.animate)===null||u===void 0?void 0:u.disable)===null||c===void 0?void 0:c.call(u)});const o=e.concat(t).reduce((d,u)=>(Object.assign(d,u.parameters()),d),{});let l=0;const h=()=>{l-=1,l===0&&t.forEach(d=>{var u,c;(c=(u=d.animate)===null||u===void 0?void 0:u.enable)===null||c===void 0||c.call(u)})};a.enter.forEach(d=>{d.next.forEach(u=>{this.doMorph([],[u],i,h,o)}),l+=1}),a.update.forEach(d=>{const u=Math.min(d.prev.length,d.next.length),c=this.divideElements(d.prev,u),f=this.divideElements(d.next,u);for(let p=0;p<u;p++)this.doMorph(c[p],f[p],i,h,o),l+=1})}diffUpdateByGroup(e,t,i,s){const r=dr(e,d=>{var u;return(u=i(d))!==null&&u!==void 0?u:py}),a=dr(t,d=>{var u;return(u=s(d))!==null&&u!==void 0?u:py});let o=e,l=t;const h=[];return a.keys.forEach(d=>{if(d!==py){const u=r.data.get(d),c=a.data.get(d);u&&c&&(h.push({prev:u,next:c}),o=o.filter(f=>!u.includes(f)),l=l.filter(f=>!c.includes(f)))}}),{prev:o,next:l,update:h}}doMorph(e,t,i,s,r){var a,o;const l={prev:e.map(_=>_.getDatum()),next:t.map(_=>_.getDatum())},h={prev:e.slice(),next:t.slice()},d=i.animation.easing,u=Ot(i.animation.delay,r,l,h),c=Ot(i.animation.duration,r,l,h),f=Ot(i.animation.oneByOne,r,l,h),p=Ot(i.animation.splitPath,r,l,h),g=j(f)&&f>0?_=>oe(f)?_*f:f===!0?_*c:0:void 0;e.length!==1&&e.length!==0||t.length!==1?e.length===1&&t.length>1?oz(e[0].getGraphicItem(),t.map(_=>_.getGraphicItem()),{delay:u,duration:c,easing:d,onEnd:s,individualDelay:g,splitPath:p}):e.length>1&&t.length===1&&hz(e.map(_=>_.getGraphicItem()),t[0].getGraphicItem(),{delay:u,duration:c,easing:d,onEnd:s,individualDelay:g,splitPath:p}):sE((o=(a=e[0])===null||a===void 0?void 0:a.getGraphicItem)===null||o===void 0?void 0:o.call(a),t[0].getGraphicItem(),{delay:u,duration:c,easing:d,onEnd:s})}divideElements(e,t){const i=Math.floor(e.length/t);return new Array(t).fill(0).map((s,r)=>e.slice(i*r,r===t-1?e.length:i*(r+1)))}}class lO{constructor(e,t){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=ae(e)?i=>i[e]:e,this._warning=t}record(e){var t,i;const s=e.grammarType,r=this._mapKey(e);return this._grammarMap[s]?(this._grammars[s].push(e),C(r)||(this._grammarMap[s][r]?(t=this._warning)===null||t===void 0||t.call(this,r,e):this._grammarMap[s][r]=e)):(this._grammars.customized.push(e),C(r)||(this._grammarMap.customized[r]?(i=this._warning)===null||i===void 0||i.call(this,r,e):this._grammarMap.customized[r]=e)),this._size+=1,this}unrecord(e){const t=e.grammarType,i=this._mapKey(e);return this._grammarMap[t]?(this._grammars[t]=this._grammars[t].filter(s=>s!==e),C(i)||this._grammarMap[t][i]!==e||delete this._grammarMap[t][i]):(this._grammars.customized=this._grammars.customized.filter(s=>s!==e),C(i)||this._grammarMap.customized[i]!==e||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(e){var t;return(t=this._grammarMap.signal[e])!==null&&t!==void 0?t:null}getData(e){var t;return(t=this._grammarMap.data[e])!==null&&t!==void 0?t:null}getScale(e){var t;return(t=this._grammarMap.scale[e])!==null&&t!==void 0?t:null}getCoordinate(e){var t;return(t=this._grammarMap.coordinate[e])!==null&&t!==void 0?t:null}getMark(e){var t;return(t=this._grammarMap.mark[e])!==null&&t!==void 0?t:null}getCustomized(e){var t;return(t=this._grammarMap.customized[e])!==null&&t!==void 0?t:null}getGrammar(e){return this._grammarMap.data[e]?this._grammarMap.data[e]:this._grammarMap.signal[e]?this._grammarMap.signal[e]:this._grammarMap.scale[e]?this._grammarMap.scale[e]:this._grammarMap.coordinate[e]?this._grammarMap.coordinate[e]:this._grammarMap.mark[e]?this._grammarMap.mark[e]:this._grammarMap.customized[e]?this._grammarMap.customized[e]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(e){var t;Object.values((t=this._grammars)!==null&&t!==void 0?t:{}).forEach(i=>(i??[]).forEach(s=>{e.call(null,s)}))}find(e){let t=null;return this.traverse(i=>e.call(null,i)===!0&&(t=i,!0)),t}filter(e){const t=[];return this.traverse(i=>{e.call(null,i)===!0&&t.push(i)}),t}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class u8 extends lO{constructor(){super(...arguments),this._markNodes=[]}record(e){if(super.record(e),e.grammarType==="mark"){const t=e,i={mark:t,parent:null,children:[]};this._markNodes.forEach(s=>{const r=s.mark;r.markType===ne.group&&r.includesChild(t,!1)?(s.children.push(i),i.parent=s):t.markType===ne.group&&t.includesChild(r,!1)&&(i.children.push(s),s.parent=i)}),this._markNodes.push(i)}return this}unrecord(e){if(super.unrecord(e),e.grammarType==="mark"){const t=e,i=this._markNodes.find(s=>s.mark===t);this._markNodes.forEach(s=>{const r=s.mark;r.markType===ne.group&&r.includesChild(t,!1)?(s.children=s.children.filter(a=>a!==i),i.parent=null):t.markType===ne.group&&t.includesChild(r,!1)&&(i.children=i.children.filter(a=>a!==s),s.parent=null)}),this._markNodes=this._markNodes.filter(s=>s!==i)}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class c8{constructor(e){this._animations=[],this._additionalAnimateMarks=[],this.isEnabled=!0,this._onAnimationStart=t=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter(i=>{var s;return(s=i==null?void 0:i.animate)===null||s===void 0?void 0:s.isAnimating()}),this._animations.length===0&&this._additionalAnimateMarks.length===0&&this._view.emit(de.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:t.animationConfig,mark:t.mark})},this._onAnimationEnd=t=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter(i=>{var s;return(s=i==null?void 0:i.animate)===null||s===void 0?void 0:s.isAnimating()}),this._animations=this._animations.filter(i=>i.config!==t.animationConfig||i.mark!==t.mark),this._animations.length===0&&this._additionalAnimateMarks.length===0&&this._view.emit(de.ALL_ANIMATION_END,{})},this._view=e,this._view.addEventListener(de.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(de.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree(e=>{var t,i;e.animate&&((i=(t=e.animate).stop)===null||i===void 0||i.call(t))}),this._additionalAnimateMarks.forEach(e=>{var t,i;e.view&&e.animate&&((i=(t=e.animate).stop)===null||i===void 0||i.call(t))}),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree(e=>{var t,i;e.animate&&((i=(t=e.animate).pause)===null||i===void 0||i.call(t))}),this._additionalAnimateMarks.forEach(e=>{var t,i;e.view&&e.animate&&((i=(t=e.animate).pause)===null||i===void 0||i.call(t))}),this}resume(){return this._view.traverseMarkTree(e=>{var t,i;e.animate&&((i=(t=e.animate).resume)===null||i===void 0||i.call(t))}),this._additionalAnimateMarks.forEach(e=>{var t,i;e.view&&e.animate&&((i=(t=e.animate).resume)===null||i===void 0||i.call(t))}),this}enable(){return this.isEnabled=!0,this._view.traverseMarkTree(e=>{var t,i;e.animate&&((i=(t=e.animate).enable)===null||i===void 0||i.call(t))}),this}disable(){return this.isEnabled=!1,this._view.traverseMarkTree(e=>{var t,i;e.animate&&((i=(t=e.animate).disable)===null||i===void 0||i.call(t))}),this._additionalAnimateMarks.forEach(e=>{var t,i;e.view&&e.animate&&((i=(t=e.animate).stop)===null||i===void 0||i.call(t))}),this._additionalAnimateMarks=[],this}enableAnimationState(e){return this._view.traverseMarkTree(t=>{var i,s;t.animate&&((s=(i=t.animate).enableAnimationState)===null||s===void 0||s.call(i,e))}),this}disableAnimationState(e){return this._view.traverseMarkTree(t=>{var i,s;t.animate&&((s=(i=t.animate).disableAnimationState)===null||s===void 0||s.call(i,e))}),this}isAnimating(){return this._animations.length!==0||this._additionalAnimateMarks.some(e=>{var t;return((t=e==null?void 0:e.animate)===null||t===void 0?void 0:t.isAnimating())||!1})}animate(){return this.isEnabled?(this._view.traverseMarkTree(e=>{e.isUpdated&&e.animate&&e.animate.animate(),e.cleanExitElements(),e.isUpdated=!1},null,!0),this):this}animateAddition(e){return e.animate.animate(),this._additionalAnimateMarks.push(e),this}release(){this._additionalAnimateMarks=[],this._view.removeEventListener(de.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(de.ALL_ANIMATION_END,this._onAnimationEnd)}}class hO extends Mh{addGraphicItem(e,t){const i=e==null?void 0:e.text,s=(i==null?void 0:i.type)==="rich",r=gd(this,s?ne.richtext:ne.text,e);return s&&(e.textConfig=[]),super.addGraphicItem(e,t,r)}getAttributeTransforms(){var e;return((e=this.getGroupGraphicItem())===null||e===void 0?void 0:e.type)==="richtext"?oo.richtext:oo.text}release(){super.release()}}hO.markType=ne.text;const f8={label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#89909d",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},p8={title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},g8={style:{stroke:"#f1f2f5"}},_8={style:{stroke:"#f1f2f5"}},m8={layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},y8={title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},b8={title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},v8={start:{x:0,y:0},end:{x:0,y:0}},x8={start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},S8={center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},A8={center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},k8={center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},w8={layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},M8={size:{width:400,height:400},dataLabels:[]},T8={type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},C8={type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},P8={type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},E8={type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},R8={type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},O8={type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},B8={data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},L8={orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},I8={},D8={},F8={},z8={textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},j8={width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}},dO={axis:f8,circleAxis:p8,grid:g8,circleGrid:_8,discreteLegend:m8,colorLegend:y8,sizeLegend:b8,lineCrosshair:v8,rectCrosshair:x8,sectorCrosshair:S8,circleCrosshair:A8,polygonCrosshair:k8,slider:w8,dataLabel:M8,pointLabel:B8,lineLabel:C8,areaLabel:P8,rectLabel:E8,symbolLabel:R8,arcLabel:O8,lineDataLabel:T8,datazoom:L8,continuousPlayer:I8,discretePlayer:D8,tooltip:F8,title:z8,scrollbar:j8},uO=5,cO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},bi=Object.assign({},dO);bi.axis=Object.assign({},bi.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),bi.circleAxis=Object.assign({},bi.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),bi.grid=Object.assign({},bi.grid,{style:{stroke:"#404349"}}),bi.circleGrid=Object.assign({},bi.circleGrid,{style:{stroke:"#404349"}}),bi.rectLabel=Object.assign({},bi.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),bi.lineLabel=Object.assign({},bi.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),bi.symbolLabel=Object.assign({},bi.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),bi.title=Object.assign({},bi.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const H8={name:"dark",padding:uO,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:cO,components:bi},G8={name:"default",padding:uO,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:cO,components:dO};let $a=class nd{static registerTheme(e,t){e&&nd._themes.set(e,t)}static unregisterTheme(e){nd._themes.delete(e)}static getTheme(e){return nd._themes.get(e)}static getDefaultTheme(){return nd.getTheme("default")}};$a._themes=new Map,$a.registerTheme("default",G8),$a.registerTheme("dark",H8);class A0 extends Mh{constructor(e,t,i,s){super(e,ne.component,i),this._componentDatum={[zs]:0},this.componentType=t,this.spec.type="component",this.spec.componentType=t,this.mode=s,this._updateComponentEncoders()}configureComponent(e){return this.spec.componentConfig=e,this.commit(),this}addGraphicItem(e,t,i){const s=i??ee.createGraphicComponent(this.componentType,e,{mode:this.mode,skipDefault:this.spec.skipTheme});return this.emit(de.BEFORE_ADD_VRENDER_MARK),this.graphicParent.appendChild(s),this.emit(de.AFTER_ADD_VRENDER_MARK),s}join(e){return super.join(e,zs)}encodeState(e,t,i){return super.encodeState(e,t,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[zs]+=1}evaluateJoin(e){return this.spec.key=zs,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var e;return(e=this._encoders)!==null&&e!==void 0?e:{}}}var zh=function(n,e,t,i){return new(t||(t=Promise))(function(s,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?s(h.value):(d=h.value,d instanceof t?d:new t(function(u){u(d)})).then(a,o)}l((i=i.apply(n,e||[])).next())})};class vo extends po{static useRegisters(e){e.forEach(t=>{t()})}constructor(e={},t={}){super(),this._observer=null,this._onResize=Us((...i)=>{const s=this._getContainerSize();s&&this.resize(s.width,s.height)},100),this.delegateEvent=(i,s)=>{var r;const a=(r=i.target)===null||r===void 0?void 0:r[ao],o=jv(this,i,a,s,Ua);this.emit(s,o,a)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach(i=>{i.isDoingProgressive()&&i.evaluateProgressive()}),this.doPreProgressive()},this._config=t,this._options=Object.assign({mode:wY},e),this.initialize()}getGrammarById(e){return this.grammars.getGrammar(e)}getSignalById(e){return this.grammars.getSignal(e)}getDataById(e){return this.grammars.getData(e)}getScaleById(e){return this.grammars.getScale(e)}getCoordinateById(e){return this.grammars.getCoordinate(e)}getMarkById(e){return this.grammars.getMark(e)}getCustomizedById(e){return this.grammars.getCustomized(e)}getGrammarsByName(e){return this.grammars.filter(t=>t.name()===e)}getGrammarsByType(e){return this.grammars.filter(t=>t.grammarType===e)}getMarksByType(e){return this.grammars.getAllMarks().filter(t=>t.markType===e)}getMarksByName(e){return this.grammars.getAllMarks().filter(t=>t.name()===e)}getMarksBySelector(e){if(!e)return null;const t=N(e),i=[];return t.forEach(s=>{if(Yu(s))return void i.push(s);if(s[0]===NY){const a=this.getMarkById(s.slice(1));return void(a&&i.push(a))}const r=s[0]===VY?this.getMarksByName(s.slice(1)):hR(s)?this.getMarksByType(s):null;r&&r.length&&r.forEach(a=>{i.push(a)})}),i}updateSignal(e,t){ae(e)&&(e=this.getSignalById(e)),e.set(t),this.commit(e)}signal(e,t){const i=new FY(this);return arguments.length>=1&&i.value(e),arguments.length>=2&&i.update(t),this.grammars.record(i),this._dataflow.add(i),i}data(e){const t=new kY(this,e);return this.grammars.record(t),this._dataflow.add(t),t}scale(e){const t=ee.createGrammar("scale",this,e);return t&&(this.grammars.record(t),this._dataflow.add(t)),t}coordinate(e){const t=ee.createGrammar("coordinate",this,e);return t&&(this.grammars.record(t),this._dataflow.add(t)),t}mark(e,t,i){const s=ae(t)?this.getMarkById(t):t;let r;switch(e){case ne.group:r=new s8(this,s);break;case ne.glyph:r=new h8(this,i==null?void 0:i.glyphType,s);break;case ne.component:r=ee.hasComponent(i==null?void 0:i.componentType)?ee.createComponent(i==null?void 0:i.componentType,this,s,i==null?void 0:i.mode):new A0(this,i==null?void 0:i.componentType,s,i==null?void 0:i.mode);break;case ne.text:r=new hO(this,e,s);break;default:r=ee.hasMark(e)?ee.createMark(e,this,s):new Mh(this,e,s)}return this.grammars.record(r),this._dataflow.add(r),r}group(e){return this.mark(ne.group,e)}glyph(e,t){return this.mark(ne.glyph,t,{glyphType:e})}component(e,t,i="2d"){return this.mark(ne.component,t,{componentType:e,mode:i})}axis(e,t="2d"){return this.mark(ne.component,e,{componentType:ut.axis,mode:t})}grid(e,t="2d"){return this.mark(ne.component,e,{componentType:ut.grid,mode:t})}legend(e){return this.mark(ne.component,e,{componentType:ut.legend})}slider(e){return this.mark(ne.component,e,{componentType:ut.slider})}label(e){return this.mark(ne.component,e,{componentType:ut.label})}datazoom(e){return this.mark(ne.component,e,{componentType:ut.datazoom})}player(e){return this.mark(ne.component,e,{componentType:ut.player})}title(e){return this.mark(ne.component,e,{componentType:ut.title})}scrollbar(e){return this.mark(ne.component,e,{componentType:ut.scrollbar})}customized(e,t){const i=ee.createGrammar(e,this,t==null?void 0:t.type);if(i)return i.parse(t),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(e){return this.grammars.find(t=>t.uid===e.uid)||(this.grammars.record(e),this._dataflow.add(e),e.parse(e.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(e){const t=ae(e)?this.getGrammarById(e):e;return t&&this.grammars.find(i=>i.uid===t.uid)?(t.grammarType==="mark"&&t.prepareRelease(),this._cachedGrammars.record(t),this._dataflow.remove(t),this.grammars.unrecord(t),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse(e=>{e.grammarType==="signal"&&lM.includes(e.id())||e.grammarType==="mark"&&e.id()==="root"||this.removeGrammar(e)}),this}removeAllGraphicItems(){return this.traverseMarkTree(e=>{e.graphicItem&&(Op(e.graphicItem),e.elementMap.forEach(t=>{t.resetGraphicItem()}),e.graphicItem=null)}),this}parseSpec(e){var t,i,s,r,a,o;if(this.emit(de.BEFORE_PARSE_VIEW),this._spec=e,HY(e),e.theme?this.theme(e.theme):this.theme($a.getDefaultTheme()),e.width&&this.width(e.width),e.height&&this.height(e.height),this.padding((i=(t=e.padding)!==null&&t!==void 0?t:this._options.padding)!==null&&i!==void 0?i:this._theme.padding),!this.width()||!this.height()){const h=this._getContainerSize();h&&(this.updateSignal(Kr,h.width),this.updateSignal(qr,h.height))}!((s=e.signals)===null||s===void 0)&&s.length&&e.signals.forEach(h=>{this.signal().parse(h)}),!((r=e.data)===null||r===void 0)&&r.length&&e.data.forEach(h=>{this.data(null).parse(h)}),!((a=e.coordinates)===null||a===void 0)&&a.length&&e.coordinates.forEach(h=>{var d;(d=this.coordinate(h.type))===null||d===void 0||d.parse(h)}),!((o=e.scales)===null||o===void 0)&&o.length&&e.scales.forEach(h=>{var d;(d=this.scale(h.type))===null||d===void 0||d.parse(h)});const l=ee.getGrammars();return Object.keys(l).forEach(h=>{const{specKey:d}=l[h];e[d]&&e[d].length&&e[d].forEach(u=>{this.customized(h,u)})}),e.marks&&e.marks.length&&e.marks.forEach(h=>{this.parseMarkSpec(h)}),e.events&&e.events.length&&e.events.forEach(h=>{this.event(h)}),e.interactions&&e.interactions.length&&e.interactions.forEach(h=>{this.interaction(h.type,h)}),e.animation===!1?this.animate.disable():this.animate.enable(),this.emit(de.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=Bn.before,this}updateSpec(e){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(e)}parseBuiltIn(){jY(this._options,this._config,this.getCurrentTheme()).forEach(e=>{const t=this.signal().parse(e);e.value&&t.set(e.value)}),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseMarkSpec(e){var t;const i=e.type===ne.glyph?{glyphType:e.glyphType}:e.type===ne.component?{componentType:e.componentType,mode:e.mode}:null;this.mark(e.type,e.group,i).parse(e),(t=e.marks)===null||t===void 0||t.forEach(s=>{this.parseMarkSpec(s)})}theme(e){var t,i,s,r,a,o;ae(e)?this._theme=(t=$a.getTheme(e))!==null&&t!==void 0?t:$a.getDefaultTheme():this._theme=e;const{background:l,padding:h}=(i=this._spec)!==null&&i!==void 0?i:{};return this._theme?(this.background((s=l??this._options.background)!==null&&s!==void 0?s:this._theme.background),this.padding((r=h??this._options.padding)!==null&&r!==void 0?r:this._theme.padding),(o=(a=this.renderer.stage())===null||a===void 0?void 0:a.setTheme)===null||o===void 0||o.call(a,Object.assign({},this._theme.marks))):(this.background(l??this._options.background),this.padding(h??this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(e,t=!0){return zh(this,void 0,void 0,function*(){if(!this._isReleased){if(this.theme(e),this.grammars.getAllMarks().forEach(i=>{i.commit()}),t){if(yield this.evaluate(),this._isReleased)return;this.renderer.render(!0)}else yield this._dataflow.evaluate();return this}})}background(e){return arguments.length?(this._background=e,this.renderer.background(e),e):this._background}width(e){const t=this.getSignalById(Kr);return arguments.length?(this._options.width=e,this.updateSignal(t,e),e):t.output()}height(e){const t=this.getSignalById(qr);return arguments.length?(this._options.height=e,this.updateSignal(t,e),e):t.output()}viewWidth(e){const t=this.getSignalById(zl);if(arguments.length){const i=this.padding();return this.width(e+i.left+i.right),e}return t.output()}viewHeight(e){const t=this.getSignalById(jl);if(arguments.length){const i=this.padding();return this.height(e+i.top+i.bottom),e}return t.output()}padding(e){const t=this.getSignalById(Ln);if(arguments.length){const i=Zr(e);return this.updateSignal(t,i),i}return Zr(t.output())}autoFit(e){const t=this.getSignalById(xd);return arguments.length?(this.updateSignal(t,e),e):t.output()}getViewBox(){const e=this.getSignalById(x0);return e==null?void 0:e.output()}updateLayoutTag(){return this._layoutState=Bn.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const e={},t=[];this.traverseMarkTree(i=>{e[i.id()]=!0,i.group&&e[i.group.id()]||t.push(i),i.markType===ne.group&&i.updateLayoutChildren()},i=>i.needLayout()),this._layoutMarks=t}doLayout(){var e;const t=this._options.doLayout||oO;!((e=this._layoutMarks)===null||e===void 0)&&e.length&&(this.emit(de.BEFORE_DO_LAYOUT),t(this._layoutMarks,this._options,this),this.emit(de.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(de.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach(e=>{fy(e,"layoutChildren",t=>{t.handleLayoutEnd()},t=>t!==e)}),this.emit(de.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(de.BEFORE_MARK_RENDER_END),fy(this.rootMark,"children",e=>{e.handleRenderEnd()}),this.emit(de.AFTER_MARK_RENDER_END)}commit(e){return this._dataflow.commit(e),this}run(e){return this.evaluate(e),this}runSync(e){return this.evaluateSync(e),this}isRunning(){return this._running}runAsync(e){return zh(this,void 0,void 0,function*(){if(this._isReleased)return;for(;this._running&&(yield this._running,!this._isReleased););const t=()=>{this._running=null};return(this._running=this.evaluate(e)).then(t,t),this._running})}runNextTick(e){return zh(this,void 0,void 0,function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then(()=>this.runAsync(e).then(()=>{this._currentDataflow=null}).catch(t=>{this._currentDataflow=null,this.logger.error(t)}))),yield this._currentDataflow,this})}doRender(e){this.emit(de.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(e),this.handleRenderEnd()),this.emit(de.AFTER_DO_RENDER)}evaluate(e){var t,i,s,r;return zh(this,void 0,void 0,function*(){if(this._isReleased)return;const a=hM(e),o=this._cachedGrammars.size()>0;o&&(this.reuseCachedGrammars(a),this.detachCachedGrammar());const l=this._resizeRenderer(),h=this._dataflow.hasCommitted();if(!(o||h||this._layoutState||l))return this;if(this.clearProgressive(),(t=this.renderer)===null||t===void 0||t.preventRender(!0),yield this._dataflow.evaluate(),!this._isReleased){if(this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState){if(this._layoutState=Bn.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=Bn.reevaluate,yield this._dataflow.evaluate(),this._isReleased))return;this._layoutState=Bn.after,!((i=this._layoutMarks)===null||i===void 0)&&i.length&&this.handleLayoutEnd()}return(s=this.renderer)===null||s===void 0||s.preventRender(!1),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),(r=this._willMorphMarks)===null||r===void 0||r.forEach(d=>{this._morph.morph(d.prev,d.next,a)}),this._willMorphMarks=null,this.releaseCachedGrammars(a),this.doPreProgressive(),this}})}evaluateSync(e){var t,i;const s=hM(e),r=this._cachedGrammars.size()>0;r&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const a=this._resizeRenderer(),o=this._dataflow.hasCommitted();return r||o||this._layoutState||a?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=Bn.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=Bn.reevaluate,this._dataflow.evaluateSync()),this._layoutState=Bn.after,!((t=this._layoutMarks)===null||t===void 0)&&t.length&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),(i=this._willMorphMarks)===null||i===void 0||i.forEach(l=>{this._morph.morph(l.prev,l.next,s)}),this._willMorphMarks=null,this.releaseCachedGrammars(s),this.doPreProgressive(),this):this}reuseCachedGrammars(e){if(this._willMorphMarks||(this._willMorphMarks=[]),e.reuse){const t=i=>{i.next.reuse(i.prev),i.prev.detachAll(),i.prev.clear(),this._cachedGrammars.unrecord(i.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter(i=>!lM.includes(i.id()))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter(t=>t.id()!=="root"),e).update.forEach(t=>{const i=t.prev.length===1&&t.next.length===1&&t.prev[0].markType===t.next[0].markType,s=t.prev.every(r=>r.getMorphConfig().morph)&&t.next.every(r=>r.getMorphConfig().morph);i&&e.reuse?(t.next[0].reuse(t.prev[0]),t.prev[0].detachAll(),t.prev[0].clear(),this._cachedGrammars.unrecord(t.prev[0])):(e.morph&&s||e.morphAll)&&this._willMorphMarks.push({prev:t.prev,next:t.next})})}detachCachedGrammar(){this._cachedGrammars.traverse(e=>{var t,i;if(e.detachAll(),e.grammarType==="mark"){const s=e;(i=(t=s.group)===null||t===void 0?void 0:t.removeChild)===null||i===void 0||i.call(t,s)}})}releaseCachedGrammars(e){this._cachedGrammars.traverse(s=>{s.grammarType!=="mark"&&s.release()});const t=this._cachedGrammars.getAllMarkNodes();t.forEach(s=>{s.mark.animate.stop(),e.enableExitAnimation&&this.animate.animateAddition(s.mark)});const i=s=>{if(s.mark.view&&s.mark.animate.getAnimatorCount()===0&&(!s.children||s.children.length===0)){s.mark.release();const r=s.parent;r&&(s.parent.children=s.parent.children.filter(a=>a!==s),s.parent=null,i(r))}};t.forEach(s=>{const r=s.mark;r.animate.getAnimatorCount()===0?i(s):r.addEventListener("animationEnd",()=>{r.animate.getAnimatorCount()===0&&i(s)})}),this._cachedGrammars.clear()}runAfter(e){return this._dataflow.runAfter(()=>{e.call(null,this)}),this}runBefore(e){return this._dataflow.runBefore(()=>{e.call(null,this)}),this}getImageBuffer(){var e,t;if(this._options.mode!=="node")return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=(t=(e=this.renderer)===null||e===void 0?void 0:e.stage)===null||t===void 0?void 0:t.call(e);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(e,t,i){return fy(this.rootMark,"children",e,t,i),this}_bindResizeEvent(){var e,t,i,s,r,a;if(this.autoFit()){const o=(r=(s=(i=(t=(e=this.renderer)===null||e===void 0?void 0:e.stage)===null||t===void 0?void 0:t.call(e))===null||i===void 0?void 0:i.window)===null||s===void 0?void 0:s.getContainer)===null||r===void 0?void 0:r.call(s);if(o){const l=window.ResizeObserver;this._observer=new l(this._onResize),(a=this._observer)===null||a===void 0||a.observe(o)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var e,t,i,s,r,a,o,l,h,d,u;const c=(r=(s=(i=(t=(e=this.renderer)===null||e===void 0?void 0:e.stage)===null||t===void 0?void 0:t.call(e))===null||i===void 0?void 0:i.window)===null||s===void 0?void 0:s.getContainer)===null||r===void 0?void 0:r.call(s);if(c){const{width:f,height:p}=Gy(c);return{width:(l=(o=(a=this._spec)===null||a===void 0?void 0:a.width)!==null&&o!==void 0?o:this._options.width)!==null&&l!==void 0?l:f,height:(u=(d=(h=this._spec)===null||h===void 0?void 0:h.height)!==null&&d!==void 0?d:this._options.height)!==null&&u!==void 0?u:p}}return null}resize(e,t,i=!0){return zh(this,void 0,void 0,function*(){let s=!1;return e!==this.width()&&(s=!0,this.updateSignal(Kr,e)),t!==this.height()&&(s=!0,this.updateSignal(qr,t)),s&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this})}_resizeRenderer(){const e=this.width(),t=this.height();return!!this.renderer.shouldResize(e,t)&&(this.renderer.resize(e,t),this.emit("resize",{},{width:e,height:t}),!0)}bindEvents(e){if(this._eventConfig.disable)return;const{type:t,filter:i,callback:s,throttle:r,debounce:a,consume:o,target:l,dependency:h}=e,d=UY(t);if(!d)return;const{source:u,type:c}=d,f=GY(d),p=(Array.isArray(l)&&l.length?l.map(m=>({signal:this.getSignalById(m.target),callback:m.callback})):[{signal:ae(l)?this.getSignalById(l):null,callback:s}]).filter(m=>m.signal||m.callback),g=d0(h,this),_=WY((m,y)=>{const b=u===Ua&&CY(this._eventConfig,c)||o&&(m.cancelable===void 0||m.cancelable);u===Za&&(m=jv(this,m,y,c,Za));let v=!1;if((!i||i(m))&&(!f||f(y))&&p.length){const x=g.reduce((S,A)=>(S[A.id()]=A.output(),S),{});p.forEach(S=>{S.callback&&S.signal?S.signal.set(S.callback(m,x))&&(this.commit(S.signal),v=!0):S.callback?S.callback(m,x):(this.commit(S.signal),v=!0)})}b&&m.preventDefault(),o&&m.stopPropagation(),v&&this.runAsync()},{throttle:r,debounce:a});if(u===Ua){if(PY(this._eventConfig,Ua,c))return this.addEventListener(c,_,MY),()=>{this.removeEventListener(c,_)}}else if(u===Za)return Fe.addEventListener(c,_),this._eventListeners.push({type:c,source:Fe,handler:_}),()=>{Fe.removeEventListener(c,_);const m=this._eventListeners.findIndex(y=>y.type===c&&y.source===Fe&&y.handler===_);m>=0&&this._eventListeners.splice(m,1)}}event(e){if("between"in e){const[t,i]=e.between,s=`${t.type}-${e.type}-${i.type}`;let r;this.bindEvents(Object.assign({},t,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[s]){const a=this.bindEvents(e);this._eventCache[s]=a}r||(r=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[s]&&(this._eventCache[s](),this._eventCache[s]=null)}})))}}))}else"merge"in e?e.merge.forEach(t=>{const i=Object.assign({},e);ae(t)?i.type=t:He(t)&&Object.assign(i,t),i.debounce=50,this.bindEvents(i)}):this.bindEvents(e)}interaction(e,t){const i=ee.createInteraction(e,this,t);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(e,t){if(this._boundInteractions){const i=this._boundInteractions.filter(s=>{var r;return C(t)?ae(e)?s.type===e:e?s===e:void 0:((r=s.options)===null||r===void 0?void 0:r.id)===t});i.length&&i.forEach(s=>{s.unbind()})}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach(e=>{e.unbind()}),this._boundInteractions=null),this}initEvent(){const e=this.renderer.stage();e&&e.on("*",this.delegateEvent)}addEventListener(e,t,i){let s=t;return i&&i.trap===!1||(s=t,s.raw=t),i&&i.target&&(s.target=i.target),this.on(e,s),this}removeEventListener(e,t){return t?this.off(e,t):this.off(e),this}initializeRenderer(){const e=this._options.width,t=this._options.height;this.renderer=new OY(this),this.renderer.initialize(e,t,this._options,this._eventConfig).background(this._background)}initialize(){var e;this.grammars=new lO(t=>t.id(),(t,i)=>this.logger.warn(`Grammar id '${t}' has been occupied`,i)),this._cachedGrammars=new u8(t=>t.id()),this._options.logger&&De.setInstance(this._options.logger),this.logger=De.getInstance((e=this._options.logLevel)!==null&&e!==void 0?e:0),this._dataflow=new RY,this.animate=new c8(this),this._morph=new d8,this._options.hooks&&(Object.keys(this._options.hooks).forEach(t=>{this.on(t,this._options.hooks[t])}),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._eventListeners=[],this._eventConfig=TY(this._options.eventConfig),this._theme=this._options.disableTheme?null:$a.getDefaultTheme(),this.parseBuiltIn(),$Y(this._options),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=Bn.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const e=[];return this.traverseMarkTree(t=>{e.push(t)},t=>t.markType!==ne.group&&t.isProgressive()),e.length?(this._progressiveMarks=e,this.renderer&&this.renderer.combineIncrementalLayers(),e):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some(e=>e.isDoingProgressive())){const e=Fe.getRequestAnimationFrame();this._progressiveRafId=e(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&Fe.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach(e=>{e.clearProgressive()}),this._progressiveMarks=null)}release(){var e,t,i;this._isReleased=!0,this._unBindResizeEvent(),this.clearProgressive(),ee.unregisterRuntimeTransforms(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,(t=(e=this.renderer)===null||e===void 0?void 0:e.release)===null||t===void 0||t.call(e),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),(i=this._eventListeners)===null||i===void 0||i.forEach(s=>{s.source.removeEventListener(s.type,s.handler)}),this._eventListeners=null}}const fO=()=>{Pi(),c0(),ee.registerGraphic(ne.arc,Yx)},W8=()=>{Pi(),n4(),ee.registerGraphic(ne.arc3d,CE)},V8=()=>{Pi(),a4(),ee.registerGraphic(ne.pyramid3d,EE)},N8=()=>{Pi(),pR(),ee.registerGraphic(ne.area,TE)},U8=()=>{Pi(),zt(),ee.registerGraphic(ne.group,Fx)},$8=()=>{Pi(),gR(),ee.registerGraphic(ne.image,$x)},Y8=()=>{Pi(),Ca(),ee.registerGraphic(ne.line,Ux)},pO=()=>{Pi(),Xu(),ee.registerGraphic(ne.path,ME)},k0=()=>{Pi(),kr(),ee.registerGraphic(ne.rect,eh)},X8=()=>{Pi(),o4(),ee.registerGraphic(ne.rect3d,AE)},w0=()=>{Pi(),Ca(),ee.registerGraphic(ne.rule,Ux)},gO=()=>{Pi(),xs(),ee.registerGraphic(ne.symbol,M_)},_O=()=>{Pi(),Ea(),Pa(),ee.registerGraphic(ne.text,no)},K8=()=>{Pi(),L_(),ee.registerGraphic(ne.polygon,PE)},q8=()=>{Pi(),Pa(),ee.registerGraphic(ne.richtext,wE)},Z8=()=>{Pi(),xs(),ee.registerGraphic(ne.cell,M_)},Z_=()=>{Pi(),r4(),ee.registerGraphic(ne.glyph,kE)},mO=n=>(e,t,i)=>{var s,r,a;const o=(a=(s=e.getGraphicAttribute("direction",!1))!==null&&s!==void 0?s:(r=e.mark.getGlyphConfig())===null||r===void 0?void 0:r.direction)!==null&&a!==void 0?a:"vertical",l=n(e,o,t);if(!j(l))return{};const h=e.getGraphicAttribute("x",!1),d=e.getGraphicAttribute("y",!1),u=e.getGraphicAttribute("min",!1),c=e.getGraphicAttribute("max",!1),f=e.getGraphicAttribute("q1",!1),p=e.getGraphicAttribute("q3",!1),g=e.getGraphicAttribute("median",!1),_={from:{x:h,y:d},to:{x:h,y:d}};return j(u)&&(_.from.min=l,_.to.min=u),j(c)&&(_.from.max=l,_.to.max=c),j(f)&&(_.from.q1=l,_.to.q1=f),j(p)&&(_.from.q3=l,_.to.q3=p),j(g)&&(_.from.median=l,_.to.median=g),_},yO=n=>(e,t,i)=>{var s,r,a;const o=(a=(s=e.getGraphicAttribute("direction",!1))!==null&&s!==void 0?s:(r=e.mark.getGlyphConfig())===null||r===void 0?void 0:r.direction)!==null&&a!==void 0?a:"vertical",l=n(e,o,t);if(!j(l))return{};const h=e.getGraphicAttribute("x",!0),d=e.getGraphicAttribute("y",!0),u=e.getGraphicAttribute("min",!0),c=e.getGraphicAttribute("max",!0),f=e.getGraphicAttribute("q1",!0),p=e.getGraphicAttribute("q3",!0),g=e.getGraphicAttribute("median",!0),_={from:{x:h,y:d},to:{x:h,y:d}};return j(u)&&(_.to.min=l,_.from.min=u),j(c)&&(_.to.max=l,_.from.max=c),j(f)&&(_.to.q1=l,_.from.q1=f),j(p)&&(_.to.q3=l,_.from.q3=p),j(g)&&(_.to.median=l,_.from.median=g),_},bO=(n,e,t)=>{var i,s,r,a,o,l,h,d,u,c,f,p;if(t&&j(t.center))return t.center;let g,_,m,y,b;if(Ai(e)){g=(s=(i=n.getGraphicAttribute("points",!1,"median"))===null||i===void 0?void 0:i[0])===null||s===void 0?void 0:s.x,_=(a=(r=n.getGraphicAttribute("points",!1,"max"))===null||r===void 0?void 0:r[0])===null||a===void 0?void 0:a.x,m=(l=(o=n.getGraphicAttribute("points",!1,"min"))===null||o===void 0?void 0:o[0])===null||l===void 0?void 0:l.x;const v=n.getGraphicAttribute("width",!1,"box"),x=n.getGraphicAttribute("x",!1,"box");y=x,b=x+v}else{g=(d=(h=n.getGraphicAttribute("points",!1,"median"))===null||h===void 0?void 0:h[0])===null||d===void 0?void 0:d.y,_=(c=(u=n.getGraphicAttribute("points",!1,"max"))===null||u===void 0?void 0:u[0])===null||c===void 0?void 0:c.y,m=(p=(f=n.getGraphicAttribute("points",!1,"min"))===null||f===void 0?void 0:f[0])===null||p===void 0?void 0:p.y;const v=n.getGraphicAttribute("height",!1,"box"),x=n.getGraphicAttribute("y",!1,"box");y=x,b=x+v}return j(g)?g:j(y)&&j(b)?(y+b)/2:j(_)&&j(m)?(_+m)/2:j(m)?m:j(_)?_:NaN},J8=(n,e,t,i)=>{var s,r,a,o,l,h,d,u;const c={shaft:{},box:{},max:{},min:{},median:{}},f=(s=n.x)!==null&&s!==void 0?s:t.getGraphicAttribute("x",!1),p=(r=n.y)!==null&&r!==void 0?r:t.getGraphicAttribute("y",!1),g=(a=n.width)!==null&&a!==void 0?a:t.getGraphicAttribute("width",!1),_=(o=n.height)!==null&&o!==void 0?o:t.getGraphicAttribute("height",!1),m=(l=n.boxWidth)!==null&&l!==void 0?l:t.getGraphicAttribute("boxWidth",!1),y=(h=n.boxHeight)!==null&&h!==void 0?h:t.getGraphicAttribute("boxHeight",!1),b=(d=n.ruleWidth)!==null&&d!==void 0?d:t.getGraphicAttribute("ruleWidth",!1),v=(u=n.ruleHeight)!==null&&u!==void 0?u:t.getGraphicAttribute("ruleHeight",!1);return i&&Ai(i.direction)?(j(y)?(Object.assign(c.box,{y:p-y/2,y1:p+y/2}),Object.assign(c.median,{y:p-y/2,y1:p+y/2})):(Object.assign(c.box,{y:p-_/2,y1:p+_/2}),Object.assign(c.median,{y:p-_/2,y1:p+_/2})),j(v)?(Object.assign(c.max,{y:p-v/2,y1:p+v/2}),Object.assign(c.min,{y:p-v/2,y1:p+v/2})):(Object.assign(c.max,{y:p-_/2,y1:p+_/2}),Object.assign(c.min,{y:p-_/2,y1:p+_/2}))):(j(m)?(Object.assign(c.box,{x:f-m/2,x1:f+m/2}),Object.assign(c.median,{x:f-m/2,x1:f+m/2})):(Object.assign(c.box,{x:f-g/2,x1:f+g/2}),Object.assign(c.median,{x:f-g/2,x1:f+g/2})),j(b)?(Object.assign(c.max,{x:f-b/2,x1:f+b/2}),Object.assign(c.min,{x:f-b/2,x1:f+b/2})):(Object.assign(c.max,{x:f-g/2,x1:f+g/2}),Object.assign(c.min,{x:f-g/2,x1:f+g/2}))),c},Q8=mO(bO),e6=yO(bO);function t6(){ee.registerGlyph("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(J8).registerChannelEncoder("x",(n,e,t,i,s,r)=>r&&Ai(r.direction)?null:{shaft:{x:e,x1:e}}).registerChannelEncoder("y",(n,e,t,i,s,r)=>r&&Ai(r.direction)?{shaft:{y:e,y1:e}}:null).registerChannelEncoder("q1",(n,e,t,i,s,r)=>r&&Ai(r.direction)?{box:{x:e}}:{box:{y:e}}).registerChannelEncoder("q3",(n,e,t,i,s,r)=>r&&Ai(r.direction)?{box:{x1:e}}:{box:{y1:e}}).registerChannelEncoder("min",(n,e,t,i,s,r)=>r&&Ai(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}}).registerChannelEncoder("max",(n,e,t,i,s,r)=>r&&Ai(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}}).registerChannelEncoder("median",(n,e,t,i,s,r)=>r&&Ai(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}}).registerChannelEncoder("angle",(n,e,t,i,s,r)=>{var a;const o=r&&Ai(r.direction)?[(t.min+t.max)/2,t.y]:[t.x,(t.min+t.max)/2],l=(a=t.anchor)!==null&&a!==void 0?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}}).registerDefaultEncoder(()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}})),ee.registerAnimationType("boxplotScaleIn",Q8),ee.registerAnimationType("boxplotScaleOut",e6),Z_(),k0(),w0()}const vO=(n,e,t)=>{var i,s,r,a;if(j(t==null?void 0:t.center))return t.center;let o,l,h,d,u;if(Ai(e)){o=(s=(i=n.getGraphicAttribute("points",!1,"median"))===null||i===void 0?void 0:i[0])===null||s===void 0?void 0:s.x;const c=n.getGraphicAttribute("width",!1,"minMaxBox"),f=n.getGraphicAttribute("x",!1,"minMaxBox");h=f,l=f+c;const p=n.getGraphicAttribute("width",!1,"q1q3Box"),g=n.getGraphicAttribute("x",!1,"q1q3Box");d=g,u=g+p}else{o=(a=(r=n.getGraphicAttribute("points",!1,"median"))===null||r===void 0?void 0:r[0])===null||a===void 0?void 0:a.y;const c=n.getGraphicAttribute("height",!1,"minMaxBox"),f=n.getGraphicAttribute("y",!1,"minMaxBox");h=f,l=f+c;const p=n.getGraphicAttribute("height",!1,"q1q3Box"),g=n.getGraphicAttribute("y",!1,"q1q3Box");d=g,u=g+p}return j(o)?o:j(d)&&j(u)?(d+u)/2:j(l)&&j(h)?(l+h)/2:j(h)?h:j(l)?l:NaN},i6=(n,e,t,i)=>{var s,r,a,o,l,h,d,u;const c={minMaxBox:{},q1q3Box:{},median:{}},f=(s=n.x)!==null&&s!==void 0?s:t.getGraphicAttribute("x",!1),p=(r=n.y)!==null&&r!==void 0?r:t.getGraphicAttribute("y",!1),g=(a=n.width)!==null&&a!==void 0?a:t.getGraphicAttribute("width",!1),_=(o=n.minMaxWidth)!==null&&o!==void 0?o:t.getGraphicAttribute("minMaxWidth",!1),m=(l=n.q1q3Width)!==null&&l!==void 0?l:t.getGraphicAttribute("q1q3Width",!1),y=(h=n.height)!==null&&h!==void 0?h:t.getGraphicAttribute("height",!1),b=(d=n.minMaxHeight)!==null&&d!==void 0?d:t.getGraphicAttribute("minMaxHeight",!1),v=(u=n.q1q3Height)!==null&&u!==void 0?u:t.getGraphicAttribute("q1q3Height",!1);return i&&Ai(i.direction)?(j(b)?Object.assign(c.minMaxBox,{y:p-b/2,y1:p+b/2}):Object.assign(c.minMaxBox,{y:p-y/2,y1:p+y/2}),j(v)?(Object.assign(c.q1q3Box,{y:p-v/2,y1:p+v/2}),Object.assign(c.median,{y:p-v/2,y1:p+v/2})):(Object.assign(c.q1q3Box,{y:p-y/2,y1:p+y/2}),Object.assign(c.median,{y:p-y/2,y1:p+y/2}))):(j(_)?Object.assign(c.minMaxBox,{x:f-_/2,x1:f+_/2}):Object.assign(c.minMaxBox,{x:f-g/2,x1:f+g/2}),j(m)?(Object.assign(c.q1q3Box,{x:f-m/2,x1:f+m/2}),Object.assign(c.median,{x:f-m/2,x1:f+m/2})):(Object.assign(c.q1q3Box,{x:f-g/2,x1:f+g/2}),Object.assign(c.median,{x:f-g/2,x1:f+g/2}))),c},n6=mO(vO),s6=yO(vO);function r6(){ee.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(i6).registerChannelEncoder("q1",(n,e,t,i,s,r)=>r&&Ai(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}}).registerChannelEncoder("q3",(n,e,t,i,s,r)=>r&&Ai(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}}).registerChannelEncoder("min",(n,e,t,i,s,r)=>r&&Ai(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}}).registerChannelEncoder("max",(n,e,t,i,s,r)=>r&&Ai(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}}).registerChannelEncoder("median",(n,e,t,i,s,r)=>r&&Ai(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}}).registerChannelEncoder("angle",(n,e,t,i,s,r)=>{var a;const o=(a=t.anchor)!==null&&a!==void 0?a:[t.x,(t.min+t.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}}).registerChannelEncoder("lineWidth",(n,e,t,i,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}})).registerChannelEncoder("minMaxFillOpacity",(n,e,t,i,s,r)=>({minMaxBox:{fillOpacity:e}})).registerChannelEncoder("stroke",(n,e,t,i,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})).registerDefaultEncoder(()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}})),ee.registerAnimationType("barBoxplotScaleIn",n6),ee.registerAnimationType("barBoxplotScaleOut",s6),Z_(),k0(),w0()}const a6=()=>{ee.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder((n,e,t,i)=>{var s;const r=Math.max(0,Math.min(n.ripple,1)),a=(s=n.size)!==null&&s!==void 0?s:t.getGraphicAttribute("size"),o=.5*a;return{ripple0:{size:a+o*r,fillOpacity:.75-.25*r},ripple1:{size:a+o*(1+r),fillOpacity:.5-.25*r},ripple2:{size:a+o*(2+r),fillOpacity:.25-.25*r}}}).registerDefaultEncoder(()=>({ripple0:{fillOpacity:.75},ripple1:{fillOpacity:.5},ripple2:{fillOpacity:.25}})),Z_(),gO()},o6=(n,e)=>{var t;const i=(t=n.curvature)!==null&&t!==void 0?t:.5,s=typeof e=="number"?n.thickness*e:n.thickness;let r=n.x0,a=n.x1,o=n.y0,l=n.y1,h=r+i*(a-r),d=a+i*(r-a),u=m=>m;n.round!==!1&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),d=Math.round(d),u=Math.round),n.pathType==="line"||n.pathType,n.align==="center"?(o=u(n.y0-s/2),l=u(n.y1-s/2)):n.align==="end"?(o=u(n.y0+n.thickness/2-s),l=u(n.y1+n.thickness/2-s)):(o=u(n.y0-n.thickness/2),l=u(n.y1-n.thickness/2));const c=u(o+s),f=u(l+s),p=Math.abs(a-r)>1e-6,g=n.endArrow&&p?`L${a},${u(l-s/2)}L${u(a+s)},${u((l+f)/2)}L${a},${u(f+s/2)}`:"",_=n.startArrow&&p?`L${r},${u(c+s/2)}L${u(r-s)},${u((o+c)/2)}L${r},${u(o-s/2)}`:"";return n.pathType==="line"?`M${r},${o}L${a},${l}${g}L${a},${f}L${r},${c}${_}Z`:n.pathType==="polyline"?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}
  42. ${g}L${a},${f}L${h},${f}L${h},${c}L${r},${c}${_}Z`:`M${r},${o}C${h},${o},${d},${l},${a},${l}
  43. ${g}L${a},${f}C${d},${f},${h},${c},${r},${c}${_}Z`},l6=(n,e)=>{var t;const i=(t=n.curvature)!==null&&t!==void 0?t:.5,s=typeof e=="number"?n.thickness*e:n.thickness;let r=n.y0,a=n.y1,o=n.x0,l=n.x1,h=r+i*(a-r),d=a+i*(r-a),u=m=>m;n.round!==!1&&(u=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),d=Math.round(d)),n.pathType==="line"||n.pathType,n.align==="center"?(o=u(n.x0-s/2),l=u(n.x1-s/2)):n.align==="end"?(o=u(n.x0+n.thickness/2-s),l=u(n.x1+n.thickness/2-s)):(o=u(n.x0-n.thickness/2),l=u(n.x1-n.thickness/2));const c=u(o+s),f=u(l+s),p=Math.abs(a-r)>1e-6,g=n.endArrow&&p?`L${u(l-s/2)},${a}L${u((l+f)/2)},${u(a+s)}L${u(f+s/2)},${a}`:"",_=n.startArrow&&p?`L${u(c+s/2)},${r}L${u((c+o)/2)},${u(r-s)}L${u(o-s/2)},${r}`:"";return n.pathType==="line"?`M${o},${r}L${l},${a}${g}L${f},${a}L${c},${r}${_}Z`:n.pathType==="polyline"?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}
  44. ${g}L${f},${a}L${f},${h}L${c},${h}L${c},${r}${_}Z`:`M${o},${r}C${o},${h},${l},${d},${l},${a}
  45. ${g}L${f},${a}C${f},${d},${c},${h},${c},${r}${_}Z`},h6=(n,e,t,i)=>{var s;const r=(s=n.direction)!==null&&s!==void 0?s:i==null?void 0:i.direction,a=["vertical","TB","BT"].includes(r)?l6:o6,o=typeof n.ratio=="number"&&n.ratio>=0&&n.ratio<=1,l=Object.keys(n);return["x0","y0","x1","y1"].every(h=>l.includes(h))?{back:{path:o?a(n,1):""},front:{path:a(n,o?n.ratio:1)}}:{}},d6=(n,e,t)=>{const i={x0:n.getGraphicAttribute("x0",!1),x1:n.getGraphicAttribute("x1",!1),y0:n.getGraphicAttribute("y0",!1),y1:n.getGraphicAttribute("y1",!1),thickness:n.getGraphicAttribute("thickness",!1),round:n.getGraphicAttribute("round",!1),align:n.getGraphicAttribute("align",!1),pathType:n.getGraphicAttribute("pathType",!1),endArrow:n.getGraphicAttribute("endArrow",!1),startArrow:n.getGraphicAttribute("startArrow",!1)};return Object.keys(i).forEach(s=>{C(i[s])&&delete i[s]}),{from:Object.assign({},i,{x1:i.x0,y1:i.y0}),to:i}},u6=(n,e,t)=>{const i={x0:n.getGraphicAttribute("x0",!0),x1:n.getGraphicAttribute("x1",!0),y0:n.getGraphicAttribute("y0",!0),y1:n.getGraphicAttribute("y1",!0),thickness:n.getGraphicAttribute("thickness",!0),round:n.getGraphicAttribute("round",!0),align:n.getGraphicAttribute("align",!0),pathType:n.getGraphicAttribute("pathType",!0),endArrow:n.getGraphicAttribute("endArrow",!0),startArrow:n.getGraphicAttribute("startArrow",!0)};return Object.keys(i).forEach(s=>{C(i[s])&&delete i[s]}),{from:i,to:Object.assign({},i,{x1:i.x0,y1:i.y0})}},c6=(n,e,t)=>{const i={thickness:n.getGraphicAttribute("thickness",!1),round:n.getGraphicAttribute("round",!1),align:n.getGraphicAttribute("align",!1),pathType:n.getGraphicAttribute("pathType",!1),endArrow:n.getGraphicAttribute("endArrow",!1),startArrow:n.getGraphicAttribute("startArrow",!1)};return Object.keys(i).forEach(s=>{C(i[s])&&delete i[s]}),{from:Object.assign(Object.assign({x0:n.getGraphicAttribute("x0",!0),x1:n.getGraphicAttribute("x1",!0),y0:n.getGraphicAttribute("y0",!0),y1:n.getGraphicAttribute("y1",!0)},i),i),to:Object.assign({x0:n.getGraphicAttribute("x0",!1),x1:n.getGraphicAttribute("x1",!1),y0:n.getGraphicAttribute("y0",!1),y1:n.getGraphicAttribute("y1",!1)},i)}},f6=()=>{ee.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(h6).registerChannelEncoder("backgroundStyle",(n,e)=>({back:e})).registerDefaultEncoder(()=>({back:{zIndex:0},front:{zIndex:1}})),ee.registerAnimationType("linkPathGrowIn",d6),ee.registerAnimationType("linkPathGrowOut",u6),ee.registerAnimationType("linkPathUpdate",c6),Z_(),pO()};class xO extends A0{parseAddition(e){return super.parseAddition(e),this.scale(e.scale),this}scale(e){if(this.spec.scale){const i=ae(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(i),this.spec.scale=void 0}const t=ae(e)?this.view.getScaleById(e):e;return this.spec.scale=t,this.attach(t),this._updateComponentEncoders(),this.commit(),this}getScale(){return ae(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const p6=(n,e,t,i)=>{var s,r,a,o;const l=(r=(s=e==null?void 0:e.components)===null||s===void 0?void 0:s.axis)!==null&&r!==void 0?r:{};if(!n)return re({},l,t??{});const h=[((o=(a=n.tickData)===null||a===void 0?void 0:a.call(n,i))!==null&&o!==void 0?o:[]).map(d=>({id:d.index,label:d.tick,value:d.value,rawValue:d.tick}))];return re({},l,{items:h},t??{})},g6=(n,e,t,i)=>{var s,r,a,o;const l=(r=(s=e==null?void 0:e.components)===null||s===void 0?void 0:s.circleAxis)!==null&&r!==void 0?r:{};if(!n)return re({},l,t??{});const h=[((o=(a=n.tickData)===null||a===void 0?void 0:a.call(n,i))!==null&&o!==void 0?o:[]).map(d=>({id:d.index,label:d.tick,value:d.value,rawValue:d.tick}))];return re({},l,{items:h},t??{})},SO=(n,e,t,i,s,r)=>{var a;const o=n.getCoordinateAxisPosition();s&&s.position==="auto"&&(s.position=t?"content":o);const l=n.getCoordinateAxisPoints(i);if(l){const u={start:l[0],end:l[1],verticalFactor:(o==="top"||o==="left"?-1:1)*(t?-1:1)*(!((a=n.getSpec().range)===null||a===void 0)&&a.reversed?-1:1)};if(r&&e.type==="polar"){const c=e.angle();u.center=e.origin(),u.startAngle=c[0],u.endAngle=c[1]}return u}const h=e.radius(),d=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:t,startAngle:d[0],endAngle:d[1]}};class AO extends xO{constructor(e,t,i){super(e,ut.axis,t),this.spec.componentType=ut.axis,this.mode=i}parseAddition(e){return super.parseAddition(e),this.axisType(e.axisType),this.tickCount(e.tickCount),this.inside(e.inside),this.baseValue(e.baseValue),this}scale(e){return super.scale(e),this._axisComponentType=null,this}axisType(e){return this.spec.axisType=e,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(e,t){const i=re({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},e),s=ee.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,t,s)}tickCount(e){const t=ae(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return t&&t.tickCount(e),this.setFunctionSpec(e,"tickCount")}inside(e){return this.setFunctionSpec(e,"inside")}baseValue(e){return this.setFunctionSpec(e,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const e=ae(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,t=Object.assign({update:{}},this.spec.encode),i=Object.keys(t).reduce((s,r)=>{const a=t[r];return a&&(s[r]={callback:(o,l,h)=>{var d,u;const c=this.spec.skipTheme?null:this.view.getCurrentTheme();let f=qa(a,o,l,h);const p=Ot(this.spec.inside,h,o,l),g=Ot(this.spec.baseValue,h,o,l),_=(d=e==null?void 0:e.getCoordinate)===null||d===void 0?void 0:d.call(e);_&&(f=Object.assign(SO(e,_,p,g,this.spec.layout),f));const m=(u=e==null?void 0:e.getScale)===null||u===void 0?void 0:u.call(e),y=Ot(this.spec.tickCount,h,o,l);switch(this._getAxisComponentType()){case Fs.lineAxis:return p6(m,c,f,y);case Fs.circleAxis:return g6(m,c,f,y)}return f}}),s},{});this._encoders=i}_getAxisComponentType(){var e;if(this._axisComponentType)return this._axisComponentType;let t=this.spec.axisType;if(C(t)){const i=ae(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;t=!((e=i==null?void 0:i.getCoordinate)===null||e===void 0)&&e.call(i)?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType=t==="circle"?Fs.circleAxis:Fs.lineAxis,this._axisComponentType}}AO.componentType=ut.axis;const _6=()=>{ee.registerGraphicComponent(Fs.lineAxis,(n,e)=>new ru(n,e)),ee.registerGraphicComponent(Fs.circleAxis,n=>new au(n)),ee.registerComponent(ut.axis,AO)},m6=(n,e,t,i,s,r={})=>{var a;const o=(a=r.components)===null||a===void 0?void 0:a.dataLabel,l=n.map((h,d)=>{var u,c,f,p,g;const _=Object.assign(Object.assign({},s),{labelIndex:d}),m=(u=Ot(i,_,h))!==null&&u!==void 0?u:{},{components:y={}}=r;let b={};switch(h.markType){case ne.line:case ne.area:b=m.type==="line"?y.lineLabel:m.type==="area"?y.areaLabel:y.lineDataLabel;break;case ne.rect:case ne.rect3d:case ne.interval:b=y.rectLabel;break;case ne.symbol:case ne.circle:case ne.cell:b=y.symbolLabel;break;case ne.arc:case ne.arc3d:b=y.arcLabel;break;case ne.polygon:case ne.path:default:b=y.pointLabel}const v=(c=m.data)!==null&&c!==void 0?c:[],x=(p=(f=b==null?void 0:b.data)===null||f===void 0?void 0:f[0])!==null&&p!==void 0?p:{};v&&v.length>0?v.forEach((A,k)=>{if(h.elements[k]){const w=qa(t,A,h.elements[k],_);re(A,x,w)}}):h.elements.forEach(A=>{if(A.getGraphicItem().releaseStatus!=="willRelease")if(h.isCollectionMark())A.getDatum().forEach(k=>{const w=qa(t,k,A,_);v.push(re({},x,w))});else{const k=qa(t,A.getDatum(),A,_),w=re({},x,k);v.push(w)}});const S=(g=h.graphicItem)===null||g===void 0?void 0:g.name;return re({},b,{data:v,baseMarkGroupName:S,getBaseMarks:()=>h.elements.map(A=>A.getGraphicItem())},m??{})}).filter(h=>!C(h));return re({},o,{size:e,dataLabels:l})};let kO=class extends A0{constructor(e,t){super(e,ut.label,t),this.spec.componentType=ut.label}parseAddition(e){return super.parseAddition(e),this.labelStyle(e.labelStyle),this.size(e.size),this.target(e.target),this}labelStyle(e){return this.setFunctionSpec(e,"labelStyle")}size(e){return this.setFunctionSpec(e,"size")}target(e){if(this.spec.target){const t=N(this.spec.target).map(i=>ae(i)?this.view.getMarkById(i):i);this.detach(t)}if(this.spec.target=e,e){const t=N(e).map(i=>ae(i)?this.view.getMarkById(i):i);this.attach(t)}return this.commit(),this}_updateComponentEncoders(){const e=Object.assign({update:{}},this.spec.encode),t=Object.keys(e).reduce((i,s)=>{const r=e[s];return r&&(i[s]={callback:(a,o,l)=>{var h,d,u,c;const f=N(this.spec.target).map(m=>ae(m)?this.view.getMarkById(m):m),p=(d=(h=this.group)===null||h===void 0?void 0:h.getGroupGraphicItem)===null||d===void 0?void 0:d.call(h);let g=Ot(this.spec.size,l);g||(g=p?{width:(u=p.attribute.width)!==null&&u!==void 0?u:p.AABBBounds.width(),height:(c=p.attribute.height)!==null&&c!==void 0?c:p.AABBBounds.height()}:{width:1/0,height:1/0});const _=this.spec.skipTheme?null:this.view.getCurrentTheme();return m6(f,g,r,this.spec.labelStyle,l,_)}}),i},{});this._encoders=t}};kO.componentType=ut.label;const wO=()=>{ee.registerGraphicComponent(ut.label,n=>new U_(n)),ee.registerComponent(ut.label,kO)},y6=(n,e,t,i)=>{var s,r,a,o;const l=(r=(s=e==null?void 0:e.components)===null||s===void 0?void 0:s.grid)!==null&&r!==void 0?r:{};if(!n)return re({},l,t??{});const h=((o=(a=n.tickData)===null||a===void 0?void 0:a.call(n,i))!==null&&o!==void 0?o:[]).map(d=>({id:d.index,label:d.tick,value:d.value,rawValue:d.tick}));return re({},l,{items:h},t??{})},b6=(n,e,t,i)=>{var s,r,a,o;const l=(r=(s=e==null?void 0:e.components)===null||s===void 0?void 0:s.circleGrid)!==null&&r!==void 0?r:{};if(!n)return re({},l,t??{});const h=((o=(a=n.tickData)===null||a===void 0?void 0:a.call(n,i))!==null&&o!==void 0?o:[]).map(d=>({id:d.index,label:d.tick,value:d.value,rawValue:d.tick}));return re({},l,{items:h},t??{})};class MO extends xO{constructor(e,t,i){super(e,ut.grid,t),this.spec.componentType=ut.grid,this.mode=i}parseAddition(e){return super.parseAddition(e),this.target(e.target),this.gridType(e.gridType),this.gridShape(e.gridShape),this}scale(e){return super.scale(e),this._gridComponentType=null,this}gridType(e){return this.spec.gridType=e,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(e){return this.spec.gridShape=e,this.commit(),this}target(e){if(this.spec.target){const i=ae(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(i)}this.spec.target=e;const t=ae(e)?this.view.getMarkById(e):e;return this.attach(t),this._targetAxis=t,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(e){const t=ae(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return t&&t.tickCount(e),this.setFunctionSpec(e,"tickCount")}inside(e){return this.setFunctionSpec(e,"inside")}baseValue(e){return this.setFunctionSpec(e,"baseValue")}addGraphicItem(e,t){const i=re({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},e),s=ee.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,t,s)}_updateComponentEncoders(){const e=Object.assign({update:{}},this.spec.encode),t=Object.keys(e).reduce((i,s)=>{const r=e[s];return r&&(i[s]={callback:(a,o,l)=>{var h,d,u,c;const f=this.spec.skipTheme?null:this.view.getCurrentTheme();let p,g=qa(r,a,o,l);const _=Ot(this.spec.baseValue,l,a,o);if(this._targetAxis){const b=(h=this._targetAxis.getSpec())===null||h===void 0?void 0:h.scale;p=ae(b)?this.view.getScaleById(b):b;const v=this._targetAxis.elements[0];if(v)switch(this._getGridComponentType()){case ii.lineAxisGrid:g=Object.assign({x:v.getGraphicAttribute("x"),y:v.getGraphicAttribute("y"),start:v.getGraphicAttribute("start"),end:v.getGraphicAttribute("end"),verticalFactor:(d=v.getGraphicAttribute("verticalFactor"))!==null&&d!==void 0?d:1},g);break;case ii.circleAxisGrid:g=Object.assign({x:v.getGraphicAttribute("x"),y:v.getGraphicAttribute("y"),center:v.getGraphicAttribute("center"),radius:v.getGraphicAttribute("radius"),innerRadius:v.getGraphicAttribute("innerRadius"),inside:v.getGraphicAttribute("inside"),startAngle:v.getGraphicAttribute("startAngle"),endAngle:v.getGraphicAttribute("endAngle")},g)}}else{p=ae(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const b=Ot(this.spec.inside,l,a,o),v=(u=p==null?void 0:p.getCoordinate)===null||u===void 0?void 0:u.call(p);v&&(g=Object.assign(SO(p,v,b,_,this.spec.layout,!0),g))}this._getGridComponentType()===ii.lineAxisGrid&&(g=this.spec.gridShape!=="line"&&this.spec.gridShape?Object.assign({center:g.start,closed:!0},g,{type:this.spec.gridShape}):Object.assign({},g,{type:"line"}));const m=(c=p==null?void 0:p.getScale)===null||c===void 0?void 0:c.call(p),y=Ot(this.spec.tickCount,l,a,o);switch(this._getGridComponentType()){case ii.lineAxisGrid:return y6(m,f,g,y);case ii.circleAxisGrid:return b6(m,f,g,y)}return g}}),i},{});this._encoders=t}_getGridComponentType(){var e;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)this.spec.gridType==="circle"?this._gridComponentType=ii.circleAxisGrid:this._gridComponentType=ii.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case Fs.circleAxis:this._gridComponentType=ii.circleAxisGrid;break;case Fs.lineAxis:default:this._gridComponentType=ii.lineAxisGrid}else if(this.spec.scale){const t=ae(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=!((e=t==null?void 0:t.getCoordinate)===null||e===void 0)&&e.call(t)?t.getCoordinateAxisPoints()?ii.lineAxisGrid:ii.circleAxisGrid:ii.lineAxisGrid}else this._gridComponentType=ii.lineAxisGrid;return this._gridComponentType}}MO.componentType=ut.grid;const v6=()=>{ee.registerGraphicComponent(ii.lineAxisGrid,(n,e)=>new IR(n,e)),ee.registerGraphicComponent(ii.circleAxisGrid,(n,e)=>new DR(n,e)),ee.registerComponent(ut.grid,MO)},x6=(n,e,t)=>e.filter(i=>n.callback(i,t)),S6=(n,e,t)=>{const i=n.callback,s=n.as;if(!n.all)return e.forEach(a=>{const o=i(a,t);if(!C(s)){if(C(a))return;a[s]=o}return o}),e;const r=i(e,t);return C(s)||C(e)?r:(e[s]=r,e)};function TO(n){return n.reduce((e,t)=>e+t,0)}function A6(n){return n.length===0?0:TO(n)/n.length}const k6={min:hi,max:Vt,average:A6,sum:TO};function w6(n,e,t,i){const s=Math.floor(e.length/n),r=[],a=e.length;let o,l,h,d=0,u=0;r[u++]=d;for(let c=1;c<a-1;c+=s){const f=Math.min(c+s,a-1),p=Math.min(c+2*s,a),g=(p+f)/2;let _=0;for(let x=f;x<p;x++){const S=e[x][i];Number.isNaN(S)||(_+=S)}_/=p-f;const m=c,y=Math.min(c+s,a),b=c-1,v=e[d][i];o=-1,h=m;for(let x=m;x<y;x++){const S=e[x][i];Number.isNaN(i)||(l=Math.abs((b-g)*(S-v)-(b-x)*(_-v)),l>o&&(o=l,h=x))}r[u++]=h,d=h}return r[u-1]!==a-1&&(r[u++]=a-1),r.map(c=>t?e[c].i:c)}function J_(n,e,t,i,s){let r=Math.floor(e.length/n);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][s]=e[l][s];for(let d=1;d<o-1;d+=r){r>o-d&&(r=o-d,h.length=r),h=[];for(let c=0;c<r;c++)h.push(e[d+c][s]);const u=k6[i](h);l=Math.min(Math.round(d+h.length/2)||0,o-1),e[l][s]=u,a.push(l)}return a.map(d=>t?e[d].i:d)}function M6(n,e,t,i){return J_(n,e,t,"min",i)}function T6(n,e,t,i){return J_(n,e,t,"max",i)}function C6(n,e,t,i){return J_(n,e,t,"average",i)}function P6(n,e,t,i){return J_(n,e,t,"sum",i)}const E6=(n,e)=>{let t=n.size;const i=n.factor||1;if(Array.isArray(t)&&(t=Math.floor(t[1]-t[0])),t*=i,t<=0)return[];if(e.length<=t)return e;if(n.skipfirst)return e.slice(0,1);const{mode:s,yfield:r,groupBy:a}=n,o=r??"y";let l=w6;if(s==="min"?l=M6:s==="max"?l=T6:s==="average"?l=C6:s==="sum"&&(l=P6),e.length){const h={};if(a){for(let u=0,c=e.length;u<c;u++){const f=e[u],p=f[a];h[p]?h[p].push({[o]:f[o],i:u}):(h[p]=[],h[p].push({[o]:f[o],i:u}))}let d=[];return Object.keys(h).forEach(u=>{const c=h[u];if(c.length<=t){const f=c.map(p=>p.i);d=d.concat(f)}else{const f=l(t,c,!0,o);d=d.concat(f),c.forEach(p=>e[p.i][o]=p[o])}}),d.sort((u,c)=>u-c),d.map(u=>e[u])}return l(t,e,!1,o).map(d=>e[d])}return[]},Q_="_mo_hide_";function R6(n){return n.forEach(e=>{e.getGraphicAttribute("HIDE_KEY")&&(e.setGraphicAttribute("visible",!0),e.setGraphicAttribute(Q_,!1))}),n}function O6(n,e,t,i){if(i){let s=-1/0,r=0;const a=C(e);let o=e;n.forEach(l=>{if(l.getGraphicAttribute("visible")===!1)return;const h=l.getGraphicAttribute("size")/2,d=l.getGraphicAttribute("x");a&&(o=(h+r)*t),Math.abs(d-s)<o+r+h?l.getGraphicAttribute("forceShow")||(l.setGraphicAttribute(Q_,!0),l.setGraphicAttribute("visible",!1)):s=d,r=h})}}function B6(n,e,t,i){if(i){let s=-1/0,r=0;const a=C(e);let o=e;n.forEach(l=>{if(l.getGraphicAttribute("visible")===!1)return;const h=l.getGraphicAttribute("size")/2,d=l.getGraphicAttribute("y");a&&(o=(h+r)*t),Math.abs(d-s)<o+r+h?l.getGraphicAttribute("forceShow")||(l.setGraphicAttribute(Q_,!0),l.setGraphicAttribute("visible",!1)):s=d,r=h})}}function L6(n,e,t,i){if(i){let r=-1/0,a=0,o=0;const l=C(e);let h=e;n.forEach(d=>{if(d.getGraphicAttribute("visible")===!1)return;const u=d.getGraphicAttribute("size")/2,c=d.getGraphicAttribute("x"),f=d.getGraphicAttribute("y");l&&(h=(u+a)*t),o=(-1/0-c)**2+(r-f)**2,o<(h+a+u)**2?d.getGraphicAttribute("forceShow")||(d.setGraphicAttribute(Q_,!0),d.setGraphicAttribute("visible",!1)):r=f,a=u})}}const I6=(n,e)=>{if(!e||e.length===0)return;let{radius:t}=n;C(t)&&e[0].mark.markType==="symbol"&&(t=!0);const{direction:i,delta:s,deltaMul:r=1,groupBy:a}=n,o=l=>{R6(l);const h=l.slice().sort((d,u)=>d.getGraphicAttribute("x")-u.getGraphicAttribute("x"));i===0?L6(h,s,r,t):i===1?O6(h,s,r,t):B6(h,s,r,t)};if(a){const l=e.reduce((h,d)=>{const u=d.getDatum()[a];return h[u]?h[u].push(d):h[u]=[d],h},{});Object.keys(l).forEach(h=>{o(l[h])})}else o(e);return e},D6=()=>{ee.registerTransform("filter",{transform:x6,markPhase:"beforeJoin"},!0)},F6=()=>{ee.registerTransform("map",{transform:S6,markPhase:"beforeJoin"},!0)},M0=()=>{ee.registerTransform("sampling",{transform:E6,markPhase:"afterEncode"},!0)},T0=()=>{ee.registerTransform("markoverlap",{transform:I6,markPhase:"afterEncode"},!0)},z6=(n,e,t)=>{var i;const s=n.getGraphicAttribute("clipRangeByDimension",!1),r=(i=n.getGraphicAttribute("clipRange",!1))!==null&&i!==void 0?i:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},j6=(n,e,t)=>{var i;const s=n.getGraphicAttribute("clipRangeByDimension",!0),r=(i=n.getGraphicAttribute("clipRange",!0))!==null&&i!==void 0?i:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},H6=(n,e,t)=>{var i,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:(i=n.getGraphicAttribute("opacity",!1))!==null&&i!==void 0?i:1,fillOpacity:(s=n.getGraphicAttribute("fillOpacity",!1))!==null&&s!==void 0?s:1,strokeOpacity:(r=n.getGraphicAttribute("strokeOpacity",!1))!==null&&r!==void 0?r:1}}},G6=(n,e,t)=>{var i,s,r;return{from:{opacity:(i=n.getGraphicAttribute("opacity",!0))!==null&&i!==void 0?i:1,fillOpacity:(s=n.getGraphicAttribute("fillOpacity",!0))!==null&&s!==void 0?s:1,strokeOpacity:(r=n.getGraphicAttribute("strokeOpacity",!0))!==null&&r!==void 0?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},W6=(n,e,t)=>{switch(e==null?void 0:e.direction){case"x":{const i=n.getGraphicAttribute("x",!1),s=n.getGraphicAttribute("x1",!1),r=n.getGraphicAttribute("width",!1);return{from:P(r)?{x:i+r/2,x1:void 0,width:0}:{x:(i+s)/2,x1:(i+s)/2,width:void 0},to:{x:i,x1:s,width:r}}}case"y":{const i=n.getGraphicAttribute("y",!1),s=n.getGraphicAttribute("y1",!1),r=n.getGraphicAttribute("height",!1);return{from:P(r)?{y:i+r/2,y1:void 0,height:0}:{y:(i+s)/2,y1:(i+s)/2,height:void 0},to:{y:i,y1:s,height:r}}}default:{const i=n.getGraphicAttribute("x",!1),s=n.getGraphicAttribute("x1",!1),r=n.getGraphicAttribute("width",!1),a=n.getGraphicAttribute("y",!1),o=n.getGraphicAttribute("y1",!1),l=n.getGraphicAttribute("height",!1),h={};return P(r)?(h.x=i+r/2,h.width=0,h.x1=void 0):(h.x=(i+s)/2,h.x1=(i+s)/2,h.width=void 0),P(l)?(h.y=a+l/2,h.height=0,h.y1=void 0):(h.y=(a+o)/2,h.y1=(a+o)/2,h.height=void 0),{from:h,to:{x:i,y:a,x1:s,y1:o,width:r,height:l}}}}},V6=(n,e,t)=>{switch(e==null?void 0:e.direction){case"x":{const i=n.getGraphicAttribute("x",!1),s=n.getGraphicAttribute("x1",!1),r=n.getGraphicAttribute("width",!1);return{to:P(r)?{x:i+r/2,x1:void 0,width:0}:{x:(i+s)/2,x1:(i+s)/2,width:void 0}}}case"y":{const i=n.getGraphicAttribute("y",!1),s=n.getGraphicAttribute("y1",!1),r=n.getGraphicAttribute("height",!1);return{to:P(r)?{y:i+r/2,y1:void 0,height:0}:{y:(i+s)/2,y1:(i+s)/2,height:void 0}}}default:{const i=n.getGraphicAttribute("x",!1),s=n.getGraphicAttribute("y",!1),r=n.getGraphicAttribute("x1",!1),a=n.getGraphicAttribute("y1",!1),o=n.getGraphicAttribute("width",!1),l=n.getGraphicAttribute("height",!1),h={};return P(o)?(h.x=i+o/2,h.width=0,h.x1=void 0):(h.x=(i+r)/2,h.x1=(i+r)/2,h.width=void 0),P(l)?(h.y=s+l/2,h.height=0,h.y1=void 0):(h.y=(s+a)/2,h.y1=(s+a)/2,h.height=void 0),{to:h}}}};function N6(n,e,t){const i=n.getGraphicAttribute("x",!1),s=n.getGraphicAttribute("x1",!1),r=n.getGraphicAttribute("width",!1);if(e&&e.orient==="negative"){const o=P(r)?Math.max(i,i+r):Math.max(i,s);return{from:{x:o,x1:C(s)?void 0:o,width:C(r)?void 0:0},to:{x:i,x1:s,width:r}}}const a=P(r)?Math.min(i,i+r):Math.min(i,s);return{from:{x:a,x1:C(s)?void 0:a,width:C(r)?void 0:0},to:{x:i,x1:s,width:r}}}function U6(n,e,t){var i;const s=n.getGraphicAttribute("x",!1),r=n.getGraphicAttribute("x1",!1),a=n.getGraphicAttribute("width",!1);let o;return e&&e.orient==="negative"?oe(e.overall)?o=e.overall:t.group?(o=(i=t.groupWidth)!==null&&i!==void 0?i:t.group.getBounds().width(),t.groupWidth=o):o=t.width:o=oe(e==null?void 0:e.overall)?e==null?void 0:e.overall:0,{from:{x:o,x1:C(r)?void 0:o,width:C(a)?void 0:0},to:{x:s,x1:r,width:a}}}const $6=(n,e,t)=>{var i;return((i=e==null?void 0:e.overall)!==null&&i!==void 0&&i)!==!1?U6(n,e,t):N6(n,e)};function Y6(n,e,t){const i=n.getGraphicAttribute("x",!1),s=n.getGraphicAttribute("x1",!1),r=n.getGraphicAttribute("width",!1);if(e&&e.orient==="negative"){const o=P(r)?Math.max(i,i+r):Math.max(i,s);return{to:{x:o,x1:C(s)?void 0:o,width:C(r)?void 0:0}}}const a=P(r)?Math.min(i,i+r):Math.min(i,s);return{to:{x:a,x1:C(s)?void 0:a,width:C(r)?void 0:0}}}function X6(n,e,t){var i;const s=n.getGraphicAttribute("x1",!1),r=n.getGraphicAttribute("width",!1);let a;return e&&e.orient==="negative"?oe(e.overall)?a=e.overall:t.group?(a=(i=t.groupWidth)!==null&&i!==void 0?i:t.group.getBounds().width(),t.groupWidth=a):a=t.width:a=oe(e==null?void 0:e.overall)?e.overall:0,{to:{x:a,x1:C(s)?void 0:a,width:C(r)?void 0:0}}}const K6=(n,e,t)=>{var i;return((i=e==null?void 0:e.overall)!==null&&i!==void 0&&i)!==!1?X6(n,e,t):Y6(n,e)};function q6(n,e,t){const i=n.getGraphicAttribute("y",!1),s=n.getGraphicAttribute("y1",!1),r=n.getGraphicAttribute("height",!1);if(e&&e.orient==="negative"){const o=P(r)?Math.max(i,i+r):Math.max(i,s);return{from:{y:o,y1:C(s)?void 0:o,height:C(r)?void 0:0},to:{y:i,y1:s,height:r}}}const a=P(r)?Math.min(i,i+r):Math.min(i,s);return{from:{y:a,y1:C(s)?void 0:a,height:C(r)?void 0:0},to:{y:i,y1:s,height:r}}}function Z6(n,e,t){var i;const s=n.getGraphicAttribute("y",!1),r=n.getGraphicAttribute("y1",!1),a=n.getGraphicAttribute("height",!1);let o;return e&&e.orient==="negative"?oe(e.overall)?o=e.overall:t.group?(o=(i=t.groupHeight)!==null&&i!==void 0?i:t.group.getBounds().height(),t.groupHeight=o):o=t.height:o=oe(e==null?void 0:e.overall)?e.overall:0,{from:{y:o,y1:C(r)?void 0:o,height:C(a)?void 0:0},to:{y:s,y1:r,height:a}}}const J6=(n,e,t)=>{var i;return((i=e==null?void 0:e.overall)!==null&&i!==void 0&&i)!==!1?Z6(n,e,t):q6(n,e)};function Q6(n,e,t){const i=n.getGraphicAttribute("y",!1),s=n.getGraphicAttribute("y1",!1),r=n.getGraphicAttribute("height",!1);if(e&&e.orient==="negative"){const o=P(r)?Math.max(i,i+r):Math.max(i,s);return{to:{y:o,y1:C(s)?void 0:o,height:C(r)?void 0:0}}}const a=P(r)?Math.min(i,i+r):Math.min(i,s);return{to:{y:a,y1:C(s)?void 0:a,height:C(r)?void 0:0}}}function e7(n,e,t){var i;const s=n.getGraphicAttribute("y1",!1),r=n.getGraphicAttribute("height",!1);let a;return e&&e.orient==="negative"?oe(e.overall)?a=e.overall:t.group?(a=(i=t.groupHeight)!==null&&i!==void 0?i:t.group.getBounds().height(),t.groupHeight=a):a=t.height:a=oe(e==null?void 0:e.overall)?e.overall:0,{to:{y:a,y1:C(s)?void 0:a,height:C(r)?void 0:0}}}const t7=(n,e,t)=>{var i;return((i=e==null?void 0:e.overall)!==null&&i!==void 0&&i)!==!1?e7(n,e,t):Q6(n,e)},i7=(n,e,t)=>e&&e.orient==="anticlockwise"?{from:{startAngle:n.getGraphicAttribute("endAngle",!1)},to:{startAngle:n.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:n.getGraphicAttribute("startAngle",!1)},to:{endAngle:n.getGraphicAttribute("endAngle",!1)}},n7=(n,e,t)=>{if(e&&e.orient==="anticlockwise"){const s=oe(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s,endAngle:s},to:{startAngle:n.getGraphicAttribute("startAngle",!1),endAngle:n.getGraphicAttribute("endAngle",!1)}}}const i=oe(e==null?void 0:e.overall)?e.overall:0;return{from:{startAngle:i,endAngle:i},to:{startAngle:n.getGraphicAttribute("startAngle",!1),endAngle:n.getGraphicAttribute("endAngle",!1)}}},s7=(n,e,t)=>{var i;return((i=e==null?void 0:e.overall)!==null&&i!==void 0&&i)!==!1?n7(n,e):i7(n,e)},r7=(n,e,t)=>e&&e.orient==="anticlockwise"?{from:{startAngle:n.getGraphicAttribute("startAngle",!0)},to:{startAngle:n.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:n.getGraphicAttribute("endAngle",!0)},to:{endAngle:n.getGraphicAttribute("startAngle",!1)}},a7=(n,e,t)=>{if(e&&e.orient==="anticlockwise"){const s=oe(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:n.getGraphicAttribute("startAngle",!0),endAngle:n.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}}const i=oe(e==null?void 0:e.overall)?e.overall:0;return{from:{startAngle:n.getGraphicAttribute("startAngle",!0),endAngle:n.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}},o7=(n,e,t)=>{var i;return((i=e==null?void 0:e.overall)!==null&&i!==void 0&&i)!==!1?a7(n,e):r7(n,e)},l7=(n,e,t)=>e&&e.orient==="inside"?{from:{innerRadius:n.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:n.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:n.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:n.getGraphicAttribute("outerRadius",!1)}},h7=(n,e,t)=>{const i=oe(e==null?void 0:e.overall)?e.overall:0;return{from:{innerRadius:i,outerRadius:i},to:{innerRadius:n.getGraphicAttribute("innerRadius",!1),outerRadius:n.getGraphicAttribute("outerRadius",!1)}}},d7=(n,e,t)=>{var i;return((i=e==null?void 0:e.overall)!==null&&i!==void 0&&i)!==!1?h7(n,e):l7(n,e)},u7=(n,e,t)=>e&&e.orient==="inside"?{from:{innerRadius:n.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:n.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:n.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:n.getGraphicAttribute("innerRadius",!1)}},c7=(n,e,t)=>{const i=oe(e==null?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n.getGraphicAttribute("innerRadius",!0),outerRadius:n.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:i,outerRadius:i}}},f7=(n,e,t)=>{var i;return((i=e==null?void 0:e.overall)!==null&&i!==void 0&&i)!==!1?c7(n,e):u7(n,e)},CO=(n,e,t)=>{const i=n.getGraphicAttribute("points",!1),s={x:0,y:0};return i.forEach(r=>{s.x+=r.x,s.y+=r.y}),s.x/=i.length,s.y/=i.length,e&&e.center&&(j(e.center.x)&&(s.x=e.center.x),j(e.center.y)&&(s.y=e.center.y)),n.mark.markType==="area"&&(s.x1=s.x,s.y1=s.y),i.map(()=>Object.assign(s))},p7=(n,e,t)=>({from:{points:CO(n,e)},to:{points:n.getGraphicAttribute("points",!1)}}),g7=(n,e,t)=>({from:{points:n.getGraphicAttribute("points",!0)},to:{points:CO(n,e)}}),PO=(n,e,t)=>n.getGraphicAttribute("points",!1).map(i=>{var s;if(e&&e.orient==="negative"){let r=t.width;return t.group&&(r=(s=t.groupWidth)!==null&&s!==void 0?s:t.group.getBounds().width(),t.groupWidth=r),{x:r,y:i.y,x1:r,y1:i.y1,defined:i.defined!==!1}}return{x:0,y:i.y,x1:0,y1:i.y1,defined:i.defined!==!1}}),_7=(n,e,t)=>({from:{points:PO(n,e,t)},to:{points:n.getGraphicAttribute("points",!1)}}),m7=(n,e,t)=>({from:{points:n.getGraphicAttribute("points",!0)},to:{points:PO(n,e,t)}}),EO=(n,e,t)=>n.getGraphicAttribute("points",!1).map(i=>{var s;if(e&&e.orient==="negative"){let r=t.height;return t.group&&(r=(s=t.groupHeight)!==null&&s!==void 0?s:t.group.getBounds().height(),t.groupHeight=r),{x:i.x,y:r,x1:i.x1,y1:r,defined:i.defined!==!1}}return{x:i.x,y:0,x1:i.x1,y1:0,defined:i.defined!==!1}}),y7=(n,e,t)=>({from:{points:EO(n,e,t)},to:{points:n.getGraphicAttribute("points",!1)}}),b7=(n,e,t)=>({from:{points:n.getGraphicAttribute("points",!0)},to:{points:EO(n,e,t)}}),v7=(n,e,t)=>{var i,s;const{offset:r=0,orient:a,direction:o,point:l}=e??{};let h=0,d=0;a==="negative"&&(t.group?(h=(i=t.groupWidth)!==null&&i!==void 0?i:t.group.getBounds().width(),d=(s=t.groupHeight)!==null&&s!==void 0?s:t.group.getBounds().height(),t.groupWidth=h,t.groupHeight=d):(h=t.width,d=t.height)),h+=r,d+=r;const u=Y(l)?l.call(null,n.getDatum(),n,t):l,c=u&&j(u.x)?u.x:h,f=u&&j(u.y)?u.y:d;switch(o){case"x":return{from:{x:c},to:{x:n.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:n.getGraphicAttribute("y",!1)}};default:return{from:{x:c,y:f},to:{x:n.getGraphicAttribute("x",!1),y:n.getGraphicAttribute("y",!1)}}}},x7=(n,e,t)=>{var i,s;const{offset:r=0,orient:a,direction:o,point:l}=e??{},h=t.group?t.group.getBounds():null,d=(i=h==null?void 0:h.width())!==null&&i!==void 0?i:t.width,u=(s=h==null?void 0:h.height())!==null&&s!==void 0?s:t.height,c=(a==="negative"?d:0)+r,f=(a==="negative"?u:0)+r,p=Y(l)?l.call(null,n.getDatum(),n,t):l,g=p&&j(p.x)?p.x:c,_=p&&j(p.y)?p.y:f;switch(o){case"x":return{from:{x:n.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:n.getGraphicAttribute("y",!0)},to:{y:_}};default:return{from:{x:n.getGraphicAttribute("x",!0),y:n.getGraphicAttribute("y",!0)},to:{x:g,y:_}}}},S7=(n,e,t)=>{var i,s,r,a;switch(e==null?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:(i=n.getGraphicAttribute("scaleX",!1))!==null&&i!==void 0?i:1}};case"y":return{from:{scaleY:0},to:{scaleY:(s=n.getGraphicAttribute("scaleY",!1))!==null&&s!==void 0?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:(r=n.getGraphicAttribute("scaleX",!1))!==null&&r!==void 0?r:1,scaleY:(a=n.getGraphicAttribute("scaleY",!1))!==null&&a!==void 0?a:1}}}},A7=(n,e,t)=>{var i,s,r,a;switch(e==null?void 0:e.direction){case"x":return{from:{scaleX:(i=n.getGraphicAttribute("scaleX",!0))!==null&&i!==void 0?i:1},to:{scaleX:0}};case"y":return{from:{scaleY:(s=n.getGraphicAttribute("scaleY",!0))!==null&&s!==void 0?s:1},to:{scaleY:0}};default:return{from:{scaleX:(r=n.getGraphicAttribute("scaleX",!0))!==null&&r!==void 0?r:1,scaleY:(a=n.getGraphicAttribute("scaleY",!0))!==null&&a!==void 0?a:1},to:{scaleX:0,scaleY:0}}}},k7=(n,e,t)=>{const i=Object.assign({},n.getPrevGraphicAttributes()),s=Object.assign({},n.getNextGraphicAttributes());return e&&N(e.excludeChannels).forEach(r=>{delete i[r],delete s[r]}),Object.keys(s).forEach(r=>{R_(r,i,s)&&(delete i[r],delete s[r])}),{from:i,to:s}},w7=(n,e,t)=>{var i;const s=(i=n.getGraphicAttribute("angle",!1))!==null&&i!==void 0?i:0;let r=0;return r=Qi(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:j(e==null?void 0:e.angle)?e.angle:(e==null?void 0:e.orient)==="anticlockwise"?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:s}}},M7=(n,e,t)=>{var i;const s=(i=n.getGraphicAttribute("angle",!0))!==null&&i!==void 0?i:0;let r=0;return r=Qi(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:j(e==null?void 0:e.angle)?e.angle:(e==null?void 0:e.orient)==="anticlockwise"?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:r}}},T7=()=>{ee.registerAnimationType("clipIn",z6)},C7=()=>{ee.registerAnimationType("clipOut",j6)},P7=()=>{ee.registerAnimationType("fadeIn",H6)},E7=()=>{ee.registerAnimationType("fadeOut",G6)},R7=()=>{ee.registerAnimationType("growCenterIn",W6)},O7=()=>{ee.registerAnimationType("growCenterOut",V6)},B7=()=>{ee.registerAnimationType("growHeightIn",J6)},L7=()=>{ee.registerAnimationType("growHeightOut",t7)},I7=()=>{ee.registerAnimationType("growWidthIn",$6)},D7=()=>{ee.registerAnimationType("growWidthOut",K6)},RO=()=>{ee.registerAnimationType("growPointsIn",p7)},OO=()=>{ee.registerAnimationType("growPointsOut",g7)},F7=()=>{ee.registerAnimationType("growPointsXIn",_7)},z7=()=>{ee.registerAnimationType("growPointsXOut",m7)},j7=()=>{ee.registerAnimationType("growPointsYIn",y7)},H7=()=>{ee.registerAnimationType("growPointsYOut",b7)},G7=()=>{ee.registerAnimationType("growAngleIn",s7)},W7=()=>{ee.registerAnimationType("growAngleOut",o7)},V7=()=>{ee.registerAnimationType("growRadiusIn",d7)},N7=()=>{ee.registerAnimationType("growRadiusOut",f7)},U7=()=>{ee.registerAnimationType("moveIn",v7)},$7=()=>{ee.registerAnimationType("moveOut",x7)},Y7=()=>{ee.registerAnimationType("scaleIn",S7)},X7=()=>{ee.registerAnimationType("scaleOut",A7)},K7=()=>{ee.registerAnimationType("rotateIn",w7)},q7=()=>{ee.registerAnimationType("rotateOut",M7)},Z7=()=>{ee.registerAnimationType("update",k7)};class BO extends Mh{encodeState(e,t,i){return super.encodeState(e,t,i),this._updateComponentEncoders(e),this}_updateComponentEncoders(e){this._encoders||(this._encoders={});const t=this.spec.encode[e];if(t&&e==="update"){const i=this.parameters(),s=Xr(t)?null:Object.keys(t).reduce((r,a)=>(B_(t[a])&&(r[a]=tu(t[a].scale,i)),r),{});this._encoders[e]={callback:(r,a,o)=>{const l=qa(t,r,a,o);if(C(l.size)){const h=s.x?Qw(s.x):void 0,d=s.y?Qw(s.y):void 0;C(h)&&C(d)?l.size=10:C(h)?l.size=d:C(d)&&(l.size=h),l.size=[h,d]}return C(l.shape)&&(l.shape="rect"),l}}}else this._encoders[e]=t}_getEncoders(){var e;return(e=this._encoders)!==null&&e!==void 0?e:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(e,t,i)=>{if(oe(i.padding)&&i.padding>0)e.size=W(i.size)?i.size.map(s=>Math.max(s-i.padding,1)):Math.max(i.size-i.padding,1);else if(W(i.padding)&&i.padding.length===2){const s=W(i.size)?i.size:[i.size,i.size];e.size=[Math.max(s[0]-i.padding[0],1),Math.max(s[1]-i.padding[1],1)]}else e.size=i.size},storedAttrs:"paddingAttrs"}].concat(oo.symbol)}release(){super.release(),this._encoders=null}}BO.markType=ne.cell;const J7=()=>{ee.registerMark(ne.cell,BO)},Q7=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var ye;(function(n){n.initialized="initialized",n.rendered="rendered",n.renderFinished="renderFinished",n.animationFinished="animationFinished",n.regionSeriesDataFilterOver="regionSeriesDataFilterOver",n.afterInitData="afterInitData",n.afterInitEvent="afterInitEvent",n.afterInitMark="afterInitMark",n.rawDataUpdate="rawDataUpdate",n.viewDataFilterOver="viewDataFilterOver",n.viewDataUpdate="viewDataUpdate",n.viewDataStatisticsUpdate="viewDataStatisticsUpdate",n.markDeltaYUpdate="markDeltaYUpdate",n.viewDataLabelUpdate="viewDataLabelUpdate",n.scaleDomainUpdate="scaleDomainUpdate",n.scaleUpdate="scaleUpdate",n.dataZoomChange="dataZoomChange",n.drill="drill",n.layoutStart="layoutStart",n.layoutEnd="layoutEnd",n.layoutRectUpdate="layoutRectUpdate",n.playerPlay="playerPlay",n.playerPause="playerPause",n.playerEnd="playerEnd",n.playerChange="playerChange",n.playerForward="playerForward",n.playerBackward="playerBackward",n.scrollBarChange="scrollBarChange",n.brushStart="brushStart",n.brushChange="brushChange",n.brushEnd="brushEnd",n.brushClear="brushClear",n.legendSelectedDataChange="legendSelectedDataChange",n.legendFilter="legendFilter",n.legendItemClick="legendItemClick",n.legendItemHover="legendItemHover",n.legendItemUnHover="legendItemUnHover",n.tooltipShow="tooltipShow",n.tooltipHide="tooltipHide",n.tooltipRelease="tooltipRelease",n.afterResize="afterResize",n.afterRender="afterRender",n.afterLayout="afterLayout"})(ye||(ye={}));var Xe;(function(n){n.chart="chart",n.window="window",n.canvas="canvas"})(Xe||(Xe={}));var We;(function(n){n.vchart="vchart",n.chart="chart",n.model="model",n.mark="mark"})(We||(We={}));const hg=`${be}_waterfall_default_seriesField`,LO=`${be}_CORRELATION_X`,IO=`${be}_CORRELATION_Y`,DO=`${be}_CORRELATION_SIZE`,oi=`${be}_DEFAULT_DATA_INDEX`,Vs=`${be}_DEFAULT_DATA_KEY`,vn=`${be}_DEFAULT_DATA_SERIES_FIELD`,bM=`${be}_DEFAULT_SERIES_STYLE_NAME`;var J;(function(n){n[n.Default=0]="Default",n[n.Theme=1]="Theme",n[n.Chart=2]="Chart",n[n.Base_Series=3]="Base_Series",n[n.Series=4]="Series",n[n.Mark=5]="Mark",n[n.User_Chart=6]="User_Chart",n[n.User_Series=7]="User_Series",n[n.User_Mark=8]="User_Mark",n[n.Built_In=99]="Built_In"})(J||(J={}));const Yn=`${be}_STACK_START`,Jt=`${be}_STACK_END`,lu=`${be}_STACK_START_PERCENT`,ka=`${be}_STACK_END_PERCENT`,Hv=`${be}_STACK_START_OffsetSilhouette`,Gv=`${be}_STACK_END_OffsetSilhouette`,FO=`${be}_STACK_TOTAL`,eX=`${be}_STACK_TOTAL_PERCENT`,Wv=`${be}_STACK_TOTAL_TOP`,bf=`${be}_SEGMENT_START`,gy=`${be}_SEGMENT_END`;var rt;(function(n){n[n.Axis_Grid=50]="Axis_Grid",n[n.CrossHair_Grid=100]="CrossHair_Grid",n[n.Region=450]="Region",n[n.Mark=300]="Mark",n[n.Node=400]="Node",n[n.Axis=100]="Axis",n[n.MarkLine=500]="MarkLine",n[n.MarkArea=100]="MarkArea",n[n.MarkPoint=500]="MarkPoint",n[n.DataZoom=500]="DataZoom",n[n.ScrollBar=500]="ScrollBar",n[n.Player=500]="Player",n[n.Legend=500]="Legend",n[n.CrossHair=500]="CrossHair",n[n.Indicator=500]="Indicator",n[n.Title=500]="Title",n[n.Label=500]="Label",n[n.Brush=500]="Brush",n[n.CustomMark=500]="CustomMark",n[n.Interaction=700]="Interaction"})(rt||(rt={}));var bs;(function(n){n[n.Indicator=10]="Indicator",n[n.Region=20]="Region",n[n.Axis=30]="Axis",n[n.DataZoom=40]="DataZoom",n[n.Player=40]="Player",n[n.ScrollBar=40]="ScrollBar",n[n.Legend=50]="Legend",n[n.Title=70]="Title",n[n.CustomMark=70]="CustomMark"})(bs||(bs={}));const vM=["linear","radial","conical"],tX={x0:0,y0:0,x1:1,y1:1},iX={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},nX={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},sX={linear:tX,radial:iX,conical:nX},mt={label:{name:"label",type:"text"}},_y=`${be}_rect_x`,my=`${be}_rect_x1`,yy=`${be}_rect_y`,by=`${be}_rect_y1`,em=Object.assign(Object.assign({},mt),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),C0=Object.assign(Object.assign({},mt),{bar3d:{name:"bar3d",type:"rect3d"}}),Gr={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},zO=Object.assign(Object.assign({},mt),Gr),jO=Object.assign(Object.assign({},mt),{point:{name:"point",type:"symbol"}}),P0=Object.assign(Object.assign(Object.assign({},mt),Gr),{area:{name:"area",type:"area"}}),HO=Object.assign(Object.assign(Object.assign({},mt),Gr),{area:{name:"area",type:"area"}}),GO=Object.assign(Object.assign({},mt),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),WO=Object.assign(Object.assign({},mt),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),VO=Object.assign(Object.assign({},mt),{rose:{name:"rose",type:"arc"}}),NO=Object.assign(Object.assign({},mt),{area:{name:"area",type:"path"}}),E0=Object.assign(Object.assign({},mt),{group:{name:"group",type:"group"}}),UO=Object.assign(Object.assign({},E0),{track:{name:"track",type:"progressArc"},progress:{name:"progress",type:"progressArc"}}),$O=Object.assign(Object.assign({},mt),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),YO=Object.assign(Object.assign({},mt),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),Vv=Object.assign(Object.assign({},mt),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),XO=Object.assign(Object.assign({},mt),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),KO=Object.assign(Object.assign({},mt),{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"}}),qO=Object.assign(Object.assign({},mt),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),ZO=Object.assign(Object.assign({},em),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),JO=Object.assign(Object.assign({},mt),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),QO=Object.assign(Object.assign({},mt),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),eB=Object.assign(Object.assign({},mt),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),tB=Object.assign(Object.assign({},E0),{segment:{name:"segment",type:"progressArc"},track:{name:"track",type:"progressArc"}}),iB=Object.assign(Object.assign({},mt),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),nB=Object.assign(Object.assign({},mt),{sunburst:{name:"sunburst",type:"arc"}}),sB=Object.assign(Object.assign({},em),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),rB=Object.assign(Object.assign({},C0),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),aB=Object.assign(Object.assign({},mt),{circlePacking:{name:"circlePacking",type:"arc"}}),oB=Object.assign(Object.assign({},mt),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),lB=Object.assign(Object.assign({},mt),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),hB=Object.assign({},P0);var xM;(function(n){n.area_horizontal="area_horizontal",n.area_vertical="area_vertical",n.line_horizontal="line_horizontal",n.line_vertical="line_vertical",n.bar_horizontal="bar_horizontal",n.bar_vertical="bar_vertical",n.bar3d_horizontal="bar3d_horizontal",n.bar3d_vertical="bar3d_vertical",n.rangeColumn_horizontal="rangeColumn_horizontal",n.rangeColumn_vertical="rangeColumn_vertical",n.rangeColumn3d_horizontal="rangeColumn3d_horizontal",n.rangeColumn3d_vertical="rangeColumn3d_vertical",n.rangeArea_horizontal="rangeArea_horizontal",n.rangeArea_vertical="rangeArea_vertical",n.linearProgress_horizontal="linearProgress_horizontal",n.linearProgress_vertical="linearProgress_vertical",n.boxPlot_horizontal="boxPlot_horizontal",n.boxPlot_vertical="boxPlot_vertical",n.sankey_horizontal="sankey_horizontal",n.sankey_vertical="sankey_vertical",n.waterfall_horizontal="waterfall_horizontal",n.waterfall_vertical="waterfall_vertical"})(xM||(xM={}));const dg={[z.bar]:em,[z.bar3d]:C0,[z.line]:zO,[z.scatter]:jO,[z.area]:P0,[z.radar]:HO,[z.pie]:GO,[z.pie3d]:WO,[z.rose]:VO,[z.geo]:mt,[z.map]:NO,[z.circularProgress]:UO,[z.link]:$O,[z.dot]:YO,[z.wordCloud]:Vv,[z.wordCloud3d]:Vv,[z.funnel]:XO,[z.funnel3d]:KO,[z.linearProgress]:qO,[z.waterfall]:ZO,[z.boxPlot]:JO,[z.treemap]:QO,[z.sankey]:eB,[z.gauge]:tB,[z.gaugePointer]:iB,[z.sunburst]:nB,[z.rangeColumn]:sB,[z.rangeColumn3d]:rB,[z.circlePacking]:aB,[z.heatmap]:oB,[z.correlation]:lB,[z.rangeArea]:hB};function dB(n){var e,t;const{type:i}=n;return i===z.sankey?(e=n.direction)!==null&&e!==void 0?e:"horizontal":(t=n.direction)!==null&&t!==void 0?t:"vertical"}const rX={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},aX={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function oX(n,e){const t=rX[e];if(t&&n[t])return n[t];if(n[e])return n[e];const i=aX[e];return i?n[i]:void 0}function hu(n,e){var t;if(!n)return[];const i=uB(n,e);if(!i||W(i))return(t=i)!==null&&t!==void 0?t:[];if(He(i)){const{dataScheme:s}=i;return s?R0(s)?s.map(r=>Object.assign(Object.assign({},r),{scheme:r.scheme.map(a=>ug(a)?Uv(n,a,e):a).filter(P)})):s.map(r=>ug(r)?Uv(n,r,e):r).filter(P):[]}return[]}function Nv(n,e){var t,i;return R0(n)?(i=(t=n.find(s=>P(s.isAvailable)?Y(s.isAvailable)?s.isAvailable(e):!!s.isAvailable:!P(s.maxDomainLength)||(e==null?void 0:e.length)<=s.maxDomainLength))===null||t===void 0?void 0:t.scheme)!==null&&i!==void 0?i:n[n.length-1].scheme:n}function Uv(n,e,t){var i;const s=uB(n,t);if(!s)return;let r;const{palette:a}=s;if(He(a)&&(r=(i=oX(a,e.key))!==null&&i!==void 0?i:e.default),!r)return;if(C(e.a)&&C(e.l)||!ae(r))return r;let o=new Gt(r);if(P(e.l)){const{r:l,g:h,b:d}=o.color,{h:u,s:c}=a_(l,h,d),f=kf(u,c,e.l),p=new Gt(`rgb(${f.r}, ${f.g}, ${f.b})`);p.setOpacity(o.color.opacity),o=p}return P(e.a)&&o.setOpacity(e.a),o.toRGBA()}const lX=(n,e,t)=>{if(e&&ug(n)){const i=Uv(e,n,t);if(i)return i}return n};function ug(n){return n&&n.type==="palette"&&!!n.key}function R0(n){return!(!W(n)||n.length===0)&&n.every(e=>P(e.scheme))}function hX(n){return W(n)?{dataScheme:n}:n}function uB(n,e){var t,i;const{type:s}=e??{};let r;if(!e||C(s))r=n==null?void 0:n.default;else{const a=dB(e);r=(i=(t=n==null?void 0:n[`${s}_${a}`])!==null&&t!==void 0?t:n==null?void 0:n[s])!==null&&i!==void 0?i:n==null?void 0:n.default}return r}class Qu extends ro{range(e){return e?(this._range=e,this._resetRange(),this):super.range()}domain(e){return e?(super.domain(e),this._resetRange(),this):super.domain()}_resetRange(){if(!R0(this._range))return void super.range(this._range);const e=Nv(this._range,this._domain);super.range(e)}}const dX={linear:qn,band:bo,point:I5,ordinal:ro,threshold:s0,colorOrdinal:Qu};function $v(n){const e=dX[n];return e?new e:null}function uX(n,e){if("scale"in n&&n.scale)return ae(n.scale)&&(e!=null&&e.globalScale)?e.globalScale.registerMarkAttributeScale(n,e.seriesId):n.scale;const t=$v(n.type);return t&&cX(t,n),t}function cX(n,e){n&&e&&(e.domain&&n.domain(e.domain),e.range&&n.range(e.range),e.specified&&n.specified&&n.specified(e.specified))}function Ke(n,e){if(!e)return n;const t=e.range(),i=Math.min(t[0],t[t.length-1]),s=Math.max(t[0],t[t.length-1]);return Math.min(Math.max(i,n),s)}function SM(n){return P(n==null?void 0:n.field)&&P(n==null?void 0:n.scale)}function O0(n){switch(n){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function dn(n){return!!ae(n)&&!!n.endsWith("%")&&Ws(n.substring(0,n.length-1))}function fX(n){return!!He(n)&&("percent"in n||"offset"in n)}function Ii(n,e,t){var i,s;return oe(n)?n:dn(n)?Number(n.substring(0,n.length-1))*e/100:Y(n)?n(t):He(n)?e*((i=n.percent)!==null&&i!==void 0?i:0)+((s=n.offset)!==null&&s!==void 0?s:0):0}function cB(n,e,t){var i,s,r,a;const o={top:0,bottom:0,left:0,right:0};return Object.values(n).every(l=>oe(l))?(o.top=(i=n.top)!==null&&i!==void 0?i:0,o.right=(s=n.right)!==null&&s!==void 0?s:0,o.bottom=(r=n.bottom)!==null&&r!==void 0?r:0,o.left=(a=n.left)!==null&&a!==void 0?a:0,o):([{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach(l=>{l.orients.forEach(h=>{o[h]=Ii(n[h],l.size,t)})}),o)}function pX(n,e){return n?{width:Math.ceil(Math.min(n.x2-n.x1,e.width)),height:Math.ceil(Math.min(n.y2-n.y1,e.height))}:{width:0,height:0}}function vr(n){let e={};return W(n)?(C(n[0])||(e.top=e.left=e.bottom=e.right=n[0]),C(n[1])||(e.left=e.right=n[1]),C(n[2])||(e.bottom=n[2]),C(n[3])||(e.left=n[3]),e):oe(n)||dn(n)||Y(n)||fX(n)?(e.top=e.left=e.bottom=e.right=n,e):(He(n)&&(e=Object.assign({},n)),e)}function AM(n,e,t){return t?{x:n.x+e.x,y:n.y+e.y}:n}const el=(n,e)=>{const t=Number(n),i=n.toString();return isNaN(t)&&i[i.length-1]==="%"?e*(Number(i.slice(0,i.length-1))/100):t};function gX(n){if(!n)return null;if(typeof n=="string")return{fill:n,fillOpacity:1};if(typeof n!="object")return null;const e=Nl(n,["x","y","width","height","x1","y1","image"]);return e.background=n.image,e}const fB=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],_X={default:{dataScheme:fB,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2"}}},mX={label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}}},yX={label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bX={bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},vX={outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},me={defaultFontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",defaultFontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%",axisTickSize:4,areaOpacity:.2},xX={dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:me.l5FontSize,lineHeight:me.l5LineHeight}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:me.l5FontSize,lineHeight:me.l5LineHeight}}},SX={transform:{style:{fill:{type:"palette",key:"axisGridColor"}}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:me.l4FontSize,lineHeight:me.l4LineHeight,fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:me.l4FontSize,lineHeight:me.l4LineHeight,fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}},AX={transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:me.l4FontSize,lineHeight:me.l4LineHeight,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:me.l4FontSize,lineHeight:me.l4LineHeight,fill:"#707070",textBaseline:"middle"}}},kX={outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},wX="M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z",kM="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",MX={pointer:{type:"path",width:.4,height:.4,style:{path:wX}},pin:{width:.025,height:.025,style:{path:kM,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:kM,fill:"#ddd"}}},TX={label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},CX={bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},PX={arrow:{style:{size:10}}},EX={defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:me.l6FontSize,lineHeight:me.l6LineHeight,textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},RX={outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}}},OX={outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside"}},BX={label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},LX={point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},IX={seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:me.l4FontSize,lineHeight:me.l4LineHeight}},label:{visible:!1,offset:12,position:"inside"}},DX={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},FX={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},zX={gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:me.l5FontSize,lineHeight:me.l5LineHeight}},nonLeafLabel:{padding:2*me.l5FontSize,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:me.l5FontSize,lineHeight:me.l5LineHeight,textBaseline:"middle",textAlign:"center"}}},jX={innerRadius:0,outerRadius:1,startAngle:pd,endAngle:pf,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:me.l5FontSize,lineHeight:me.l5LineHeight}}},HX={label:{visible:!1,offset:5,position:"inside",style:{fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},GX={layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:me.l5FontSize,lineHeight:me.l5LineHeight}}},WX={cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},VX={link:{style:{fillOpacity:.15,round:!0}}},NX={rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},UX={boxPlot:{style:{lineWidth:1}}},$X={centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},YX={scatter:LX,line:TX,area:mX,bar:yX,bar3d:bX,pie:RX,pie3d:OX,map:EX,radar:BX,dot:xX,link:PX,wordCloud:DX,wordCloud3d:FX,funnel:SX,funnel3d:AX,linearProgress:CX,circularProgress:vX,waterfall:IX,gauge:kX,gaugePointer:MX,treemap:zX,sunburst:jX,rangeColumn:HX,circlePacking:GX,heatmap:WX,sankey:VX,rose:NX,boxPlot:UX,correlation:$X},XX={text:{style:{fontSize:me.l4FontSize,lineHeight:me.l4LineHeight,fontWeight:"normal",fillOpacity:1}}},KX={label:{style:{fontSize:me.l4FontSize,fontWeight:"normal",fillOpacity:1}},area:{style:{fillOpacity:me.areaOpacity}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},circlePacking:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},funnel3d:{style:{stroke:!1}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06}}}},qX={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},pB={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:me.l5FontSize,fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},ZX={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:me.l5FontSize,fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},JX=Object.assign(Object.assign({},pB),{label:{space:0}}),QX={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:me.axisTickSize,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:me.axisTickSize/2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:me.l5FontSize,fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:me.l5FontSize,lineHeight:me.l5LineHeight,fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},e9={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},t9={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},i9={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},n9={style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},wM=()=>({visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:me.l5FontSize},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}),s9={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineDash:[]}},label:wM()},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineDash:[2,3]}},label:wM()}},MM=`M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3
  46. C-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6
  47. C-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6
  48. C0.3-1.4,0.3-1.4,0.3-1.4z;`,r9={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:MM,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:MM,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:me.l5FontSize,lineHeight:me.l5LineHeight,fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:me.l5FontSize,lineHeight:me.l5LineHeight,fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},a9={title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:me.l1FontSize,fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:me.l2FontSize,fill:{type:"palette",key:"tertiaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},cg={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:me.l5FontSize,lineHeight:me.l5LineHeight,fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:me.l5FontSize,lineHeight:me.l5LineHeight,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:me.l5FontSize,lineHeight:me.l5LineHeight,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:me.l5FontSize,lineHeight:me.l5LineHeight,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},TM={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},o9={horizontal:Object.assign(Object.assign({},cg),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:TM}),vertical:Object.assign(Object.assign({},cg),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:TM})},l9={orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:me.l5FontSize,lineHeight:me.l5LineHeight,fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:me.l5FontSize,lineHeight:me.l5LineHeight,opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},CM={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},h9={horizontal:Object.assign(Object.assign({},cg),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:CM}),vertical:Object.assign(Object.assign({},cg),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:CM})},d9={visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:me.l6FontSize}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:me.l6FontSize}},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:"red"}}},u9={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:me.l4FontSize,fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},c9={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:{visible:!1,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{visible:!0,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},label:{refY:5,style:{fontSize:me.l4FontSize,fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},f9={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}},p9={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},g9={padding:{top:4,bottom:20},textStyle:{fontSize:me.l3FontSize,lineHeight:me.l3LineHeight,fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:me.l4FontSize,lineHeight:me.l4LineHeight,fill:{type:"palette",key:"tertiaryFontColor"}}},_9={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:me.l4FontSize,lineHeight:me.l4LineHeight,fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textAlign:"left",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:me.l4FontSize,lineHeight:me.l4LineHeight,fontColor:{type:"palette",key:"secondaryFontColor"},textAlign:"left",textBaseline:"middle",spacing:26},valueLabel:{fontSize:me.l4FontSize,lineHeight:me.l4LineHeight,fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},m9={visible:!0,position:"auto",padding:8,titleStyle:{fontSize:me.l5FontSize,fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:me.l5FontSize,fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}},y9={visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:me.l4FontSize,fill:{type:"palette",key:"primaryFontColor"}}},b9={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}},v9={discreteLegend:l9,colorLegend:o9,sizeLegend:h9,axis:QX,axisBand:qX,axisLinear:e9,axisX:pB,axisY:ZX,axisZ:JX,axisAngle:i9,axisRadius:t9,markLine:c9,markArea:u9,markPoint:f9,tooltip:_9,dataZoom:r9,crosshair:s9,player:p9,brush:n9,indicator:a9,title:g9,mapLabel:d9,poptip:m9,totalLabel:y9,scrollBar:b9},Yv={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:me.defaultFontFamily,colorScheme:_X,mark:XX,markByName:KX,series:YX,component:v9,animationThreshold:2e3},x9={default:{dataScheme:fB,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff"}}},PM={name:"dark",colorScheme:x9,component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}};function gB(n,e,t=!1){if(e){if(n===e)return;if(P(e)&&typeof e=="object"){const i=Object(e),s=[];for(const o in i)s.push(o);let{length:r}=s,a=-1;for(;r--;){const o=s[++a];P(i[o])&&typeof i[o]=="object"&&!W(n[o])?S9(n,e,o,t):_B(n,o,i[o])}}}}function S9(n,e,t,i=!1){const s=n[t],r=e[t];let a=e[t],o=!0;if(W(r)){if(i)a=[];else if(W(s))a=s;else if(r_(s)){a=new Array(s.length);let l=-1;const h=s.length;for(;++l<h;)a[l]=s[l]}}else _s(r)?(a=s??{},typeof s!="function"&&typeof s=="object"||(a={})):o=!1;o&&gB(a,r,i),_B(n,t,a)}function _B(n,e,t){(t!==void 0&&!A9(n[e],t)||t===void 0&&!(e in n))&&(n[e]=t)}function A9(n,e){return n===e||Number.isNaN(n)&&Number.isNaN(e)}function pe(n,...e){let t=-1;const i=e.length;for(;++t<i;)gB(n,e[t],!0);return n}function EM(n,e,t,i){Object.keys(n).forEach(s=>{if(He(e))e.type===s&&(W(n[s])?n[s].length>=e.index&&(n[s][e.index]=i?pe({},n[s][e.index],t):t):n[s]=i?pe({},n[s],t):t);else if(W(n[s])){const r=n[s].findIndex(a=>a.id===e);r>=0&&(n[s][r]=i?pe({},n[s][r],t):t)}else n.id===e&&(n[s]=i?pe({},n[s],t):t)})}function Xv(n,...e){return pe(RM(n),...e.map(RM))}function RM(n){if(!n)return n;const e=k9(n.colorScheme),{series:t}=n,{mark:i,markByName:s}=n;let r;return(i||s)&&(r=Object.keys(dg).reduce((a,o)=>{var l;const h=(l=t==null?void 0:t[o])!==null&&l!==void 0?l:{};return a[o]=Kv(h,o,i,s),a},{})),Object.assign({},n,{colorScheme:e,series:Object.assign({},n.series,r)})}function k9(n){return n&&(n=Object.keys(n).reduce((e,t)=>{const i=n[t];return e[t]=hX(i),e},{})),n}function Kv(n,e,t,i){if(!dg[e])return n;const s={};return Object.values(dg[e]).forEach(({type:r,name:a})=>{s[a]=pe({},t==null?void 0:t[N(r)[0]],i==null?void 0:i[a],n==null?void 0:n[a])}),Object.assign(Object.assign({},n),s)}const w9=["animationThreshold","colorScheme","fontFamily","name","padding"];function tm(n,e,t){if(!n)return n;const i={};return Object.keys(n).forEach(s=>{const r=n[s];w9.includes(s)?i[s]=r:_s(r)?ug(r)?i[s]=lX(r,e,t):i[s]=tm(r,e,t):i[s]=r}),i}const Hl={[Yv.name]:Yv},ec=Yv.name,oh=new Map(Object.keys(Hl).map(n=>[n,Hl[n]])),B0=new Map(Object.keys(Hl).map(n=>[n,tm(Hl[n],Hl[n].colorScheme)])),fg=new Map(Object.keys(Hl).map(n=>[n,n===ec])),L0=(n,e)=>{if(!n)return;const t=C9(e);oh.set(n,t),B0.set(n,tm(t,t.colorScheme)),fg.set(n,!0)},mB=(n=ec,e=!1)=>(fg.has(n)&&!fg.get(n)&&L0(n,oh.get(n)),e?B0.get(n):oh.get(n)),M9=n=>oh.delete(n)&&B0.delete(n)&&fg.delete(n),T9=n=>!!ae(n)&&oh.has(n),C9=n=>{var e;const t=(e=n.type)!==null&&e!==void 0?e:ec,i=mB(t);return Xv({},i,n)};class Hn{static registerInstance(e){Hn.instances.set(e.id,e)}static unregisterInstance(e){Hn.instances.delete(e.id)}static getInstance(e){return Hn.instances.get(e)}static instanceExist(e){return Hn.instances.has(e)}static forEach(e,t=[],i){const s=N(t);return Hn.instances.forEach((r,a,o)=>{s.includes(a)||e(r,a,o)},i)}}Hn.instances=new Map;class qi{static registerTheme(e,t){L0(e,t)}static getTheme(e,t=!1){return mB(e,t)}static removeTheme(e){return M9(e)}static themeExist(e){return T9(e)}static getDefaultTheme(){return qi.themes.get(ec)}static setCurrentTheme(e){qi.themeExist(e)&&(qi._currentThemeName=e,Hn.forEach(t=>t==null?void 0:t.setCurrentTheme(e)))}static getCurrentTheme(){return qi.getTheme(qi._currentThemeName)}static getCurrentThemeName(){return qi._currentThemeName}}qi.themes=oh,qi._currentThemeName=ec;function Or(n,e){return ae(n)?qi.themeExist(n)?qi.getTheme(n,e):{}:He(n)?n:{}}function qv(n,e={data:t=>t}){if(!n)return n;if(n.constructor===Object){const t={};for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){if(e[i]){t[i]=e[i](n[i]);continue}t[i]=qv(n[i],e)}return t}return W(n)?n.map(t=>qv(t,e)):n}function Zv(n,e){if(!n)return n;if(_s(n)){const t={};for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){if(ae(n[i])&&e.getFunction(n[i])){t[i]=e.getFunction(n[i]);continue}t[i]=Zv(n[i],e)}return t}return W(n)?n.map(t=>Zv(t,e)):n}const P9=(n,e,t)=>r0(n,e,t,{fontFamily:me.defaultFontFamily,fontSize:me.defaultFontSize}),E9=(n,e,t,i)=>P9(e,t,i).measure(n);function Gl(n,e){for(let t=0;t<e.length;t++){const i=e[t],s=R9(n,i.key);s?s.operations=[...new Set(s.operations.concat(i.operations))]:n.push(i)}return n}function R9(n,e){return n.find(t=>t.key===e)}function pg(n,e){var t;if(!n)return e??null;const i=n.getFields();return i&&i[e]?(t=i[e].alias)!==null&&t!==void 0?t:e:e??null}function yB(n,e,t){const i={};return n.getSeries().forEach(s=>{var r;const a=s.getStackData(),o=s.getStackValue(),l=s.getStackValueField(),h=!t||t(s);a&&l&&h&&(i[o]=(r=i[o])!==null&&r!==void 0?r:{nodes:{}},xB(s,a,i[o],l,e))}),i}function bB(n,e){if("values"in n&&n.values.length){const t=nR(n.values,e),i=o0(n.values,ka);n.values.forEach(r=>{r[FO]=t,r[eX]=i,delete r[Wv]});const s=n.values.reduce((r,a)=>a[Jt]>r[Jt]?a:r);s[Wv]=!0}else for(const t in n.nodes)bB(n.nodes[t],e)}function O9(n){if(!n.values.length)return;const e=n.values[n.values.length-1][Jt]/2;for(let t=0;t<n.values.length;t++)n.values[t][Hv]=n.values[t][Yn]-e,n.values[t][Gv]=n.values[t][Jt]-e}function vB(n,e,t){if(n.values.length>0){let i=0,s=0,r=1,a=0;const o=n.values.length;for(let l=0;l<o;l++){const h=n.values[e?o-1-l:l];a=h[Jt],a>=0?(h[Yn]=i,i+=h[Jt],h[Jt]=i):(h[Yn]=s,s+=h[Jt],h[Jt]=s)}if(t)for(let l=0;l<o;l++){const h=n.values[e?o-1-l:l];a=h[Jt];const d=a>=0?i:s;r=a>=0?1:-1,h[lu]=d===0?0:Math.min(1,h[Yn]/d)*r,h[ka]=d===0?0:Math.min(1,h[Jt]/d)*r}}for(const i in n.nodes)vB(n.nodes[i],e,t)}function xB(n,e,t,i,s){if("values"in e)return s&&e.values.forEach(r=>r[Jt]=h5(r[i])),t.values.push(...e.values),void t.series.push({s:n,values:e.values});for(const r in e.nodes)!t.nodes[r]&&(t.nodes[r]={values:[],series:[],nodes:{}}),xB(n,e.nodes[r],t.nodes[r],i,s)}const SB=(n,e,t="key",i="children")=>{for(let s=0;s<n.length;s++){const r=n[s];if(r[t]===e)return r;if(r[i]){const a=SB(r[i],e,t,i);if(a)return a}}return null},AB=(n,e,t="key",i="children")=>{for(let s=0;s<n.length;s++){const r=n[s];if(r[i])for(let a=0;a<r[i].length;a++){const o=r[i][a];if(o[t]===e)return r;const l=AB([o],e,t,i);if(l)return l}}return null},B9=(n,e,t="key",i="children")=>{const s=[],r=(a,o)=>{for(const l of a){if(l[t]===e)return s.push(...o,l[t].toString()),!0;if(l[i]){const h=r(l[i],[...o,l[t]]);if(h===!0)return h}}return!1};return r(n,[]),s};function cs(n={}){const e=Object.assign({},n);if(Y(n.style)?e.style=(t,i,s,r)=>ve(n.style(t,i,s,r)):fe(n.style)||(e.style=ve(n.style)),!fe(n.state)){const t={};Object.keys(n.state).forEach(i=>{Y(n.state[i])?t[i]=(s,r,a,o)=>ve(n.state[i](s,r,a,o)):fe(n.state[i])||(t[i]=ve(n.state[i]))}),e.state=t}return e}function Po(n){if(fe(n))return null;const e={};return Object.keys(n).forEach(t=>{Y(n[t])?e[t]=(i,s,r,a)=>ve(n[t](i,s,r,a)):fe(n[t])||(e[t]=ve(n[t]))}),e}function L9(n){if(fe(n))return null;const e={};return Object.keys(n).forEach(t=>{Y(n[t])?e[t]=(i,s,r,a)=>ve(n[t](i.rawValue,s,i,r,a)):fe(n[t])||(e[t]=ve(n[t]))}),e}function ve(n){return n!=null&&n.angle&&(n.angle=st(n.angle)),n}class D{static registerChart(e,t){D._charts[e]=t}static registerSeries(e,t){D._series[e]=t}static registerComponent(e,t,i){D._components[e]={cmp:t,alwaysCheck:i}}static registerMark(e,t){D._marks[e]=t}static registerRegion(e,t){D._regions[e]=t}static registerTransform(e,t){D.transforms[e]=t}static registerLayout(e,t){D._layout[e]=t}static registerAnimation(e,t){D._animations[e]=t}static registerImplement(e,t){D._implements[e]=t}static registerChartPlugin(e,t){D._chartPlugin[e]=t}static createChart(e,t,i){return D._charts[e]?new D._charts[e](t,i):null}static createChartSpecTransformer(e,t){if(!D._charts[e])return null;const i=D._charts[e];return new i.transformerConstructor(Object.assign({seriesType:i.seriesType},t))}static createRegion(e,t,i){return D._regions[e]?new D._regions[e](t,i):null}static createRegionSpecTransformer(e,t){return D._regions[e]?new D._regions[e].transformerConstructor(t):null}static createSeries(e,t,i){return D._series[e]?new D._series[e](t,i):null}static createSeriesSpecTransformer(e,t){return D._series[e]?new D._series[e].transformerConstructor(t):null}static createMark(e,t,i){if(!D._marks[e])return null;const s=new D._marks[e](t,i);return s.type==="group"&&s.setInteractive(!1),s}static getComponents(){return Object.values(D._components)}static getComponentInKey(e){return D._components[e].cmp}static getLayout(){return Object.values(D._layout)}static getLayoutInKey(e){return D._layout[e]}static getSeries(){return Object.values(D._series)}static getSeriesInType(e){return D._series[e]}static getRegionInType(e){return D._regions[e]}static getAnimationInKey(e){return D._animations[e]}static getImplementInKey(e){return D._implements[e]}static getSeriesMarkMap(e){return D._series[e]?D._series[e].mark:{}}static getChartPlugins(){return Object.values(D._chartPlugin)}}D._charts={},D._series={},D._components={},D._marks={},D._regions={},D._animations={},D._implements={},D._chartPlugin={},D.transforms={simplify:hP,fields:dP,filter:WD,fold:Z2},D.dataParser={csv:fP,dsv:cP,tsv:pP},D._layout={};const I9=(n,e,t)=>n.x>=e.x&&n.x<=t.x&&n.y>=e.y&&n.y<=t.y,D9=(n,e,t)=>{const i=n.getRegionsInIds(N(e.layout.layoutBindRegionID));return i==null?void 0:i.some(s=>{const r=s.getLayoutRect(),a=s.getLayoutStartPoint();return I9(t,{x:a.x,y:a.y},{x:r.width+a.x,y:r.height+a.y})})},kB=(n,e)=>{var t,i;return n===e||!C(n)&&!C(e)&&n.value===e.value&&((t=n.axis)===null||t===void 0?void 0:t.id)===((i=e.axis)===null||i===void 0?void 0:i.id)},Jv=(n,e,t,i)=>{var s;const r=e.getScale(),a=wi(r.type),o=[],l=e.getRegions();for(const h of l){const d=h.getSeries();for(const u of d)if(u.coordinate===t){const c=N(i(u)),f=(s=u.getViewData())===null||s===void 0?void 0:s.latestData;if(c&&f)if(a)o.push({series:u,datum:f.filter(p=>{var g;return((g=p[c[0]])===null||g===void 0?void 0:g.toString())===(n==null?void 0:n.toString())})});else if(P(c[1]))o.push({series:u,datum:f.filter(p=>{var g;return((g=p[c[0]])===null||g===void 0?void 0:g.toString())===(n==null?void 0:n.toString())||P(p[c[0]])&&P(p[c[1]])&&n>=p[c[0]]&&n<p[c[1]]})});else{const p=e.getSpec().tooltipFilterRange,g=j(p)?[-p,p]:p;let _=[];if(g)f.forEach(m=>{if(P(m[c[0]])){const y=m[c[0]]-n;y>=g[0]&&y<=g[1]&&_.push(m)}});else{let m=1/0,y=0;f.forEach(b=>{if(P(b[c[0]])){const v=Math.abs(b[c[0]]-n),x=Math.sign(b[c[0]]-n);v<m?(m=v,_=[b],y=x):v===m&&x===y&&_.push(b)}})}o.push({series:u,datum:_})}}}return o},gg=(n,e,t)=>{const i=n.getAllComponents().filter(s=>s.specKey==="axes"&&e(s)&&D9(n,s,t));return i.length?i:null},F9=(n,e)=>{const t=2*Math.PI,i=hi(e),s=Vt(e);return n<i?n+=Math.ceil((i-n)/t)*t:n>s&&(n-=Math.ceil((n-s)/t)*t),n},wB=(n,e)=>{if(!n||!l0(n.getRegionsInIndex(),"polar"))return null;const{x:t,y:i}=e,s=gg(n,l=>l.getOrient()==="angle",e),r=gg(n,l=>l.getOrient()==="radius",e),a=[],o=l=>l.getDimensionField()[0];return s&&s.forEach(l=>{var h;const d=l.getScale();if(d&&wi(d.type)){const u=d.domain(),c=d.range(),f=l.getCenter(),p={x:t-l.getLayoutStartPoint().x-f.x,y:i-l.getLayoutStartPoint().y-f.y};let g=mk({x:1,y:0},p);g=F9(g,c);const _=Pp(p),m=(h=r[0])===null||h===void 0?void 0:h.getScale(),y=m==null?void 0:m.range();if((g-(c==null?void 0:c[0]))*(g-(c==null?void 0:c[1]))>0||(_-(y==null?void 0:y[0]))*(_-(y==null?void 0:y[1]))>0)return;const b=l.invert(g);if(C(b))return;let v=u.findIndex(S=>(S==null?void 0:S.toString())===b.toString());v<0&&(v=void 0);const x=Jv(b,l,"polar",o);a.push({index:v,value:b,axis:l,data:x})}}),r&&r.forEach(l=>{var h;const d=l.getScale(),u=d==null?void 0:d.range();if(d&&wi(d.type)){const c=l.getCenter(),f={x:t-l.getLayoutStartPoint().x-c.x,y:i-l.getLayoutStartPoint().y-c.y};let p=mk({x:1,y:0},f);p<-Math.PI/2&&(p=2*Math.PI+p);const g=Pp(f),_=(h=s[0])===null||h===void 0?void 0:h.getScale(),m=_==null?void 0:_.range();if((p-(m==null?void 0:m[0]))*(p-(m==null?void 0:m[1]))>0||(g-(u==null?void 0:u[0]))*(g-(u==null?void 0:u[1]))>0)return;const y=d.invert(g);if(C(y))return;let b=d.domain().findIndex(x=>(x==null?void 0:x.toString())===y.toString());b<0&&(b=void 0);const v=Jv(y,l,"polar",o);a.push({index:b,value:y,axis:l,data:v})}}),a.length?a:null};function At(n){return n==="bottom"||n==="top"}function or(n){return n==="left"||n==="right"}function Br(n){return n==="z"}function z9(n,e){return e?At(n)?"linear":"band":At(n)?"band":"linear"}function jr(n,e){return O0(n.orient)||e&&e.includes(n.orient)?n.orient:"left"}function MB(n){return n==="top"||n==="bottom"?"horizontal":"vertical"}function j9(n,e){let t=n.inverse;return e&&!At(n.orient)&&(t=!P(n.inverse)||!n.inverse),t}function OM(n,e){var t;const i=(t=n.type)!==null&&t!==void 0?t:z9(n.orient,e);return{axisType:i,componentName:`${X.cartesianAxis}-${i}`}}const TB=n=>n.fieldX[0],CB=n=>n.fieldY[0],H9=n=>[n.fieldX[0],n.fieldX2],G9=n=>[n.fieldY[0],n.fieldY2],PB=(n,e)=>{var t,i;if(!n||!l0(n.getRegionsInIndex(),"cartesian"))return null;const{x:s,y:r}=e,a=(t=gg(n,c=>At(c.getOrient()),e))!==null&&t!==void 0?t:[],o=(i=gg(n,c=>or(c.getOrient()),e))!==null&&i!==void 0?i:[],l=new Set,h=new Set;[a,o].forEach(c=>c.forEach(f=>{wi(f.getScale().type)?l.add(f):h.add(f)}));const d=[],u=(c,f)=>{(c==="x"?a:o).forEach(p=>{if((f?l:h).has(p)){const g=W9(p,c==="x"?s:r,c,c==="x"?f?TB:H9:f?CB:G9);g&&d.push(g)}})};return n.getSpec().direction==="horizontal"?(u("y",l.size>0),d.length===0&&u("x",l.size>0)):(u("x",l.size>0),d.length===0&&u("y",l.size>0)),d.length?d:null},W9=(n,e,t,i)=>{const s=n.getScale(),r=e-n.getLayoutStartPoint()[t];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return EB(n,a,i)},EB=(n,e,t)=>{const i=n.getScale();if(C(e))return null;let s=i.domain().findIndex(a=>(a==null?void 0:a.toString())===e.toString());s<0&&(s=void 0);const r=Jv(e,n,"cartesian",t??(At(n.getOrient())?TB:CB));return{index:s,value:e,axis:n,data:r}};class RB{constructor(e,t){this._eventDispatcher=e,this._mode=t}get chart(){var e,t;return this._chart||(this._chart=(t=(e=this._eventDispatcher.globalInstance).getChart)===null||t===void 0?void 0:t.call(e)),this._chart}register(e,t){var i,s;((s=(i=this.chart)===null||i===void 0?void 0:i.getOption().onError)!==null&&s!==void 0?s:Kl)("Method not implemented.")}unregister(){var e,t;((t=(e=this.chart)===null||e===void 0?void 0:e.getOption().onError)!==null&&t!==void 0?t:Kl)("Method not implemented.")}getTargetDimensionInfo(e,t){var i,s;const r=(i=PB(this.chart,{x:e,y:t}))!==null&&i!==void 0?i:[],a=(s=wB(this.chart,{x:e,y:t}))!==null&&s!==void 0?s:[],o=[].concat(r,a);return o.length===0?null:o}dispatch(e,t){var i;const s=(i=this.chart)===null||i===void 0?void 0:i.getAllComponents().filter(a=>{if(a.specKey!=="axes")return!1;const o=a.getScale();return!!wi(o.type)&&(!(t!=null&&t.filter)||t.filter(a))}),r=[];return s.forEach(a=>{const o=EB(a,e);o&&r.push(o)}),this._callback.call(null,{action:"enter",dimensionInfo:r}),r}}class V9 extends RB{constructor(){super(...arguments),this.onClick=e=>{if(!e)return;const t=e.event.viewX,i=e.event.viewY,s=this.getTargetDimensionInfo(t,i);s&&this._callback.call(null,Object.assign(Object.assign({},e),{action:"click",dimensionInfo:s.slice()}))}}register(e,t){this._callback=t.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},t.query),{source:Xe.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}class N9 extends RB{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=e=>{if(!e)return;const t=e.event.viewX,i=e.event.viewY,s=this.getTargetDimensionInfo(t,i);s===null&&this._cacheDimensionInfo!==null?(this._callback.call(null,Object.assign(Object.assign({},e),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):s===null||this._cacheDimensionInfo!==null&&s.length===this._cacheDimensionInfo.length&&!s.some((r,a)=>!kB(r,this._cacheDimensionInfo[a]))?s!==null&&this._callback.call(null,Object.assign(Object.assign({},e),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},e),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=e=>{e&&(this._callback.call(null,Object.assign(Object.assign({},e),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(e,t){this._callback=t.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},t.query),{source:Xe.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},t.query),{source:Xe.canvas}),callback:this.onMouseOut}),va(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},t.query),{source:Xe.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),va(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var xr;(function(n){n.dimensionHover="dimensionHover",n.dimensionClick="dimensionClick"})(xr||(xr={}));const vy={[xr.dimensionHover]:N9,[xr.dimensionClick]:V9};let tc=class{getComposedEventMap(){return this._composedEventMap}constructor(e,t){this._composedEventMap=new Map,this._eventDispatcher=e,this._mode=t}on(e,t,i){const s=typeof t=="function"?{query:null,callback:t}:{query:t,callback:i};if(vy[e]){const r=new vy[e](this._eventDispatcher,this._mode);r.register(e,s),this._composedEventMap.set(i,{eventType:e,event:r})}else this._eventDispatcher.register(e,s);return this}off(e,t,i){var s,r;const a=i??t;if(vy[e])if(a)(s=this._composedEventMap.get(a))===null||s===void 0||s.event.unregister(),this._composedEventMap.delete(a);else for(const o of this._composedEventMap.entries())o[1].eventType===e&&((r=this._composedEventMap.get(o[0]))===null||r===void 0||r.event.unregister(),this._composedEventMap.delete(o[0]));else if(a){const o={callback:a,query:null,filter:{nodeName:null,type:e,level:null,source:t.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(e,o)}else this._eventDispatcher.unregister(e);return this}emit(e,t,i){return this._eventDispatcher.dispatch(e,t,i),this}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class U9{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(We.vchart,[]),this._levelNodes.set(We.chart,[]),this._levelNodes.set(We.model,[]),this._levelNodes.set(We.mark,[])}addHandler(e,t){var i;const s={level:t,handler:e};return(i=this._levelNodes.get(t))===null||i===void 0||i.push(s),this._map.set(e.callback,s),this}removeHandler(e){const t=this._map.get(e.callback);if(!t)return this;this._map.delete(e.callback);const i=this._levelNodes.get(t.level),s=i==null?void 0:i.findIndex(r=>r.handler.callback===e.callback);return s!==void 0&&s>=0&&(i==null||i.splice(s,1)),this}getHandlers(e){var t;return((t=this._levelNodes.get(e))===null||t===void 0?void 0:t.map(i=>i.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const BM={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label"};class $9{constructor(e,t){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.globalInstance=e,this._compiler=t}register(e,t){var i,s,r,a;this._parseQuery(t);const o=this.getEventBubble(((i=t.filter)===null||i===void 0?void 0:i.source)||Xe.chart),l=this.getEventListeners(((s=t.filter)===null||s===void 0?void 0:s.source)||Xe.chart);if(o.get(e)||o.set(e,new U9),o.get(e).addHandler(t,(r=t.filter)===null||r===void 0?void 0:r.level),this._isValidEvent(e)&&!l.has(e)){const h=this._onDelegate.bind(this);this._compiler.addEventListener((a=t.filter)===null||a===void 0?void 0:a.source,e,h),l.set(e,h)}return this}unregister(e,t){var i,s,r,a;let o=!1;const l=this.getEventBubble(((i=t==null?void 0:t.filter)===null||i===void 0?void 0:i.source)||Xe.chart),h=this.getEventListeners(((s=t==null?void 0:t.filter)===null||s===void 0?void 0:s.source)||Xe.chart);if(t){const d=l.get(e);d==null||d.removeHandler(t),(d==null?void 0:d.getCount())===0&&(d==null||d.release(),l.delete(e),o=!0),!((r=t==null?void 0:t.wrappedCallback)===null||r===void 0)&&r.cancel&&t.wrappedCallback.cancel()}else{const d=l.get(e);d==null||d.release(),l.delete(e),o=!0}if(o&&this._isValidEvent(e)){const d=h.get(e);this._compiler.removeEventListener(((a=t==null?void 0:t.filter)===null||a===void 0?void 0:a.source)||Xe.chart,e,d),h.delete(e)}return this}dispatch(e,t,i){const s=this.getEventBubble(t.source||Xe.chart).get(e);if(!s)return this;let r=!1;if(i){const a=s.getHandlers(i);r=this._invoke(a,e,t)}else{const a=s.getHandlers(We.mark);if(r=this._invoke(a,e,t),!r){const o=s.getHandlers(We.model);r=this._invoke(o,e,t)}if(!r){const o=s.getHandlers(We.chart);r=this._invoke(o,e,t)}if(!r){const o=s.getHandlers(We.vchart);r=this._invoke(o,e,t)}}return this}release(){for(const e of this._viewListeners.entries())this._compiler.removeEventListener(Xe.chart,e[0],e[1]);this._viewListeners.clear();for(const e of this._windowListeners.entries())this._compiler.removeEventListener(Xe.window,e[0],e[1]);this._windowListeners.clear();for(const e of this._canvasListeners.entries())this._compiler.removeEventListener(Xe.canvas,e[0],e[1]);this._canvasListeners.clear();for(const e of this._viewBubbles.values())e.release();this._viewBubbles.clear();for(const e of this._windowBubbles.values())e.release();this._windowBubbles.clear();for(const e of this._canvasBubbles.values())e.release();this._canvasBubbles.clear()}_filter(e,t,i){var s,r,a;if(Y(e.filter)&&!e.filter(i)||e.nodeName&&Te(i,"node.name")!==e.nodeName||e.markName&&((s=i==null?void 0:i.mark)===null||s===void 0?void 0:s.name)!==e.markName)return!1;let o=(r=i.model)===null||r===void 0?void 0:r.type;return BM[o]&&(o=BM[o]),(!e.type||o===e.type)&&!(e.level==="mark"&&!e.type&&!(i!=null&&i.mark))&&!(e.level==="model"&&!e.type&&!(i!=null&&i.model))&&(!P(e.userId)||((a=i.model)===null||a===void 0?void 0:a.userId)===e.userId)}_prepareParams(e,t){if(e.markName&&t.mark&&t.itemMap){const i=t.mark.getProductId(),s=t.itemMap.get(i),r=s==null?void 0:s.getDatum();return Object.assign(Object.assign({},t),{item:s,datum:r})}return Object.assign({},t)}_onDelegate(e){var t;const i=this.globalInstance.getChart(),s=P(e.modelId)&&(i==null?void 0:i.getModelById(e.modelId))||void 0,r=P(e.markId)&&(i==null?void 0:i.getMarkById(e.markId))||null,a=new Map;let o=(t=e.item)===null||t===void 0?void 0:t.mark;for(o&&P(o.id())&&a.set(o.id(),e.item);o!=null&&o.elements;){const h=o.id();P(h)&&!a.has(h)&&a.set(h,o.elements[0]),o=o.group}const l={event:e.event,item:e.item,datum:e.datum,source:e.source,itemMap:a,chart:i,model:s,mark:r??void 0,node:Te(e.event,"target")};this.dispatch(e.type,l)}_invoke(e,t,i){return e.map(s=>{var r,a,o;const l=s.filter;if(!s.query||this._filter(l,t,i)){const h=(s.wrappedCallback||s.callback).call(null,this._prepareParams(l,i)),d=h??((r=s.query)===null||r===void 0?void 0:r.consume);return d&&((a=i.event)===null||a===void 0||a.stopPropagation(),(o=i.event)===null||o===void 0||o.preventDefault()),!!d}}).some(s=>s===!0)}_getQueryLevel(e){return e?e.level?e.level:P(e.id)?We.model:We.vchart:We.vchart}_parseQuery(e){var t;const i=e.query;i!=null&&i.throttle?e.wrappedCallback=Ta(e.callback,i.throttle):i!=null&&i.debounce&&(e.wrappedCallback=Us(e.callback,i.debounce));let s=this._getQueryLevel(i),r=null,a=Xe.chart,o=null,l=null,h=null;return i!=null&&i.nodeName&&(o=i.nodeName),i!=null&&i.markName&&(l=i.markName),!(i!=null&&i.type)||s!==We.model&&s!==We.mark||(r=i.type),i!=null&&i.source&&(a=i.source),P(i==null?void 0:i.id)&&(h=i==null?void 0:i.id,s=We.model),e.filter={level:s,markName:l,type:r,source:a,nodeName:o,userId:h,filter:(t=i==null?void 0:i.filter)!==null&&t!==void 0?t:null},e}getEventBubble(e){switch(e){case Xe.chart:return this._viewBubbles;case Xe.window:return this._windowBubbles;case Xe.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(e){switch(e){case Xe.chart:return this._viewListeners;case Xe.window:return this._windowListeners;case Xe.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(e){return Q7.includes(e)||Object.values(de).includes(e)||Object.values(ye).includes(e)}}function Ae(n,e,t){n.getTransform(e)||n.registerTransform(e,t)}function pr(n,e,t){n.getParser(e)||n.registerParser(e,t)}const lo=new Map;let Do;function Y9(){Do||(Do=new to,pr(Do,"geojson",bP),pr(Do,"topojson",pF),Ae(Do,"simplify",hP))}function X9(n,e,t={type:"geojson",centroid:!0}){lo.has(n)&&ba(`map type of '${n}' already exists, will be overwritten.`),Y9();const i=new Ye(Do),s=re({},{centroid:!0,simplify:!1},t);t.type==="topojson"?i.parse(e,{type:"topojson",options:s}):i.parse(e,{type:"geojson",options:s}),t.simplify===!0&&i.transform({type:"simplify"}),lo.set(n,i)}function K9(n){lo.has(n)?lo.delete(n):ba(`map type of '${n}' does not exists.`)}function q9(n){return lo.get(n)}function LM(n,e=!1){let t=e;return n.latestData instanceof Ye&&(t=!1),t?ri(n.latestData):n.latestData.slice()}const im=(n,e)=>n.length===0?[]:n.length===1?LM(n[0],e==null?void 0:e.deep):n.map(t=>LM(t,e==null?void 0:e.deep));function Qv(n,e,t){e=e instanceof to?e:n.dataSet,Ae(e,"copyDataView",im);const i=new Ye(e,t);return i.parse([n],{type:"dataview"}),i.transform({type:"copyDataView",level:An.copyDataView}),i}function _g(n,e,t=[],i={}){var s,r,a;if(n instanceof Ye)return n;const{id:o,values:l=[],fromDataIndex:h,fromDataId:d,transforms:u=[]}=n,c=n.parser?ri(n.parser):{clone:!0},f=ri(n.fields);let p;c.clone=c.clone!==!1;const g=t.find(_=>_.name===o);if(g)p=g;else{const _={name:o};if(f&&(_.fields=f),p=new Ye(e,_),typeof d=="string"){const m=t.find(y=>y.name===d);if(!m)return((s=i.onError)!==null&&s!==void 0?s:Kl)(`no data matches fromDataId ${d}`),null;p.parse([m],{type:"dataview"}),p.transform({type:"copyDataView"})}else if(typeof h=="number"){const m=t[h];if(!m)return((r=i.onError)!==null&&r!==void 0?r:Kl)(`no data matches fromDataIndex ${h}`),null;p.parse([m],{type:"dataview"}),p.transform({type:"copyDataView"})}else Array.isArray(l)?p.parse(l,c):!ae(l)||c&&!["csv","dsv","tsv"].includes(c.type)?(p.parse([]),ba("values should be array")):p.parse(l,(a=c)!==null&&a!==void 0?a:{type:"csv"});u&&u.length&&u.forEach(m=>{e.getTransform(m.type)&&p.transform(m)})}return p}function I0(n,e,t){n&&(e.fields&&n.setFields(e.fields,t),n.parseNewData(e.values,e.parser))}var An;(function(n){n[n.copyDataView=-10]="copyDataView",n[n.treemapFilter=-8]="treemapFilter",n[n.treemapFlatten=-7]="treemapFlatten",n[n.dotObjFlat=-7]="dotObjFlat",n[n.linkDotInfo=-7]="linkDotInfo",n[n.sankeyLayout=-7]="sankeyLayout",n[n.dataZoomFilter=-6]="dataZoomFilter",n[n.legendFilter=-5]="legendFilter"})(An||(An={}));const Z9=(n,e)=>{const t={nodes:{}},{fields:i}=e;if(!(i!=null&&i.length))return t;const s=i.length-1;let r,a,o=t;return n.forEach(l=>{l.latestData.forEach(h=>{o=t;for(let d=0;d<i.length;d++){const u=h[i[d]];if(C(u))break;o.nodes[u]||(d===s?o.nodes[u]={values:[]}:(r={nodes:{}},o.nodes[u]=r)),d===s?(a=o.nodes[u],a.values.push(h)):o=o.nodes[u]}})}),t};var Qt;(function(n){n.appear="appear",n.disappear="disappear",n.enter="enter",n.update="update",n.state="state",n.exit="exit",n.normal="normal",n.none="none"})(Qt||(Qt={}));var oa;(function(n){n.data="data",n.signal="signal",n.mark="mark"})(oa||(oa={}));function J9(n){switch(n){case Yt["desktop-browser"]:case Yt["mobile-browser"]:return"browser";case Yt.node:case Yt.worker:return"node";case Yt.miniApp:case Yt["desktop-miniApp"]:return"feishu";case Yt.lynx:return"lynx";case Yt.wx:return"wx"}return"browser"}var Q9=function(n,e,t,i){return new(t||(t=Promise))(function(s,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?s(h.value):(d=h.value,d instanceof t?d:new t(function(u){u(d)})).then(a,o)}l((i=i.apply(n,e||[])).next())})};class eK{getVGrammarView(){return this._view}getModel(){return this._model}constructor(e,t){this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this.isReleased=!1,this._model={[oa.signal]:{},[oa.data]:{},[oa.mark]:{}},this._compileChart=null,this._container=e,this._option=t}getRenderer(){var e;return(e=this._view)===null||e===void 0?void 0:e.renderer}getCanvas(){var e;return(e=this._view)===null||e===void 0?void 0:e.renderer.canvas()}getStage(){var e;return(e=this._view)===null||e===void 0?void 0:e.renderer.stage()}initView(){var e,t,i,s;if(this.isReleased||(this.isInited=!0,this._view))return;const r=new De((e=this._option.logLevel)!==null&&e!==void 0?e:gn.Error);!((t=this._option)===null||t===void 0)&&t.onError&&r.addErrorHandler((...a)=>{var o,l;(l=(o=this._option)===null||o===void 0?void 0:o.onError)===null||l===void 0||l.call(o,...a)}),this._view=new vo(Object.assign(Object.assign({width:this._width,height:this._height,container:(i=this._container.dom)!==null&&i!==void 0?i:null,renderCanvas:(s=this._container.canvas)!==null&&s!==void 0?s:null,hooks:this._option.performanceHook},this._option),{mode:J9(this._option.mode),autoFit:!1,eventConfig:{gesture:va(this._option.mode),disable:this._option.interactive===!1},doLayout:()=>{var a;(a=this._compileChart)===null||a===void 0||a.onLayout(this._view)},logger:r,logLevel:r.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",()=>{var a,o;(o=(a=this._compileChart)===null||a===void 0?void 0:a.getEvent())===null||o===void 0||o.emit(ye.afterRender,{chart:this._compileChart})}),this._option.interactive!==!1&&this._viewListeners.forEach(a=>{var o;(o=this._view)===null||o===void 0||o.addEventListener(a.type,a.callback)})}_setCanvasStyle(){if(this._view&&this._container.dom&&!ae(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const e=this.getCanvas();e&&(e.style.display="block")}}compile(e,t){const{chart:i}=e;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}clear(e,t=!1){const{chart:i}=e;i.clear(),this.releaseGrammar(t)}renderAsync(e){var t;return Q9(this,void 0,void 0,function*(){if(!this.isReleased)return this.initView(),this._view?(yield(t=this._view)===null||t===void 0?void 0:t.runNextTick(e),this):Promise.reject("srView init fail")})}renderSync(e){var t;this.initView(),this._view&&((t=this._view)===null||t===void 0||t.runSync(e))}updateViewBox(e,t=!0){this._view&&this._view.renderer.setViewBox(e,t)}resize(e,t,i=!0){return this._view?(this._width=e,this._height=t,this._view.resize(e,t),i?this.renderAsync({morph:!1}):this):Promise.reject()}setBackground(e){var t;(t=this._view)===null||t===void 0||t.background(e)}setSize(e,t){this._width=e,this._height=t,this._view&&(this._view.width(e),this._view.height(t))}setViewBox(e,t=!0){this._view&&this._view.renderer.setViewBox(e,t)}addEventListener(e,t,i){var s,r;if(this._option.interactive!==!1){if(e===Xe.chart){const a=(function(o,l){var h,d,u;const c=(d=(h=l==null?void 0:l.mark)===null||h===void 0?void 0:h.getContext())!==null&&d!==void 0?d:{},f=P(c.modelId)?c.modelId:null,p=P(c.markId)?c.markId:null,g=P(c.modelUserId)?c.modelUserId:null,_=P(c.markUserId)?c.markUserId:null,m={event:o,type:t,source:e,item:l,datum:((u=l==null?void 0:l.getDatum)===null||u===void 0?void 0:u.call(l))||null,markId:p,modelId:f,markUserId:_,modelUserId:g};i.call(null,m)}).bind(this);this._viewListeners.set(i,{type:t,callback:a}),(s=this._view)===null||s===void 0||s.addEventListener(t,a)}else if(e===Xe.window){const a=(function(l){const h={event:l,type:t,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,h)}).bind(this);this._windowListeners.set(i,{type:t,callback:a});const o=this._getGlobalThis();o==null||o.addEventListener(t,a)}else if(e===Xe.canvas){const a=(function(l){const h={event:l,type:t,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,h)}).bind(this);this._canvasListeners.set(i,{type:t,callback:a});const o=(r=this.getStage())===null||r===void 0?void 0:r.window;o==null||o.addEventListener(t,a)}}}removeEventListener(e,t,i){var s,r,a,o;if(this._option.interactive!==!1){if(e===Xe.chart){const l=(s=this._viewListeners.get(i))===null||s===void 0?void 0:s.callback;l&&((r=this._view)===null||r===void 0||r.removeEventListener(t,l)),this._viewListeners.delete(i)}else if(e===Xe.window){const l=this._getGlobalThis(),h=(a=this._windowListeners.get(i))===null||a===void 0?void 0:a.callback;h&&(l==null||l.removeEventListener(t,h)),this._windowListeners.delete(i)}else if(e===Xe.canvas){const l=this._getGlobalThis(),h=(o=this._canvasListeners.get(i))===null||o===void 0?void 0:o.callback;h&&(l==null||l.removeEventListener(t,h)),this._canvasListeners.delete(i)}}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var e;this.releaseEvent(),this._option=this._container=null,this._releaseModel(),(e=this._view)===null||e===void 0||e.release(),this._view=null,this.isInited=!1,this.isReleased=!0}releaseGrammar(e=!1){var t,i;this._releaseModel(),e&&((t=this._view)===null||t===void 0||t.removeAllGraphicItems()),(i=this._view)===null||i===void 0||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach(e=>{Object.values(this._model[e]).forEach(t=>{Object.values(t).forEach(i=>{i.removeProduct(!0)})}),this._model[e]={}})}addGrammarItem(e){const t=e.getProduct();if(C(t))return;const i=t.id(),s=e.grammarType;C(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][e.id]=e}removeGrammarItem(e,t){var i;const s=e.getProduct();if(C(s))return;const r=s.id(),a=e.grammarType,o=this._model[a][r];P(o)&&(delete o[e.id],Object.keys(o).length===0&&delete this._model[a][r]),t||(i=this._view)===null||i===void 0||i.removeGrammar(s)}updateDepend(e){return P(e)&&e.length>0?e.every(t=>t.updateDepend()):(Object.values(this._model).forEach(t=>{Object.values(t).forEach(i=>{const s=Object.values(i),r=s[0].getProduct(),a=s.reduce((o,l)=>l.getDepend().length>0?o.concat(l.getDepend()):o,[]).filter(o=>!!o).map(o=>o.getProduct());r.depend(a)})}),!0)}_getGlobalThis(){var e;return Nn(this._option.mode)?globalThis:(e=this.getStage())===null||e===void 0?void 0:e.window}}var tK=function(n,e,t,i){return new(t||(t=Promise))(function(s,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?s(h.value):(d=h.value,d instanceof t?d:new t(function(u){u(d)})).then(a,o)}l((i=i.apply(n,e||[])).next())})};function iK(n="vchart",e){const t=document.createElement("a");t.setAttribute("href",e),t.setAttribute("target","_blank"),t.setAttribute("download",`${n}.png`),t.dispatchEvent(new MouseEvent("click"))}function nK(n){return new Promise(e=>{n.convertToBlob().then(t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}})})}function sK(n,e){var t;return tK(this,void 0,void 0,function*(){if(!n)return"";try{if(OffscreenCanvas!==void 0&&n instanceof OffscreenCanvas)return nK(n)}catch(i){((t=e==null?void 0:e.onError)!==null&&t!==void 0?t:Kl)(`getCanvasDataURL error : ${i.toString()}`)}return n.toDataURL()})}function Ra(n){n.crosshair=N(n.crosshair||{}).map(e=>pe({[n.direction==="horizontal"?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e))}function OB(n,e,t){var i;const{width:s,height:r}=n;if(P(s)&&P(r))return{width:s,height:r};let a=t.width,o=t.height;const l=e.container,h=e.canvas;if(l){const{width:d,height:u}=Gy(l,t.width,t.height);a=d,o=u}else if(h&&Nn(e.mode)){let d;d=ae(h)?document==null?void 0:document.getElementById(h):h;const{width:u,height:c}=Gy(d,t.width,t.height);a=u,o=c}else if(xa(e.mode)&&(!((i=e.modeParams)===null||i===void 0)&&i.domref)){const d=e.modeParams.domref;a=d.width,o=d.height}return a=s??a,o=r??o,{width:a,height:o}}function Fo(n,...e){const t=i=>e.reduce((s,r)=>s||(r==null?void 0:r[i]),n[i]);return Object.assign(n,{change:t("change"),reCompile:t("reCompile"),reMake:t("reMake"),reRender:t("reRender"),reSize:t("reSize")}),n}function BB(n,e){return n==="line"||n==="area"||n==="common"&&e.series.every(t=>t.type==="area"||t.type==="line")?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var _e;(function(n){n.STATE_NORMAL="normal",n.STATE_HOVER="hover",n.STATE_HOVER_REVERSE="hover_reverse",n.STATE_DIMENSION_HOVER="dimension_hover",n.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",n.STATE_SELECTED="selected",n.STATE_SELECTED_REVERSE="selected_reverse"})(_e||(_e={}));var Sd;(function(n){n.STATE_HOVER_REVERSE="hover_reverse",n.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",n.STATE_SELECTED_REVERSE="selected_reverse"})(Sd||(Sd={}));class wa{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(e,t){C(e)||(this._children.push(e),this._markNameMap[e.name]=e,this._infoMap.set(e,re({},wa.defaultMarkInfo,t)))}removeMark(e){const t=this._children.findIndex(i=>i.name===e);t>=0&&(this._infoMap.delete(this._children[t]),delete this._markNameMap[e],this._children.splice(t,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(e){this._children.forEach(e)}includes(e,t){return this._children.includes(e,t)}get(e){return isNaN(Number(e))?this._markNameMap[e]:this._children[e]}getMarks(){return this._children.slice()}getMarksInType(e){const t=N(e);return this._children.filter(i=>t.includes(i.type))}getMarkInId(e){return this._children.find(t=>t.id===e)}getMarkWithInfo(e){return this._children.find(t=>Object.keys(e).every(i=>e[i]===this._infoMap.get(t)[i]))}}wa.defaultMarkInfo={};class rK{get hover(){return this._hover}get select(){return this._select}constructor(e){this._marks=new wa,this._markReverse=new wa,this._lastDimensionEvent=null,this.onHover=t=>{const i=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(_e.STATE_DIMENSION_HOVER).forEach(s=>{this.interaction.addEventElement(_e.STATE_DIMENSION_HOVER_REVERSE,s)}),this.interaction.clearEventElement(_e.STATE_DIMENSION_HOVER,!1),i.forEach(({el:s,mark:r})=>{this.interaction.addEventElement(_e.STATE_DIMENSION_HOVER,s)}),this.interaction.reverseEventElement(_e.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(_e.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t},this._option=e,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(e){}registerMark(e){fe(e.stateStyle[_e.STATE_DIMENSION_HOVER])||this._marks.addMark(e),fe(e.stateStyle[_e.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(e)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(xr.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(e){}getEventElement(e,t=!1){const i=[];return e.dimensionInfo.forEach(s=>{s.data.forEach(r=>{(t?this._markReverse:this._marks).getMarks().filter(a=>a.model===r.series&&a.getVisible()).forEach(a=>{const o=a.getProduct().elements.filter(l=>{const h=l.getDatum();let d;return d=W(h)?h.every((u,c)=>u===r.datum[c]):r.datum.some(u=>u===h),t?!d:d}).map(l=>({el:l,mark:a}));i.push(...o)})})}),i}dimensionDataEqual(e){if(this._lastDimensionEvent===e)return!0;if(!this._lastDimensionEvent||!e||this._lastDimensionEvent.dimensionInfo.length!==e.dimensionInfo.length)return!1;for(let t=0;t<this._lastDimensionEvent.dimensionInfo.length;t++){const i=this._lastDimensionEvent.dimensionInfo[t],s=e.dimensionInfo[t];if(i.value!==s.value||i.axis!==s.axis||i.data.length!==s.data.length)return!1;for(let r=0;r<i.data.length;r++){const a=i.data[r],o=s.data[r];if(a.series!==o.series||a.datum.length!==o.datum.length)return!1;for(let l=0;l<a.datum.length;l++)if(a.datum[l]!==o.datum[l])return!1}}return!0}}function aK(n,e,t){var i;const s=(i=e[n])===null||i===void 0?void 0:i.style;return oK(n,s)||Y(s)?!0:!(!(s!=null&&s.scale)||s.field===t)}function oK(n,e){return(n==="fill"||n==="stroke")&&(e==null?void 0:e.gradient)&&(e==null?void 0:e.stops)}const LB={};Object.values(_e).forEach(n=>{LB[n]=!0});function lK(n){return!!LB[n]}const hK={[_e.STATE_HOVER]:_e.STATE_HOVER_REVERSE,[_e.STATE_SELECTED]:_e.STATE_SELECTED_REVERSE,[_e.STATE_DIMENSION_HOVER]:_e.STATE_DIMENSION_HOVER_REVERSE};function Xc(n){return hK[n]}class dK{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._disableTriggerEvent=!1}static markStateEnable(e,t){return!fe(e.stateStyle[t])}setDisableActiveEffect(e){this._disableTriggerEvent=e}registerMark(e,t){var i;this._stateMarks.has(e)||this._stateMarks.set(e,[]),(i=this._stateMarks.get(e))===null||i===void 0||i.push(t)}getStateMark(e){return this._stateMarks.get(e)}filterEventMark(e,t){var i;return!(!e.mark||!(!((i=this._stateMarks.get(t))===null||i===void 0)&&i.includes(e.mark)))}getEventElement(e){var t;return(t=this._stateElements.get(e))!==null&&t!==void 0?t:[]}getEventElementData(e){return this.getEventElement(e).map(t=>t.getDatum())}exchangeEventElement(e,t){var i;if(this._disableTriggerEvent)return;const s=Xc(e);(i=this._stateElements.get(e))===null||i===void 0||i.forEach(r=>{r.removeState(e),s&&this.addEventElement(s,r)}),t.getStates().includes(e)||(t.addState(e),s&&t.removeState(s)),this._stateElements.set(e,[t])}removeEventElement(e,t){var i,s;if(this._disableTriggerEvent)return;t.removeState(e);const r=(s=(i=this._stateElements.get(e))===null||i===void 0?void 0:i.filter(o=>o!==t))!==null&&s!==void 0?s:[];this._stateElements.set(e,r);const a=Xc(e);a&&(r.length===0?this.clearEventElement(a,!1):this.addEventElement(a,t))}addEventElement(e,t){var i;if(this._disableTriggerEvent)return;t.getStates().includes(e)||t.addState(e);const s=(i=this._stateElements.get(e))!==null&&i!==void 0?i:[];s.push(t),this._stateElements.set(e,s)}clearEventElement(e,t){var i;if(!this._disableTriggerEvent&&((i=this._stateElements.get(e))===null||i===void 0||i.forEach(s=>{s.removeState(e)}),this._stateElements.set(e,[]),t)){const s=Xc(e);s&&this.clearEventElement(s,!1)}}reverseEventElement(e){if(this._disableTriggerEvent)return;const t=Xc(e);if(!t)return;const i=this.getStateMark(t);if(!i)return;const s=this.getEventElement(e);s.length&&(this.getEventElement(t).length||(s.length===1?i.forEach(r=>{r.getProduct().elements.filter(a=>a!==s[0]).forEach(a=>{this.addEventElement(t,a)})}):i.forEach(r=>{r.getProduct().elements.filter(a=>!s.includes(a)).forEach(a=>{this.addEventElement(t,a)})})))}}class nm{getOption(){return this._option}constructor(e){this._option=e,this.getCompiler=this._option.getCompiler}getVGrammarView(){var e;return(e=this.getCompiler())===null||e===void 0?void 0:e.getVGrammarView()}release(){this._option=null}}class D0 extends nm{constructor(){super(...arguments),this.id=mo(),this._compiledProductId=null,this._depend=[]}getProduct(){if(P(this._product))return this._product;const e=this.getVGrammarView(),t=this.getProductId();return P(t)&&P(e)&&(this._product=this._lookupGrammar(t)),this._product}getProductId(){var e;return(e=this._compiledProductId)!==null&&e!==void 0?e:this.generateProductId()}getDepend(){return this._depend}setDepend(...e){this._depend=e}compile(e){this._compileProduct(e),this._afterCompile(e)}_afterCompile(e){var t;P(this._product)&&((t=this.getCompiler())===null||t===void 0||t.addGrammarItem(this))}updateDepend(){if(P(this._product)){const e=this.getDepend().map(t=>t.getProduct()).filter(P);return this._product.depend(e),e.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(e){this.getCompiler().removeGrammarItem(this,e),this._product=null,this._compiledProductId=null}}class uK extends D0{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(e,t,i,s){super(e),this.grammarType=oa.signal,this.name=t,this._value=i,this._updateFunc=s}updateSignal(e,t){this._value=e,this._updateFunc=t,this.compile()}_compileProduct(){const e=this.getVGrammarView();if(e){if(!this.getProduct()){const t=this.getProductId();this._product=e.signal().id(t),this._compiledProductId=t}P(this._value)&&this._product.value(this._value),P(this._updateFunc)&&this._product.update(this._updateFunc)}}generateProductId(){return this.name}_lookupGrammar(e){var t;return(t=this.getCompiler().getVGrammarView())===null||t===void 0?void 0:t.getSignalById(e)}}class cK extends nm{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(e){return this._signalMap[e]}updateSignal(e,t,i){this._signalMap[e]?this._signalMap[e].updateSignal(t,i):(this._signalMap[e]=new uK(this._option,e,t,i),this._signalMap[e].compile())}compile(){Object.values(this._signalMap).forEach(e=>{e.compile()})}release(){super.release(),Object.values(this._signalMap).forEach(e=>{e.release()}),this._signalMap={}}}class IB extends cK{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(e){super(e),e.stateKeyToSignalName?this.stateKeyToSignalName=e.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(e){this._stateMap=e??this._getDefaultStateMap()}compile(e){const t=e??this._stateMap;Object.keys(t).forEach(i=>{const s=this.stateKeyToSignalName(i),r=t[i];this.updateSignal(s,r)})}updateState(e,t){return e?(re(this._stateMap,e),this.compile(e),t?Promise.resolve():this.getCompiler().renderAsync()):Promise.resolve()}}class DB extends IB{constructor(){super(...arguments),this.id=mo(),this.stateKeyToSignalName=e=>`${be}_animate_${this.id}_${e}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(e,t){e===Qt.update?this.updateState({animationState:{callback:(i,s)=>s.diffState}},t):e===Qt.appear?this.updateState({animationState:{callback:(i,s)=>s.diffState==="exit"?Qt.none:Qt.appear}},t):this.updateState({animationState:{callback:(i,s)=>e}},t)}_getDefaultStateMap(){return{animationState:{callback:(e,t)=>t.diffState==="exit"?Qt.exit:Qt.appear}}}}class sm{constructor(e){this._option=e,this.type=e.type}_initTheme(e,t){return this._theme=this.getTheme(e,t),this._mergeThemeToSpec(e,t)}getTheme(e,t){}transformSpec(e,t,i){this._transformSpecBeforeMergingTheme(e,t,i);const s=this._initTheme(e,t);return this._transformSpecAfterMergingTheme(s.spec,t,i),s}_transformSpecBeforeMergingTheme(e,t,i){}_transformSpecAfterMergingTheme(e,t,i){}_mergeThemeToSpec(e,t){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(t),r=a=>pe({},i,s,a);return W(e)?{spec:e.map(a=>r(a)),theme:i}:{spec:r(e),theme:i}}return{spec:e,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(e){}}class F0 extends nm{getSpec(){return this._spec||{}}getSpecPath(){return this._option.specPath}getSpecInfoPath(){var e;return(e=this._option.specInfoPath)!==null&&e!==void 0?e:this._option.specPath}getData(){return this._data}get layout(){return this._layout}getSpecIndex(){return this._specIndex}getOption(){return this._option}getMarks(){var e,t;return(t=(e=this._marks)===null||e===void 0?void 0:e.getMarks())!==null&&t!==void 0?t:[]}getMarkNameMap(){var e;return(e=this._marks)===null||e===void 0?void 0:e.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map(e=>({type:e.type,name:e.name}))}getChart(){return this._option.getChart()}get _theme(){var e;return(e=this.getSpecInfo())===null||e===void 0?void 0:e.theme}constructor(e,t){var i,s;super(t),this.transformerConstructor=sm,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this._specIndex=0,this.specKey="",this._marks=new wa,this._lastLayoutRect=null,this.id=mo(),this.userId=e.id,this._spec=e,this._specIndex=(i=t.specIndex)!==null&&i!==void 0?i:0,this.effect={},this.event=new tc(t.eventDispatcher,t.mode),(s=t.map)===null||s===void 0||s.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(e){}afterInit(){}getVisible(){var e;return((e=this._spec)===null||e===void 0?void 0:e.visible)!==!1}onLayoutStart(e,t,i){var s;(s=this._layout)===null||s===void 0||s.onLayoutStart(e,t,i)}onLayoutEnd(e){var t;(t=this._layout)===null||t===void 0||t.onLayoutEnd(e),this.getMarks().forEach(i=>i.updateLayoutState(!0,!0))}onEvaluateEnd(e){}onDataUpdate(){}beforeRelease(){}release(){var e;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach(t=>t.release()),(e=this._data)===null||e===void 0||e.release(),this._data=this._specIndex=null,this._marks.clear(),super.release()}updateSpec(e){const t=this._compareSpec(e,this._spec);return this._spec=e,t.reMake||this.reInit(),t}_compareSpec(e,t){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(e){e&&(this._spec=e),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var e;(e=this._layout)===null||e===void 0||e.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(e){return Object.assign({},e)}setMarkStyle(e,t,i,s){P(e)&&P(t)&&e.setStyle(this._convertMarkStyle(t),i,s)}initMarkStyleWithSpec(e,t,i){if(!P(e)||!P(t))return;const{style:s,state:r}=t,a=Object.assign({},t);s&&(a.style=this._convertMarkStyle(s)),r&&(a.state={},Object.keys(r).forEach(o=>{a.state[o]=this._convertMarkStyle(r[o])})),e.initStyleWithSpec(a,i)}stateKeyToSignalName(e,t){let i=`${be}_${this.modelType}_${this.type}_${this.id}_${e}`;return t&&(i+=`_${t}`),i}compileData(){var e;(e=this._data)===null||e===void 0||e.compile()}compileMarks(e){this.getMarks().forEach(t=>{t.compile({group:e})})}_createMark(e,t={}){const{type:i,name:s}=e,r=D.createMark(i,s,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},t));return r==null||r.created(),r}_getDataIdKey(){}getColorScheme(){var e,t;return(t=(e=this._option).getTheme)===null||t===void 0?void 0:t.call(e).colorScheme}getSpecInfo(){var e,t,i;const s=(i=(t=(e=this._option).getSpecInfo)===null||t===void 0?void 0:t.call(e))!==null&&i!==void 0?i:{};return $5(s,this.getSpecInfoPath())}}class fK{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(e){this._minWidth=e}get maxWidth(){return this._maxWidth}set maxWidth(e){this._maxWidth=e}get minHeight(){return this._minHeight}set minHeight(e){this._minHeight=e}get maxHeight(){return this._maxHeight}set maxHeight(e){this._maxHeight=e}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(e){this._layoutOrient=e}get model(){return this._model}get type(){return this._model.type}constructor(e,t){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:hn,height:hn},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=bs.Region,this._model=e,this._option=t,this.layoutLevel=t.layoutLevel,this.layoutType=t.layoutType,t.layoutOrient&&(this.layoutOrient=t.layoutOrient),this._spec=(i=e==null?void 0:e.getSpec)===null||i===void 0?void 0:i.call(e)}_setLayoutAttributeFromSpec(e,t){var i,s,r,a;if(this._spec&&this._spec.visible!==!1){const o=vr(e.padding),l=cB(o,t,t);this.layoutPaddingLeft=l.left,this.layoutPaddingRight=l.right,this.layoutPaddingTop=l.top,this.layoutPaddingBottom=l.bottom,this._minHeight=C(e.minHeight)?(i=this._minHeight)!==null&&i!==void 0?i:null:Ii(e.minHeight,t.height,t),this._maxHeight=C(e.maxHeight)?(s=this._maxHeight)!==null&&s!==void 0?s:null:Ii(e.maxHeight,t.height,t),this._minWidth=C(e.minWidth)?(r=this._minWidth)!==null&&r!==void 0?r:null:Ii(e.minWidth,t.width,t),this._maxWidth=C(e.maxWidth)?(a=this._maxWidth)!==null&&a!==void 0?a:null:Ii(e.maxWidth,t.width,t),e.width&&this.setLayoutRect({width:Ii(e.width,t.width,t)},{width:Fr}),e.height&&this.setLayoutRect({height:Ii(e.height,t.height,t)},{height:Fr}),C(e.offsetX)||(this.layoutOffsetX=Ii(e.offsetX,t.width,t)),C(e.offsetY)||(this.layoutOffsetY=Ii(e.offsetY,t.height,t)),e.alignSelf&&(this.alignSelf=e.alignSelf)}}setAttrFromSpec(e,t){var i,s,r,a;this._spec=e,this.layoutType=(i=e.layoutType)!==null&&i!==void 0?i:this.layoutType,this.layoutLevel=(s=e.layoutLevel)!==null&&s!==void 0?s:this.layoutLevel,this.layoutOrient=(r=e.orient)!==null&&r!==void 0?r:this.layoutOrient,this._setLayoutAttributeFromSpec(e,t),this.layoutClip=(a=e.clip)!==null&&a!==void 0?a:this.layoutClip}onLayoutStart(e,t,i){this._setLayoutAttributeFromSpec(this._spec,t)}onLayoutEnd(e){}_getAbsoluteSpecValue(e){const t={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach(i=>{C(this._spec[i])||(t[i]=Ii(this._spec[i],i==="top"||i==="bottom"?e.height:e.width,e))}),t}absoluteLayoutInRect(e){const{top:t,bottom:i,left:s,right:r}=this._getAbsoluteSpecValue(e),a={width:e.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:e.height-this.layoutPaddingTop-this.layoutPaddingBottom};C(s)||(a.width-=s),C(r)||(a.width-=r),C(t)||(a.height-=t),C(i)||(a.height-=i),this.setLayoutRect(a);const{width:o,height:l}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:o,height:l});const h={x:e.x,y:e.y};this._spec.center===!0?(h.x=e.x+.5*e.width-.5*o,h.y=e.y+.5*e.height-.5*l):(C(s)?C(r)||(h.x=e.x+e.width-this.layoutPaddingRight-r-o):h.x=e.x+s+this.layoutPaddingLeft,C(t)?C(i)||(h.y=e.y+e.height-this.layoutPaddingBottom-i-l):h.y=e.y+t+this.layoutPaddingTop),this.setLayoutStartPosition(h)}setLayoutStartPosition(e){var t,i;this._option.transformLayoutPosition&&(e=this._option.transformLayoutPosition(e)),j(e.x)&&(this._layoutStartPoint.x=e.x),j(e.y)&&(this._layoutStartPoint.y=e.y),(i=(t=this._model).afterSetLayoutStartPoint)===null||i===void 0||i.call(t,this._layoutStartPoint)}setLayoutRect({width:e,height:t},i){var s,r,a,o;j(e)&&((s=i==null?void 0:i.width)!==null&&s!==void 0?s:hn)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=e,this._layoutRectLevelMap.width=(r=i==null?void 0:i.width)!==null&&r!==void 0?r:hn),j(t)&&((a=i==null?void 0:i.height)!==null&&a!==void 0?a:hn)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=t,this._layoutRectLevelMap.height=(o=i==null?void 0:i.height)!==null&&o!==void 0?o:hn),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:e,height:t}){const i={width:e,height:t};return this._layoutRectLevelMap.width>hn&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>hn&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return this._layoutOrient==="bottom"||this._layoutOrient==="top"?"x":"y"}getOrientSizeAttribute(){return this._layoutOrient==="bottom"||this._layoutOrient==="top"?"width":"height"}changeBoundsBySetting(e){return this._layoutRectLevelMap.width>hn&&(e.x2=e.x1+this._layoutRect.width),this._layoutRectLevelMap.height>hn&&(e.y2=e.y1+this._layoutRect.height),e.x1-=this._layoutStartPoint.x,e.x2-=this._layoutStartPoint.x,e.y1-=this._layoutStartPoint.y,e.y2-=this._layoutStartPoint.y,e}setRectInSpec(e){const t=Object.assign({},e);return this._layoutRectLevelMap.width<Fr?(C(this._minWidth)||(t.width=Math.max(t.width,this._minWidth)),C(this._maxWidth)||(t.width=Math.min(t.width,this._maxWidth))):t.width=this._layoutRect.width,this._layoutRectLevelMap.height<Fr?(C(this._minHeight)||(t.height=Math.max(t.height,this._minHeight)),C(this._maxHeight)||(t.height=Math.min(t.height,this._maxHeight))):t.height=this._layoutRect.height,t}computeBoundsInRect(e){if(this._lastComputeRect=e,this.layoutType==="region-relative"&&(this._layoutRectLevelMap.width===Fr&&(this.layoutOrient==="left"||this.layoutOrient==="right")||this._layoutRectLevelMap.height===Fr&&(this.layoutOrient==="bottom"||this.layoutOrient==="top")))return this._layoutRect;const t=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(e),e));this.changeBoundsBySetting(t),this.autoIndent&&t.x2-t.x1>0&&t.y2-t.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-t.x1),this._lastComputeOutBounds.x2=Math.ceil(t.x2-e.width),this._lastComputeOutBounds.y1=Math.ceil(-t.y1),this._lastComputeOutBounds.y2=Math.ceil(t.y2-e.height));let i=this.setRectInSpec(pX(t,e));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class FB extends F0{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null}get layoutOrient(){return this._orient}set layoutOrient(e){this._orient=e,this._layout&&(this._layout.layoutOrient=e)}initLayout(){this.layoutType!=="none"&&(this._layout=new fK(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&this._orient!=="radius"&&this._orient!=="angle"&&this.layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(e,t,i){this._isLayout=!0,super.onLayoutStart(e,t,i)}onLayoutEnd(e){super.onLayoutEnd(e),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&ft(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(e){}_forceLayout(){var e;this._isLayout||(this._forceLayoutTag=!0,(e=this._option.globalInstance.getChart())===null||e===void 0||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(e){return this._layout?this._layout.setLayoutStartPosition(e):this._layoutStartPos=re(this._layoutStartPos,e)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(e,t){return this._layout?this._layout.setLayoutRect(e):this._lastLayoutRect=re(this._layoutRect,e)}getLastComputeOutBounds(){var e;return(e=this._layout)===null||e===void 0?void 0:e.getLastComputeOutBounds()}setAttrFromSpec(){var e,t,i;super.setAttrFromSpec(),this.layoutClip=(e=this._spec.clip)!==null&&e!==void 0?e:this.layoutClip,this.layoutZIndex=(t=this._spec.zIndex)!==null&&t!==void 0?t:this.layoutZIndex,this.layoutType=(i=this._spec.layoutType)!==null&&i!==void 0?i:this.layoutType}}class zB extends sm{_initTheme(e,t){return{spec:e,theme:this._theme}}}class Wl extends FB{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(e){this._layout.maxWidth=e}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(e){this._layout.maxHeight=e}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return this._spec.stackInverse===!0}constructor(e,t){var i;super(e,t),this.transformerConstructor=zB,this.modelType="region",this.specKey="region",this.type=Wl.type,this._series=[],this.layoutType="region",this.layoutZIndex=rt.Region,this.interaction=new dK,this.seriesDataFilterOver=()=>{this.event.emit(ye.regionSeriesDataFilterOver,{model:this}),this._series.forEach(s=>{s.getViewDataFilter()&&s.reTransformViewData()})},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=(i=e.coordinate)!==null&&i!==void 0?i:"cartesian",this._option.animation&&(this.animate=new DB({getCompiler:t.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var e,t,i,s;const r=this._option.getChart().getSpec(),a=(t=(e=r.dataZoom)===null||e===void 0?void 0:e.some)===null||t===void 0?void 0:t.call(e,l=>{var h;return((h=l.filterMode)!==null&&h!==void 0?h:"filter")==="axis"}),o=(s=(i=r.scrollBar)===null||i===void 0?void 0:i.some)===null||s===void 0?void 0:s.call(i,l=>{var h;return((h=l.filterMode)!==null&&h!==void 0?h:"axis")==="axis"});return!(!a&&!o)||this._layout.layoutClip}created(){var e;this.initLayout(),super.created();const t=(e=this._spec.clip)!==null&&e!==void 0?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",this.userId+"_interaction",rt.Interaction),this._spec.style&&(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),t&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach(i=>{i&&(i.created(),this.setMarkStyle(i,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",J.Built_In),this._groupMark.addMark(i))}),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(rt.Mark+1)),this.createTrigger()}_createGroupMark(e,t,i){var s,r;const a=this._createMark({type:"group",name:e});a.setUserId(t),a.setZIndex(i);const o=(s=this._spec.clip)!==null&&s!==void 0?s:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",J.Built_In),this.setMarkStyle(a,{cornerRadius:(r=this._spec.style)===null||r===void 0?void 0:r.cornerRadius},"normal",J.User_Mark),this._marks.addMark(a),a}init(e){super.init(e),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,t;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:!((e=this._spec.style)===null||e===void 0)&&e.fill?1:0},this._spec.style),"normal",J.User_Mark),((t=this._spec.clip)!==null&&t!==void 0?t:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",J.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",J.User_Mark)}_compareSpec(e,t){const i=super._compareSpec(e,t);return ft(t==null?void 0:t.style,e==null?void 0:e.style)||(i.reMake=!0),i}reInit(e){super.reInit(e),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(e){e&&(this._series.includes(e)||this._series.push(e))}removeSeries(e){if(!e)return;const t=this._series.findIndex(i=>i===e);t>=0&&this._series.splice(t,1)}getSeries(e={}){return this._series.filter(t=>{var i,s;return(!e.name||(t==null?void 0:t.name)===e.name)&&(!e.userId||N(e.userId).includes(t.userId))&&(!P(e.specIndex)||!t.getSpecIndex||N(e.specIndex).includes(t.getSpecIndex()))&&(!e.id||t.id===e.id)&&(!e.type||t.type===e.type)&&(!e.coordinateType||t.coordinate===e.coordinateType)&&(!e.dataName||((s=(i=t.getRawData)===null||i===void 0?void 0:i.call(t))===null||s===void 0?void 0:s.name)===e.dataName)})}getSeriesInName(e){return this.getSeries({name:e})[0]}getSeriesInUserId(e){return this.getSeries({userId:e})[0]}getSeriesInId(e){return this.getSeries({id:e})[0]}getSeriesInType(e){return this.getSeries({type:e})}getSeriesInCoordinateType(e){return this.getSeries({coordinateType:e})}getSeriesInDataName(e){return this.getSeries({dataName:e})}onRender(e){}initSeriesDataflow(){const e=this._series.map(t=>{var i;return(i=t.getViewDataFilter())!==null&&i!==void 0?i:t.getViewData()}).filter(t=>!!t);this._option.dataSet.multipleDataViewAddListener(e,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const e=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new rK(e)}initTrigger(){this._series.forEach(e=>{e.getMarksWithoutRoot().forEach(t=>{this._trigger.registerMark(t)})}),this._trigger.init()}initInteraction(){this._series.forEach(e=>{e.getMarksWithoutRoot().forEach(t=>{for(const i in Sd)fe(t.stateStyle[Sd[i]])||this.interaction.registerMark(Sd[i],t)})})}compileMarks(e){this.getMarks().forEach(t=>{var i;t.compile({group:e}),(i=t.getProduct())===null||i===void 0||i.configure({context:{model:this}}).layout((s,r,a,o)=>{})})}compile(){var e;(e=this.animate)===null||e===void 0||e.compile(),this.compileMarks()}onLayoutEnd(e){this._series.forEach(t=>t.onLayoutEnd(e)),super.onLayoutEnd(e)}}Wl.type="region",Wl.transformerConstructor=zB,Wl.specKey="region";function rm(n){const e=[],t=[],i=[];return n.forEach(s=>{C(s.getSpec().position)||s.getSpec().position==="start"?e.push(s):s.getSpec().position==="middle"?t.push(s):s.getSpec().position==="end"&&i.push(s)}),{startItems:e,endItems:i,middleItems:t}}function jB(n,e,t){e?n.forEach(i=>{const s=ra(i),r=s.getLayoutStartPoint().y+s.getLayoutRect().height-i[0].getLayoutStartPoint().y,a=(t-r)/2;i.forEach(o=>{o.setLayoutStartPosition({x:o.getLayoutStartPoint().x,y:o.getLayoutStartPoint().y+a})})}):n.forEach(i=>{const s=ra(i),r=s.getLayoutStartPoint().x+s.getLayoutRect().width-i[0].getLayoutStartPoint().x,a=(t-r)/2;i.forEach(o=>{o.setLayoutStartPosition({x:o.getLayoutStartPoint().x+a,y:o.getLayoutStartPoint().y})})})}function am(n,e,t,i){let s;n.forEach((r,a)=>{r.length>1&&(s=t[a],r.forEach(o=>{if(!o.alignSelf||o.alignSelf==="start")return;const l=o.getLayoutStartPoint(),h=o.alignSelf==="middle"?.5:1,d=e?s-(o.getLayoutRect().width+o.layoutPaddingLeft+o.layoutPaddingRight):s-(o.getLayoutRect().height+o.layoutPaddingTop+o.layoutPaddingBottom);e?o.setLayoutStartPosition({x:l.x+i*d*h,y:l.y}):o.setLayoutStartPosition({x:l.x,y:l.y+i*d*h})}))})}function mg(n,e,t,i,s){if(n.length){let r=0;const a=s==="right",o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const d=[];let u=[];const c=[];n.forEach(f=>{const p=e.getItemComputeLayoutRect(f),g=f.computeBoundsInRect(p);f.setLayoutRect(g);const _=g.height+f.layoutPaddingTop+f.layoutPaddingBottom,m=g.width+f.layoutPaddingLeft+f.layoutPaddingRight,y=a?-g.width-f.layoutPaddingRight:f.layoutPaddingLeft;f.setLayoutStartPosition({x:l+f.layoutOffsetX+y,y:h+f.layoutOffsetY+f.layoutPaddingTop}),h+=_,h>t&&u.length?(c.push(r),l+=o*r,r=m,h=e.topCurrent+_,f.setLayoutStartPosition({x:l+f.layoutOffsetX+y,y:e.topCurrent+f.layoutOffsetY+f.layoutPaddingTop}),d.push(u),u=[f]):(r=Math.max(r,m),u.push(f))}),c.push(r),d.push(u),am(d,!0,c,o),i&&jB(d,!0,t),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function HB(n,e,t,i){if(n.length){let s=0;const r=i==="right",a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let d=[];const u=[];n.forEach(c=>{const f=e.getItemComputeLayoutRect(c),p=c.computeBoundsInRect(f);c.setLayoutRect(p);const g=p.height+c.layoutPaddingTop+c.layoutPaddingBottom,_=p.width+c.layoutPaddingLeft+c.layoutPaddingRight,m=r?-p.width-c.layoutPaddingRight:c.layoutPaddingLeft;l<g&&d.length?(u.push(s),o+=a*s,s=_,l=e.bottomCurrent,c.setLayoutStartPosition({x:o+c.layoutOffsetX+m,y:l+c.layoutOffsetY-p.height-c.layoutPaddingBottom}),h.push(d),d=[c]):(c.setLayoutStartPosition({x:o+c.layoutOffsetX+m,y:l+c.layoutOffsetY-p.height-c.layoutPaddingBottom}),s=Math.max(s,_),l-=g,d.push(c))}),u.push(s),h.push(d),am(h,!0,u,a),r?e.rightCurrent=o+a*s:e.leftCurrent=o+a*s}}function yg(n,e,t,i,s){if(n.length){const r=s==="top",a=r?1:-1;let o=0,l=e.leftCurrent,h=r?e.topCurrent:e.bottomCurrent;const d=[];let u=[];const c=[];n.forEach(f=>{const p=e.getItemComputeLayoutRect(f),g=f.computeBoundsInRect(p);f.setLayoutRect(g);const _=g.height+f.layoutPaddingTop+f.layoutPaddingBottom,m=g.width+f.layoutPaddingLeft+f.layoutPaddingRight,y=r?f.layoutPaddingTop:-g.height-f.layoutPaddingBottom;f.setLayoutStartPosition({x:l+f.layoutOffsetX+f.layoutPaddingLeft,y:h+f.layoutOffsetY+y}),l+=m,l>t&&u.length?(c.push(o),l=e.leftCurrent+m,h+=a*o,o=_,f.setLayoutStartPosition({x:e.leftCurrent+f.layoutOffsetX+f.layoutPaddingLeft,y:h+f.layoutOffsetY+y}),d.push(u),u=[f]):(o=Math.max(o,_),u.push(f))}),c.push(o),d.push(u),am(d,!1,c,a),i&&jB(d,!1,t),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function GB(n,e,t,i){if(n.length){const s=i==="top",r=s?1:-1;let a=0,o=e.rightCurrent,l=s?e.topCurrent:e.bottomCurrent;const h=[];let d=[];const u=[];n.forEach(c=>{const f=e.getItemComputeLayoutRect(c),p=c.computeBoundsInRect(f);c.setLayoutRect(p);const g=p.height+c.layoutPaddingTop+c.layoutPaddingBottom,_=p.width+c.layoutPaddingLeft+c.layoutPaddingRight,m=s?c.layoutPaddingTop:-p.height-c.layoutPaddingBottom;o<_&&d.length?(o=e.rightCurrent,l+=r*a,a=g,c.setLayoutStartPosition({x:e.rightCurrent+c.layoutOffsetX-p.width-c.layoutPaddingRight,y:l+c.layoutOffsetY+m}),h.push(d),d=[c]):(d.push(c),c.setLayoutStartPosition({x:o+c.layoutOffsetX-p.width-c.layoutPaddingRight,y:l+c.layoutOffsetY+m}),a=Math.max(a,g),o-=_)}),u.push(a),h.push(d),am(h,!1,u,r),s?e.topCurrent=l+r*a:e.bottomCurrent=l+r*a}}function pK(n,e,t){const{startItems:i,middleItems:s,endItems:r}=rm(n);i.length&&mg(i,e,t,!1,"left"),s.length&&mg(s,e,t,!0,"left"),r.length&&HB(r,e,t,"left")}function gK(n,e,t){const{startItems:i,middleItems:s,endItems:r}=rm(n);i.length&&mg(i,e,t,!1,"right"),s.length&&mg(s,e,t,!0,"right"),r.length&&HB(r,e,t,"right")}function _K(n,e,t){const{startItems:i,middleItems:s,endItems:r}=rm(n);i.length&&yg(i,e,t,!1,"top"),s.length&&yg(s,e,t,!0,"top"),r.length&&GB(r,e,t,"top")}function mK(n,e,t){const{startItems:i,middleItems:s,endItems:r}=rm(n);i.length&&yg(i,e,t,!1,"bottom"),s.length&&yg(s,e,t,!0,"bottom"),r.length&&GB(r,e,t,"bottom")}class z0{constructor(e,t){this.leftCurrent=0,this.topCurrent=0,this.rightCurrent=0,this.bottomCurrent=0,this._onError=t==null?void 0:t.onError}_layoutInit(e,t,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,t.sort((r,a)=>a.layoutLevel-r.layoutLevel)}_layoutNormalItems(e){this.layoutNormalInlineItems(e.filter(t=>t.layoutType==="normal-inline")),this.layoutNormalItems(e.filter(t=>t.layoutType==="normal"))}_groupItems(e){const t=e.filter(o=>o.layoutType==="region"),i=e.filter(o=>o.layoutType==="region-relative"),s=e.filter(o=>o.layoutType==="region-relative-overlap"),r=i.concat(s),a={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(o=>{a[o.layoutOrient].items.push(o)}),{regionItems:t,relativeItems:i,relativeOverlapItems:s,allRelatives:r,overlapItems:a}}layoutItems(e,t,i,s){this._layoutInit(e,t,i,s),this._layoutNormalItems(t);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:a,relativeItems:o,relativeOverlapItems:l,allRelatives:h,overlapItems:d}=this._groupItems(t);this.layoutRegionItems(a,o,l,d),this._processAutoIndent(a,o,l,d,h,r),this.layoutAbsoluteItems(t.filter(u=>u.layoutType==="absolute"))}_processAutoIndent(e,t,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,a){if(r.some(o=>o.autoIndent)){const{top:o,bottom:l,left:h,right:d}=this._checkAutoIndent(r,a);(o||l||h||d)&&(this.topCurrent=a.top+o,this.bottomCurrent=a.bottom-l,this.leftCurrent=a.left+h,this.rightCurrent=a.right-d,this.layoutRegionItems(e,t,i,s))}}layoutNormalItems(e){e.forEach(t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);t.setLayoutRect(s),t.layoutOrient==="left"?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=s.width+t.layoutPaddingLeft+t.layoutPaddingRight):t.layoutOrient==="top"?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=s.height+t.layoutPaddingTop+t.layoutPaddingBottom):t.layoutOrient==="right"?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-s.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=s.width+t.layoutPaddingLeft+t.layoutPaddingRight):t.layoutOrient==="bottom"&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-s.height-t.layoutPaddingBottom}),this.bottomCurrent-=s.height+t.layoutPaddingTop+t.layoutPaddingBottom)})}layoutNormalInlineItems(e){const t=e.filter(l=>l.layoutOrient==="left"),i=e.filter(l=>l.layoutOrient==="right"),s=e.filter(l=>l.layoutOrient==="top"),r=e.filter(l=>l.layoutOrient==="bottom"),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;t.length&&pK(t,this,o),s.length&&_K(s,this,a),i.length&&gK(i,this,o),r.length&&mK(r,this,a)}_layoutRelativeOverlap(e,t){t.items.forEach(i=>{const s=this.getItemComputeLayoutRect(i),r=i.computeBoundsInRect(s);t.rect.width=Math.max(r.width,t.rect.width),t.rect.height=Math.max(r.height,t.rect.height)}),t.items.forEach(i=>{i.setLayoutRect(t.rect),e==="left"?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX+i.layoutPaddingLeft}):e==="right"?i.setLayoutStartPosition({x:this.rightCurrent+i.layoutOffsetX+i.layoutPaddingLeft}):e==="top"?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetX+i.layoutPaddingLeft}):i.setLayoutStartPosition({x:this.bottomCurrent+i.layoutOffsetX+i.layoutPaddingLeft})}),e==="left"?this.leftCurrent+=t.rect.width:e==="right"?this.rightCurrent-=t.rect.width:e==="top"?this.topCurrent+=t.rect.height:this.bottomCurrent-=t.rect.height}_layoutRelativeItem(e,t){const i=e.computeBoundsInRect(t);e.layoutOrient==="left"||e.layoutOrient==="right"?e.setLayoutRect({width:i.width}):e.setLayoutRect({height:i.height}),e.layoutOrient==="left"?(e.setLayoutStartPosition({x:this.leftCurrent+e.layoutOffsetX+e.layoutPaddingLeft}),this.leftCurrent+=i.width+e.layoutPaddingLeft+e.layoutPaddingRight):e.layoutOrient==="right"?(this.rightCurrent-=i.width+e.layoutPaddingLeft+e.layoutPaddingRight,e.setLayoutStartPosition({x:this.rightCurrent+e.layoutOffsetX+e.layoutPaddingLeft})):e.layoutOrient==="top"?(e.setLayoutStartPosition({y:this.topCurrent+e.layoutOffsetY+e.layoutPaddingTop}),this.topCurrent+=i.height+e.layoutPaddingTop+e.layoutPaddingBottom):e.layoutOrient==="bottom"&&(this.bottomCurrent-=i.height+e.layoutPaddingTop+e.layoutPaddingBottom,e.setLayoutStartPosition({y:this.bottomCurrent+e.layoutOffsetY+e.layoutPaddingTop}))}_layoutRegionItem(e,t,i){const s=Math.max(Math.min(t,...e.map(a=>{var o;return(o=a.maxWidth)!==null&&o!==void 0?o:Number.MAX_VALUE})),0),r=Math.max(Math.min(i,...e.map(a=>{var o;return(o=a.maxHeight)!==null&&o!==void 0?o:Number.MAX_VALUE})),0);return e.forEach(a=>{a.setLayoutRect({width:s,height:r}),a.setLayoutStartPosition({x:this.leftCurrent+a.layoutOffsetX+a.layoutPaddingLeft,y:this.topCurrent+a.layoutOffsetY+a.layoutPaddingTop})}),{regionHeight:r,regionWidth:s}}layoutRegionItems(e,t,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}}}){let r=this.rightCurrent-this.leftCurrent,a=this.bottomCurrent-this.topCurrent;t.filter(h=>h.layoutOrient==="left"||h.layoutOrient==="right").forEach(h=>{this._layoutRelativeItem(h,this.getItemComputeLayoutRect(h))}),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),r=this.rightCurrent-this.leftCurrent,t.filter(h=>h.layoutOrient==="top"||h.layoutOrient==="bottom").forEach(h=>{this._layoutRelativeItem(h,this.getItemComputeLayoutRect(h))}),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),a=this.bottomCurrent-this.topCurrent;const{regionWidth:o,regionHeight:l}=this._layoutRegionItem(e,r,a);t.concat(i).forEach(h=>{if(["left","right"].includes(h.layoutOrient)){const d=this.filterRegionsWithID(e,h.layoutBindRegionID[0]);h.setLayoutRect({height:d.getLayoutRect().height}),h.setLayoutStartPosition({y:d.getLayoutStartPoint().y+h.layoutOffsetY+h.layoutPaddingTop}),h.layoutOrient==="right"&&h.setLayoutStartPosition({x:h.getLayoutStartPoint().x+o-r})}else if(["top","bottom"].includes(h.layoutOrient)){const d=this.filterRegionsWithID(e,h.layoutBindRegionID[0]);h.setLayoutRect({width:d.getLayoutRect().width}),h.setLayoutStartPosition({x:d.getLayoutStartPoint().x+h.layoutOffsetX+h.layoutPaddingLeft}),h.layoutOrient==="bottom"&&h.setLayoutStartPosition({y:h.getLayoutStartPoint().y+l-a})}})}layoutAbsoluteItems(e){e.forEach(t=>{t.absoluteLayoutInRect(this._chartLayoutRect)})}filterRegionsWithID(e,t){var i;const s=e.find(r=>r.getModelId()===t);return s||((i=this._onError)!==null&&i!==void 0?i:Kl)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(e){return{width:this.rightCurrent-this.leftCurrent-e.layoutPaddingLeft-e.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-e.layoutPaddingTop-e.layoutPaddingBottom}}_checkAutoIndent(e,t){const i={top:0,left:0,bottom:0,right:0};return e.forEach(s=>{if(!s.getModelVisible()||!s.autoIndent)return;const r=s.layoutOrient==="left"||s.layoutOrient==="right",a=s.getLastComputeOutBounds(),o=this._getOutInLayout(a,s,t);r?(i.top=Math.max(i.top,o.top),i.bottom=Math.max(i.bottom,o.bottom)):(i.left=Math.max(i.left,o.left),i.right=Math.max(i.right,o.right))}),i}_getOutInLayout(e,t,i){const{x:s,y:r}=t.getLayoutStartPoint(),{width:a,height:o}=t.getLayoutRect();return{left:i.left-(s-e.x1),right:s+a+e.x2-i.right,top:i.top-(r-e.y1),bottom:r+o+e.y2-i.bottom}}}z0.type="base";const yK=["line","area","trail"];function xy(n){return yK.includes(n)}class bK extends IB{getStateInfoList(){return this._stateInfoList}constructor(e,t){super(e),this._stateInfoList=[],this._mark=t}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(e){return this._stateInfoList.find(t=>t.stateValue===e)}addStateInfo(e){if(this.getStateInfo(e.stateValue))return;e.level=e.level||0;let t=!0;for(let i=0;i<this._stateInfoList.length;i++){const s=this._stateInfoList[i].level;if(s&&s>e.level){this._stateInfoList.splice(i,0,e),t=!1;break}}t&&this._stateInfoList.push(e)}_clearStateBeforeSet(e){e.datums=null,e.items=null,e.fields=null,e.filter=null}changeStateInfo(e){const t=this.getStateInfo(e.stateValue);if(t){if(e.datums!==void 0&&(this._clearStateBeforeSet(t),t.datums=e.datums,t.datumKeys=e.datumKeys),e.items!==void 0&&(this._clearStateBeforeSet(t),t.items=e.items),e.fields!==void 0)if(this._clearStateBeforeSet(t),e.fields===null)t.fields=e.fields;else{t.fields=t.fields||{};for(const i in e.fields){const s=e.fields[i];t.fields[i]=t.fields[i]||{};const r=t.fields[i];P(s.domain)&&(r.domain=s.domain),P(s.type)&&(r.type=s.type)}}e.filter&&(this._clearStateBeforeSet(t),t.filter=e.filter)}else this.addStateInfo(e)}clearStateInfo(e){e.forEach(t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})})}checkOneState(e,t,i,s){var r;s=ht(xy)?s:!e.mark||xy(e.mark.markType);let a=!1,o=!1;if(P(i.datums)&&i.datums.length>0)a=this.checkDatumState(i,t,s),o=!0;else if(i.items)a=(r=this.checkItemsState(i,e))!==null&&r!==void 0&&r,o=!0;else if(i.fields)a=this.checkFieldsState(i,t,e,s),o=!0;else if(!a&&i.filter){const l={mark:this._mark,renderNode:e,type:e.mark.markType};a=i.filter(t,l),o=!0}return o?a?"in":"out":"skip"}checkState(e,t){const i=e.getStates().filter(r=>lK(r)).map(r=>[r,10]),s=!e.mark||xy(e.mark.markType);for(let r=0;r<this._stateInfoList.length;r++){const a=this._stateInfoList[r],o=this.checkOneState(e,t,a,s);o!=="skip"&&o==="in"&&i.push([a.stateValue,a.level])}return i.map(r=>r[0])}checkDatumState(e,t,i){let s=!1;const r=i?t[0]:t;if(W(e.datums)){const a=e.datumKeys||Object.keys(e.datums[0]).filter(o=>!o.startsWith(be));s=e.datums.some(o=>i&&W(o==null?void 0:o.items)?a.every(l=>{var h,d;return((d=(h=o==null?void 0:o.items)===null||h===void 0?void 0:h[0])===null||d===void 0?void 0:d[l])===(r==null?void 0:r[l])}):a.every(l=>(o==null?void 0:o[l])===(r==null?void 0:r[l])))}else He(e.datums)?s=(e.datumKeys||Object.keys(e.datums).filter(a=>!a.startsWith(be))).every(a=>{var o,l;return i?((o=e.datums.items)===null||o===void 0?void 0:o[0][a])===r[a]:((l=e.datums)===null||l===void 0?void 0:l[a])===r[a]}):s=t===e.datums;return s}checkItemsState(e,t){var i;return(i=e.items)===null||i===void 0?void 0:i.includes(t)}checkFieldsState(e,t,i,s){var r;let a=!0;for(const o in e.fields){const l=e.fields[o],h=l.type,d=l.domain,u=s?(r=t[0])===null||r===void 0?void 0:r[o]:t[o];if(Ue(h)&&d.length>1){if(this.checkLinearFieldState(d,o,t,i,s)){a=!1;break}a=!0}else{if(!d.some(c=>c===u)){a=!1;break}a=!0}}return a}checkLinearFieldState(e,t,i,s,r){var a;const o=r?(a=i[0])===null||a===void 0?void 0:a[t]:i[t];return o<e[0]||o>e[e.length-1]}updateLayoutState(e){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},e)}compileState(e){e.state({callback:(t,i)=>this.checkState(i,t)})}}class wr extends D0{getDataView(){return this._data}setDataView(e){this._data=e}getLatestData(){var e;return(e=this._data)===null||e===void 0?void 0:e.latestData}constructor(e,t){super(e),this.grammarType=oa.data,this._data=null,this._data=t}release(){super.release(),this._data=null}updateData(e){const t=this.getProduct(),i=this.getLatestData();return t&&i&&(t.values(i),!e)?this.getCompiler().renderAsync():Promise.resolve()}_compileProduct(){const e=this.getLatestData();C(e)||(C(this.getProduct())?this._initProduct(e):this._product.values(e))}_initProduct(e){const t=this.getVGrammarView();if(!t||!e)return;const i=this.getProductId();this._product=t.data(e).id(i),this._compiledProductId=i}generateProductId(){var e;return`${(e=this.getDataView())===null||e===void 0?void 0:e.name}`}_lookupGrammar(e){var t,i;return(i=(t=this.getCompiler().getVGrammarView())===null||t===void 0?void 0:t.getDataById)===null||i===void 0?void 0:i.call(t,e)}}class vK extends wr{constructor(e){super(e),this._mark=e.mark}setCompiledProductId(e){this._compiledProductId=e}generateProductId(){const e=super.generateProductId();return P(e)?e:`${be}_markData_${this._mark.id}`}_compileProduct(){var e;const t=(e=this._data)===null||e===void 0?void 0:e.latestData;C(t)||P(this.getProduct())||this._initProduct(t)}}var IM=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};class xK extends D0{getSkipTheme(){return this._skipTheme}setSkipTheme(e){this._skipTheme=e}getSupport3d(){return this._support3d}setSupport3d(e){this._support3d=e}getFacet(){return this._facet}setFacet(e){this._facet=e}getInteractive(){return this._interactive}setInteractive(e){this._interactive=e}getZIndex(){return this._zIndex}setZIndex(e){this._zIndex=e}getVisible(){return this._visible}setVisible(e){this._visible=e}getUserId(){return this._userId}setUserId(e){P(e)&&(this._userId=e)}getDataView(){var e;return(e=this._data)===null||e===void 0?void 0:e.getDataView()}setDataView(e,t){C(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),P(t)&&this._data.setCompiledProductId(t),this._data.setDataView(e)}getData(){return this._data}setData(e){this._data=e}hasState(e){return e in this.state.getStateMap()}getState(e){return this.state.getStateMap()[e]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(e){this._animationConfig=e}setSkipBeforeLayouted(e){this._skipBeforeLayouted=e}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(e){this._morph=e}getMorphKey(){return this._morphKey}setMorphKey(e){this._morphKey=e}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(e){this._morphElementKey=e}getGroupKey(){return this._groupKey}setGroupKey(e){this._groupKey=e}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(e){this._progressiveConfig=e}setCustomizedShapeCallback(e){this._setCustomizedShape=e}setEnableSegments(e){this._enableSegments=e}constructor(e,t,i){super(e),this.grammarType=oa.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=rt.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=t,this.model=i,this.key=e.key,this.state=new bK(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._option.skipTheme&&this.setSkipTheme(!0),this._event=new tc(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(e){this._transform=e}initMarkData(e){this._data=new vK(e)}stateKeyToSignalName(e){return`${be}_${this.type}_${this.id}_${e}`}getAttribute(e,t,i,s){}_compileProduct(e){const t=this.getProduct();if(!this.getVisible())return void(P(t)&&this.removeProduct());P(t)||this.getCompiler().isInited&&(this._initProduct(e==null?void 0:e.group),C(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(e){const t=this.getVGrammarView(),i=this.getProductId();this._product=t.mark(this.type,e??t.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var e;if(C(this._data))return;this._data.compile();const t=this._data.getProduct();P(this._product)&&P(t)&&this._product.join(t,this.key,void 0,(e=this._groupKey)!==null&&e!==void 0?e:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:e,updateStyles:t}=this._separateStyle();this._product.encodeState("group",e,!0),this._product.encode(t,!0)}_separateStyle(){const e=this.stateStyle,t=_e.STATE_NORMAL,i=e[t],s=(IM(e,[typeof t=="symbol"?t:t+""]),this._option.noSeparateStyle?null:{}),r={};return Object.keys(i).forEach(a=>{this._unCompileChannel[a]||(this._option.noSeparateStyle||aK(a,i,this.getFacet())?r[a]={callback:this.compileCommonAttributeCallback(a,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:s[a]=this.compileCommonAttributeCallback(a,"normal"))}),{enterStyles:s,updateStyles:r}}compileEncode(){const e=this.stateStyle,t=_e.STATE_NORMAL,i=(e[t],IM(e,[typeof t=="symbol"?t:t+""])),{enterStyles:s,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",s,!0),Object.keys(i).forEach(a=>{const o={};Object.keys(i[a]).forEach(l=>{this._unCompileChannel[l]||(o[l]={callback:this.compileCommonAttributeCallback(l,a),dependency:[this.stateKeyToSignalName("markUpdateRank")]})}),this._product.encodeState(a,o,!0)}),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){var e,t;if(this._animationConfig){let i;this.type==="component"?i=(e=this.model.animate)===null||e===void 0?void 0:e.getAnimationStateSignalName():i=(t=this.model.getRegion().animate)===null||t===void 0?void 0:t.getAnimationStateSignalName(),this._product.animation(this._animationConfig),this._product.animationState({callback:(s,r,a)=>{var o;return(o=a[i])===null||o===void 0?void 0:o.callback(s,r)},dependency:i}),this._animationConfig.normal&&this._event.on(de.ANIMATION_END,({event:s})=>{s.mark===this.getProduct()&&s.animationState===Qt.appear&&this.runAnimationByState(Qt.normal)})}}compileContext(){const e={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},skipTheme:this.getSkipTheme(),support3d:this.getSupport3d(),enableSegments:!!this._enableSegments};this._progressiveConfig&&(e.progressiveStep=this._progressiveConfig.progressiveStep,e.progressiveThreshold=this._progressiveConfig.progressiveThreshold,e.large=this._progressiveConfig.large,e.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(e.morph=this._morph,e.morphKey=this._morphKey,e.morphElementKey=this._morphElementKey),this._setCustomizedShape&&(e.setCustomizedShape=this._setCustomizedShape),this._product.configure(e)}compileSignal(){this.state.compile()}_computeAttribute(e,t){return(i,s)=>{}}compileCommonAttributeCallback(e,t){const i=this._computeAttribute(e,t),s={mark:null,parent:null,element:null};return(r,a)=>(s.mark=a.mark,s.parent=a.mark.group,s.element=a,i(r,s))}compileTransform(){var e;!((e=this._transform)===null||e===void 0)&&e.length&&this.getProduct().transform(this._transform)}_lookupGrammar(e){var t;return(t=this.getCompiler().getVGrammarView())===null||t===void 0?void 0:t.getMarkById(e)}updateState(e,t){return this.state.updateState(e,t)}updateLayoutState(e,t){return t&&this.getMarks().length>0&&this.getMarks().forEach(i=>i.state.updateLayoutState(!0)),this.state.updateLayoutState(e)}updateMarkState(e){if(!this._product)return;const t=this.state.getStateInfo(e);this._product.elements.forEach(i=>{this.state.checkOneState(i,i.getDatum(),t)==="in"?i.addState(e):i.removeState(e)})}getMarks(){return[]}runAnimationByState(e){var t,i;return(i=(t=this.getProduct())===null||t===void 0?void 0:t.animate)===null||i===void 0?void 0:i.runAnimationByState(e)}stopAnimationByState(e){var t,i;return(i=(t=this.getProduct())===null||t===void 0?void 0:t.animate)===null||i===void 0?void 0:i.stopAnimationByState(e)}pauseAnimationByState(e){var t,i;return(i=(t=this.getProduct())===null||t===void 0?void 0:t.animate)===null||i===void 0?void 0:i.pauseAnimationByState(e)}resumeAnimationByState(e){var t,i;return(i=(t=this.getProduct())===null||t===void 0?void 0:t.animate)===null||i===void 0?void 0:i.resumeAnimationByState(e)}release(){super.release(),this.state.release()}}var DM=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};class Ti extends xK{constructor(e,t){var i;super(t,e,t.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=t.attributeContext,(i=t.map)===null||i===void 0||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(e,t){e&&(P(e.id)&&(this._userId=e.id),ht(e.interactive)&&(this._interactive=e.interactive),P(e.zIndex)&&this.setZIndex(e.zIndex),ht(e.visible)&&this.setVisible(e.visible),this._initSpecStyle(e,this.stateStyle,t))}convertAngleToRadian(e){if(oe(e))return st(e);if(e.scale){const t=e.scale.range();return e.scale.range(t.map(st)),e}return typeof e=="function"?(t,i,s,r)=>st(e(t,i,s,r)):e}isUserLevel(e){return[J.User_Mark,J.User_Series,J.User_Chart].includes(e)}setStyle(e,t="normal",i=0,s=this.stateStyle){if(C(e))return;e=this._filterStyle(e,t,i,s),s[t]===void 0&&(s[t]={});const r=this.isUserLevel(i);Object.keys(e).forEach(a=>{let o=e[a];C(o)||(o=this._filterAttribute(a,o,t,i,r,s),this.setAttribute(a,o,t,i,s))})}getStyle(e,t="normal"){var i;return(i=this.stateStyle[t][e])===null||i===void 0?void 0:i.style}_filterStyle(e,t,i,s=this.stateStyle){return e}_filterAttribute(e,t,i,s,r,a=this.stateStyle){let o=this._styleConvert(t);return r&&e==="angle"&&(o=this.convertAngleToRadian(o)),o}setReferer(e,t,i,s=this.stateStyle){var r;if(e)if(t&&i){const a=(r=s[i])!==null&&r!==void 0?r:{[t]:{}};s[i][t]=Object.assign(Object.assign({},a[t]),{referer:e})}else Object.entries(s).forEach(([a,o])=>{Object.entries(o).forEach(([l,h])=>{s[a][l].referer=e})})}setPostProcess(e,t,i="normal"){var s;!((s=this.stateStyle[i])===null||s===void 0)&&s[e]&&(this.stateStyle[i][e].postProcess=t)}getAttribute(e,t,i="normal",s){return this._computeAttribute(e,i)(t,s)}setAttribute(e,t,i="normal",s=0,r=this.stateStyle){var a;r[i]===void 0&&(r[i]={}),r[i][e]===void 0&&(r[i][e]={level:s,style:t,referer:void 0});const o=(a=r[i][e])===null||a===void 0?void 0:a.level;P(o)&&o<=s&&pe(r[i][e],{style:t,level:s}),i!=="normal"&&e in this._extensionChannel&&this._extensionChannel[e].forEach(l=>{r[i][l]===void 0&&(r[i][l]=r.normal[l])})}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(e){if(!e)return e;if(tv(e.type)||e.scale){const t=uX(e,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(t)return{scale:t,field:e.field,changeDomain:e.changeDomain}}return e}_computeAttribute(e,t){var i;let s=(i=this.stateStyle[t])===null||i===void 0?void 0:i[e];s||(s=this.stateStyle.normal[e]);const r=this._computeStateAttribute(s,e,t),a=Y(s==null?void 0:s.postProcess),o=e in this._computeExChannel;if(a&&o){const l=this._computeExChannel[e];return(h,d)=>{let u=r(h,d);return u=s.postProcess(u,h,this._attributeContext,d,this.getDataView()),l(e,h,t,d,u)}}if(a)return(l,h)=>s.postProcess(r(l,h),l,this._attributeContext,h,this.getDataView());if(o){const l=this._computeExChannel[e];return(h,d)=>l(e,h,t,d,r(h,d))}return r}_computeStateAttribute(e,t,i){var s;return e?e.referer?e.referer._computeAttribute(t,i):typeof e.style=="function"?(r,a)=>e.style(r,this._attributeContext,a,this.getDataView()):vM.includes(e.style.gradient)?this._computeGradientAttr(e.style):["outerBorder","innerBorder"].includes(t)?this._computeBorderAttr(e.style):tv((s=e.style.scale)===null||s===void 0?void 0:s.type)?(r,a)=>e.style.scale.scale(r[e.style.field]):(r,a)=>e.style:(r,a)=>{}}_initStyle(){const e=this._getDefaultStyle();this.setStyle(e,"normal",0)}_initSpecStyle(e,t,i){e.style&&this.setStyle(e.style,"normal",J.User_Mark,t);const s=e.state;s&&Object.keys(s).forEach(r=>{const a=s[r];if("style"in a){const o=a.style;let l={stateValue:r};"level"in a&&(l.level=a.level),"filter"in a&&(l=Y(a.filter)?Object.assign({filter:a.filter},l):Object.assign(Object.assign({},a.filter),l)),this.state.addStateInfo(l),this.setStyle(o,r,J.User_Mark,t)}else this.setStyle(a,r,J.User_Mark,t)})}_computeGradientAttr(e){var t,i;const{gradient:s,scale:r,field:a}=e,o=DM(e,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||this.model.modelType!=="series")){const{scale:c,field:f}=this.model.getColorAttribute();r||(l=c),h||(h=f)}const d=Nv(hu(this.model.getColorScheme(),this.model.modelType==="series"?(i=(t=this.model).getSpec)===null||i===void 0?void 0:i.call(t):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},sX[s]),o);return(c,f)=>{const p={},g=this.getDataView();return Object.keys(u).forEach(_=>{const m=u[_];_==="stops"?p.stops=m.map(y=>{const{opacity:b,color:v,offset:x}=y;let S=v??(l==null?void 0:l.scale(c[h]));return Y(v)&&(S=v(c,this._attributeContext,f,g)),P(b)&&(S=Gt.SetOpacity(S,b)),{offset:Y(x)?x(c,this._attributeContext,f,g):x,color:S||d[0]}}):Y(m)?p[_]=m(c,this._attributeContext,f,g):p[_]=m}),p.gradient=s,p}}_computeBorderAttr(e){const{scale:t,field:i}=e,s=DM(e,["scale","field"]);return(r,a)=>{var o,l,h;const d={};if(Object.keys(s).forEach(u=>{const c=s[u];Y(c)?d[u]=c(r,this._attributeContext,a,this.getDataView()):d[u]=c}),"stroke"in d)vM.includes((h=s.stroke)===null||h===void 0?void 0:h.gradient)&&(d.stroke=this._computeGradientAttr(s.stroke)(r,a));else{const u=Nv(hu(this.model.getColorScheme(),this.model.modelType==="series"?(l=(o=this.model).getSpec)===null||l===void 0?void 0:l.call(o):void 0),this.model.getDefaultColorDomain());let c=t,f=i;if(!(t&&i||this.model.modelType!=="series")){const{scale:p,field:g}=this.model.getColorAttribute();t||(c=p),f||(f=g),d.stroke=(c==null?void 0:c.scale(r[f]))||u[0]}}return d}}}class du extends Ti{constructor(){super(...arguments),this.type=du.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{clip:!1})}isMarkExist(e){return this._marks.find(t=>t.id===e.id||t.name===e.name)!==void 0}addMark(e){return this.isMarkExist(e)?(ba("Mark already exists, add mark failed."),!1):(this._marks.push(e),!0)}removeMark(e){const t=this._marks.findIndex(i=>i.id===e.id||i.name===e.name);return t===-1?(ba("Mark does not exists, removeMark failed."),!1):(this._marks.splice(t,1),!0)}getMarkInType(e){return this._marks.filter(t=>t.type===e)}getMarkInId(e){return this._marks.find(t=>t.id===e)}getMarkInName(e){return this._marks.find(t=>t.name===e)}_compileProduct(e){super._compileProduct(e),this._product.configure({zIndex:this.getZIndex()}),e!=null&&e.ignoreChildren||this.getMarks().forEach(t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})})}}du.type="group";const SK=()=>{U8(),D.registerMark(du.type,du)},AK={type:"clipIn"},kK={type:"fadeIn"},wK=n=>({type:n.direction==="horizontal"?"growPointsXIn":"growPointsYIn",options:{orient:n.direction==="horizontal"?"positive":"negative"}});function MK(n,e){switch(e){case"grow":return wK(n);case"fadeIn":return kK;default:return AK}}const Jr={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"}},j0={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},om={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},lm=()=>{D.registerAnimation("scaleInOut",()=>j0)},Mr=()=>{D.registerAnimation("fadeInOut",()=>om)},TK=()=>{D.registerAnimation("cartesianGroupClip",n=>({appear:{custom:kA,customParameters:(e,t)=>({animationType:"in",group:t.getGraphicItem(),direction:n.direction(),width:n.width(),height:n.height(),orient:n.orient()})},disappear:{custom:kA,customParameters:(e,t)=>({animationType:"out",group:t.getGraphicItem(),direction:n.direction(),width:n.width(),height:n.height(),orient:n.orient()})}}))},WB=()=>{D.registerAnimation("line",(n,e)=>({appear:MK(n,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:qP,duration:Jr.update.duration,easing:Jr.update.easing}],disappear:{type:"clipOut"}}))},CK=()=>{vo.useRegisters([Y7,X7,P7,E7,U7,$7,K7,q7,Z7])},VB=()=>{vo.useRegisters([B7,L7,I7,D7,R7,O7])},H0=()=>{vo.useRegisters([V7,N7,G7,W7])},NB=()=>{vo.useRegisters([RO,OO,F7,z7,j7,H7,T7,C7])},UB=()=>{vo.useRegisters([RO,OO])},PK={measureText:E9};class mn{static instance(){return mn.instance_||(mn.instance_=new mn),mn.instance_}constructor(){this.functions={}}registerFunction(e,t){e&&t&&(this.functions[e]=t)}unregisterFunction(e){e&&delete this.functions[e]}getFunction(e){return this.functions[e]||null}getFunctionNameList(){return Object.keys(this.functions)}}const EK=()=>{Fp(we)},RK=()=>{Hp(we)};class $B{constructor(){this.id=mo(),this._plugins=[]}add(e){if(!e||e.length===0)return null;const t=[];return e.forEach(i=>{this._plugins.find(s=>s.id===i.id)?ba("不要重复添加相同的plugin"):(this._plugins.push(i),t.push(i),i.onAdd&&i.onAdd(this))}),t}load(e){const t=this.add(e);t&&t.length&&this.activate(e)}activate(e){e.length&&e.forEach(t=>{t.init&&t.init()})}get(e){return this._plugins.find(t=>t.id===e)}getAll(){return this._plugins.slice()}dispose(e){const t=this._plugins.find(i=>i.id===e);t&&t.dispose&&t.dispose(this)}disposeAll(){this._plugins.forEach(e=>{e.dispose&&e.dispose(this)})}}class OK extends $B{constructor(e){super(),this.globalInstance=e}onInit(e){this._plugins.forEach(t=>{t.onInit&&t.onInit(this,e)})}onBeforeResize(e,t){this._plugins.forEach(i=>{i.onBeforeResize&&i.onBeforeResize(this,e,t)})}onAfterChartSpecTransform(e,t){this._plugins.forEach(i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,e,t)})}onBeforeInitChart(e,t){this._plugins.forEach(i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,e,t)})}}var ns=function(n,e,t,i){return new(t||(t=Promise))(function(s,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?s(h.value):(d=h.value,d instanceof t?d:new t(function(u){u(d)})).then(a,o)}l((i=i.apply(n,e||[])).next())})},BK=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};let Un=class vf{static useRegisters(e){e.forEach(t=>{typeof t=="function"?t():console.error("Invalid function:",t)})}static useChart(e){e.forEach(t=>D.registerChart(t.type,t))}static useSeries(e){e.forEach(t=>D.registerSeries(t.type,t))}static useComponent(e){e.forEach(t=>D.registerComponent(t.type,t))}static useMark(e){e.forEach(t=>{var i;return D.registerMark((i=t.constructorType)!==null&&i!==void 0?i:t.type,t)})}static useLayout(e){e.forEach(t=>D.registerLayout(t.type,t))}static registerDataSetTransform(e,t){D.registerTransform(e,t)}static registerFunction(e,t){e&&t&&mn.instance().registerFunction(e,t)}static unregisterFunction(e){e&&mn.instance().unregisterFunction(e)}static getFunction(e){return e?mn.instance().getFunction(e):null}static getFunctionList(){return mn.instance().getFunctionNameList()}static registerMap(e,t,i){const s=D.getImplementInKey("registerMap");s&&s(e,t,i)}static unregisterMap(e){const t=D.getImplementInKey("unregisterMap");t&&t(e)}static getMap(e){return q9(e)}static hideTooltip(e=[]){Hn.forEach(t=>{var i;return(i=t==null?void 0:t.hideTooltip)===null||i===void 0?void 0:i.call(t)},e)}static getLogger(){return De.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(e,t){var i,s,r,a,o,l,h;this.id=mo(),this._userEvents=[],this._autoSize=!0,this._option={mode:Yt["desktop-browser"],onError:y=>{throw new Error(y)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._onResize=Us((...y)=>{this._doResize()},100),this._option=re(this._option,{animation:e.animation!==!1},t),this._onError=(i=this._option)===null||i===void 0?void 0:i.onError;const d=this._option,{dom:u,renderCanvas:c,mode:f,stage:p,poptip:g}=d,_=BK(d,["dom","renderCanvas","mode","stage","poptip"]),m=Nn(f);m&&u&&(this._container=ae(u)?document==null?void 0:document.getElementById(u):u),c&&(this._canvas=c),p&&(this._stage=p),f==="node"||this._container||this._canvas||this._stage?(m?EK():f==="node"&&RK(),this._viewBox=this._option.viewBox,this._currentThemeName=qi.getCurrentThemeName(),this._setNewSpec(e),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new eK({dom:(r=this._container)!==null&&r!==void 0?r:"none",canvas:c},Object.assign(Object.assign({mode:this._option.mode,stage:p,pluginList:g!==!1?["poptipForText"]:[]},_),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new $9(this,this._compiler),this._event=new tc(this._eventDispatcher,f),this._compiler.initView(),(a=this.getStage())===null||a===void 0||a.setTheme({text:{fontFamily:(o=this._currentTheme)===null||o===void 0?void 0:o.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!m&&((h=(l=e.autoFit)!==null&&l!==void 0?l:this._option.autoFit)===null||h===void 0||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),Hn.registerInstance(this)):(s=this._option)===null||s===void 0||s.onError("please specify container or renderCanvas!")}_setNewSpec(e,t){return!!e&&(ae(e)&&(e=JSON.parse(e)),t&&this._originalSpec&&(e=pe({},this._originalSpec,e)),this._originalSpec=e,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var e;const t=qv(this._originalSpec);return t.data=(e=t.data)!==null&&e!==void 0?e:[],t}_initChartSpec(e,t){var i;vf.getFunctionList()&&vf.getFunctionList().length&&(e=Zv(e,vf)),this._spec=e,this._chartSpecTransformer||(this._chartSpecTransformer=D.createChartSpecTransformer(this._spec.type,{type:this._spec.type,getTheme:()=>{var s;return(s=this._currentTheme)!==null&&s!==void 0?s:{}},animation:this._option.animation})),this._chartSpecTransformer.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,t),this._specInfo=(i=this._chartSpecTransformer)===null||i===void 0?void 0:i.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,t)}_updateSpecInfo(){var e;this._chartSpecTransformer||(this._chartSpecTransformer=D.createChartSpecTransformer(this._spec.type,{type:this._spec.type,getTheme:()=>{var t;return(t=this._currentTheme)!==null&&t!==void 0?t:{}}})),this._specInfo=(e=this._chartSpecTransformer)===null||e===void 0?void 0:e.createSpecInfo(this._spec)}_initChart(e){var t,i;if(!this._compiler)return void((t=this._option)===null||t===void 0||t.onError("compiler is not initialized"));const s=D.createChart(e.type,e,{type:e.type,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._option.mode||Yt["desktop-browser"],modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var r;return(r=this._currentTheme)!==null&&r!==void 0?r:{}},getSpecInfo:()=>{var r;return(r=this._specInfo)!==null&&r!==void 0?r:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:this._option.disableTriggerEvent===!0});s?(this._chart=s,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(ye.initialized,{})):(i=this._option)===null||i===void 0||i.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&!this._compiler.isReleased&&(this._compiler.getVGrammarView().addEventListener(de.ALL_ANIMATION_END,()=>{this._event.emit(ye.animationFinished,{})}),this._compiler.getVGrammarView().addEventListener(de.AFTER_VRENDER_NEXT_RENDER,()=>{this._event.emit(ye.renderFinished,{})}))}_bindResizeEvent(){var e;if(this._autoSize){if(this._container){const t=window.ResizeObserver;this._observer=new t(this._onResize),(e=this._observer)===null||e===void 0||e.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var e,t,i,s;return OB(this._spec,{container:this._container,canvas:this._canvas,mode:this._option.mode||Yt["desktop-browser"],modeParams:this._option.modeParams},{width:(t=(e=this._currentSize)===null||e===void 0?void 0:e.width)!==null&&t!==void 0?t:Xo,height:(s=(i=this._currentSize)===null||i===void 0?void 0:i.height)!==null&&s!==void 0?s:Ko})}_doResize(){const{width:e,height:t}=this.getCurrentSize();this._currentSize.width===e&&this._currentSize.height===t||(this._currentSize={width:e,height:t},this.resize(e,t))}_initDataSet(e){this._dataSet=e instanceof to?e:new to,pr(this._dataSet,"dataview",c_),pr(this._dataSet,"array",YI),Ae(this._dataSet,"stackSplit",Z9),Ae(this._dataSet,"copyDataView",im);for(const t in D.transforms)Ae(this._dataSet,t,D.transforms[t]);for(const t in D.dataParser)pr(this._dataSet,t,D.dataParser[t])}updateCustomConfigAndRerender(e,t,i={}){if(!this._isReleased&&e)return Y(e)&&(e=e()),this._reCompile(e),t?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(e,t={}){return!!e&&(this._reCompile(e),this._beforeRender(t))}_reCompile(e,t){var i,s,r,a,o,l,h;if(e.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,this._chart.release(),this._chart=null,(i=this._compiler)===null||i===void 0||i.releaseGrammar(((s=this._option)===null||s===void 0?void 0:s.animation)===!1||((r=this._spec)===null||r===void 0?void 0:r.animation)===!1),this._userEvents.forEach(d=>{var u;return(u=this._event)===null||u===void 0?void 0:u.on(d.eType,d.query,d.handler)}),e.reSize&&this._doResize();else if(e.reCompile&&((a=this._compiler)===null||a===void 0||a.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),(o=this._compiler)===null||o===void 0||o.compile({chart:this._chart,vChart:this},{})),e.reSize){const{width:d,height:u}=this.getCurrentSize();this._chart.onResize(d,u,!1),(h=(l=this._compiler).resize)===null||h===void 0||h.call(l,d,u,!1)}}_beforeRender(e={}){var t,i,s,r,a,o,l,h;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:d,actionSource:u}=e;return d&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,u),(i=(t=this._option.performanceHook)===null||t===void 0?void 0:t.beforeInitializeChart)===null||i===void 0||i.call(t),this._initChart(this._spec),(r=(s=this._option.performanceHook)===null||s===void 0?void 0:s.afterInitializeChart)===null||r===void 0||r.call(s),!(!this._chart||!this._compiler)&&((o=(a=this._option.performanceHook)===null||a===void 0?void 0:a.beforeCompileToVGrammar)===null||o===void 0||o.call(a),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),(h=(l=this._option.performanceHook)===null||l===void 0?void 0:l.afterCompileToVGrammar)===null||h===void 0||h.call(l),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(ye.rendered,{}),!0)}renderSync(e){return this._renderSync({morphConfig:e,transformSpec:!0,actionSource:"render"})}renderAsync(e){return ns(this,void 0,void 0,function*(){return this._renderAsync({morphConfig:e,transformSpec:!0,actionSource:"render"})})}_renderSync(e={}){var t;const i=this;return this._beforeRender(e)&&((t=this._compiler)===null||t===void 0||t.renderSync(e.morphConfig),this._afterRender()),i}_renderAsync(e={}){var t;return ns(this,void 0,void 0,function*(){const i=this;return this._beforeRender(e)&&(yield(t=this._compiler)===null||t===void 0?void 0:t.renderAsync(e.morphConfig),this._afterRender()),i})}_updateAnimateState(){var e,t;this._option.animation&&((e=this._chart)===null||e===void 0||e.getAllRegions().forEach(i=>{var s;(s=i.animate)===null||s===void 0||s.updateAnimateState(Qt.update,!0)}),(t=this._chart)===null||t===void 0||t.getAllComponents().forEach(i=>{var s;(s=i.animate)===null||s===void 0||s.updateAnimateState(Qt.update,!0)}))}release(){var e,t,i,s;!((e=this._onResize)===null||e===void 0)&&e.cancel&&this._onResize.cancel(),this._chartPluginApply("disposeAll"),this._chartSpecTransformer=null,(t=this._chart)===null||t===void 0||t.release(),(i=this._compiler)===null||i===void 0||i.release(),(s=this._eventDispatcher)===null||s===void 0||s.release(),this._unBindResizeEvent(),this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,Hn.unregisterInstance(this)}updateData(e,t,i){return ns(this,void 0,void 0,function*(){if(C(this._dataSet))return this;if(this._chart)return this._chart.updateData(e,t,!0,i),yield this._compiler.renderAsync(),this;this._spec.data=N(this._spec.data);const s=this._spec.data.find(r=>r.name===e||r.id===e);return s?s.id===e?s.values=t:s.name===e&&s.parse(t,i):W(t)?this._spec.data.push({id:e,values:t}):this._spec.data.push(t),this})}updateDataInBatches(e){return ns(this,void 0,void 0,function*(){return this._chart?(this._chart.updateFullData(e.map(({id:t,data:i,options:s})=>({id:t,values:i,parser:s}))),this._chart.updateGlobalScaleDomain(),yield this._compiler.renderAsync(),this):(e.forEach(({id:t,data:i,options:s})=>{const r=this._spec.data.find(a=>a.name===t);if(r)r.parse(i,s);else{const a=new Ye(this._dataSet,{name:t});a.parse(i,s),this._spec.data.push(a)}}),this)})}updateDataSync(e,t,i){if(C(this._dataSet))return this;if(this._chart)return this._chart.updateData(e,t,!0,i),this._compiler.renderSync(),this;const s=this._spec.data.find(r=>r.name===e);if(s)s.parse(t,i);else{const r=new Ye(this._dataSet,{name:e});r.parse(t,i),this._spec.data.push(r)}return this}updateFullDataSync(e,t=!0){return this._chart?(this._chart.updateFullData(e),t&&this._compiler.renderSync(),this):(N(e).forEach(i=>{var s;const{id:r,values:a,parser:o,fields:l}=i,h=this._spec.data.find(d=>d.name===r);if(h)h.setFields(ri(l)),h.parse(a,ri(o));else{const d=_g(i,this._dataSet,this._spec.data,{onError:(s=this._option)===null||s===void 0?void 0:s.onError});this._spec.data.push(d)}}),this)}updateFullData(e,t=!0){return ns(this,void 0,void 0,function*(){return this._chart?(this._chart.updateFullData(e),t&&(yield this._compiler.renderAsync()),this):(N(e).forEach(i=>{var s;const{id:r,values:a,parser:o,fields:l}=i,h=this._spec.data.find(d=>d.name===r);if(h)h.setFields(ri(l)),h.parse(a,ri(o));else{const d=_g(i,this._dataSet,this._spec.data,{onError:(s=this._option)===null||s===void 0?void 0:s.onError});this._spec.data.push(d)}}),this)})}updateSpec(e,t=!1,i){return ns(this,void 0,void 0,function*(){const s=this._updateSpec(e,t);return yield this.updateCustomConfigAndRerender(s,!1,{morphConfig:i,transformSpec:!0,actionSource:"updateSpec"}),this})}updateSpecSync(e,t=!1,i){const s=this._updateSpec(e,t);return this.updateCustomConfigAndRerender(s,!0,{morphConfig:i,transformSpec:!0,actionSource:"updateSpec"}),this}updateSpecAndRecompile(e,t=!1,i={}){const s=this._updateSpec(e,t);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}_updateSpec(e,t=!1){var i,s;const r=this._spec;if(!this._setNewSpec(e,t))return;ft(r.theme,this._spec.theme)||this._setCurrentTheme();const a=this._shouldChartResize(r);return(s=(i=this._compiler)===null||i===void 0?void 0:i.getVGrammarView())===null||s===void 0||s.updateLayoutTag(),Fo(this._chart.updateSpec(this._spec),{change:a,reMake:!1,reCompile:!1,reSize:a})}updateModelSpec(e,t,i=!1,s){return ns(this,void 0,void 0,function*(){if(!t||!this._spec)return this;if(ae(t)&&(t=JSON.parse(t)),Y(e)||EM(this._spec,e,t,i),this._chart){const r=this._chart.getModelInFilter(e);if(r)return this._updateModelSpec(r,t,!1,i,s)}return this})}updateModelSpecSync(e,t,i=!1,s){if(!t||!this._spec)return this;if(ae(t)&&(t=JSON.parse(t)),Y(e)||EM(this._spec,e,t,i),this._chart){const r=this._chart.getModelInFilter(e);if(r)return this._updateModelSpec(r,t,!0,i,s)}return this}_updateModelSpec(e,t,i=!1,s=!1,r){s&&(t=pe({},e.getSpec(),t));const a=e.updateSpec(t);return e.reInit(t),(a.change||a.reCompile||a.reMake||a.reSize||a.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(a,i,{morphConfig:r,transformSpec:!1,actionSource:"updateModelSpec"})}resize(e,t){var i,s,r,a,o,l;return ns(this,void 0,void 0,function*(){if(!this._chart||!this._compiler)return this;const h=this._chart.getCanvasRect();return h&&h.width===e&&h.height===t?this:(this._chartPluginApply("onBeforeResize",e,t),(s=(i=this._option.performanceHook)===null||i===void 0?void 0:i.beforeResizeWithUpdate)===null||s===void 0||s.call(i),this._chart.onResize(e,t,!1),(a=(r=this._option.performanceHook)===null||r===void 0?void 0:r.afterResizeWithUpdate)===null||a===void 0||a.call(r),yield(l=(o=this._compiler).resize)===null||l===void 0?void 0:l.call(o,e,t),this._isReleased||this._event.emit(ye.afterResize,{chart:this._chart}),this)})}updateViewBox(e,t=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=e,this._chart.updateViewBox(e,i),i&&(this._compiler.renderSync(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(e,t),this):this}on(e,t,i){var s;this._userEvents&&(this._userEvents.push({eType:e,query:typeof t=="function"?null:t,handler:typeof t=="function"?t:i}),(s=this._event)===null||s===void 0||s.on(e,t,i))}off(e,t){var i;if(this._userEvents&&this._userEvents.length!==0)if(t){const s=this._userEvents.findIndex(r=>r.eType===e&&r.handler===t);s>=0&&(this._userEvents.splice(s,1),(i=this._event)===null||i===void 0||i.off(e,t))}else this._userEvents.forEach(s=>{var r;s.eType===e&&((r=this._event)===null||r===void 0||r.off(e,s.handler))}),this._userEvents=this._userEvents.filter(s=>s.eType!==e)}updateState(e,t){this._chart&&this._chart.updateState(e,t)}setSelected(e,t,i){this._chart&&this._chart.setSelected(e,t,i)}setHovered(e,t,i){this._chart&&this._chart.setHovered(e,t,i)}_updateCurrentTheme(e){var t,i;const s=this._option.theme,r=(t=this._spec)===null||t===void 0?void 0:t.theme;if(e&&(this._currentThemeName=e),fe(s)&&fe(r))this._currentTheme=Or(this._currentThemeName,!0);else if(ae(s)&&(!r||ae(r))||ae(r)&&(!s||ae(s))){const a=Xv({},Or(this._currentThemeName,!0),Or(s,!0),Or(r,!0));this._currentTheme=a}else{const a=Xv({},Or(this._currentThemeName),Or(s),Or(r));this._currentTheme=tm(a,a.colorScheme)}v4(Te(this._currentTheme,"component.poptip")),(i=this._compiler)===null||i===void 0||i.setBackground(this._getBackground())}_shouldChartResize(e){var t,i;let s=!1;C(this._spec.width)?this._spec.width=e.width:this._spec.width!==e.width&&(s=!0),C(this._spec.height)?this._spec.height=e.height:this._spec.height!==e.height&&(s=!0);const r=this._autoSize;return this._autoSize=!!Nn(this._option.mode)&&((i=(t=this._spec.autoFit)!==null&&t!==void 0?t:this._option.autoFit)===null||i===void 0||i),this._autoSize!==r&&(s=!0),s}_getBackground(){return(typeof this._spec.background=="string"?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return Or(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(e){return ns(this,void 0,void 0,function*(){if(!qi.themeExist(e))return this;const t=this._setCurrentTheme(e);return yield this.updateCustomConfigAndRerender(t,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this})}setCurrentThemeSync(e){if(!qi.themeExist(e))return this;const t=this._setCurrentTheme(e);return this.updateCustomConfigAndRerender(t,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(e){var t;return this._updateCurrentTheme(e),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),(t=this._chart)===null||t===void 0||t.setCurrentTheme(),{change:!0,reMake:!1}}_getTooltipComponent(){var e;return(e=this._chart)===null||e===void 0?void 0:e.getAllComponents().find(t=>t.type===X.tooltip)}setTooltipHandler(e){var t,i;this._context.tooltipHandler=e;const s=this._getTooltipComponent();s&&((i=(t=s.tooltipHandler)===null||t===void 0?void 0:t.release)===null||i===void 0||i.call(t),s.tooltipHandler=e)}getTooltipHandlerByUser(){var e;return(e=this._context)===null||e===void 0?void 0:e.tooltipHandler}getTooltipHandler(){const e=this._getTooltipComponent();return e?e.tooltipHandler:this._context.tooltipHandler}showTooltip(e,t){var i;const s=this._getTooltipComponent();return(i=P(e)&&(s==null?void 0:s.showTooltip(e,t))!=="none")!==null&&i!==void 0&&i}hideTooltip(){var e;const t=this._getTooltipComponent();return(e=t==null?void 0:t.hideTooltip())!==null&&e!==void 0&&e}getLegendDataById(e){var t;const i=(t=this._chart)===null||t===void 0?void 0:t.getComponentByUserId(e);return i?i.getLegendData():[]}getLegendDataByIndex(e=0){var t;const i=(t=this._chart)===null||t===void 0?void 0:t.getAllComponents().filter(s=>s.type===X.discreteLegend);return i[e]?i[e].getLegendData():[]}getLegendSelectedDataById(e){var t;const i=(t=this._chart)===null||t===void 0?void 0:t.getComponentByUserId(e);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(e=0){var t;const i=(t=this._chart)===null||t===void 0?void 0:t.getAllComponents().filter(s=>s.type===X.discreteLegend);return i[e]?i[e].getSelectedData():[]}setLegendSelectedDataById(e,t){var i;const s=(i=this._chart)===null||i===void 0?void 0:i.getComponentByUserId(e);s&&s.setSelectedData(t)}setLegendSelectedDataByIndex(e=0,t){var i;const s=(i=this._chart)===null||i===void 0?void 0:i.getAllComponents().filter(r=>r.type===X.discreteLegend);s[e]&&s[e].setSelectedData(t)}getDataURL(){var e;return ns(this,void 0,void 0,function*(){const t=this.getStage();if(this._chart&&t){t.render();const i=this._chart.getCanvas();return yield sK(i,{onError:this._onError})}return(e=this._option)===null||e===void 0||e.onError(new ReferenceError("render is not defined")),null})}exportImg(e){var t,i;return ns(this,void 0,void 0,function*(){if(!Nn(this._option.mode))return void((t=this._option)===null||t===void 0||t.onError(new TypeError("non-browser environment can not export img")));const s=yield this.getDataURL();s?iK(e,s):(i=this._option)===null||i===void 0||i.onError(new ReferenceError("render is not defined"))})}exportCanvas(){var e;const t=this.getStage();if(this._chart&&t)return t.toCanvas();(e=this._option)===null||e===void 0||e.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var e,t;if(this._option.mode!=="node")return void((e=this._option)===null||e===void 0||e.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();return i?(i.render(),i.window.getImageBuffer()):((t=this._option)===null||t===void 0||t.onError(new ReferenceError("render is not defined")),null)}setLayout(e){var t;this._option.layout=e,(t=this._chart)===null||t===void 0||t.setLayout(e)}reLayout(){var e;(e=this._chart)===null||e===void 0||e.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var e;return(e=this._compiler)===null||e===void 0?void 0:e.getCanvas()}getContainer(){var e;if(P(this._container))return this._container;let t;return t=ae(this._canvas)?document==null?void 0:document.getElementById(this._canvas):this._canvas,P(t)?t.parentElement:(e=this.getCanvas())===null||e===void 0?void 0:e.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(e,t={}){var i;return(i=this._chart)===null||i===void 0?void 0:i.setDimensionIndex(e,t)}stopAnimation(){var e,t,i;(i=(t=(e=this._compiler)===null||e===void 0?void 0:e.getVGrammarView())===null||t===void 0?void 0:t.animate)===null||i===void 0||i.stop()}pauseAnimation(){var e,t,i;(i=(t=(e=this._compiler)===null||e===void 0?void 0:e.getVGrammarView())===null||t===void 0?void 0:t.animate)===null||i===void 0||i.pause()}resumeAnimation(){var e,t,i;(i=(t=(e=this._compiler)===null||e===void 0?void 0:e.getVGrammarView())===null||t===void 0?void 0:t.animate)===null||i===void 0||i.resume()}convertDatumToPosition(e,t={},i=!1){var s;if(!this._chart||fe(e))return null;const{seriesId:r,seriesIndex:a=0}=t;let o;if(P(r)?o=this._chart.getSeriesInUserId(r):P(a)&&(o=(s=this._chart.getSeriesInIndex([a]))===null||s===void 0?void 0:s[0]),o){const l=Object.keys(e),h=o.getViewData().latestData.find(c=>l.every(f=>c[f]==e[f])),d=o.getRegion().getLayoutStartPoint();let u;return u=h?o.dataToPosition(h):o.dataToPosition(e),AM(u,d,i)}return null}convertValueToPosition(e,t,i=!1){var s,r;if(!this._chart||C(e)||fe(t))return null;if(!W(e)){const{axisId:h,axisIndex:d}=t;let u;if(P(h)?u=this._chart.getComponentsByKey("axes").find(f=>f.userId===h):P(d)&&(u=(s=this._chart.getComponentsByKey("axes"))===null||s===void 0?void 0:s[d]),!u)return ba("Please check whether the `axisId` or `axisIndex` is set!"),null;const c=u==null?void 0:u.valueToPosition(e);if(i){const f=u.getLayoutStartPoint(),p=u.getOrient();return c+(p==="bottom"||p==="top"?f.x:f.y)}return c}const{seriesId:a,seriesIndex:o}=t;let l;return P(a)?l=this._chart.getSeriesInUserId(a):P(o)&&(l=(r=this._chart.getSeriesInIndex([o]))===null||r===void 0?void 0:r[0]),l?AM(l.valueToPosition(e[0],e[1]),l.getRegion().getLayoutStartPoint(),i):(ba("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(e){return mn.instance().getFunction(e)}registerFunction(e,t){e&&t&&mn.instance().registerFunction(e,t)}unregisterFunction(e){e&&mn.instance().unregisterFunction(e)}getFunctionList(){return mn.instance().getFunctionNameList()}setRuntimeSpec(e){this._spec=e,this._updateSpecInfo()}_initChartPlugin(){const e=D.getChartPlugins();e.length>0&&(this._chartPlugin=new OK(this),this._chartPlugin.load(e.map(t=>new t)),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(e,...t){this._chartPlugin&&this._chartPlugin[e]&&this._chartPlugin[e].apply(this._chartPlugin,t)}};Un.InstanceManager=Hn,Un.ThemeManager=qi,Un.globalConfig={uniqueTooltip:!0},Un.Utils=PK;D.registerRegion("region",Wl),D.registerLayout("base",z0),SK(),vo.useRegisters([D6,F6]),CK(),L0(PM.name,PM),De.getInstance(gn.Error);class LK{constructor(e){this.id=mo(),this.name=`${e}_${this.id}`}onAdd(e){this.service=e}}const Th=(n,e)=>{const t=e.beforeCall();return n.forEach((i,s)=>e.call(i,s,t)),t.keyMap&&(t.keyMap.clear(),t.keyMap=null),n};function IK(n){return n===Yt["desktop-browser"]||n===Yt["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"pointerleave"},select:{enable:!0,trigger:"pointertap"}}:va(n)||xa(n)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"pointerleave"},select:{enable:!0,trigger:"tap"}}:null}class DK{get hover(){return this._hover}get select(){return this._select}constructor(e,t){this._fields=null,this._marks=new wa,this._markReverse=new wa,this.onHover=i=>{this.filterEventMark(i)?(this._isHovered=!0,this.hoverItem(i)):this._isHovered&&(this._isHovered=!1,this.unhoverItem())},this.onUnHover=i=>{this.filterEventMark(i)||this.interaction.filterEventMark(i,_e.STATE_HOVER)||this.interaction.getEventElement(_e.STATE_HOVER)[0]&&this.unhoverItem()},this.onSelect=i=>{this.handleSingleEventSelect(i)},this.onUnSelect=i=>{this.interaction.filterEventMark(i,_e.STATE_SELECTED)||this.clearSelectedItems()},this._spec=e,this._option=t,this.event=new tc(t.eventDispatcher,t.mode),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(e){this._fields=e.slice()}registerMark(e){this._marks.addMark(e),this._hover.enable&&this.interaction.registerMark(_e.STATE_HOVER,e),this._select.enable&&this.interaction.registerMark(_e.STATE_SELECTED,e)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const e=this.event,{enable:t,trigger:i,triggerOff:s}=this._hover,{enable:r,trigger:a,triggerOff:o}=this._select;t&&(N(i).forEach(l=>{e.on(l,{level:We.chart},this.onHover)}),s&&s!=="none"&&N(s).forEach(l=>{e.on(l,{level:We.vchart,source:Xe.chart},this.onUnHover)})),r&&(N(a).forEach(l=>{e.on(l,{level:We.mark},this.onSelect)}),o&&o!=="none"&&N(o).forEach(l=>{e.on(l,{level:We.mark},this.onUnSelect)}),o||N(o??a).forEach(l=>{e.on(l,{level:We.vchart},this.onUnSelect)}))}releaseEvent(){this.event.release()}initConfig(e){const t=IK(e);this._hover=Object.assign({},t==null?void 0:t.hover),this._select=Object.assign({},t==null?void 0:t.select);const i=this._spec.hover;ht(i)?this._hover.enable=i:He(i)&&(this._hover.enable=!0,this._hover=pe(this._hover,i));const s=this._spec.select;ht(s)?this._select.enable=s:He(s)&&(this._select.enable=!0,this._select=pe(this._select,s))}hoverItem(e){const{datum:t}=e,i=this.interaction.getEventElement(_e.STATE_HOVER)[0];e.item!==i&&(this.interaction.exchangeEventElement(_e.STATE_HOVER,e.item),this.interaction.reverseEventElement(_e.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[t]}))}unhoverItem(){const e=this.interaction.getEventElementData(_e.STATE_HOVER);this.interaction.clearEventElement(_e.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:e})}handleSingleEventHover(e){this.filterEventMark(e)?this.hoverItem(e):this.interaction.getEventElement(_e.STATE_HOVER)[0]&&!this.interaction.filterEventMark(e,_e.STATE_HOVER)&&this.unhoverItem()}selectItems(e){this.event.emit("selected",{model:this._option.model,value:e})}clearSelectedItems(){const e=this.interaction.getEventElementData(_e.STATE_SELECTED);this.interaction.clearEventElement(_e.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:e})}unselectItems(e){const{triggerOff:t}=this._select;t!=="none"&&(this.interaction.removeEventElement(_e.STATE_SELECTED,e.item),this.event.emit("unselected",{model:this._option.model,value:e.item}))}handleSingleEventSelect(e){if(this.filterEventMark(e))if(e.item.getStates().includes(_e.STATE_SELECTED))this.unselectItems(e);else{this._select.mode==="multiple"?this.interaction.addEventElement(_e.STATE_SELECTED,e.item):this.interaction.exchangeEventElement(_e.STATE_SELECTED,e.item),this.interaction.reverseEventElement(_e.STATE_SELECTED);const t=this.interaction.getEventElementData(_e.STATE_SELECTED);this.selectItems(t)}else this.interaction.filterEventMark(e,_e.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(e){return!(!e.mark||!this._marks.includes(e.mark))}isDatumEqual(e,t){return(this._fields?this._fields:Object.keys(e)).every(i=>e[i]===t[i])}}class FK{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set}}}const Qr=n=>{var e,t;if((n==null?void 0:n.visible)===!1)return[];const i={mark:((e=n==null?void 0:n.mark)===null||e===void 0?void 0:e.visible)!==!1,dimension:((t=n==null?void 0:n.dimension)===null||t===void 0?void 0:t.visible)!==!1};return P(n==null?void 0:n.activeType)&&Object.keys(i).forEach(s=>{var r;i[s]=(r=n==null?void 0:n.activeType)===null||r===void 0?void 0:r.includes(s)}),Object.keys(i).filter(s=>i[s])};function zK(n){return C(n.mark)&&C(n.model)&&C(n.datum)}class rn extends FK{constructor(e){super(),this._getSeriesCacheInfo=()=>{var t,i,s;const{series:r}=this,a=r.getSeriesField();return{seriesFields:P(a)?N(a):(t=r.getSeriesKeys())!==null&&t!==void 0?t:[],dimensionFields:(i=r.getDimensionField())!==null&&i!==void 0?i:[],measureFields:(s=r.getMeasureField())!==null&&s!==void 0?s:[],type:r.type}},this._getDimensionData=t=>{const{dimensionFields:i}=this._seriesCacheInfo;return i[0]&&(t==null?void 0:t[i[0]])},this._getMeasureData=t=>{const{measureFields:i}=this._seriesCacheInfo;return i[0]&&(t==null?void 0:t[i[0]])},this._getSeriesStyle=(t,i,s)=>{var r;for(const a of N(i)){const o=(r=this.series.getSeriesStyle(t))===null||r===void 0?void 0:r(a);if(P(o))return o}return s},this.contentKeyCallback=(t,i)=>{const{dimensionFields:s,seriesFields:r}=this._seriesCacheInfo,a=s[s.length-1];return P(r[0])&&(t!=null&&t[r[0]])?t==null?void 0:t[r[0]]:(s.length>1&&(r.length===0||this.series.getSeriesKeys().length),t==null?void 0:t[a])},this.contentValueCallback=(t,i)=>this._getMeasureData(t),this.contentShapeTypeCallback=(t,i)=>{var s;return(s=this._getSeriesStyle(t,"shape",null))!==null&&s!==void 0?s:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.contentShapeColorCallback=(t,i)=>this._getSeriesStyle(t,["fill","stroke"]),this.titleValueCallback=(t,i)=>this._getDimensionData(t),this.series=e,this.updateTooltipSpec()}updateTooltipSpec(){var e,t,i,s;const r=(t=(e=this.series.getSpec())===null||e===void 0?void 0:e.tooltip)!==null&&t!==void 0?t:{},a=(s=(i=this.series.getChart().getSpec())===null||i===void 0?void 0:i.tooltip)!==null&&s!==void 0?s:{},o=Object.assign(Object.assign({},a),r);["mark","dimension"].forEach(l=>{const h=o[l];P(h)&&(o[l]=Object.assign(Object.assign({},h),{title:P(h.title)?Y(h.title)?h.title:Object.assign(Object.assign({},h.title),{seriesId:this.series.id}):void 0,content:P(h.content)?Y(h.content)?h.content:N(h.content).map(d=>Y(d)?d:Object.assign(Object.assign({},d),{seriesId:this.series.id})):void 0}))}),this.spec=o,this.activeType=Qr(o),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(e,t){if(e==="mark")return{visible:!0,activeType:e,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1}]};if(e==="dimension"&&t){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return t.forEach(({data:r})=>r.forEach(({series:a})=>{s.push({seriesId:a.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1})})),{visible:!0,activeType:e,title:i,content:s}}return null}}const jK={min:n=>n.length?hi(n.map(e=>1*e)):0,max:n=>n.length?Vt(n.map(e=>1*e)):0,"array-min":n=>n.length?hi(n.map(e=>1*e)):0,"array-max":n=>n.length?Vt(n.map(e=>1*e)):0,values:n=>{const e={},t=[];for(const i of n)e[i]||(t.push(i),e[i]=1);return t}},ex=(n,e)=>{var t,i;let s=e.fields;if(Y(s)&&(s=s()),!(s!=null&&s.length)||!(n!=null&&n.length))return{};s=Gl([],s);const r=e.target==="parser"?"parserData":"latestData",a=n[0][r]?n[0][r]:n||[],o=(i=(t=n[0]).getFields)===null||i===void 0?void 0:i.call(t);return YB(a,s,o)},YB=(n,e,t)=>{const i={};let s=[],r=[];return e.forEach(a=>{const o=a.key;i[o]={};const l=t==null?void 0:t[o],h=a.operations,d=h.some(f=>f==="min"||f==="max"||f==="allValid");let u=!0;s.length=0,n.forEach(f=>{f&&s.push(f[o])});const c=s.length;if(d){r.length=0,s.forEach((p,g)=>{Ws(p)&&r.push(p)});const f=s;s=r,r=f,u=s.length===c}else s=h.some(f=>f==="array-min"||f==="array-max")?s.reduce((f,p)=>(p&&p.forEach(g=>{Ws(g)&&f.push(g)}),f),[]):s.filter(f=>f!==void 0);h.forEach(f=>{if(a.customize)i[o][f]=a.customize;else{if(l&&l.lockStatisticsByDomain&&!C(l.domain)){if(f==="values")return void(i[o][f]=l.domain.slice())}else if(f==="allValid")return;i[o][f]=jK[f](s),f==="array-max"&&(i[o].max=i[o][f]),f==="array-min"&&(i[o].min=i[o][f])}}),d&&(i[o].allValid=u)}),i},HK=(n,e)=>{const{config:t}=e;if(!t)return n;const{invalidType:i,checkField:s}=t();return i!=="zero"||n.forEach(r=>{Ws(r[s])||(r[s]=0)}),n};class Ns extends wr{_compileProduct(){var e;const t=(e=this._data)===null||e===void 0?void 0:e.latestData;C(t)||P(this.getProduct())||this._initProduct([])}generateProductId(){var e;return(e=this._data)===null||e===void 0?void 0:e.name}}const uu=`${be}_HIERARCHY_DEPTH`,Ma=`${be}_HIERARCHY_ROOT`,GK=`${be}_HIERARCHY_ROOT_INDEX`;function cu(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function lh(n,e,t){n&&(t.needDefaultSeriesField&&(n[vn]=t.defaultSeriesField),n[oi]=e,n[Vs]=t.getKey(n,e,t))}function G0(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function hm(n,e,t,i=0,s,r){r===void 0&&(r=e),lh(n,e,t),n[uu]=i,n[Ma]=s||n[t.categoryField],n[GK]=r,n.children&&n.children.length&&n.children.forEach((a,o)=>hm(a,o,t,n[uu]+1,n[Ma],r))}const FM=["appear","enter","update","exit","disappear","normal"];function Le(n={},e,t){const i={};for(let s=0;s<FM.length;s++){const r=FM[s],a=e?e[r]:void 0;if(a===!1)continue;if(r==="normal"){a&&(i.normal=a);continue}if(r!=="update"&&!a&&!n[r])continue;let o,l;o=W(n[r])?n[r]:[Object.assign(Object.assign({},Jr[r]),n[r])],r==="exit"&&o.forEach(h=>{h.controlOptions={stopWhenStateChange:!0}}),a?(l=W(a)?a.map((h,d)=>{var u;let c=h;return HM(c)&&delete c.type,c.oneByOne&&(c=zM(c,(u=t==null?void 0:t.dataIndex)!==null&&u!==void 0?u:jM,t==null?void 0:t.dataCount)),c}):o.map((h,d)=>{var u;let c=pe({},o[d],a);return HM(c)&&delete c.type,c.oneByOne&&(c=zM(c,(u=t==null?void 0:t.dataIndex)!==null&&u!==void 0?u:jM,t==null?void 0:t.dataCount)),c}),i[r]=l):i[r]=o}return i.state=i.update,i}function Ge(n,e,t){var i,s,r,a,o;const l={};return e.animationAppear&&(l.appear=(i=e.animationAppear[n])!==null&&i!==void 0?i:e.animationAppear),e.animationDisappear&&(l.disappear=(s=e.animationDisappear[n])!==null&&s!==void 0?s:e.animationDisappear),e.animationEnter&&(l.enter=(r=e.animationEnter[n])!==null&&r!==void 0?r:e.animationEnter),e.animationExit&&(l.exit=(a=e.animationExit[n])!==null&&a!==void 0?a:e.animationExit),e.animationUpdate&&(l.update=(o=e.animationUpdate[n])!==null&&o!==void 0?o:e.animationUpdate),e.animationNormal&&e.animationNormal[n]&&(l.normal=e.animationNormal[n]),VK(l,t)}function zM(n,e,t){const{oneByOne:i,duration:s,delay:r,delayAfter:a}=n;return n.delay=(o,l,h)=>{const d=e(o),u=Y(s)?s(o,l,h):j(s)?s:0,c=Y(r)?r(o,l,h):j(r)?r:0;let f=Y(i)?i(o,l,h):i;return f===!1?c:(f=f===!0?0:f,c+d*(u+f))},n.delayAfter=(o,l,h)=>{const d=e(o),u=Y(s)?s(o,l,h):j(s)?s:0,c=Y(a)?a(o,l,h):j(a)?a:0;let f=Y(i)?i(o,l,h):i;return f===!1?c:(f=f===!0?0:f,c+((t?t():l.mark.elements.length)-d)*(u+f))},delete n.oneByOne,n}function jM(n){return n==null?void 0:n[oi]}function Tr(n,e){var t,i,s,r,a;if(n.animation===!1||((t=n.morph)===null||t===void 0?void 0:t.enable)===!1)return!1;const o=((s=(i=n.animationAppear)===null||i===void 0?void 0:i[e])!==null&&s!==void 0?s:n.animationAppear)!==!1,l=((a=(r=n.animationUpdate)===null||r===void 0?void 0:r[e])!==null&&a!==void 0?a:n.animationUpdate)!==!1;return!(!o||!l)}function WK(n){return P(n.timeSlices)}function HM(n){return!WK(n)&&P(n.channel)}function VK(n,e){return n&&(tx(n=ri(n),t=>{var i;return Y(t)&&((i=t.prototype)===null||i===void 0?void 0:i.constructor)!==t?(...s)=>t(...s,e):t}),n)}function tx(n,e){if(W(n))n.forEach((t,i)=>{n[i]=e(n[i],i),tx(n[i],e)});else if(He(n))for(const t in n)n[t]=e(n[t],t),tx(n[t],e)}function NK(n){return n.getSpec().animation!==!1&&P(n.getRegion().animate)}class kn extends sm{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(e){return this.markLabelSpec[e]}setLabelSpec(e,t){this.markLabelSpec[e]=N(t)}addLabelSpec(e,t,i=!1){this.markLabelSpec[e]||(this.markLabelSpec[e]=[]),i?this.markLabelSpec[e].unshift(t):this.markLabelSpec[e].push(t)}getTheme(e,t){var i;const s=dB(e),r=(i=this._option)===null||i===void 0?void 0:i.getTheme(),{markByName:a,mark:o}=r,l=this._option.type,h=Kv(Te(r,`series.${l}`),l,o,a),d=Kv(Te(r,`series.${l}_${s}`),`${l}_${s}`,o,a);return pe({},h,d)}transformSpec(e,t,i){const s=super.transformSpec(e,t,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec})}_transformLabelSpec(e){}_addMarkLabelSpec(e,t,i="label",s="initLabelMarkStyle",r,a){const o=e==null?void 0:e[i];o!=null&&o.visible&&this.addLabelSpec(t,Object.assign(Object.assign({animation:r??e.animation},o),{getStyleHandler:l=>{var h;return(h=l[s])===null||h===void 0?void 0:h.bind(l)}}),a)}_getDefaultSpecFromChart(e){var t;const i=(t=super._getDefaultSpecFromChart(e))!==null&&t!==void 0?t:{},{outerRadius:s,innerRadius:r}=e;return P(s)&&(i.outerRadius=s),P(r)&&(i.innerRadius=r),Object.keys(i).length>0?i:void 0}}class ho extends F0{getTrigger(){return this._trigger}getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var e;return(e=this._data)===null||e===void 0?void 0:e.getDataView()}getViewDataProductId(){var e;return(e=this._data)===null||e===void 0?void 0:e.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(e){P(e)&&(this._seriesField=e,this.getMarks().filter(t=>t.getDataView()===this.getViewData()).forEach(t=>{t.setFacet(this._seriesField)}))}getGroups(){return this._groups}getStack(){return this._stack}getStackValue(){var e;return(e=this._spec.stackValue)!==null&&e!==void 0?e:`${be}_series_${this.type}`}getPercent(){return this._percent}getStackOffsetSilhouette(){return this._stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(e){var t;this._invalidType=e,(t=this.getViewData())===null||t===void 0||t.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,t){var i;super(e,t),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=kn,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var s,r;return{width:(s=this._layoutRect.width)!==null&&s!==void 0?s:this._region.getLayoutRect().width,height:(r=this._layoutRect.height)!==null&&r!==void 0?r:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this._percent=!1,this._stackOffsetSilhouette=!1,this.layoutZIndex=0,this._invalidType="break",this._getInvalidDefined=s=>Ws(s[this.getStackValueField()]),this._region=t.region,this._dataSet=t.dataSet,!((i=this._spec)===null||i===void 0)&&i.name&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(ye.afterInitData,{model:this}),this.initTrigger(),this.initRootMark(),this.initMark();const e=NK(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(ye.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(e,t)=>{var i;return(i=this._option.globalScale.getScale(e))===null||i===void 0?void 0:i.scale(t)},seriesColor:e=>{var t;return C(e)&&(e=this.getSeriesKeys()[0]),(t=this._option.globalScale.getScale("color"))===null||t===void 0?void 0:t.scale(e)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),ht(this._spec.stack)&&(this._stack=this._spec.stack),ht(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.percent||this._stack),ht(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stackOffsetSilhouette||this._stack),P(this._spec.stackValue)&&(this._stack=!0),C(this._stack)&&this._supportStack&&this._seriesField&&(this._stack=!0),P(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}initData(){var e,t,i,s,r,a;const o=(e=this._spec.data)!==null&&e!==void 0?e:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(o&&(this._rawData=_g(o,this._dataSet,this._option.sourceDataList,{onError:(t=this._option)===null||t===void 0?void 0:t.onError})),(s=(i=this._rawData)===null||i===void 0?void 0:i.target)===null||s===void 0||s.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this._stack&&(this._viewDataFilter=Qv(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const l=Qv(this._stack?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new Ns(this._option,l),this._stack&&this._viewDataFilter.target.removeListener("change",l.reRunAllTransform)}this._invalidType==="zero"&&(!((r=this._rawData)===null||r===void 0)&&r.dataSet)&&(Ae(this._rawData.dataSet,"invalidTravel",HK),(a=this._rawData)===null||a===void 0||a.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const e=this.getGroupFields();e&&e.length&&(this._groups={fields:e})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(e,t){var i,s;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[e]){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(!((i=this._viewDataStatistics.latestData)===null||i===void 0)&&i[e]))this._rawStatisticsCache[e]=this._viewDataStatistics.latestData[e];else if(this._rawData){const r=(s=this._rawData.getFields())===null||s===void 0?void 0:s[e];r&&r.lockStatisticsByDomain&&r.domain?(this._rawStatisticsCache[e]={},t?(this._rawStatisticsCache[e].min=hi(r.domain),this._rawStatisticsCache[e].max=Vt(r.domain)):this._rawStatisticsCache[e].values=r.domain):this._rawStatisticsCache[e]=YB(this._rawData.latestData,[{key:e,operations:t?["min","max"]:["values"]}])[e]}}return t&&(C(this._rawStatisticsCache[e].min)||C(this._rawStatisticsCache[e].max))&&(this._rawStatisticsCache[e].min=hi(this._rawStatisticsCache[e].values),this._rawStatisticsCache[e].max=Vt(this._rawStatisticsCache[e].values)),this._rawStatisticsCache[e]}_statisticViewData(){Ae(this._dataSet,"dimensionStatistics",ex);const e=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Ye(this._dataSet,{name:e}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&Gl(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this._stack&&this.createdStackData()}createStatisticalData(e,t,i){Ae(this._dataSet,"dimensionStatistics",ex);const s=new Ye(this._dataSet,{name:e});return s.parse([t],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var r;const a=Gl(this.getStatisticFields(),(r=i==null?void 0:i(t.name))!==null&&r!==void 0?r:[]);return this._seriesField&&Gl(a,[{key:this._seriesField,operations:["values"]}]),a},target:"latest"}},!1),s}createdStackData(){const e=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Ye(this._dataSet,{name:e}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(e,t){return t}generateDefaultDataKey(e){var t;return C(e)?(i,s,r)=>{if(this._spec.animation===!1){const l=this._noAnimationDataKey(i,s);if(l!==void 0)return l}const{keyMap:a}=r,o=this._getSeriesDataKey(i);return a.get(o)===void 0?(a.set(o,0),o):(a.set(o,a.get(o)+1),`${o}_${a.get(o)}`)}:ae(e)?i=>i[e]:W(e)&&e.every(i=>ae(i))?i=>e.map(s=>i[s]).join("-"):Y(e)?(i,s)=>e(i,s):((t=this._option)===null||t===void 0||t.onError(`invalid dataKey: ${e}`),(i,s)=>{})}_addDataIndexAndKey(){var e;!((e=this._rawData)===null||e===void 0)&&e.dataSet&&(Ae(this._rawData.dataSet,"addVChartProperty",Th),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:cu.bind(this),call:lh}},!1))}updateRawData(e){this._rawData&&this._rawData.updateRawData(e)}rawDataUpdate(e){var t;(t=this._rawDataStatistics)===null||t===void 0||t.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(ye.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(ye.viewDataFilterOver,{model:this})}viewDataUpdate(e){var t;this.event.emit(ye.viewDataUpdate,{model:this}),(t=this._data)===null||t===void 0||t.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(ye.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(e,t){return!e||C(t)?null:e[t]}getDatumPositionValues(e,t){return!e||C(t)?[]:ae(t)?[e[t]]:t.map(i=>e[i])}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var e,t;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:(t=(e=this._region).getGroupMark)===null||t===void 0?void 0:t.call(e),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_initExtensionMark(e){var t;this._spec.extensionMark&&((t=this._spec.extensionMark)===null||t===void 0||t.forEach((i,s)=>{this._createExtensionMark(i,null,`${be}_series_${this.id}_extensionMark`,s,e)}))}_createExtensionMark(e,t,i,s,r){var a;const o=this._createMark({type:e.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:e,parent:t,dataView:!1,customShape:e==null?void 0:e.customShape});if(o){if(r.hasAnimation){const l=Le({},Ge(e.type,e,this._markAttributeContext));o.setAnimationConfig(l)}if(e.type==="group")i=`${i}_${s}`,(a=e.children)===null||a===void 0||a.forEach((l,h)=>{this._createExtensionMark(l,o,i,h,r)});else if(!(t||C(e.dataId)&&C(e.dataIndex))){const l=this._option.getSeriesData(e.dataId,e.dataIndex);l===this._rawData?o.setDataView(this.getViewData(),this.getViewDataProductId()):o.setDataView(l)}}}_updateExtensionMarkSpec(e){var t;(t=this._spec.extensionMark)===null||t===void 0||t.forEach((i,s)=>{var r;const a=this._marks.getMarkWithInfo({name:`${this.type}_${this.id}_extensionMark_${s}`});a&&(e&&ft((r=e.extensionMark)===null||r===void 0?void 0:r[s],i)||(this.initMarkStyleWithSpec(a,i),a.updateStaticEncode(),a.updateLayoutState()))})}getStackData(){var e;return(e=this._viewStackData)===null||e===void 0?void 0:e.latestData}initTrigger(){const e={hover:this._spec.hover,select:this._spec.select},t=Object.assign(Object.assign({},this._option),{model:this,interaction:this._region.interaction});this._trigger=new DK(e,t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const t=this._spec.seriesStyle;if(!t||!t.length)return;const i=(e=this._seriesField)!==null&&e!==void 0?e:vn;this.getMarksWithoutRoot().forEach(s=>{const r={},a={},o={};t.forEach(h=>{var d;const u=(d=h[s.name])===null||d===void 0?void 0:d.style;u&&(r[h.name]=!0,o[h.name]=o[h.name]||{},Object.keys(u).forEach(c=>{a[c]=!0,o[h.name][c]=u[c]}))}),s.state.addStateInfo({stateValue:bM,level:-1,filter:h=>Array.isArray(h)?h.length!==0&&r[h[0][i]]===!0:r[h[i]]===!0});const l={};Object.keys(a).forEach(h=>{l[h]=d=>{var u,c;let f;if(Array.isArray(d)){if(d.length===0)return;f=(u=o[d[0][i]])===null||u===void 0?void 0:u[h]}return f=(c=o[d[i]])===null||c===void 0?void 0:c[h],f||s.getAttribute(h,d)}}),this.setMarkStyle(s,l,bM)})}afterInitMark(){var e,t,i;this.event.emit(ye.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField);let s=(e=this._spec.animationThreshold)!==null&&e!==void 0?e:Number.MAX_SAFE_INTEGER;this.getMarks().forEach(r=>{var a,o;!((o=(a=r.stateStyle)===null||a===void 0?void 0:a.normal)===null||o===void 0)&&o.lineWidth&&r.setAttribute("stroke",this.getColorAttribute(),"normal",J.Base_Series);const l=r.getProgressiveConfig();l&&(l.large&&l.largeThreshold&&(s=Math.min(s,l.largeThreshold)),l.progressiveThreshold&&(s=Math.min(s,l.progressiveThreshold)))}),((i=(t=this._rawData)===null||t===void 0?void 0:t.latestData)===null||i===void 0?void 0:i.length)>=s&&(this._spec.animation=!1)}getMarksWithoutRoot(){return this.getMarks().filter(e=>!e.name.includes("seriesGroup"))}getMarksInType(e){return this._marks.getMarksInType(e)}getMarkInName(e){return this._marks.get(e)}getMarkInId(e){return this.getMarks().find(t=>t.id===e)}initEvent(){var e,t,i;this._trigger.init(),(t=(e=this._data)===null||e===void 0?void 0:e.getDataView())===null||t===void 0||t.target.addListener("change",this.viewDataUpdate.bind(this)),(i=this._viewDataStatistics)===null||i===void 0||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new rn(this)}_compareSpec(e,t,i){var s,r;const a=super._compareSpec(e,t),o=Object.keys(t||{}).sort(),l=Object.keys(e||{}).sort();return ft(o,l)?((i=i??{data:!0}).invalidType=!0,e.invalidType!==t.invalidType&&(a.reCompile=!0),i.extensionMark=!0,(N(e.extensionMark).length!==N(t.extensionMark).length||!((s=t.extensionMark)===null||s===void 0)&&s.some((h,d)=>h.type!==e.extensionMark[d].type||h.id!==e.extensionMark[d].id))&&(a.reMake=!0),a.reMake?a:(!((r=t.extensionMark)===null||r===void 0)&&r.some((h,d)=>h.visible!==e.extensionMark[d].visible)&&(a.reCompile=!0),this._marks.getMarks().some(h=>{var d,u;return i[h.name]=!0,((d=t[h.name])===null||d===void 0?void 0:d.visible)!==((u=e[h.name])===null||u===void 0?void 0:u.visible)})&&(a.reCompile=!0),o.some(h=>!i[h]&&!ft(e[h],t[h]))&&(a.reMake=!0),a)):(a.reMake=!0,a)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Ye||I0(this._rawData,this._spec.data,!0)}reInit(e){super.reInit(e);const t=this.getMarksWithoutRoot();t.forEach(i=>{this._spec[i.name]&&this.initMarkStyleWithSpec(i,this._spec[i.name])}),this.initMarkStyle(),t.forEach(i=>{i.updateStaticEncode(),i.updateLayoutState(!0)}),this._updateExtensionMarkSpec(e),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec()}onEvaluateEnd(e){this._data.updateData()}onRender(e){}release(){var e,t,i;super.release(),this._viewDataMap.clear();const s=(t=(e=this._rawData)===null||e===void 0?void 0:e.transformsArr)===null||t===void 0?void 0:t.findIndex(r=>r.type==="addVChartProperty");s>=0&&this._rawData.transformsArr.splice(s,1),(i=this._data)===null||i===void 0||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(e){j(e.x)&&(this._layoutStartPoint.x=e.x),j(e.y)&&(this._layoutStartPoint.y=e.y)}setLayoutRect({width:e,height:t},i){j(e)&&(this._layoutRect.width=e),j(t)&&(this._layoutRect.height=t)}getSeriesKeys(){var e,t;return this._seriesField?(t=(e=this.getRawDataStatisticsByField(this._seriesField))===null||e===void 0?void 0:e.values)!==null&&t!==void 0?t:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(e){return t=>{var i,s;return(s=(i=this._seriesMark)===null||i===void 0?void 0:i.getAttribute(t,e))!==null&&s!==void 0?s:void 0}}_getSeriesInfo(e,t){const i=this.getDefaultShapeType();return t.map(s=>({key:s,style:this.getSeriesStyle({[e]:s}),shapeType:i}))}getSeriesInfoInField(e){var t,i;return this._getSeriesInfo(e,(i=(t=this.getRawDataStatisticsByField(e))===null||t===void 0?void 0:t.values)!==null&&i!==void 0?i:[])}getSeriesInfoList(){var e;return this._getSeriesInfo((e=this._seriesField)!==null&&e!==void 0?e:vn,this.getSeriesKeys())}_getDefaultColorScale(){var e,t;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return(t=(e=new Qu().domain(i)).range)===null||t===void 0?void 0:t.call(e,s)}_getDataScheme(){return hu(this.getColorScheme(),this.type)}getDefaultColorDomain(){var e,t;return this._seriesField?(t=(e=this.getViewDataStatistics())===null||e===void 0?void 0:e.latestData[this._seriesField])===null||t===void 0?void 0:t.values:[]}getColorAttribute(){var e,t;return{scale:(e=this._option.globalScale.getScale("color"))!==null&&e!==void 0?e:this._getDefaultColorScale(),field:(t=this._seriesField)!==null&&t!==void 0?t:vn}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(e){}_createMark(e,t={}){var i,s,r,a;const{key:o,groupKey:l,skipBeforeLayouted:h,themeSpec:d={},markSpec:u,dataView:c,dataProductId:f,parent:p,isSeriesMark:g,depend:_,progressive:m,support3d:y=this._spec.support3d||!!this._spec.zField,morph:b=!1,customShape:v}=t,x=super._createMark(e,{key:o??this._getDataIdKey(),support3d:y,seriesId:this.id,attributeContext:this._markAttributeContext});if(P(x)){this._marks.addMark(x,{name:e.name}),g&&(this._seriesMark=x),C(p)?(i=this._rootMark)===null||i===void 0||i.addMark(x):p!==!1&&p.addMark(x),C(c)?(x.setDataView(this.getViewData(),this.getViewDataProductId()),x.setSkipBeforeLayouted(!0)):c!==!1&&x.setDataView(c,f),ht(h)&&x.setSkipBeforeLayouted(h),P(_)&&x.setDepend(...N(_));const S=this.getSpec()||{};x.setMorph(b),x.setMorphKey(((s=S.morph)===null||s===void 0?void 0:s.morphKey)||`${this._specIndex}`),x.setMorphElementKey((a=(r=S.morph)===null||r===void 0?void 0:r.morphElementKey)!==null&&a!==void 0?a:t.defaultMorphElementKey),C(m)||x.setProgressiveConfig(m),C(l)||x.setGroupKey(l),v&&x.setCustomizedShapeCallback(v),this.initMarkStyleWithSpec(x,pe({},d,u||S[x.name]))}return x}_getDataIdKey(){var e;return(e=super._getDataIdKey())!==null&&e!==void 0?e:Vs}_getSeriesDataKey(e){let t="";if(!e)return t;const i=this.getDimensionField();t=i.map(r=>e[r]).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(t+=`_${e[s]}`),t}addViewDataFilter(e){var t,i;(i=(t=this._viewDataFilter)!==null&&t!==void 0?t:this.getViewData())===null||i===void 0||i.transform(e,!1)}reFilterViewData(){var e,t;(t=(e=this._viewDataFilter)!==null&&e!==void 0?e:this.getViewData())===null||t===void 0||t.reRunAllTransform()}reTransformViewData(){var e,t;(t=(e=this._data)===null||e===void 0?void 0:e.getDataView())===null||t===void 0||t.reRunAllTransform()}fillData(){var e;(e=this.getRawData())===null||e===void 0||e.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(e){var t;return e!==Jt&&e!==ka&&e!==Yn&&e!==lu||(e=this.getStackValueField()),(t=pg(this.getRawData(),e))!==null&&t!==void 0?t:e}getMarkInfoList(){var e;const t=super.getMarkInfoList();return t.length?t:Object.values((e=dg[this.type])!==null&&e!==void 0?e:{})}_getInvalidConnectType(){return this._invalidType==="zero"?"zero":this._invalidType==="link"?"connect":"none"}}ho.mark=mt,ho.transformerConstructor=kn;function UK(n){return[z.rose,z.radar,z.circularProgress].includes(n)}function XB(n,e,t){const i=n.getScale(0),s="isInverse"in n&&n.isInverse();Ue(i.type)?t.sort((r,a)=>(r[e]-a[e])*(s?-1:1)):t.sort((r,a)=>(i._index.get(r[e])-i._index.get(a[e]))*(s?-1:1))}function Oa(n){return{dataIndex:e=>{var t,i;const s=n.direction==="horizontal"?n.fieldY[0]:n.fieldX[0],r=e==null?void 0:e[s],a=n.direction==="horizontal"?n.scaleY:n.scaleX;return((i=(t=a==null?void 0:a.domain)===null||t===void 0?void 0:t.call(a))!==null&&i!==void 0?i:[]).indexOf(r)||0},dataCount:()=>{var e,t,i;const s=n.direction==="horizontal"?n.scaleY:n.scaleX;return(i=((t=(e=s==null?void 0:s.domain)===null||e===void 0?void 0:e.call(s))!==null&&t!==void 0?t:[]).length)!==null&&i!==void 0?i:0}}}class Qn extends ho{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getInvalidDefined=e=>{var t,i;return!(!((t=this._xAxisHelper)===null||t===void 0)&&t.isContinuous&&!Ws(e[this._specXField[0]]))&&!(!((i=this._yAxisHelper)===null||i===void 0)&&i.isContinuous&&!Ws(e[this._specYField[0]]))}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(e){this._fieldX=N(e)}get fieldY(){return this._fieldY}setFieldY(e){this._fieldY=N(e)}get fieldZ(){return this._fieldZ}setFieldZ(e){this._fieldZ=e&&N(e)}get fieldX2(){return this._fieldX2}setFieldX2(e){this._fieldX2=e}get fieldY2(){return this._fieldY2}setFieldY2(e){this._fieldY2=e}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(e){this._scaleX=e}get scaleY(){return this._scaleY}setScaleY(e){this._scaleY=e}get scaleZ(){return this._scaleZ}setScaleZ(e){this._scaleZ=e}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(e){this._xAxisHelper=e,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(e){this._yAxisHelper=e,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(e){this._zAxisHelper=e,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){var e,t,i;const s=[];return!((e=this.getXAxisHelper())===null||e===void 0)&&e.getScale&&(this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX).forEach(r=>{const a={key:r,operations:[]};Ue(this.getXAxisHelper().getScale(0).type)?a.operations=["max","min"]:a.operations=["values"],s.push(a)}),!((t=this.getYAxisHelper())===null||t===void 0)&&t.getScale&&(this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY).forEach(r=>{const a={key:r,operations:[]};Ue(this.getYAxisHelper().getScale(0).type)?a.operations=["max","min"]:a.operations=["values"],s.push(a)}),this._fieldZ&&(!((i=this.getZAxisHelper())===null||i===void 0)&&i.getScale)&&this._fieldZ.forEach(r=>{const a={key:r,operations:[]};Ue(this.getZAxisHelper().getScale(0).type)?a.operations=["max","min"]:a.operations=["values"],s.push(a)}),this.getStack()&&s.push({key:this.getStackValueField(),operations:["allValid"]}),s}getGroupFields(){return this.direction==="vertical"?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var e;return(e=this._spec.stackValue)!==null&&e!==void 0?e:`${be}_series_${this.type}_${(this.direction==="horizontal"?this.getXAxisHelper():this.getYAxisHelper()).getAxisId()}`}getStackValueField(){return this.direction==="vertical"?N(this._spec.yField)[0]:N(this._spec.xField)[0]}setValueFieldToStack(){this.direction==="vertical"?(this.setFieldY(Jt),this.setFieldY2(Yn)):(this.setFieldX(Jt),this.setFieldX2(Yn))}setValueFieldToPercent(){this.direction==="vertical"?(this.setFieldY(ka),this.setFieldY2(lu)):(this.setFieldX(ka),this.setFieldX2(lu))}setValueFieldToStackOffsetSilhouette(){this.direction==="vertical"?(this.setFieldY(Gv),this.setFieldY2(Hv)):(this.setFieldX(Gv),this.setFieldX2(Hv))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var e,t;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=N(this._spec.xField),this._specYField=N(this._spec.yField),P(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2((e=this._spec)===null||e===void 0?void 0:e.x2Field),this.setFieldY2((t=this._spec)===null||t===void 0?void 0:t.y2Field),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette(),P(this._spec.sortDataByAxis)&&(this._sortDataByAxis=this._spec.sortDataByAxis===!0)}dataToPosition(e){return e?{x:this.dataToPositionX(e),y:this.dataToPositionY(e)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(e=0)=>{var t,i,s;return(s=(i=(t=this.getXAxisHelper()).getBandwidth)===null||i===void 0?void 0:i.call(t,e))!==null&&s!==void 0?s:0},this._markAttributeContext.yBandwidth=(e=0)=>{var t,i,s;return(s=(i=(t=this.getYAxisHelper()).getBandwidth)===null||i===void 0?void 0:i.call(t,e))!==null&&s!==void 0?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(e,t){return{x:this.valueToPositionX(e),y:this.valueToPositionY(t)}}_axisPosition(e,t,i){return this._scaleConfig.datum=i,e.isContinuous?e.valueToPosition(t,this._scaleConfig):e.dataToPosition(N(t),this._scaleConfig)}valueToPositionX(e,t){return this._axisPosition(this._xAxisHelper,e,t)}valueToPositionY(e,t){return this._axisPosition(this._yAxisHelper,e,t)}dataToPositionX(e){if(this._positionXEncoder)return this._positionXEncoder(e);if(!this._xAxisHelper)return this._positionXEncoder=i=>Number.NaN,Number.NaN;const t=this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._fieldX;return t&&t.length!==0?(this._xAxisHelper.isContinuous?this._positionXEncoder=i=>(this._scaleConfig.datum=i,this._xAxisHelper.valueToPosition(this.getDatumPositionValue(i,t[0]),this._scaleConfig)):this._positionXEncoder=i=>(this._scaleConfig.datum=i,this._xAxisHelper.dataToPosition(N(this.getDatumPositionValues(i,t)),this._scaleConfig)),this._positionXEncoder(e)):(this._positionXEncoder=i=>null,null)}dataToPositionY(e){if(this._positionYEncoder)return this._positionYEncoder(e);if(!this._yAxisHelper)return this._positionYEncoder=i=>Number.NaN,Number.NaN;const t=this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._fieldY;return t&&t.length!==0?(this._yAxisHelper.isContinuous?this._positionYEncoder=i=>(this._scaleConfig.datum=i,this._yAxisHelper.valueToPosition(this.getDatumPositionValue(i,t[0]),this._scaleConfig)):this._positionYEncoder=i=>(this._scaleConfig.datum=i,this._yAxisHelper.dataToPosition(N(this.getDatumPositionValues(i,t)),this._scaleConfig)),this._positionYEncoder(e)):(this._positionYEncoder=i=>null,null)}dataToPositionZ(e){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:t}=this._zAxisHelper;return t(this.getDatumPositionValues(e,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(e){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in e?this.valueToPositionX(this.getDatumPositionValues(e,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(e){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in e?this.valueToPositionY(this.getDatumPositionValues(e,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(e){return e?{x:this.positionToDataX(e.x),y:this.positionToDataY(e.y)}:null}positionToDataX(e){return this._scaleX?this._scaleX.invert(e):null}positionToDataY(e){return this._scaleY?this._scaleY.invert(e):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:e}=this._xAxisHelper;return e(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:e}=this._xAxisHelper;return e(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._trigger.setStateKeys([...this._fieldX,...this._fieldY]),this._buildScaleConfig()}getDimensionField(){return this._direction==="vertical"?this._specXField:this._specYField}getMeasureField(){return this._direction==="vertical"?this._specYField:this._specXField}viewDataUpdate(e){super.viewDataUpdate(e),this.sortDataByAxis&&this._sortDataInAxisDomain()}_sortDataInAxisDomain(){var e,t,i;!((t=(e=this.getViewData())===null||e===void 0?void 0:e.latestData)===null||t===void 0)&&t.length&&(XB(this._direction==="horizontal"?this._yAxisHelper:this._xAxisHelper,this._direction==="horizontal"?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),(i=this._data)===null||i===void 0||i.updateData(!0))}reInit(e){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(e)}}const W0="monotone",KB="linear",$K="bevel";class V0{addSamplingCompile(){if(this._spec.sampling){const{width:e,height:t}=this._region.getLayoutRect(),i=[],s=this._fieldY,r=this._fieldX;i.push({type:"sampling",size:this._direction==="vertical"?e:t,factor:this._spec.samplingFactor,yfield:this._direction==="vertical"?s[0]:r[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var e;if(this._spec.markOverlap){const t=[];t.push({type:"markoverlap",direction:this._direction==="horizontal"&&this.coordinate==="cartesian"?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),(e=this._symbolMark)===null||e===void 0||e.getProduct().transform(t)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(e,t){var i;return this._lineMark=this._createMark(Gr.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:t==null||t,progressive:e,customShape:(i=this._spec.line)===null||i===void 0?void 0:i.customShape}),this._lineMark}initLineMarkStyle(e,t){var i,s;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",J.Series),this._invalidType!=="zero"&&this.setMarkStyle(r,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",J.Series),this.event.on(ye.viewDataStatisticsUpdate,{filter:a=>a.model===this},()=>{this.encodeDefined(r,"defined")}),this.coordinate==="polar")this.setMarkStyle(r,{lineJoin:$K,curveType:KB,closePath:!0},"normal",J.Series);else{const a=t??((s=(i=this.getSpec().line)===null||i===void 0?void 0:i.style)===null||s===void 0?void 0:s.curveType),o=a===W0?e==="vertical"?"monotoneX":"monotoneY":a;this.setMarkStyle(r,{curveType:o},"normal",J.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",J.Series),this._trigger.registerMark(r)}return r}_getEventElement(e,t=!1){let i=[];return e.dimensionInfo.some(s=>(s.data.some(r=>r.series===this&&(i=r.datum,!0)),!i.length)),i}_dimensionTrigger(e){const t=this._getEventElement(e);switch(e.action){case"enter":this._symbolActiveMark.getDataView().parse(t),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(e,t){var i,s,r;if(((i=this._spec.point)===null||i===void 0?void 0:i.visible)!==!1&&(this._symbolMark=this._createMark(Gr.point,{morph:Tr(this._spec,Gr.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:e,isSeriesMark:!!t,customShape:(s=this._spec.point)===null||s===void 0?void 0:s.customShape})),this._spec.activePoint===!0){const a=new Ye(this._option.dataSet,{name:`${be}_series_${this.id}_active_point`});a.parse([]),this._symbolActiveMark=this._createMark({name:"active_point",type:"symbol"},{morph:!1,groupKey:this._seriesField,isSeriesMark:!1,dataView:a,parent:this._region.getInteractionMark(),customShape:(r=this._spec.point)===null||r===void 0?void 0:r.customShape}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._trigger.registerMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(xr.dimensionHover,this._dimensionTrigger.bind(this));for(const t in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[t]={};for(const i in this._symbolMark.stateStyle[t])this._symbolActiveMark.stateStyle[t][i]={style:null,level:J.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:_e.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",J.Series),this._invalidType!=="zero"&&this.setMarkStyle(e,{visible:this._getInvalidDefined},"normal",J.Series),this.event.on(ye.viewDataStatisticsUpdate,{filter:t=>t.model===this},()=>{this.encodeDefined(e,"visible")}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",J.Series))}_initSymbolActiveMarkAlone(){var e,t;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(!((t=(e=this._spec[Gr.point.name])===null||e===void 0?void 0:e.state)===null||t===void 0)&&t.dimension_hover)&&(i.setVisible(!0),this.event.on(xr.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,pe({},this._spec[Gr.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:_e.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var t;e&&(((t=e.getTarget())===null||t===void 0?void 0:t.type)!=="symbol"&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:i=>i[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._invalidType!=="zero"&&this.setMarkStyle(e,{visible:this._getInvalidDefined},"normal",J.Series),this.event.on(ye.viewDataStatisticsUpdate,{filter:i=>i.model===this},()=>{this.encodeDefined(e,"visible")}))}initLineLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,t){var i,s,r,a,o,l;if(!e)return;const h=(s=(i=this.getViewDataStatistics())===null||i===void 0?void 0:i.latestData)===null||s===void 0?void 0:s[this.getStackValueField()];if(this._invalidType==="zero"||h&&(h!=null&&h.allValid)){if(((a=(r=e.stateStyle.normal)===null||r===void 0?void 0:r[t])===null||a===void 0?void 0:a.style)===!0)return;this.setMarkStyle(e,{[t]:!0},"normal",J.Series)}else{if(((l=(o=e.stateStyle.normal)===null||o===void 0?void 0:o[t])===null||l===void 0?void 0:l.style)!==!0)return;this.setMarkStyle(e,{[t]:this._getInvalidDefined},"normal",J.Series)}e.getProduct()&&e.compileEncode()}}class qB extends Ti{setStyle(e,t="normal",i=0,s=this.stateStyle){if(C(e))return;s[t]===void 0&&(s[t]={});const r=this._getIgnoreAttributes(),a=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],o=this.isUserLevel(i);let l=!1;Object.keys(e).forEach(h=>{const d=e[h];if(C(d)||r.includes(h))return;o&&a.includes(h)&&(tv(d==null?void 0:d.type)||d!=null&&d.scale||Y(d))&&(l=!0);let u=this._styleConvert(d);o&&h==="angle"&&(u=this.convertAngleToRadian(u)),this.setAttribute(h,u,t,i,s)}),l&&this.setEnableSegments(l)}}class fu extends qB{constructor(){super(...arguments),this.type=fu.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var e,t;return((e=this.model)===null||e===void 0?void 0:e.type)===z.radar&&((t=this.model)===null||t===void 0?void 0:t.coordinate)==="polar"?[]:["fill","fillOpacity"]}}fu.type="line";const N0=()=>{D.registerMark(fu.type,fu),Y8(),NB()};class ZB extends Ti{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class pu extends ZB{constructor(){super(...arguments),this.type=pu.type}}pu.type="symbol";const Ba=()=>{D.registerMark(pu.type,pu),gO()};class ic extends kn{_transformLabelSpec(e){var t,i,s;((t=e.point)===null||t===void 0?void 0:t.visible)!==!1&&((s=(i=e.point)===null||i===void 0?void 0:i.style)===null||s===void 0?void 0:s.visible)!==!1?this._addMarkLabelSpec(e,"point"):this._addMarkLabelSpec(e,"line"),this._addMarkLabelSpec(e,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}class tl extends Qn{constructor(){super(...arguments),this.type=z.line,this.transformerConstructor=ic,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var e;const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=(e=this._spec.seriesMark)!==null&&e!==void 0?e:"line";this.initLineMark(t,i==="line"),this.initSymbolMark(t,i==="point")}initTooltip(){super.initTooltip(),this._lineMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._lineMark),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var e,t,i,s;const r={direction:this.direction},a=(t=(e=this._spec)===null||e===void 0?void 0:e.animationAppear)===null||t===void 0?void 0:t.preset;if(this._lineMark.setAnimationConfig(Le((i=D.getAnimationInKey("line"))===null||i===void 0?void 0:i(r,a),Ge("line",this._spec,this._markAttributeContext))),this._symbolMark){const o=Oa(this);this._symbolMark.setAnimationConfig(Le((s=D.getAnimationInKey("scaleInOut"))===null||s===void 0?void 0:s(),Ge("point",this._spec,this._markAttributeContext),o))}}onLayoutEnd(e){super.onLayoutEnd(e),this.reCompileSampling()}getSeriesStyle(e){var t;const i=((t=this._spec)===null||t===void 0?void 0:t.seriesMark)!=="point";return s=>{var r,a;return i&&s==="fill"&&(s="stroke"),(a=(r=this._seriesMark)===null||r===void 0?void 0:r.getAttribute(s,e))!==null&&a!==void 0?a:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}tl.type=z.line,tl.mark=zO,tl.transformerConstructor=ic,li(tl,V0);const YK=()=>{M0(),T0(),N0(),Ba(),WB(),lm(),D.registerSeries(tl.type,tl)};class XK{get dataList(){return this._dataArr}constructor(e,t){this._dataArr=[],this._onError=t,this._dataSet=e}parseData(e){this._dataArr=[];const t=N(e);for(let i=0;i<t.length;i++)this._dataArr.push(_g(t[i],this._dataSet,this._dataArr,{onError:this._onError}))}updateData(e,t=!1,i=!0){const s=N(e);return(!t||s.length===this._dataArr.length)&&(this._dataValueForEach(s,(r,a)=>{a.markRunning()}),this._dataValueForEach(s,(r,a)=>{I0(a,r,i)}),!0)}_dataValueForEach(e,t){e.forEach((i,s)=>{if(i instanceof Ye)return;const r=this.getSeriesData(i.id,s);r&&t(i,r,s)})}getSeriesData(e,t){var i,s;if(!this._dataArr.length)return null;if(typeof e=="string"){const r=this._dataArr.filter(a=>a.name===e);return r[0]?r[0]:((i=this._onError)===null||i===void 0||i.call(this,`no data matches dataId ${e}!`),null)}return typeof t=="number"?this._dataArr[t]?this._dataArr[t]:((s=this._onError)===null||s===void 0||s.call(this,`no data matches dataIndex ${t}!`),null):this._dataArr[0]}}class KK{constructor(e,t){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=i=>{const s=[];return this._scaleSpecMap.forEach((r,a)=>{Yo(r.domain)&&r.domain.forEach(o=>{o.dataId===i&&o.fields.forEach(l=>{Gl(s,[{key:l,operations:Ue(r.type)?["max","min"]:["values"]}])})})}),this._markAttributeScaleMap.forEach((r,a)=>{const o=this.getScale(a);r.forEach(l=>{this._getSeriesBySeriesId(l.seriesId).getRawData().name===i&&l.field&&Gl(s,[{key:l.field,operations:Ue(o.type)?["max","min"]:["values"]}])})}),s},this._spec=e,this._chart=t,this._setAttrFromSpec()}_createFromSpec(e){if(!e.id)return null;let t=this._scaleMap.get(e.id);return t||(t=e.type==="ordinal"&&e.id==="color"?$v("colorOrdinal"):$v(e.type)),t?(W(e.range)&&t.range(e.range),W(e.domain)&&(Yo(e.domain)||t.domain(e.domain)),e.specified&&t.specified&&t.specified(e.specified),t):null}_setAttrFromSpec(){var e;if(!(!((e=this._spec)===null||e===void 0)&&e.length))return;const t=new Map,i=new Map;this._spec.forEach(s=>{const r=this._createFromSpec(s);r&&(t.set(s.id,r),i.set(s.id,s))}),this._modelScaleSpecMap.forEach(s=>{const r=this._createFromSpec(s);r&&(t.set(s.id,r),i.set(s.id,s))}),this._scaleSpecMap=i,this._scaleMap=t}updateSpec(e){const t={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(ft(e,this._spec))return t;t.change=!0;for(let i=0;i<e.length;i++){const s=e[i],r=this._scaleMap.get(s.id);if(!r)return t.reMake=!0,t;const a=this._spec.find(o=>o.id===s.id);if(!a.id||a.type!==s.type)return t.reMake=!0,t;s.range&&!ft(s.range,r.range())&&(r.range(s.range),t.reRender=!0),Yo(s.domain)?t.reRender=!0:ft(s.domain,r.domain())||(r.domain(s.domain),t.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=e,t}registerModelScale(e){const t=this._createFromSpec(e);t&&(this._modelScaleSpecMap.set(e.id,e),this._scaleSpecMap.set(e.id,e),this._scaleMap.set(e.id,t))}removeModelScale(e){this._modelScaleSpecMap.forEach(t=>{e(t)&&(this._modelScaleSpecMap.delete(t.id),this._scaleSpecMap.delete(t.id),this._scaleMap.delete(t.id))})}getScale(e){return this._scaleMap.get(e)}getScaleSpec(e){return this._scaleSpecMap.get(e)}_getSeriesByRawDataId(e){const t=this._chart.getAllSeries();for(let i=0;i<t.length;i++){const s=t[i];if(s.getRawData().name===e)return s}return null}_getSeriesBySeriesId(e){const t=this._chart.getAllSeries();for(let i=0;i<t.length;i++){const s=t[i];if(s.id===e)return s}return null}updateScaleDomain(e){this._scaleSpecMap.forEach((t,i)=>{const s=this._scaleMap.get(i);if(!s)return;if(!Yo(t.domain))return t.domain&&t.domain.length!==0||s.domain(e),void this._updateMarkScale(i,s,s.domain().slice());let r;r=Ue(t.type)?[null,null]:new Set,t.domain.forEach(o=>{const l=this._getSeriesByRawDataId(o.dataId);if(!l)return;const h=Ue(t.type);o.fields.forEach(d=>{const u=l.getRawDataStatisticsByField(d,h);u&&(h?(C(r[0])?r[0]=u.min:r[0]=Math.min(u.min,r[0]),C(r[1])?r[1]=u.max:r[1]=Math.max(u.max,r[1])):u.values.forEach(c=>{r.add(c)}))})});const a=r;Ue(t.type)||(r=Array.from(r)),s.domain(r),this._updateMarkScale(i,s,a)})}_updateMarkScale(e,t,i){const s=this._markAttributeScaleMap.get(e);s&&s.length!==0&&s.forEach(r=>{if(!r.field||!r.markScale||r.markScale===t)return;if(C(r.changeDomain)||r.changeDomain==="none"||C(r.seriesId))return void(Ue(t.type)?r.markScale.domain(i):t.domain(Array.from(i)));const a=this._getSeriesBySeriesId(r.seriesId),o=Ue(t.type),l=a.getRawDataStatisticsByField(r.field,o);if(!fe(l))return r.changeDomain==="expand"?(o?(i[0]=Math.min(i[0],l.min),i[1]=Math.max(i[1],l.max)):(l.values.forEach(h=>{i.add(h)}),i=Array.from(i)),void r.markScale.domain(i)):void(r.changeDomain!=="replace"||(o?r.markScale.domain([l.min,l.max]):r.markScale.domain(l.values)));Ue(t.type)?r.markScale.domain(i):t.domain(Array.from(i))})}registerMarkAttributeScale(e,t){const i=this._scaleMap.get(e.scale);let s=this._markAttributeScaleMap.get(e.scale);s||(s=[],this._markAttributeScaleMap.set(e.scale,s));let r=i;return(C(e.field)||!C(e.changeDomain)&&e.changeDomain!=="none"&&!C(t))&&(r=i.clone()),s.push(Object.assign(Object.assign({},e),{seriesId:t,markScale:r})),r}}class qK{constructor(e){this.stackRegion=({model:t})=>{const i=t.getSeries();if(!i.some(l=>l.getStack()))return;const s=i.some(l=>{var h,d;return(d=(h=l.getSpec())===null||h===void 0?void 0:h.totalLabel)===null||d===void 0?void 0:d.visible}),r=s||i.some(l=>l.getPercent()),a=i.some(l=>l.getStackOffsetSilhouette()),o=yB(t,!0);for(const l in o)for(const h in o[l].nodes)vB(o[l].nodes[h],t.getStackInverse(),r);if(a)for(const l in o)for(const h in o[l].nodes)O9(o[l].nodes[h]);s&&t.getSeries().forEach(l=>{const h=l.getStackData(),d=l.getStackValue(),u=l.getStackValueField();h&&u&&bB(o[d],u)})},this._chart=e}init(){this._chart.getAllRegions().forEach(e=>{e.event.on(ye.regionSeriesDataFilterOver,{filter:({model:t})=>(t==null?void 0:t.id)===e.id},this.stackRegion)})}stackAll(){this._chart.getAllRegions().forEach(e=>{this.stackRegion({model:e})})}}var GM=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};let yt=class extends nm{getSpec(){return this._spec}setSpec(e){this._spec=e}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(e,t,i=!0){var s;return this._layoutTag=e,!((s=this.getCompiler())===null||s===void 0)&&s.getVGrammarView()&&(this.getCompiler().getVGrammarView().updateLayoutTag(),e&&i&&this.getCompiler().renderAsync(t)),this._layoutTag}getEvent(){return this._event}get chartData(){return this._chartData}constructor(e,t){var i,s,r,a;super(t),this.type="chart",this.id=mo(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:Xo,height:Ko},this._viewRect={width:Xo,height:Ko},this._viewBox={x1:0,y1:0,x2:Xo,y2:Ko},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var o;return(o=this._series)!==null&&o!==void 0?o:[]},this.getRegionsInIndex=o=>o&&o.length!==0?this._regions.filter((l,h)=>o.includes(h)):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=o=>o?this._regions.filter(l=>o.includes(l.id)):[],this.getRegionsInQuerier=o=>o?this._regions.filter((l,h)=>N(o).some(d=>P(d.regionId)&&d.regionId===l.userId||d.regionIndex===h)):this._regions,this.getRegionsInUserId=o=>{if(o)return this._regions.find(l=>l.userId===o)},this.getRegionsInUserIdOrIndex=(o,l)=>this.getAllRegions().filter(h=>o!=null&&o.length?h.userId&&o.includes(h.userId):!(l!=null&&l.length)||l.includes(h.getSpecIndex())),this.getComponents=()=>this._components,this.getSeriesInIndex=o=>o&&o.length!==0?this._series.filter((l,h)=>o.includes(h)):[this._series[0]],this.getSeriesInIds=o=>o?this._series.filter(l=>o.includes(l.id)):[],this.getSeriesInUserId=o=>{if(o)return this._series.find(l=>l.userId===o)},this.getSeriesInUserIdOrIndex=(o,l)=>this.getAllSeries().filter(h=>o!=null&&o.length?h.userId&&o.includes(h.userId):!(l!=null&&l.length)||l.includes(h.getSpecIndex())),this.getComponentByIndex=(o,l)=>{const h=this._components.filter(d=>(d.specKey||d.type)===o);if(h&&h.length!==0)return h[l]},this.getComponentsByKey=o=>this._components.filter(l=>(l.specKey||l.type)===o),this.getComponentByUserId=o=>{const l=this._components.find(h=>h.userId===o);if(l)return l},this._paddingSpec=vr((i=e.padding)!==null&&i!==void 0?i:t.getTheme().padding),this._event=new tc(t.eventDispatcher,t.mode),this._dataSet=t.dataSet,this._chartData=new XK(this._dataSet,(s=this._option)===null||s===void 0?void 0:s.onError),this._modelOption=Object.assign(Object.assign({},t),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:(r=this._option)===null||r===void 0?void 0:r.onError,disableTriggerEvent:((a=this._option)===null||a===void 0?void 0:a.disableTriggerEvent)===!0,getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=e}created(){this._transformer=new this.transformerConstructor({type:this.type,seriesType:this.seriesType,getTheme:this._option.getTheme,animation:this._option.animation}),this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._spec.background&&typeof this._spec.background=="object"&&this._createBackground(),this._createLayout(),this._transformer.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),this._transformer.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),this._transformer.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}init(){this._regions.forEach(e=>e.init({})),this._series.forEach(e=>e.init({})),this._components.forEach(e=>e.init({dataSet:this._dataSet})),this._initEvent(),this._canStack&&(this._stack=new qK(this),this._stack.init()),this.reDataFlow()}reDataFlow(){this._series.forEach(e=>{var t;return(t=e.getRawData())===null||t===void 0?void 0:t.markRunning()}),this._series.forEach(e=>e.fillData()),this.updateGlobalScaleDomain()}onResize(e,t,i=!0){const s={width:e,height:t};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(e,t){this._option.viewBox=e,this._updateLayoutRect(e),this.setLayoutTag(!0,null,t)}_createBackground(){const e=gX(this._spec.background);e&&(this._backgroundMark=D.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})))}_createRegion(e,t){if(!e)return;const{spec:i}=t,s=GM(t,["spec"]),r=new e(i,Object.assign(Object.assign({},this._modelOption),s));r&&(r.created(),this._regions.push(r))}_createSeries(e,t){if(!e)return;const{spec:i}=t,s=GM(t,["spec"]);let r;if(P(i.regionId)?r=this.getRegionsInUserId(i.regionId):P(i.regionIndex)&&(r=this.getRegionsInIndex([i.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new e(i,Object.assign(Object.assign(Object.assign({},this._modelOption),s),{type:i.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(e){return this._series.find(t=>t.id===e)}_createComponent(e,t){const i=e.createComponent(t,Object.assign(Object.assign({},this._modelOption),{type:e.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}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(e){if(ae(e))return this.getAllModels().find(i=>i.userId===e);if(Y(e))return this.getAllModels().find(i=>e(i));let t=0;return this.getAllModels().find(i=>{var s;if(((s=i.specKey)!==null&&s!==void 0?s:i.type)===e.type){if(t===e.index)return!0;t++}return!1})}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(e){this._option.layout=e,this._initLayoutFunc()}_initLayoutFunc(){var e,t,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some(a=>a.zField))&&(s=!0);const r=D.getLayoutInKey((t=(e=this._spec.layout)===null||e===void 0?void 0:e.type)!==null&&t!==void 0?t:s?"layout3d":"base");if(r){const a=new r(this._spec.layout,{onError:(i=this._option)===null||i===void 0?void 0:i.onError});this._layoutFunc=a.layoutItems.bind(a)}}}layout(e){var t,i,s,r;if((i=(t=this._option.performanceHook)===null||t===void 0?void 0:t.beforeLayoutWithSceneGraph)===null||i===void 0||i.call(t),this.getLayoutTag()){this._event.emit(ye.layoutStart,{chart:this}),this.onLayoutStart(e);const a=this.getLayoutElements();this._layoutFunc(this,a,this._layoutRect,this._viewBox),this._event.emit(ye.afterLayout,{elements:a}),this.setLayoutTag(!1),this.onLayoutEnd(e),this._event.emit(ye.layoutEnd,{chart:this})}(r=(s=this._option.performanceHook)===null||s===void 0?void 0:s.afterLayoutWithSceneGraph)===null||r===void 0||r.call(s)}onLayoutStart(e){this.getAllModels().forEach(t=>t.onLayoutStart(this._layoutRect,this._viewRect,e))}onLayoutEnd(e){this.getAllModels().forEach(t=>t.onLayoutEnd(e))}onEvaluateEnd(e){[...this._components,...this._regions,...this._series].forEach(t=>t.onEvaluateEnd(e))}getLayoutElements(){return this.getAllModels().map(e=>e.layout).filter(e=>!!e)}getModelById(e){const t=this._idMap.get(e);if(t&&t instanceof F0)return t}getModelByUserId(e){const t=this._series.find(r=>r.userId===e);if(t)return t;const i=this._regions.find(r=>r.userId===e);return i||this._components.find(r=>r.userId===e)||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter(e=>e&&e instanceof Ti)}getMarkById(e){const t=this._idMap.get(e);if(t&&t instanceof Ti)return t}updateData(e,t,i=!0,s){const r=this._dataSet.getDataView(e);r&&(r.markRunning(),r.parseNewData(t,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach(a=>a.onDataUpdate())}updateFullData(e,t=!0){N(e).forEach(i=>{const s=this._dataSet.getDataView(i.id);s&&s.markRunning()}),N(e).forEach(i=>{const s=this._dataSet.getDataView(i.id);s&&I0(s,i,!0)}),t&&this.updateGlobalScaleDomain(),this.getAllModels().forEach(i=>i.onDataUpdate())}onRender(e){}setCanvasRect(e,t){this._canvasRect={width:e,height:t}}getCanvasRect(){return this._canvasRect||(this._canvasRect=OB(this._spec,this._option,{width:Xo,height:Ko})),this._canvasRect}getSeriesData(e,t){return this._chartData.getSeriesData(e,t)}_transformSpecScale(){var e,t;const i=(e=this._spec.scales)!==null&&e!==void 0?e:[];let s=i.find(a=>a.id==="color");const r=this.getColorScheme();if(!s&&(s={type:"ordinal",id:"color",domain:null,range:null},i.push(s),this._spec.color)){const a=this._spec.color;if(W(a))s.range=a;else{const o=a;Object.prototype.hasOwnProperty.call(o,"type")&&(s.type=o.type),Object.prototype.hasOwnProperty.call(o,"domain")&&(s.domain=o.domain),Object.prototype.hasOwnProperty.call(o,"range")&&(s.range=o.range),Object.prototype.hasOwnProperty.call(o,"specified")&&(s.specified=o.specified)}}return!((t=s.range)===null||t===void 0)&&t.length||(s.range=hu(r),s.rangeTheme=!0),i}_createGlobalScale(){this._globalScale=new KK(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const e=new Set;this._series.forEach(i=>{const s=i.getSeriesKeys();s&&s.forEach(r=>e.add(r))});const t=Array.from(e);this._globalScale.updateScaleDomain(t)}updateGlobalScale(e){Fo(e,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const e=this._globalScale.getScaleSpec("color"),t=this.getColorScheme();e.rangeTheme&&(e.range=hu(t),this._globalScale.getScale("color").range(e.range))}updateSpec(e){const t={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),e.type!==this.type)return t.reMake=!0,t;const i=Object.keys(this._spec).sort(),s=Object.keys(e).sort();if(JSON.stringify(i)!==JSON.stringify(s))return t.reMake=!0,t;const r=this._spec;return this._spec=e,this.updateChartConfig(t,r),t.reMake?t:(this.updateGlobalScale(t),t.reMake?t:(this.updateRegionSpec(t),t.reMake?t:(this.updateComponentSpec(t),t.reMake?t:(this.updateSeriesSpec(t),t.reMake||(this.updateDataSpec(t),t.reMake||this.updateGlobalScaleDomain()),t))))}updateChartConfig(e,t){var i,s;this._paddingSpec=vr((i=this._spec.padding)!==null&&i!==void 0?i:(s=this._option)===null||s===void 0?void 0:s.getTheme().padding),this._updateLayoutRect(this._viewBox),ft(this._spec.background,t.background)||(e.reMake=!0)}updateDataSpec(e){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(e){var t;!((t=this._spec)===null||t===void 0)&&t.region&&(this._spec.region.length===this._regions.length?this._regions.forEach(i=>{Fo(e,i.updateSpec(this._spec.region[i.getSpecIndex()]))}):e.reMake=!0)}updateComponentSpec(e){const t={};this._components.forEach(i=>{var s,r;const a=i.specKey||i.type,o=(s=this._spec[a])!==null&&s!==void 0?s:{};W(o)?(t[a]=t[a]||{specCount:o.length,componentCount:0},t[a].componentCount++,Fo(e,i.updateSpec((r=o[i.getSpecIndex()])!==null&&r!==void 0?r:{},o))):Fo(e,i.updateSpec(o))});for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const s=t[i];s.componentCount!==s.specCount&&(e.reMake=!0)}}updateSeriesSpec(e){this._spec.series.length===this._series.length?this._series.forEach(t=>{const i=this._spec.series[t.getSpecIndex()];Fo(e,t.updateSpec(i))}):e.reMake=!0}getCanvas(){var e,t;return(t=(e=this.getCompiler())===null||e===void 0?void 0:e.getCanvas())!==null&&t!==void 0?t:null}_updateLayoutRect(e){let t=this.getCanvasRect();if(e){this._viewBox=e;const{x1:i=0,y1:s=0,x2:r,y2:a}=e;t={width:r-i,height:a-s}}else this._viewBox={x1:0,y1:0,x2:t.width,y2:t.height};this._viewRect=t,this.padding=cB(this._paddingSpec,t,t),this._layoutRect.width=t.width-this.padding.left-this.padding.right,this._layoutRect.height=t.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(ye.layoutRectUpdate,{})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this._regions.forEach(e=>e.reInit(e.getSpecInfo().spec)),this._series.forEach(e=>e.reInit(e.getSpecInfo().spec)),this._components.forEach(e=>e.reInit(e.getSpecInfo().spec))}clear(){this.getAllModels().forEach(e=>{var t;return(t=e.clear)===null||t===void 0?void 0:t.call(e)})}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach(e=>{var t;(t=e.afterCompile)===null||t===void 0||t.call(e)}),this.getAllSeries().forEach(e=>{var t;(t=e.afterCompile)===null||t===void 0||t.call(e)}),this.getAllComponents().forEach(e=>{var t;(t=e.afterCompile)===null||t===void 0||t.call(e)})}compileLayout(){const{width:e,height:t}=this.getCanvasRect();this.getCompiler().setSize(e,t)}compileBackground(){var e;this._backgroundMark&&(this._backgroundMark.compile(),(e=this._backgroundMark.getProduct())===null||e===void 0||e.configure({context:{model:this}}).layout(()=>{}))}compileRegions(){var e,t,i,s;(t=(e=this._option.performanceHook)===null||e===void 0?void 0:e.beforeRegionCompile)===null||t===void 0||t.call(e),this.getAllRegions().forEach(r=>{r.compile()}),(s=(i=this._option.performanceHook)===null||i===void 0?void 0:i.afterRegionCompile)===null||s===void 0||s.call(i)}compileSeries(){var e,t,i,s;(t=(e=this._option.performanceHook)===null||e===void 0?void 0:e.beforeSeriesCompile)===null||t===void 0||t.call(e),this.getAllSeries().forEach(r=>{r.compile()}),(s=(i=this._option.performanceHook)===null||i===void 0?void 0:i.afterSeriesCompile)===null||s===void 0||s.call(i)}compileComponents(){var e,t,i,s;(t=(e=this._option.performanceHook)===null||e===void 0?void 0:e.beforeComponentCompile)===null||t===void 0||t.call(e),this.getAllComponents().forEach(r=>{r.compile()}),(s=(i=this._option.performanceHook)===null||i===void 0?void 0:i.afterComponentCompile)===null||s===void 0||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach(e=>{e.beforeRelease()}),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach(e=>{e.release()}),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(e){const t=e.rootMark;this.layout({group:t,srView:e})}updateState(e,t){const i=this.getAllSeries();for(const s in e){if(fe(e[s]))continue;const r=e[s];let a={stateValue:s};a=Y(r.filter)?Object.assign({filter:r.filter},a):Object.assign(Object.assign({},r.filter),a),r.level&&(a.level=r.level),i.forEach(o=>{o.getMarks().forEach(l=>{l.stateStyle[s]&&(t&&!t(o,l,s)||(l.state.changeStateInfo(a),l.updateMarkState(s)))})})}}setSelected(e,t,i){this._setStateInDatum(_e.STATE_SELECTED,!0,e,t,i)}setHovered(e,t,i){this._setStateInDatum(_e.STATE_HOVER,!0,e,t,i)}_initEvent(){[ye.dataZoomChange,ye.scrollBarChange].forEach(e=>{this._event.on(e,({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const i=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(de.AFTER_MARK_RENDER_END,i)};this._event.on(de.AFTER_MARK_RENDER_END,i)})})}_enableMarkAnimation(e){this.getAllMarks().forEach(t=>{const i=t.getProduct();i&&i.animate&&i.animate.enableAnimationState(e)})}_disableMarkAnimation(e){this.getAllMarks().forEach(t=>{const i=t.getProduct();i&&i.animate&&i.animate.disableAnimationState(e)})}_setStateInDatum(e,t,i,s,r){const a=(i=i?N(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(r).forEach(o=>{i?(o.getSeries().forEach(l=>{l.getMarks().forEach(h=>{if(h.getProduct()&&(!s||Y(s)&&s(l,h))){const d=h.getProduct().isCollectionMark(),u=h.getProduct().elements;let c=u;if(d)c=u.filter(f=>{const p=f.getDatum();i.every((g,_)=>a.every(m=>g[m]==p[_][m]))});else if(i.length>1){const f=i.slice();c=u.filter(p=>{if(f.length===0)return!1;const g=p.getDatum(),_=f.findIndex(m=>a.every(y=>m[y]==g[y]));return _>=0&&(f.splice(_,1),!0)})}else{const f=u.find(p=>a.every(g=>i[0][g]==p.getDatum()[g]));f&&(c=[f])}c.forEach(f=>{o.interaction.addEventElement(e,f)})}})}),t&&o.interaction.reverseEventElement(e)):o.interaction.clearEventElement(e,!0)})}setDimensionIndex(e,t){var i,s,r,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach(h=>{const{eventType:d,event:u}=h;if(d===xr.dimensionHover||d===xr.dimensionClick){const c=u.dispatch(e,t);c!=null&&c.length&&(o=c)}});const l=C(e)||!o||o.every(h=>wi(h.axis.getScale().type)&&C(h.index));if(t.tooltip!==!1){const h=this._components.find(d=>d.type===X.tooltip);if(h!=null&&h.getVisible())if(l)(s=(i=h).hideTooltip)===null||s===void 0||s.call(i);else{const d={};o.forEach(u=>{const{axis:c,value:f,data:p}=u,g=c.getOrient()==="left"||c.getOrient()==="right";p.forEach(_=>{g?d[_.series.fieldY[0]]=f:d[_.series.fieldX[0]]=f})}),h.showTooltip(d,t.showTooltipOption)}}if(t.crosshair!==!1){const h=this._components.find(d=>d.type===X.cartesianCrosshair);h&&h.clearAxisValue&&h.setAxisValue&&(l?((r=h.clearAxisValue)===null||r===void 0||r.call(h),(a=h.hide)===null||a===void 0||a.call(h)):o.forEach(d=>{const{axis:u,value:c}=d;h.clearAxisValue(),h.setAxisValue(c,u),h.layoutByValue()}))}}getColorScheme(){var e,t;return(t=(e=this._option).getTheme)===null||t===void 0?void 0:t.call(e).colorScheme}};class es{constructor(e){this._option=e,this.type=e.type,this.seriesType=e.seriesType}initChartSpec(e){return this.transformSpec(e),this.transformModelSpec(e)}transformSpec(e){e.region&&e.region.length!==0||(e.region=[{}]),Fn(e,"tooltip")||(e.tooltip={}),P(e.stackInverse)&&e.region.forEach(t=>!P(t.stackInverse)&&(t.stackInverse=e.stackInverse))}transformModelSpec(e){return this.createSpecInfo(e,(t,i,s)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=i,h=new t.transformerConstructor({type:l,getTheme:this._option.getTheme}).transformSpec(r,e,s);cf(e,a,h.spec),cf(s,o??a,Object.assign(Object.assign({},i),h))})}createSpecInfo(e,t){var i;t||(t=(a,o,l)=>{const{spec:h,specPath:d,specInfoPath:u,type:c}=o,f=new a.transformerConstructor({type:c,getTheme:this._option.getTheme});cf(l,u??d,Object.assign(Object.assign({},o),{theme:f.getTheme(h,e)}))});const s={};let r;return this.forEachRegionInSpec(e,t,s),this.forEachSeriesInSpec(e,t,s),(i=s.series)===null||i===void 0||i.forEach(({spec:{regionId:a,regionIndex:o}},l)=>{var h,d,u;P(a)?r=(h=s.region)===null||h===void 0?void 0:h.find(({spec:c})=>c.id===a):P(o)&&(r=(d=s.region)===null||d===void 0?void 0:d[o]),(r||(r=(u=s.region)===null||u===void 0?void 0:u[0]))&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(l))}),this.forEachComponentInSpec(e,t,s),s}_isValidSeries(e){return!0}_getDefaultSeriesSpec(e){var t,i,s,r;return{dataKey:e.dataKey,hover:e.hover,select:e.select,label:e.label,seriesStyle:e.seriesStyle,animation:(t=e.animation)!==null&&t!==void 0?t:this._option.animation,animationThreshold:(i=e.animationThreshold)!==null&&i!==void 0?i:(r=(s=this._option).getTheme)===null||r===void 0?void 0:r.call(s).animationThreshold,animationAppear:e.animationAppear,animationDisappear:e.animationDisappear,animationEnter:e.animationEnter,animationUpdate:e.animationUpdate,animationExit:e.animationExit,animationNormal:e.animationNormal,extensionMark:e.extensionMark,large:e.large,largeThreshold:e.largeThreshold,progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,background:e.seriesBackground,invalidType:e.invalidType,seriesField:e.seriesField,morph:e.morph}}forEachRegionInSpec(e,t,i){var s;return((s=e.region)!==null&&s!==void 0?s:[]).map((r,a)=>t(D.getRegionInType("region"),{spec:r,specIndex:a,specPath:["region",a],type:"region"},i))}forEachSeriesInSpec(e,t,i){var s;return((s=e.series)!==null&&s!==void 0?s:[]).map((r,a)=>t(D.getSeriesInType(r.type),{spec:r,specIndex:a,specPath:["series",a],type:r.type},i))}forEachComponentInSpec(e,t,i){var s,r,a,o;const l=[],h=D.getComponents();let d,u,c,f,p;const g=[];for(let m=0;m<h.length;m++){const{cmp:y,alwaysCheck:b}=h[m];y.type.startsWith(X.cartesianAxis)?d=y:y.type.startsWith(X.polarAxis)?u=y:y.type===X.geoCoordinate?c=y:(b||e[(s=y.specKey)!==null&&s!==void 0?s:y.type])&&(y.type===X.label?f=y:y.type===X.totalLabel&&(p=y),g.push(y))}let _=!1;if(d){const m=d.getSpecInfo(e);(m==null?void 0:m.length)>0&&(_=!0,m.forEach(y=>{const b=D.getComponentInKey(y.type);l.push(t(b,y,i))}))}if(u&&!_){const m=u.getSpecInfo(e);(m==null?void 0:m.length)>0&&(_=!0,m.forEach(y=>{const b=D.getComponentInKey(y.type);l.push(t(b,y,i))}))}return c&&!_&&((r=c.getSpecInfo(e))===null||r===void 0||r.forEach(m=>{l.push(t(c,m,i))})),f&&i&&((a=f.getSpecInfo(e,i))===null||a===void 0||a.forEach(m=>{l.push(t(f,m,i))})),p&&i&&((o=p.getSpecInfo(e,i))===null||o===void 0||o.forEach(m=>{l.push(t(p,m,i))})),g.forEach(m=>{var y;(y=m.getSpecInfo(e))===null||y===void 0||y.forEach(b=>{l.push(t(m,b,i))})}),l}}class As extends es{needAxes(){return!0}_isValidSeries(e){return!this.seriesType||e===this.seriesType}_getDefaultSeriesSpec(e){const t=Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{xField:e.xField,yField:e.yField,zField:e.zField,seriesField:e.seriesField,seriesStyle:e.seriesStyle,direction:e.direction,stack:e.stack,percent:e.percent,stackOffsetSilhouette:e.stackOffsetSilhouette,totalLabel:e.totalLabel,sortDataByAxis:e.sortDataByAxis}),i=this.seriesType;return i&&(t.type=i,t[i]=e[i]),t}transformSpec(e){if(super.transformSpec(e),this.needAxes()){e.axes||(e.axes=[]);const i={x:!1,y:!1,z:!1};e.axes.forEach(s=>{const{orient:r}=s;r!=="top"&&r!=="bottom"||(i.x=!0),r!=="left"&&r!=="right"||(i.y=!0),r==="z"&&(i.z=!0),Te(s,"trimPadding")&&pe(s,BB(this.type,e))}),i.x||e.axes.push({orient:"bottom"}),i.y||e.axes.push({orient:"left"}),e.zField&&!i.z&&e.axes.push({orient:"z"})}const t=this._getDefaultSeriesSpec(e);e.series&&e.series.length!==0?e.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(t).forEach(s=>{s in i||(i[s]=t[s])})}):e.series=[t]}}class JB extends As{_getDefaultSeriesSpec(e){var t;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{point:e.point,line:e.line,seriesMark:(t=e.seriesMark)!==null&&t!==void 0?t:"line",activePoint:e.activePoint,sampling:e.sampling,samplingFactor:e.samplingFactor,pointDis:e.pointDis,pointDisMul:e.pointDisMul,markOverlap:e.markOverlap,lineLabel:e.lineLabel})}transformSpec(e){super.transformSpec(e),Ra(e)}}class il extends yt{constructor(){super(...arguments),this.transformerConstructor=JB,this.type="line",this.seriesType=z.line,this._canStack=!0}}il.type="line",il.seriesType=z.line,il.view="singleDefault",il.transformerConstructor=JB;const ZK=()=>{YK(),D.registerChart(il.type,il)};class gu extends qB{constructor(){super(...arguments),this.type=gu.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}gu.type="area";const U0=()=>{D.registerMark(gu.type,gu),N8(),NB()};class JK extends rn{constructor(){super(...arguments),this._getSeriesStyle=(e,t,i)=>{var s,r,a,o;for(const l of N(t)){let h=(s=this.series.getSeriesStyle(e))===null||s===void 0?void 0:s(l);if(h!==!1||l!=="fill"&&l!=="stroke"||(h=l==="fill"?(a=(r=this.series.getSeriesStyle(e))===null||r===void 0?void 0:r("stroke"))===null||a===void 0?void 0:a[0]:(o=this.series.getSeriesStyle(e))===null||o===void 0?void 0:o("fill")),P(h))return h}return i}}}const QK={type:"clipIn"},eq=n=>({type:n.direction==="horizontal"?"growPointsXIn":"growPointsYIn",options:{orient:n.direction==="horizontal"?"positive":"negative"}}),tq={type:"fadeIn"};function iq(n,e){if(e===!1)return{};switch(e){case"grow":return eq(n);case"fadeIn":return tq;default:return QK}}const nq=()=>{D.registerAnimation("area",(n,e)=>({appear:iq(n,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}})),WB(),lm()};class QB extends ic{_transformLabelSpec(e){var t,i,s;super._transformLabelSpec(e),this._addMarkLabelSpec(e,"area","areaLabel","initLineLabelMarkStyle",void 0,!0),((t=e.point)===null||t===void 0?void 0:t.visible)!==!1&&((s=(i=e.point)===null||i===void 0?void 0:i.style)===null||s===void 0?void 0:s.visible)!==!1||this._addMarkLabelSpec(e,"area")}_transformSpecAfterMergingTheme(e,t,i){var s,r,a,o,l;super._transformSpecAfterMergingTheme(e,t,i);const{area:h={},line:d={},seriesMark:u="area"}=e,c=h.visible!==!1&&((s=h.style)===null||s===void 0?void 0:s.visible)!==!1,f=d.visible!==!1&&((r=d.style)===null||r===void 0?void 0:r.visible)!==!1;h.interactive=!(!h.interactive&&(a=d.interactive)!==null&&a!==void 0&&!a),h.support3d=!(!h.support3d&&!d.support3d),h.zIndex=P(h.zIndex)||P(d.zIndex)?Math.max((o=h.zIndex)!==null&&o!==void 0?o:0,(l=d.zIndex)!==null&&l!==void 0?l:0):void 0,h.style&&delete h.style.stroke,h.state&&Object.keys(h.state).forEach(_=>{"style"in h.state[_]?delete h.state[_].style.stroke:delete h.state[_].stroke});let p=h,g=d;(u==="line"||f&&!c)&&(p=d,g=h),h.style=pe({},g.style,p.style),h.state=pe({},g.state,p.state),c||(h.style.fill=!1),f||(h.style.stroke=!1),h.visible=!(!c&&!f),e.area=h,e.line=d}}class ur extends Qn{constructor(){super(...arguments),this.type=z.area,this.transformerConstructor=QB,this._supportStack=!0,this._sortDataByAxis=!1}initMark(){var e,t,i,s,r;const a={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},o=((e=this._spec.area)===null||e===void 0?void 0:e.visible)!==!1&&((i=(t=this._spec.area)===null||t===void 0?void 0:t.style)===null||i===void 0?void 0:i.visible)!==!1,l=(s=this._spec.seriesMark)!==null&&s!==void 0?s:"area";this._areaMark=this._createMark(ur.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:a,isSeriesMark:o&&l!=="point",customShape:(r=this._spec.area)===null||r===void 0?void 0:r.customShape}),this.initSymbolMark(a,l==="point")}initMarkStyle(){var e,t,i,s,r;const a=(i=(t=(e=this.getSpec().area)===null||e===void 0?void 0:e.style)===null||t===void 0?void 0:t.curveType)!==null&&i!==void 0?i:(r=(s=this.getSpec().line)===null||s===void 0?void 0:s.style)===null||r===void 0?void 0:r.curveType,o=a===W0?this._direction==="vertical"?"monotoneX":"monotoneY":a,l=this._areaMark;l&&(this._direction==="vertical"?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:h=>{var d,u;return Ke(this.dataToPositionY1(h),(u=(d=this._yAxisHelper)===null||d===void 0?void 0:d.getScale)===null||u===void 0?void 0:u.call(d,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",J.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:h=>{var d,u;return Ke(this.dataToPositionX1(h),(u=(d=this._xAxisHelper)===null||d===void 0?void 0:d.getScale)===null||u===void 0?void 0:u.call(d,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",J.Series),this.setMarkStyle(l,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",J.Series),this._invalidType!=="zero"&&this.setMarkStyle(l,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",J.Series),this.setMarkStyle(l,{curveType:o},"normal",J.Built_In),this._trigger.registerMark(l),Object.keys(l.stateStyle).forEach(h=>{l.stateStyle[h].stroke&&l.setPostProcess("stroke",d=>[d,!1,!1,!1],h)})),this.initLineMarkStyle(this._direction,a),this.initSymbolMarkStyle()}initAnimation(){var e,t,i,s;const r={direction:this.direction},a=(e=this._spec.animationAppear)===null||e===void 0?void 0:e.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(Le((t=D.getAnimationInKey("line"))===null||t===void 0?void 0:t(r,a),Ge("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(Le((i=D.getAnimationInKey("area"))===null||i===void 0?void 0:i(r,a),Ge("area",this._spec,this._markAttributeContext))),this._symbolMark){const o=Oa(this);this._symbolMark.setAnimationConfig(Le((s=D.getAnimationInKey("scaleInOut"))===null||s===void 0?void 0:s(),Ge("point",this._spec,this._markAttributeContext),o))}}initTooltip(){this._tooltipHelper=new JK(this),this._areaMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark),this._lineMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._lineMark),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(e){super.onLayoutEnd(e),this.reCompileSampling()}getSeriesStyle(e){return t=>{var i,s,r,a,o;const l=(i=this._spec.seriesMark)!==null&&i!==void 0?i:"area";let h=(r=(s=this._seriesMark)===null||s===void 0?void 0:s.getAttribute(t,e))!==null&&r!==void 0?r:void 0;return t!=="fill"||h&&l!=="line"||(t="stroke",h=(o=(a=this._seriesMark)===null||a===void 0?void 0:a.getAttribute(t,e))!==null&&o!==void 0?o:void 0),t==="stroke"&&W(h)?h[0]:h}}}ur.type=z.area,ur.mark=P0,ur.transformerConstructor=QB,li(ur,V0);const sq=()=>{M0(),T0(),N0(),U0(),Ba(),nq(),D.registerSeries(ur.type,ur)};class eL extends As{_getDefaultSeriesSpec(e){var t;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{point:e.point,line:e.line,area:e.area,seriesMark:(t=e.seriesMark)!==null&&t!==void 0?t:"area",activePoint:e.activePoint,sampling:e.sampling,samplingFactor:e.samplingFactor,pointDis:e.pointDis,pointDisMul:e.pointDisMul,markOverlap:e.markOverlap,areaLabel:e.areaLabel})}transformSpec(e){super.transformSpec(e),Ra(e)}}class nl extends yt{constructor(){super(...arguments),this.transformerConstructor=eL,this.type="area",this.seriesType=z.area,this._canStack=!0}}nl.type="area",nl.seriesType=z.area,nl.view="singleDefault",nl.transformerConstructor=eL;const rq=()=>{sq(),D.registerChart(nl.type,nl)};function tL(n,e=!0){return(t,i,s)=>{const r=n.direction==="vertical"?n.yField:n.xField,a=t==null?void 0:t[r];return n.direction==="vertical"?{overall:e&&n.growFrom(),orient:a>0?"negative":"positive"}:{overall:!!e&&n.growFrom(),orient:a>0?"positive":"negative"}}}const nc=(n,e=!0)=>({type:n.direction==="horizontal"?"growWidthIn":"growHeightIn",options:tL(n,e)}),hh=(n,e=!0)=>({type:n.direction==="horizontal"?"growWidthOut":"growHeightOut",options:tL(n,e)}),aq={type:"fadeIn"},oq={type:"growCenterIn"};function iL(n,e){if(e===!1)return{};switch(e){case"fadeIn":return aq;case"scaleIn":return oq;default:return nc(n)}}const lq=()=>{D.registerAnimation("bar",(n,e)=>({appear:iL(n,e),enter:nc(n,!1),exit:hh(n,!1),disappear:hh(n)}))},hq=()=>{D.registerAnimation("bar3d",(n,e)=>({appear:iL(n,e),enter:nc(n,!1),exit:hh(n,!1),disappear:hh(n)}))};class _u extends Ti{constructor(){super(...arguments),this.type=_u.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}_u.type="rect";const La=()=>{D.registerMark(_u.type,_u),k0(),VB()};function nL(n,e,t){if(n.values.length>0){let i,s=n.series;e&&(s=s.slice().reverse()),s.forEach(({s:r,values:a},o)=>{var l,h;const d=r.getSpec().barMinHeight,u=(h=(l=r[t.axisHelper]).getScale)===null||h===void 0?void 0:h.call(l,0),c=r[t.axisHelper].isInverse();for(let f=0;f<a.length;f++){const p=a[e?a.length-1-f:f],g=Ke(r[t.startMethod](p),u);let _=Ke(r[t.endMethod](p),u);f===0&&o===0&&(i=g);let m=Math.abs(g-_);m<d&&(m=d);let y=1;_<g?y=-1:_===g&&(y=t.isVertical?c?1:-1:c?-1:1),_=i+y*m,p[t.start]=i,p[t.end]=_,i=_}})}for(const i in n.nodes)nL(n.nodes[i],e,t)}class dm extends kn{_transformLabelSpec(e){this._addMarkLabelSpec(e,"bar")}}class ms extends Qn{constructor(){super(...arguments),this.type=z.bar,this._barMarkName="bar",this._barMarkType="rect",this.transformerConstructor=dm,this._supportStack=!0,this._bandPosition=0}initMark(){var e;const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._initBarBackgroundMark(t),this._barMark=this._createMark(Object.assign(Object.assign({},ms.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:Tr(this._spec,this._barMarkName),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,progressive:t,customShape:(e=this._spec.bar)===null||e===void 0?void 0:e.customShape})}_initBarBackgroundMark(e){var t,i;!((t=this._spec.barBackground)===null||t===void 0)&&t.visible&&(this._barBackgroundMark=this._createMark(ms.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),progressive:e,customShape:(i=this._spec.barBackground)===null||i===void 0?void 0:i.customShape}))}initMarkStyle(){this._barMark&&(this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",J.Series),this._trigger.registerMark(this._barMark))}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip(),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark)}_statisticViewData(){var e,t;if(super._statisticViewData(),!(!((e=this._spec.barBackground)===null||e===void 0)&&e.visible))return;Ae(this._option.dataSet,"addVChartProperty",Th),Ae(this._option.dataSet,"dimensionItems",([s],r)=>{var a;let o=[{}];const l=this.getDimensionField();for(let h=0;h<l.length;h++){const d=l[h],u=(a=s.latestData[d])===null||a===void 0?void 0:a.values;if(!(u!=null&&u.length))continue;const c=[];for(let f=0;f<u.length;f++)for(let p=0;p<o.length;p++)c.push(Object.assign(Object.assign({},o[p]),{[d]:u[f]}));o=c}return o});const i=new Ye(this._option.dataSet).parse([this._viewDataStatistics],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:cu.bind(this),call:lh}},!1);(t=this._viewDataStatistics)===null||t===void 0||t.target.addListener("change",i.reRunAllTransform),this._barBackgroundViewData=new Ns(this._option,i)}init(e){var t,i;super.init(e),this.direction==="vertical"?((t=this._xAxisHelper)===null||t===void 0?void 0:t.getScale(0).type)==="band"?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():((i=this._yAxisHelper)===null||i===void 0?void 0:i.getScale(0).type)==="band"?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const e=this.getRegion();return this._stack&&e.getSeries().filter(t=>t.type===this.type&&t.getSpec().barMinHeight).length}_calculateStackRectPosition(e){const t=this.getRegion();if(t._bar_series_position_calculated)return;let i,s,r,a,o;t._bar_series_position_calculated=!0,e?(i=by,s=yy,r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(i=my,s=_y,r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=yB(t,!1,h=>h.type===this.type);for(const h in l)for(const d in l[h].nodes)nL(l[h].nodes[d],t.getStackInverse(),{isVertical:e,start:i,end:s,startMethod:r,endMethod:a,axisHelper:o})}_calculateRectPosition(e,t){var i,s;let r,a,o;t?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=(s=(i=this[o]).getScale)===null||s===void 0?void 0:s.call(i,0),h=this[o].isInverse(),d=this._spec.barMinHeight,u=Ke(this[r](e),l),c=Ke(this[a](e),l);let f=Math.abs(u-c);f<d&&(f=d);let p=1;return c<u?p=-1:c===u&&(p=t?h?1:-1:h?-1:1),u+p*f}_dataToPosX(e){return this.dataToPositionX(e)}_dataToPosX1(e){return this.dataToPositionX1(e)}_dataToPosY(e){return this.dataToPositionY(e)}_dataToPosY1(e){return this.dataToPositionY1(e)}initBandRectMarkStyle(){var e,t,i,s;const r=(t=(e=this._xAxisHelper)===null||e===void 0?void 0:e.getScale)===null||t===void 0?void 0:t.call(e,0),a=(s=(i=this._yAxisHelper)===null||i===void 0?void 0:i.getScale)===null||s===void 0?void 0:s.call(i,0);this.direction==="horizontal"?this.setMarkStyle(this._barMark,{x:o=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),o[_y]):this._spec.barMinHeight?this._calculateRectPosition(o,!1):Ke(this._dataToPosX(o),r),x1:o=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),o[my]):Ke(this._dataToPosX1(o),r),y:o=>this._getPosition(this.direction,o),height:()=>this._getBarWidth(this._yAxisHelper)},"normal",J.Series):this.setMarkStyle(this._barMark,{x:o=>this._getPosition(this.direction,o),y:(o,l,h,d)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),o[yy]):this._spec.barMinHeight?this._calculateRectPosition(o,!0):Ke(this._dataToPosY(o),a),y1:o=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),o[by]):Ke(this._dataToPosY1(o),a),width:()=>this._getBarWidth(this._xAxisHelper)},"normal",J.Series),this._initBarBackgroundMarkStyle()}_initBarBackgroundMarkStyle(){var e,t,i,s;if(!this._barBackgroundMark)return;const r=(t=(e=this._xAxisHelper)===null||e===void 0?void 0:e.getScale)===null||t===void 0?void 0:t.call(e,0),a=(s=(i=this._yAxisHelper)===null||i===void 0?void 0:i.getScale)===null||s===void 0?void 0:s.call(i,0);this.direction==="horizontal"?this.setMarkStyle(this._barBackgroundMark,{x:()=>{const o=r.range();return Math.min(o[0],o[o.length-1])},x1:()=>{const o=r.range();return Math.max(o[0],o[o.length-1])},y:o=>this._getPosition(this.direction,o),height:()=>this._getBarWidth(this._yAxisHelper)},"normal",J.Series):this.setMarkStyle(this._barBackgroundMark,{x:o=>this._getPosition(this.direction,o),y:()=>{const o=a.range();return Math.min(o[0],o[o.length-1])},y1:()=>{const o=a.range();return Math.max(o[0],o[o.length-1])},width:()=>this._getBarWidth(this._xAxisHelper)},"normal",J.Series)}initLinearRectMarkStyle(){var e,t,i,s;const r=(t=(e=this._xAxisHelper)===null||e===void 0?void 0:e.getScale)===null||t===void 0?void 0:t.call(e,0),a=(s=(i=this._yAxisHelper)===null||i===void 0?void 0:i.getScale)===null||s===void 0?void 0:s.call(i,0);this.direction==="vertical"?this.setMarkStyle(this._barMark,{x:o=>Ke(this.dataToPositionX(o),r),x1:o=>Ke(this.dataToPositionX1(o),r),y:(o,l,h,d)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),o[yy]):this._spec.barMinHeight?this._calculateRectPosition(o,!0):Ke(this.dataToPositionY(o),a),y1:o=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),o[by]):Ke(this.dataToPositionY1(o),a)},"normal",J.Series):this.setMarkStyle(this._barMark,{x:o=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),o[_y]):this._spec.barMinHeight?this._calculateRectPosition(o,!1):Ke(this.dataToPositionX(o),r),x1:o=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),o[my]):Ke(this.dataToPositionX1(o),r),y:o=>Ke(this.dataToPositionY(o),a),y1:o=>Ke(this.dataToPositionY1(o),a)},"normal",J.Series)}initAnimation(){var e,t;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var a,o;return this.direction==="horizontal"?(a=this._xAxisHelper)===null||a===void 0?void 0:a.getScale(0).scale(0):(o=this._yAxisHelper)===null||o===void 0?void 0:o.getScale(0).scale(0)}},s=(e=this._spec.animationAppear)===null||e===void 0?void 0:e.preset,r=Oa(this);this._barMark.setAnimationConfig(Le((t=D.getAnimationInKey("bar"))===null||t===void 0?void 0:t(i,s),Ge(this._barMarkName,this._spec,this._markAttributeContext),r))}_getBarWidth(e){var t,i;const s=this._spec.barWidth!==void 0,r=(i=(t=e.getBandwidth)===null||t===void 0?void 0:t.call(e,this._groups?this._groups.fields.length-1:0))!==null&&i!==void 0?i:6;if(s)return el(this._spec.barWidth,r);const a=this._spec.barMinWidth!==void 0,o=this._spec.barMaxWidth!==void 0;let l=r;return a&&(l=Math.max(l,el(this._spec.barMinWidth,r))),o&&(l=Math.min(l,el(this._spec.barMaxWidth,r))),l}_getPosition(e,t){var i,s,r,a,o,l,h,d,u;let c,f,p;e==="horizontal"?(c=this.getYAxisHelper(),f="height",p=this.dataToPositionY.bind(this)):(c=this.getXAxisHelper(),f="width",p=this.dataToPositionX.bind(this));const g=c.getScale(0),_=this._barMark.getAttribute(f,t),m=(s=(i=c.getBandwidth)===null||i===void 0?void 0:i.call(c,this._groups?this._groups.fields.length-1:0))!==null&&s!==void 0?s:6;if(((a=(r=this._groups)===null||r===void 0?void 0:r.fields)===null||a===void 0?void 0:a.length)>1&&P(this._spec.barGapInGroup)){const b=this._groups.fields,v=N(this._spec.barGapInGroup);let x=0,S=0;for(let A=b.length-1;A>=1;A--){const k=b[A],w=(d=(h=(l=(o=this.getViewDataStatistics())===null||o===void 0?void 0:o.latestData)===null||l===void 0?void 0:l[k])===null||h===void 0?void 0:h.values)!==null&&d!==void 0?d:[],M=w.length,T=el((u=v[A-1])!==null&&u!==void 0?u:ra(v),m),E=w.indexOf(t[k]);A===b.length-1?(x+=M*_+(M-1)*T,S+=E*(_+T)):(S+=E*(x+T),x+=x+(M-1)*T)}return g.scale(t[b[0]])+c.getBandwidth(0)/2-x/2+S}const y=Ue(g.type||"band");return p(t)+.5*(m-_)+(y?-m/2:0)}onLayoutEnd(e){super.onLayoutEnd(e),this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:e,height:t}=this._region.getLayoutRect(),i=[],s=this._fieldY,r=this._fieldX;i.push({type:"sampling",size:this._direction==="vertical"?e:t,factor:this._spec.samplingFactor,yfield:this._direction==="vertical"?s[0]:r[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var e;super.compileData(),(e=this._barBackgroundViewData)===null||e===void 0||e.compile()}fillData(){var e,t;super.fillData(),(t=(e=this._barBackgroundViewData)===null||e===void 0?void 0:e.getDataView())===null||t===void 0||t.reRunAllTransform()}viewDataUpdate(e){var t,i,s;super.viewDataUpdate(e),(i=(t=this._barBackgroundViewData)===null||t===void 0?void 0:t.getDataView())===null||i===void 0||i.reRunAllTransform(),(s=this._barBackgroundViewData)===null||s===void 0||s.updateData()}release(){var e;super.release(),(e=this._barBackgroundViewData)===null||e===void 0||e.release(),this._barBackgroundViewData=null}}ms.type=z.bar,ms.mark=em,ms.transformerConstructor=dm;const sL=()=>{M0(),La(),lq(),D.registerSeries(ms.type,ms)};class um extends As{_getDefaultSeriesSpec(e){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{barWidth:e.barWidth,barMaxWidth:e.barMaxWidth,barMinWidth:e.barMinWidth,barGapInGroup:e.barGapInGroup,barMinHeight:e.barMinHeight,sampling:e.sampling,samplingFactor:e.samplingFactor,barBackground:e.barBackground})}transformSpec(e){super.transformSpec(e),Ra(e)}}class ea extends yt{constructor(){super(...arguments),this.transformerConstructor=um,this.type="bar",this.seriesType=z.bar,this._canStack=!0}}ea.type="bar",ea.seriesType=z.bar,ea.view="singleDefault",ea.transformerConstructor=um;const dq=()=>{sL(),D.registerChart(ea.type,ea)};class mu extends Ti{constructor(){super(...arguments),this.type=mu.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}mu.type="rect3d";const rL=()=>{D.registerMark(mu.type,mu),X8(),VB()};class bg extends ms{constructor(){super(...arguments),this.type=z.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}bg.type=z.bar3d,bg.mark=C0;const aL=()=>{hq(),rL(),D.registerSeries(bg.type,bg)};class oL extends um{_getDefaultSeriesSpec(e){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{barWidth:e.barWidth,barMaxWidth:e.barMaxWidth,barMinWidth:e.barMinWidth,barGapInGroup:e.barGapInGroup})}}class sl extends ea{constructor(){super(...arguments),this.transformerConstructor=oL,this.type="bar3d",this.seriesType=z.bar3d}}sl.type="bar3d",sl.seriesType=z.bar3d,sl.view="singleDefault",sl.transformerConstructor=oL;const uq=()=>{aL(),D.registerChart(sl.type,sl)},WM=10,cq=[10,20],fq=Rt.Linear,VM="circle",pq=Rt.Ordinal,gq=["circle","square","triangle","diamond","star"],_q=(n,e)=>e==="fadeIn"?{type:"fadeIn"}:{type:"scaleIn"},mq=()=>{D.registerAnimation("scatter",(n,e)=>Object.assign({appear:_q(0,e)},j0))};class lL extends kn{_transformLabelSpec(e){this._addMarkLabelSpec(e,"point")}}class la extends Qn{constructor(){super(...arguments),this.type=z.scatter,this.transformerConstructor=lL,this._invalidType="zero"}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(e,t,{defaultScaleType:i,defaultRange:s},r){var a,o,l,h;if(Y(t))return t;if(W(t)){if(C(e))return(a=this._option)===null||a===void 0||a.onError(`${r}Field is required.`),t;if(i!=="ordinal"&&t.length>2)return(o=this._option)===null||o===void 0||o.onError(`${r} length is invalid, specify up to 2 ${r}s.`),t;const d=`${be}_series_scatter_${this.id}_scale_${r}`;return this._option.globalScale.registerModelScale({id:d,type:i,domain:[{dataId:this._rawData.name,fields:[e]}],range:t}),{scale:d,field:e}}if(He(t)){if(C(e))return(l=this._option)===null||l===void 0||l.onError(`${r}Field is required.`),t;const d=`${be}_series_scatter_${this.id}_scale_${r}`,u=Object.assign({id:d,type:i,domain:[{dataId:this._rawData.name,fields:[e]}],range:s},t);return this._option.globalScale.registerModelScale(u),{scale:u.id,field:e}}return(h=this._option)===null||h===void 0||h.onError(`${r} attribute is invalid.`),t}getSizeAttribute(e,t){return C(t)?WM:oe(t)?t:ae(t)&&qI(t)?parseFloat(t):this._getSeriesAttribute(e,t,{defaultScaleType:fq,defaultRange:cq},"size")}getShapeAttribute(e,t){return C(t)?VM:ae(t)?t:this._getSeriesAttribute(e,t,{defaultScaleType:pq,defaultRange:gq},"shape")}initMark(){var e;const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(la.mark.point,{morph:Tr(this._spec,la.mark.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:t,isSeriesMark:!0,customShape:(e=this._spec.point)===null||e===void 0?void 0:e.customShape})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var e,t,i;const s=Oa(this),r=(t=(e=this._spec)===null||e===void 0?void 0:e.animationAppear)===null||t===void 0?void 0:t.preset;this._symbolMark.setAnimationConfig(Le((i=D.getAnimationInKey("scatter"))===null||i===void 0?void 0:i({},r),Ge("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&(this._invalidType!=="zero"&&this.setMarkStyle(e,{visible:this._getInvalidDefined}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:oe(this._size)||Y(this._size)?this._size:WM,symbolType:ae(this._shape)||Y(this._shape)?this._shape:VM},_e.STATE_NORMAL,J.Series),(P(this._sizeField)||P(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},_e.STATE_NORMAL,J.User_Mark),(P(this._shapeField)||P(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},_e.STATE_NORMAL,J.User_Mark),this._trigger.registerMark(e))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const t=[this.getDimensionField()[0],this.getStackValueField()].every(i=>{var s,r,a;return i&&((a=(r=(s=this.getViewDataStatistics())===null||s===void 0?void 0:s.latestData)===null||r===void 0?void 0:r[i])===null||a===void 0?void 0:a.allValid)});this._invalidType==="zero"||t?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",J.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined},"normal",J.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},_e.STATE_NORMAL,J.Series),this._invalidType!=="zero"&&this.setMarkStyle(e,{visible:this._getInvalidDefined},_e.STATE_NORMAL,J.Series))}handleZoom(e){var t,i;this.getMarksWithoutRoot().forEach(r=>{const a=r.getProduct();!a||!a.elements||!a.elements.length||a.elements.forEach((o,l)=>{const h=o.getGraphicItem(),d=o.getDatum(),u=this.dataToPosition(d);u&&h&&h.translateTo(u.x,u.y)})});const s=(i=(t=this._labelMark)===null||t===void 0?void 0:t.getComponent())===null||i===void 0?void 0:i.getProduct();s&&s.evaluateSync(null,null)}handlePan(e){var t,i;this.getMarksWithoutRoot().forEach(r=>{const a=r.getProduct();!a||!a.elements||!a.elements.length||a.elements.forEach((o,l)=>{const h=o.getGraphicItem(),d=o.getDatum(),u=this.dataToPosition(d);u&&h&&h.translateTo(u.x,u.y)})});const s=(i=(t=this._labelMark)===null||t===void 0?void 0:t.getComponent())===null||i===void 0?void 0:i.getProduct();s&&s.evaluateSync(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}la.type=z.scatter,la.mark=jO,la.transformerConstructor=lL;const yq=()=>{Ba(),mq(),D.registerSeries(la.type,la)};class hL extends As{_getDefaultSeriesSpec(e){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{point:e.point,size:e.size,sizeField:e.sizeField,shape:e.shape,shapeField:e.shapeField})}}class rl extends yt{constructor(){super(...arguments),this.transformerConstructor=hL,this.type="scatter",this.seriesType=z.scatter,this._canStack=!0}}rl.type="scatter",rl.seriesType=z.scatter,rl.view="singleDefault",rl.transformerConstructor=hL;const bq=()=>{yq(),D.registerChart(rl.type,rl)};fx();const NM={},$0=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function vq(n,e){return function t(){const i=e();return i.type=n,i.path=fx().projection(i),i.copy=i.copy||function(){const s=t();return $0.forEach(r=>{i[r]&&s[r](i[r]())}),s.path.pointRadius(i.path.pointRadius()),s},i}}function Wr(n,e){n&&ae(n)||Ka("Projection type must be a name string.");const t=n.toLowerCase();return arguments.length>1&&(NM[t]=vq(t,e)),NM[t]||null}const UM={albers:qC,albersusa:x2,azimuthalequalarea:S2,azimuthalequidistant:A2,conicconformal:M2,conicequalarea:Lf,conicequidistant:P2,equalEarth:R2,equirectangular:T2,gnomonic:O2,identity:B2,mercator:k2,naturalEarth1:L2,orthographic:I2,stereographic:D2,transversemercator:F2};Object.keys(UM).forEach(n=>{Wr(n,UM[n])});const $M="Feature",dL="FeatureCollection";function xq(n){return n.type===dL?n.features:N(n).filter(e=>!C(e)).map(e=>e.type===$M?e:{type:$M,geometry:e})}function Sq(n){const e=N(n);return e.length===1?e[0]:{type:dL,features:e.reduce((t,i)=>t.concat(xq(i)),[])}}function Aq(n){const e=Wr((n||"mercator").toLowerCase());return e||Ka("Unrecognized projection type: "+n),e()}function kq(n,e,t){Y(n[e])&&n[e](t)}const wq=$0.concat(["pointRadius","fit","extent","size"]);function YM(n,e){let t=[];return n&&Object.keys(n).forEach(i=>{wq.includes(i)&&(t=t.concat(Di(n[i],e)))}),t}let Mq=class extends q_{constructor(e){super(e),this.grammarType="projection"}parse(e){return super.parse(e),this.pointRadius(e.pointRadius),this.size(e.size),this.extent(e.extent),this.fit(e.fit),this.configure(e),this.commit(),this}pointRadius(e){return C(this.spec.pointRadius)||this.detach(Di(this.spec.pointRadius,this.view)),this.spec.pointRadius=e,this.attach(Di(e,this.view)),this.commit(),this}size(e){return C(this.spec.size)||this.detach(Di(this.spec.size,this.view)),this.spec.size=e,this.attach(Di(e,this.view)),this.commit(),this}extent(e){return C(this.spec.extent)||this.detach(Di(this.spec.extent,this.view)),this.spec.extent=e,this.attach(Di(e,this.view)),this.commit(),this}fit(e){return C(this.spec.fit)||this.detach(Di(this.spec.fit,this.view)),this.spec.fit=e,this.attach(Di(e,this.view)),this.commit(),this}configure(e){return this.detach(YM(this.spec,this.view)),C(e)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,e),this.attach(YM(this.spec,this.view))),this.commit(),this}evaluate(e,t){if(this.projection&&this.projection.type===this.spec.type||(this.projection=Aq(this.spec.type),this.projection.type=this.spec.type),$0.forEach(i=>{C(this.spec[i])||kq(this.projection,i,Ot(this.spec[i],t,Wr))}),C(this.spec.pointRadius)||this.projection.path.pointRadius(Ot(this.spec.pointRadius,t,Wr)),!(C(this.spec.fit)||C(this.spec.extent)&&C(this.spec.size))){const i=Sq(Ot(this.spec.fit,t,Wr));this.spec.extent?this.projection.fitExtent(Ot(this.spec.extent,t,Wr),i):this.spec.size&&this.projection.fitSize(Ot(this.spec.size,t,Wr),i)}return this.projection}output(){return this.projection}};const Tq=()=>{ee.registerGrammar("projection",Mq,"projections")},Cq=(n,e)=>{if(!e.from||!e.from())return n;const t=e.fields,i=e.key,s=e.values,r=e.default,a=e.as||[t],o=e.from().reduce(function(h,d){return d[t]&&h.set(d[t],d),h},new Map);let l;if(Y(e.set))l=function(h){const d=o.get(h[i]);e.set(h,d)};else if(s){const h=s.length;l=function(d){const u=o.get(d[i]);if(C(u))for(let c=0;c<h;++c)d[a[c]]=r;else for(let c=0;c<h;++c)d[a[c]]=u[s[c]]}}else l=function(h){const d=o.get(h[i]);h[a[0]]=P(d)?d:r};return n.length===0?[]:n.map(h=>(l(h),h))};class Pq extends ho{constructor(){super(...arguments),this.type=z.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var e;return(e=this._mapViewData)===null||e===void 0?void 0:e.getDataView()}get nameField(){return this._nameField}set nameField(e){this._nameField=e}get valueField(){return this._valueField}set valueField(e){this._valueField=e}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(e){this._coordinateHelper=e}getStatisticFields(){const e=[];return e.push({key:this._nameField,operations:["values"]}),e.push({key:this._valueField,operations:["max","min"]}),e}getGroupFields(){return null}dataToPosition(e){var t;let i=null;if(!e)return i;const{dataToPosition:s,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(i=this.nameToPosition(e),i===null){const o=a?e==null?void 0:e[a]:Number.NaN,l=r?e==null?void 0:e[r]:Number.NaN;i=(t=s==null?void 0:s([o,l]))!==null&&t!==void 0?t:null}return i}nameToPosition(e){var t,i;const s=this.getDatumName(e);if(C(s))return null;const r=(i=(t=this.getMapViewData())===null||t===void 0?void 0:t.latestData)===null||i===void 0?void 0:i.filter(h=>this.getDatumName(h)===s)[0];if(C(r))return null;const{dataToPosition:a}=this._coordinateHelper,o=this.getDatumCenter(r),l=a==null?void 0:a(o);return C(l)||isNaN(l.x)||isNaN(l.y)?null:l}dataToLatitude(e){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:t}=this._coordinateHelper;return t(e)}dataToLongitude(e){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:t}=this._coordinateHelper;return t(e)}valueToPosition(e,t){return{x:this.dataToLongitude(e),y:this.dataToLatitude(t)}}positionToData(e){}latitudeToData(e){}longitudeToData(e){}dataToPositionX(e){var t;return(t=this._option)===null||t===void 0||t.onError("Method not implemented."),0}dataToPositionY(e){var t;return(t=this._option)===null||t===void 0||t.onError("Method not implemented."),0}dataToPositionZ(e){var t;return(t=this._option)===null||t===void 0||t.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var e;(e=this._mapViewData)===null||e===void 0||e.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const e=`${be}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(e,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var e,t,i,s,r;return this._seriesField?(r=(t=(e=this.getRawDataStatisticsByField(this._seriesField))===null||e===void 0?void 0:e.values)!==null&&t!==void 0?t:(s=(i=this._mapViewDataStatistics)===null||i===void 0?void 0:i.latestData[this._seriesField])===null||s===void 0?void 0:s.values)!==null&&r!==void 0?r:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var e,t;super.fillData(),(e=this._mapViewData.getDataView())===null||e===void 0||e.reRunAllTransform(),(t=this._mapViewDataStatistics)===null||t===void 0||t.reRunAllTransform()}getActiveMarks(){return[]}}const vg=`${be}_MAP_LOOK_UP_KEY`,Eq=(n,e)=>(n.features&&n.features.forEach((t,i)=>{var s,r;t[oi]=i,e.nameMap?t[vg]=e.nameMap[(s=t.properties)===null||s===void 0?void 0:s[e.nameProperty]]:t[vg]=(r=t.properties)===null||r===void 0?void 0:r[e.nameProperty]}),n.features);class Rq extends rn{constructor(){super(...arguments),this.titleValueCallback=e=>{var t;const i=this.series;return(t=this._getDimensionData(e))!==null&&t!==void 0?t:i.getDatumName(e)}}}class yu extends Ti{constructor(){super(...arguments),this.type=yu.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}yu.type="path";const uL=()=>{D.registerMark(yu.type,yu),pO()};class Oq{constructor(e){this.projection=Wr(e.type)()}fit(e,t,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([e,t],s)}center(e){var t,i;(i=(t=this.projection)===null||t===void 0?void 0:t.center)===null||i===void 0||i.call(t,e)}project(e){var t;return(t=this.projection)===null||t===void 0?void 0:t.call(this,e)}shape(e){var t,i;return(i=(t=this.projection)===null||t===void 0?void 0:t.path)===null||i===void 0?void 0:i.call(t,e)}invert(e){var t,i;return(i=(t=this.projection)===null||t===void 0?void 0:t.invert)===null||i===void 0?void 0:i.call(t,e)}scale(e){var t;if(!((t=this.projection)===null||t===void 0)&&t.scale){if(e===void 0)return this.projection.scale();this.projection.scale(e)}}translate(e){var t;if(!((t=this.projection)===null||t===void 0)&&t.scale){if(e===void 0)return this.projection.translate();this.projection.translate(e)}}evaluate(e,t,i){const s=this.projection.copy();return s==null?void 0:s.fitExtent([e,t],{type:"FeatureCollection",features:i})}}class Bq extends $B{constructor(e){super(),this.component=e}}function Zi(n,e){return Te(e,`component.${n}`)}const Lq={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Iq(n){return(n=cs(n)).startSymbol=cs(n.startSymbol),n.endSymbol=cs(n.endSymbol),n}function bu(n){let e=0;return Te(n,"tick.visible")&&(e+=Te(n,"tick.tickSize")),Te(n,"label.visible")&&(e+=Te(n,"label.space")),e}function vu(n,e){var t,i,s,r,a,o;return{min:(s=(t=n.min)!==null&&t!==void 0?t:(i=n.range)===null||i===void 0?void 0:i.min)!==null&&s!==void 0?s:e==null?void 0:e.min,max:(o=(r=n.max)!==null&&r!==void 0?r:(a=n.range)===null||a===void 0?void 0:a.max)!==null&&o!==void 0?o:e==null?void 0:e.max}}function XM(n){const e=n==null?void 0:n.orient;return e==="top"||e==="bottom"||e==="left"||e==="right"||e==="z"}function KM(n){const e=n==null?void 0:n.orient;return e==="angle"||e==="radius"}const jh=(n,e,t)=>{var i;const s=(i=e==="band"?Zi("axisBand",t):["linear","log","symlog"].includes(e)?Zi("axisLinear",t):{})!==null&&i!==void 0?i:{},r=At(n)?Zi("axisX",t):or(n)?Zi("axisY",t):Zi("axisZ",t);return pe({},Zi("axis",t),s,r)},Sy=(n,e,t)=>{var i;const s=(i=e==="band"?Zi("axisBand",t):e==="linear"?Zi("axisLinear",t):{})!==null&&i!==void 0?i:{},r=Zi(n==="angle"?"axisAngle":"axisRadius",t);return pe({},Zi("axis",t),s,r)},cL=n=>n==="band"||n==="ordinal"||n==="point";function fL(n,e){const{x1:t,y1:i,x2:s,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=n.AABBBounds,{dx:d=0,dy:u=0}=n.attribute;let c=0,f=0;a<t&&(c=t-a),o<i&&(f=i-o),l>s&&(c=s-l),h>r&&(f=r-h),c&&n.setAttribute("dx",c+d),f&&n.setAttribute("dy",f+u)}function qM(n,e,t,i){let s=0,r=n.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=n[a];if(o[t]<=e&&o[i||t]>=e)return o;o[t]>e?r=a-1:s=a+1}return null}const Dq=(n,e)=>{var t,i;const s=N((t=e.axes)!==null&&t!==void 0?t:[]),{bandField:r,linearField:a,xField:o,yField:l}=(i=Zi(X.crosshair,n))!==null&&i!==void 0?i:{},h=s.find(f=>At(f.orient));let d;d=P(h)?pe({},cL(h.type)?r:a,o):o;const u=s.find(f=>or(f.orient));let c;return c=P(u)?pe({},wi(u.type)?r:a,l):l,{xField:d,yField:c}},Fq=(n,e)=>{var t,i;const s=N((t=e.axes)!==null&&t!==void 0?t:[]),{bandField:r,linearField:a,categoryField:o,valueField:l}=(i=Zi(X.crosshair,n))!==null&&i!==void 0?i:{},h=s.find(f=>f.orient==="angle");let d;d=P(h)?pe({},cL(h.type)?r:a,o):o;const u=s.find(f=>f.orient==="radius");let c;return c=P(u)?pe({},wi(u.type)?r:a,l):l,{categoryField:d,valueField:c}},zq=(n,e)=>{const{getNewDomain:t,isContinuous:i,field:s}=e,r=s(),a=t();if(C(a)||C(r))return n;if(a.length===0)return[];let o=null;return o=i()?l=>l[r]>=a[0]&&l[r]<=a[1]:l=>a.indexOf(l[r]+"")>=0||a.indexOf(l[r])>=0,n.filter(o)},jq=(n,e)=>{const{stateFields:t,valueFields:i,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return s.forEach((h,d)=>{var u;if(C(t[d]))return;const c=(u=h.getFields())===null||u===void 0?void 0:u[t[d]];c&&c.lockStatisticsByDomain&&c.domain.forEach(f=>{o[f]=0}),h.latestData.forEach(f=>{N(t[d]).forEach(p=>{C(f[p])||(C(o[f[p]])&&(o[f[p]]=0),C(i[d])||(o[f[p]]+=isNaN(parseFloat(f[i[d]]))?1:parseFloat(f[i[d]])))})})}),Object.keys(o).forEach((h,d)=>{const u={[r]:h};a&&(u[a]=o[h]),l.push(u)}),l},Hq=(n,e,t)=>{const i=Zi(e,t),s=i[MB(n)],r=pe({},i,s);return delete r.horizontal,delete r.vertical,r};function pL(n){var e,t;const i=Object.assign({},n);return fe(n.style)||(i.textStyle=ve(n.style)),fe(n.textStyle)||pe(i.textStyle,ve(n.textStyle)),!((e=n.shape)===null||e===void 0)&&e.style&&ve(i.shape.style),!((t=n.background)===null||t===void 0)&&t.style&&ve(i.background.style),i}function Gq(n){return n.orient==="bottom"||n.orient==="top"?"horizontal":"vertical"}function Wq(n,e,t,i){switch(n){case X.cartesianBandAxis:return jh(jr(t,["z"]),"band",e);case X.cartesianLinearAxis:return jh(jr(t,["z"]),"linear",e);case X.cartesianLogAxis:return jh(jr(t,["z"]),"log",e);case X.cartesianSymlogAxis:return jh(jr(t,["z"]),"symlog",e);case X.cartesianAxis:case X.cartesianTimeAxis:return jh(jr(t),void 0,e);case X.polarBandAxis:return Sy(t.orient,"band",e);case X.polarLinearAxis:return Sy(t.orient,"linear",e);case X.polarAxis:return Sy(t.orient,void 0,e);case X.cartesianCrosshair:return Dq(e,i);case X.polarCrosshair:return Fq(e,i);case X.colorLegend:case X.sizeLegend:return Zi(`${n}.${Gq(t)}`,e);case X.dataZoom:case X.scrollBar:return Hq(jr(t),n,e);default:return Zi(n,e)}}class sc extends sm{getTheme(e,t){return Wq(this.type,this._option.getTheme(),e,t)}_mergeThemeToSpec(e,t){const{spec:i,theme:s}=super._mergeThemeToSpec(e,t);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(e){const{padding:t,noOuterPadding:i=!0,orient:s}=e;i&&t&&s&&(e.padding=Object.assign(Object.assign({},vr(t)),{[s]:0}))}}var Vq=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};class an extends FB{static createComponent(e,t){const{spec:i}=e,s=Vq(e,["spec"]);return new this(i,Object.assign(Object.assign({},t),s))}getRegions(){return this._regions}created(){this.initLayout(),super.created(),this.pluginService=new Bq(this)}constructor(e,t){super(e,t),this.name="component",this.modelType="component",this.transformerConstructor=sc,this._delegateEvent=(i,s,r,a=null,o=null)=>{var l,h;this.event.emit(r,{model:this,node:i,event:s,item:a,datum:o,source:Xe.chart,chart:(h=(l=this._option)===null||l===void 0?void 0:l.globalInstance)===null||h===void 0?void 0:h.getChart()},"model")},this._option.animation&&(this.animate=new DB({getCompiler:t.getCompiler}))}initLayout(){var e;super.initLayout(),this._regions=(e=this._regions)!==null&&e!==void 0?e:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map(t=>t==null?void 0:t.id))}changeRegions(e){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(e){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(e){this.pluginService&&this.pluginService.getAll().forEach(t=>e(t))}eventPos(e){return{x:e.event.viewX-this.getLayoutStartPoint().x,y:e.event.viewY-this.getLayoutStartPoint().y}}getContainer(){var e;return this._container||(this._container=(e=this._option)===null||e===void 0?void 0:e.globalInstance.getStage().find(t=>t.name==="root",!0)),this._container}_compareSpec(e,t){const i=super._compareSpec(e,t);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some(s=>ft(t==null?void 0:t[s],e[s]))),(t==null?void 0:t.visible)!==e.visible&&(i.reCompile=!0),i}release(){super.release(),this.clear()}clear(){var e;const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach(i=>{var s;i&&((s=this.getContainer())===null||s===void 0||s.removeChild(i),i=null)}),this._container=null,(e=this.pluginService)===null||e===void 0||e.disposeAll(),this.pluginService=null}compile(){this.compileMarks()}compileMarks(e){this.getMarks().forEach(t=>{var i;t.compile({group:e}),(i=t.getProduct())===null||i===void 0||i.configure({context:{model:this}})})}getBoundsInRect(e,t){return{x1:0,x2:0,y1:0,y2:0}}}an.transformerConstructor=sc;class Nq{parserScrollEvent(e){return e&&!(e.ctrlKey||e.deltaY===0&&e.deltaX===0)&&(e.scrollX=e.deltaX,e.scrollY=e.deltaY,e)}parserZoomEvent(e){if(!e)return e;const t=Math.pow(1.0005,-e.deltaY*Math.pow(16,e.deltaMode));return e.zoomDelta=t,e.zoomX=e.canvasX,e.zoomY=e.canvasY,e}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class Uq{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(e){return this.pointerId?this.pointerId===e.pointerId:(this.pointerId=e.pointerId,!0)}parserZoomEvent(e){const t=e.scale;if(this._lastScale===0)return this._lastScale=t,e;e.zoomDelta=t/this._lastScale;const i=e.center;return e.zoomX=i.x,e.zoomY=i.y,this._lastScale=t,e}parserScrollEvent(e){return e}clearScroll(){}clearDrag(){}}function er(n){return n===Yt["desktop-browser"]||n===Yt["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:Nq}:va(n)||xa(n)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:Uq}:null}const Eo={debounce:Us,throttle:Ta};class Y0{constructor(){this._isGestureListener=!1}initZoomable(e,t=Yt["desktop-browser"]){this._eventObj=e,this._renderMode=t,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=va(this._renderMode)||xa(this._renderMode),er(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(e){return er(this._renderMode)[e]}_zoomEventDispatch(e,t,i){if(!this._isGestureListener&&!e.event)return;const s=this._isGestureListener?e:e.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:r,zoomX:a,zoomY:o}=s;C(r)||ad({x:a,y:o},this._getRegionOrSeriesLayout(t),!1)&&(this._clickEnable=!1,i&&i({zoomDelta:r,zoomX:a,zoomY:o},s),this._eventObj.emit("zoom",{scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY},model:this}))}_getRegionOrSeriesLayout(e){e.type!=="region"&&(e=e.getRegion());const{x:t,y:i,width:s,height:r}=e.layout.getLayout();return{x1:t,y1:i,x2:t+s,y2:i+r}}_bindZoomEventAsRegion(e,t,i,s){var r,a;const o=(r=s==null?void 0:s.delayType)!==null&&r!==void 0?r:"throttle",l=(a=s==null?void 0:s.delayTime)!==null&&a!==void 0?a:0,h=this._isGestureListener?this._gestureController:e,d=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:We.chart,consume:!0}],u=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:We.chart,consume:!1}];h.on(...u,Eo[o](c=>{this._zoomableTrigger.clearZoom()},l)),h.on(...d,Eo[o](c=>{this._zoomEventDispatch(c,t,i)},l))}initZoomEventOfSeries(e,t,i){this._option.disableTriggerEvent||er(this._renderMode)&&this._bindZoomEventAsRegion(e.event,e,t,i)}initZoomEventOfRegions(e,t,i,s){this._option.disableTriggerEvent||er(this._renderMode)&&e.forEach(r=>{t?r.getSeries().forEach(a=>{t(a)&&this._bindZoomEventAsRegion(a.event,a,i,s)}):this._bindZoomEventAsRegion(this._eventObj,r,i,s)})}_scrollEventDispatch(e,t,i){let s=!1;if(!this._isGestureListener&&(!e.event||this._option.disableTriggerEvent))return s;const r=this._isGestureListener?e:e.event;this._zoomableTrigger.parserScrollEvent(r);const{scrollX:a,scrollY:o,canvasX:l,canvasY:h}=r;return C(a)&&C(o)||ad({x:l,y:h},this._getRegionOrSeriesLayout(t),!1)&&(this._clickEnable=!1,i&&(s=i({scrollX:a,scrollY:o},r)),this._eventObj.emit("scroll",{scrollX:a,scrollY:o,model:this})),s}_bindScrollEventAsRegion(e,t,i,s){var r,a;const o=(r=s==null?void 0:s.delayType)!==null&&r!==void 0?r:"throttle",l=(a=s==null?void 0:s.delayTime)!==null&&a!==void 0?a:0,h=this._isGestureListener?this._gestureController:e,d=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:We.chart,consume:!0}],u=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:We.chart,consume:!1}];h.on(...u,Eo[o](c=>{this._zoomableTrigger.clearScroll()},l)),h.on(...d,Eo[o](c=>this._scrollEventDispatch(c,t,i),l))}initScrollEventOfSeries(e,t,i){er(this._renderMode)&&this._bindScrollEventAsRegion(e.event,e,t,i)}initScrollEventOfRegions(e,t,i,s){this._option.disableTriggerEvent||er(this._renderMode)&&e.forEach(r=>{t?r.getSeries().forEach(a=>{t(a)&&this._bindScrollEventAsRegion(a.event,a,i,s)}):this._bindScrollEventAsRegion(this._eventObj,r,i,s)})}_bindDragEventAsRegion(e,t,i,s){e.on(this._getZoomTriggerEvent("start"),{level:We.chart},r=>{if(!r.event)return;const{event:a}=r;ad({x:a.canvasX,y:a.canvasY},this._getRegionOrSeriesLayout(t),!1)&&this._handleDrag(r,i,s)}),e.on("click",{level:We.chart},()=>!this._clickEnable)}initDragEventOfSeries(e,t,i){this._option.disableTriggerEvent||er(this._renderMode)&&e.event.on(this._getZoomTriggerEvent("start"),{level:We.model,filter:({model:s})=>(s==null?void 0:s.id)===e.id},s=>{this._handleDrag(s,t,i)})}initDragEventOfRegions(e,t,i,s){this._option.disableTriggerEvent||er(this._renderMode)&&e.forEach(r=>{t?r.getSeries().forEach(a=>{t(a)&&(a.event.on(this._getZoomTriggerEvent("start"),{level:We.model,filter:({model:o})=>(o==null?void 0:o.id)===a.id},o=>{this._handleDrag(o,i)}),a.event.on("click",{level:We.model,filter:({model:o})=>(o==null?void 0:o.id)===a.id},()=>!this._clickEnable))}):this._bindDragEventAsRegion(this._eventObj,r,i,s)})}_handleDrag(e,t,i){var s,r,a;if(this._option.disableTriggerEvent||(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(e.event)))return;const o=(s=i==null?void 0:i.delayType)!==null&&s!==void 0?s:"throttle",l=(r=i==null?void 0:i.delayTime)!==null&&r!==void 0?r:0,h=(a=i==null?void 0:i.realTime)===null||a===void 0||a,d=this._getZoomTriggerEvent("move"),u=this._getZoomTriggerEvent("end"),c=e.event;let f=c.canvasX,p=c.canvasY,g=c.canvasX,_=c.canvasY;const m=Eo[o](b=>{this._clickEnable=!1;const v=b.event,x=[v.canvasX-g,v.canvasY-_];g=v.canvasX,_=v.canvasY,!h&&t&&t(x,b.event),this._eventObj.emit("panend",{delta:x,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(d,{level:We.chart,source:Xe.chart},y),this._eventObj.off(u,{level:We.chart,source:Xe.window},m)},l),y=Eo[o](b=>{if(!this._zoomableTrigger.parserDragEvent(b.event))return;this._clickEnable=!1;const v=b.event,x=[v.canvasX-f,v.canvasY-p];f=v.canvasX,p=v.canvasY,h&&t&&t(x,b.event),this._eventObj.emit("panmove",{delta:x,model:this})},l);this._eventObj.on(d,{level:We.chart,source:Xe.chart},y),this._eventObj.on(u,{level:We.chart,source:Xe.chart},m)}}function $q(n,e){return`${be}_${e}_${n}`}class xg extends an{constructor(){super(...arguments),this.type=X.geoCoordinate,this.name=X.geoCoordinate,this.layoutType="none",this.layoutZIndex=rt.Mark,this._projectionSpec={name:$q(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(e,t)=>{var i,s,r,a,o,l;let h=e.zoomDelta;const d=this._actualScale;return this._actualScale*=h,this._actualScale<((i=this._spec.zoomLimit)===null||i===void 0?void 0:i.min)?(this._actualScale=(s=this._spec.zoomLimit)===null||s===void 0?void 0:s.min,h=((r=this._spec.zoomLimit)===null||r===void 0?void 0:r.min)/d):this._actualScale>((a=this._spec.zoomLimit)===null||a===void 0?void 0:a.max)&&(this._actualScale=(o=this._spec.zoomLimit)===null||o===void 0?void 0:o.max,h=((l=this._spec.zoomLimit)===null||l===void 0?void 0:l.max)/d),t&&(t.zoomDelta=h),this.zoom(h,[e.zoomX,e.zoomY]),h},this.pan=(e=[0,0])=>{var t,i,s;const r=(i=(t=this._projection)===null||t===void 0?void 0:t.translate())!==null&&i!==void 0?i:[0,0];let a=r[0],o=r[1];a+=e[0],o+=e[1],(s=this._projection)===null||s===void 0||s.translate([a,o])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(e){this._projectionSpec=Object.assign(Object.assign({},e),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(e){if(C(e))return null;const t=[];return e.region.forEach((i,s)=>{if(i.coordinate==="geo"){const r=Object.assign(Object.assign({},i),{padding:0});t.push({spec:r,regionIndex:s,type:X.geoCoordinate,specInfoPath:["region",s,"geoCoordinate"]})}}),t}setAttrFromSpec(){var e,t,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=pe(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>((e=this._spec.zoomLimit)===null||e===void 0?void 0:e.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<((t=this._spec.zoomLimit)===null||t===void 0?void 0:t.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=(i=this._projectionSpec.zoom)!==null&&i!==void 0?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(e,t){const i=t||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},s=this._handleChartZoom({zoomDelta:e,zoomX:i.x,zoomY:i.y});s!==1&&this.event.emit("zoom",{scale:s,scaleCenter:i,model:this})}initEvent(){this.event.on(ye.scaleUpdate,{filter:({model:e})=>(e==null?void 0:e.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,()=>!0,this.pan),this._regions.forEach(e=>{e.getSeries().forEach(t=>{t.event.on("zoom",i=>(t.handleZoom(i),!0)),t.event.on("panmove",i=>(t.handlePan(i),!0))})}))}initProjection(){var e;this._projection=new Oq(this._projectionSpec),this._projection.projection!==null||(e=this._option)===null||e===void 0||e.onError("unsupported projection type!")}coordinateHelper(){const e={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach(t=>{t.getSeries().forEach(i=>{i.type===z.map?i.setCoordinateHelper(e):(i.setXAxisHelper(Object.assign(Object.assign({},e),{isContinuous:!0,dataToPosition:(s,r)=>{var a;let o=s[0];if(C(o)&&(r!=null&&r.datum)){const l=r.datum[i.getDimensionField()[0]];o=(a=this._centerCache.get(l))===null||a===void 0?void 0:a.x}return this.dataToLongitude(o)},valueToPosition:(s,r)=>{var a;if(C(s)&&(r!=null&&r.datum)){const o=r.datum[i.getDimensionField()[0]];s=(a=this._centerCache.get(o))===null||a===void 0?void 0:a.x}return this.dataToLongitude(s)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),i.setYAxisHelper(Object.assign(Object.assign({},e),{isContinuous:!0,dataToPosition:(s,r)=>{var a;let o=s[0];if(C(o)&&(r!=null&&r.datum)){const l=r.datum[i.getDimensionField()[0]];o=(a=this._centerCache.get(l))===null||a===void 0?void 0:a.y}return this.dataToLatitude(o)},valueToPosition:(s,r)=>{var a;if(C(s)&&(r!=null&&r.datum)){const o=r.datum[i.getDimensionField()[0]];s=(a=this._centerCache.get(o))===null||a===void 0?void 0:a.y}return this.dataToLatitude(s)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))})})}onLayoutEnd(e){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:i}=this.getLayoutRect(),{translate:s,scale:r,center:a}=this.evaluateProjection([0,0],[t,i]);s&&this._projection.translate(s),r&&this._projection.scale(r),a&&this._projection.center(a),xt(this._regions,o=>{var l;if(o.type===z.map){o.areaPath.clear();const h=(l=o.getRootMark().getProduct())===null||l===void 0?void 0:l.getGroupGraphicItem();h&&h.attribute.postMatrix&&h.setAttributes({postMatrix:new Ft})}}),this._actualScale=this._initialScale,super.onLayoutEnd(e)}onRender(e){}changeRegions(e){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const e=[];return this._regions.forEach(t=>{t.getSeries().forEach(i=>{var s,r;i.type===z.map&&e.push(...(r=(s=i.getMapViewData())===null||s===void 0?void 0:s.latestData)!==null&&r!==void 0?r:[])})}),e}dataToPosition(e=[]){var t;const i=(t=this._projection)===null||t===void 0?void 0:t.project([e[0],e[1]]);return{x:i==null?void 0:i[0],y:i==null?void 0:i[1]}}dataToLatitude(e){var t;const i=(t=this._projection)===null||t===void 0?void 0:t.project([0,e]);return i==null?void 0:i[1]}dataToLongitude(e){var t;const i=(t=this._projection)===null||t===void 0?void 0:t.project([e,0]);return i==null?void 0:i[0]}zoom(e,t=[0,0]){var i,s,r,a,o,l;let h=(s=(i=this._projection)===null||i===void 0?void 0:i.scale())!==null&&s!==void 0?s:0;const d=(a=(r=this._projection)===null||r===void 0?void 0:r.translate())!==null&&a!==void 0?a:[0,0];let u=d[0],c=d[1];h*=e,u-=(t[0]-u)*(e-1),c-=(t[1]-c)*(e-1),(o=this._projection)===null||o===void 0||o.scale(h),(l=this._projection)===null||l===void 0||l.translate([u,c])}shape(e){return this._projection.shape(e)}invert(e){return this._projection.invert(e)}evaluateProjection(e,t){var i;const s=this._projection.evaluate(e,t,this.collectFeatures());let r=s.translate();const a=s.scale()*this._initialScale,o=(i=this._projectionSpec.center)!==null&&i!==void 0?i:s.invert([t[0]/2,t[1]/2]);return o&&(r=[t[0]/2,t[1]/2]),{translate:r,scale:a,center:o}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach(e=>{e.getSeries().forEach(t=>{var i,s;t.type==="map"&&((s=(i=t.getMapViewData())===null||i===void 0?void 0:i.latestData)!==null&&s!==void 0?s:[]).forEach((r={})=>{const a=r[t.getDimensionField()[0]]||r[vg],o=t.getDatumCenter(r);a&&P(o)&&this._centerCache.set(a,{x:o[0],y:o[1]})})})})}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}xg.type=X.geoCoordinate,li(xg,Y0);const gL=()=>{D.registerComponent(xg.type,xg)};class _L extends kn{_transformLabelSpec(e){this._addMarkLabelSpec(e,"area",void 0,void 0,!1)}}class ha extends Pq{constructor(){super(...arguments),this.type=z.map,this.transformerConstructor=_L,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var e,t;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||(e=this._option)===null||e===void 0||e.onError(`map type '${this.map}' is not specified !`),lo.get(this.map)||(t=this._option)===null||t===void 0||t.onError(`'${this.map}' data is not registered !`)}initData(){var e,t;super.initData(),Ae(this._dataSet,"copyDataView",im),Ae(this._dataSet,"map",Eq),Ae(this._dataSet,"lookup",Cq);const i=lo.get(this.map);i||(e=this._option)===null||e===void 0||e.onError("no valid map data found!");const s=new Ye(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:An.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var r;return(r=this._data)===null||r===void 0?void 0:r.getLatestData()},key:vg,fields:this._nameField,set:(r,a)=>{a&&Object.keys(a).forEach(o=>{o in r||(r[o]=a[o])})}}}),(t=this._data)===null||t===void 0||t.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new Ns(this._option,s)}initMark(){this._pathMark=this._createMark(ha.mark.area,{morph:Tr(this._spec,ha.mark.area.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()})}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var i,s,r,a;return P(t[(i=this._seriesField)!==null&&i!==void 0?i:vn])?((s=this._option.globalScale.getScale("color"))!==null&&s!==void 0?s:this._getDefaultColorScale()).scale(t[(r=this._seriesField)!==null&&r!==void 0?r:vn]):(a=this._spec)===null||a===void 0?void 0:a.defaultFillColor},path:this.getPath.bind(this)},"normal",J.Series),e.setPostProcess("fill",t=>P(t)?t:this._spec.defaultFillColor),this.setMarkStyle(e,{smoothScale:!0},"normal",J.Built_In),this._trigger.registerMark(e))}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{text:t=>this.getDatumName(t),x:t=>{var i;return(i=this.dataToPosition(t))===null||i===void 0?void 0:i.x},y:t=>{var i;return(i=this.dataToPosition(t))===null||i===void 0?void 0:i.y}}))}initAnimation(){var e;this._pathMark.setAnimationConfig(Le((e=D.getAnimationInKey("fadeInOut"))===null||e===void 0?void 0:e(),Ge("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new Rq(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(e){var t;const i=this._areaCache.get(e[oi]);if(i)return i.shape;const s=(t=this._coordinateHelper)===null||t===void 0?void 0:t.shape(e);return this._areaCache.set(e[oi],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}handleZoom(e){var t,i,s;const{scale:r,scaleCenter:a}=e;if(r===1)return;const o=(t=this.getRootMark().getProduct())===null||t===void 0?void 0:t.getGroupGraphicItem();o&&(o.attribute.postMatrix||o.setAttributes({postMatrix:new Ft}),o.scale(r,r,a));const l=(s=(i=this._labelMark)===null||i===void 0?void 0:i.getComponent())===null||s===void 0?void 0:s.getProduct();l&&l.evaluateSync(null,null)}handlePan(e){var t,i,s;const{delta:r}=e;if(r[0]===0&&r[1]===0)return;const a=(t=this.getRootMark().getProduct())===null||t===void 0?void 0:t.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new Ft}),a.translate(r[0],r[1]));const o=(s=(i=this._labelMark)===null||i===void 0?void 0:i.getComponent())===null||s===void 0?void 0:s.getProduct();o&&o.evaluateSync(null,null)}getDatumCenter(e){var t,i,s,r;return this._centroidProperty&&(!((t=e.properties)===null||t===void 0)&&t[this._centroidProperty])?(i=e.properties)===null||i===void 0?void 0:i[this._centroidProperty]:j(e.centroidX*e.centroidY)?[e.centroidX,e.centroidY]:!((s=e.properties)===null||s===void 0)&&s.center?e.properties.center:!((r=e.properties)===null||r===void 0)&&r.centroid?e.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(e){var t,i,s,r;return e[this.nameField]?e[this.nameField]:!((t=e.properties)===null||t===void 0)&&t[this._nameProperty]?!((i=this._spec)===null||i===void 0)&&i.nameMap?(s=this._spec.nameMap[e.properties[this._nameProperty]])!==null&&s!==void 0?s:"":(r=e.properties[this._nameProperty])!==null&&r!==void 0?r:"":""}dataToPositionX(e){var t;return(t=this._option)===null||t===void 0||t.onError("Method not implemented."),0}dataToPositionY(e){var t;return(t=this._option)===null||t===void 0||t.onError("Method not implemented."),0}viewDataUpdate(e){var t,i,s;super.viewDataUpdate(e),(i=(t=this._mapViewData)===null||t===void 0?void 0:t.getDataView())===null||i===void 0||i.reRunAllTransform(),(s=this._mapViewData)===null||s===void 0||s.updateData()}_getDataIdKey(){return oi}getActiveMarks(){return[this._pathMark]}}ha.type=z.map,ha.mark=NO,ha.transformerConstructor=_L;const Yq=()=>{Tq(),gL(),uL(),D.registerSeries(ha.type,ha),D.registerImplement("registerMap",X9),D.registerImplement("unregisterMap",K9),Mr()},Xq=(n,e)=>{if(!n||n.length===0)return n;const{indexField:t,valueField:i,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:l,groupData:h}=e,d=[],{dimensionValues:u,dimensionData:c}=h().latestData,f=Array.from(u[t]);let p={start:0,end:0,lastIndex:null};return f.forEach((g,_)=>{const m={start:p.end,end:p.end,lastIndex:p.lastIndex,lastEnd:p.end,index:g,isTotal:!1};c[g].forEach(y=>{let b=!1;if(a&&a.type!=="end"){if((a.type==="field"||a.type==="custom")&&y[a.tagField])if(b=!0,a.type==="custom"){const{start:v,end:x}=a.product(y,p);y[s]=v,y[r]=x,m.end=x,m.start=v}else{let v=0,x=m.end;if(a.collectCountField&&!C(y[a.collectCountField])){const S=d.length-+y[a.collectCountField],A=d.length-1;S<0?console.warn("total.collectCountField error"):v=d[S].start,A<0?console.warn("total.collectCountField error"):x=d[A].end}else a.startField&&!C(y[a.startField])&&(v=+y[a.startField]),a.valueField&&!C(y[a.valueField])&&(x=zy(v,+y[a.valueField]));y[s]=v,y[r]=x,y[i]=x-v,m.start=v,m.end=x}}else _===f.length-1&&(m.start=0,y[s]=m.start,y[r]=m.end,b=!0);b||(y[s]=+m.end,y[r]=zy(y[s],+y[i]),m.end=y[r]),m.isTotal=b,(C(o)||o===hg)&&(y[hg]=b?l.total:+y[i]>=0?l.increase:l.decrease)}),p=Object.assign(Object.assign({},m),{lastIndex:g}),d.push(m)}),d},Kq=(n,e)=>{if(!n)return n;const{indexField:t,valueField:i,total:s,seriesField:r}=e,a={[t]:(s==null?void 0:s.text)||"total",[i]:n.reduce((o,l)=>zy(o,+l[i]),0)};return r&&(a[r]="total"),n.push(a),n},qq={type:"fadeIn"},Zq={type:"growCenterIn"};function Jq(n,e){switch(e){case"fadeIn":return qq;case"scaleIn":return Zq;default:return nc(n,!1)}}const Qq=()=>{D.registerAnimation("waterfall",(n,e)=>({appear:Jq(n,e),enter:nc(n,!1),exit:hh(n,!1),disappear:hh(n,!1)}))};class xu extends Ti{constructor(){super(...arguments),this.type=xu.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}xu.type="rule";const rc=()=>{D.registerMark(xu.type,xu),w0()},eZ=(n,e)=>{if(!e.fields)return n;const t={};return{dimensionValues:t,dimensionData:mL(n.map(i=>i.latestData).flat(),e.fields,t)}};function mL(n,e,t){if(e.length===0)return n;const i=e[0],s=e.slice(1);t[i]=new Set;const r=tZ(n,i,t[i]);return s.length?iZ(r,(a,o)=>mL(a,s,t)):r}function tZ(n,e,t){const i={};return n.forEach(s=>{const r=s[e];i[r]||(i[r]=[],t.add(r)),i[r].push(s)}),i}function iZ(n,e){return Object.keys(n).reduce((t,i)=>(t[i]=e(n[i],i),t),{})}class nZ{get fields(){return this._fields}get groupData(){return this._groupData}constructor(e){this._fields=[],this._fields=e}initData(e,t){const i=e.name,s=new Ye(t instanceof to?t:e.dataSet);s.name=i,s.parse([e],{type:"dataview"}),Ae(t,"dimensionTree",eZ),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(e){var t,i,s;const r=(s=(i=(t=this.groupData)===null||t===void 0?void 0:t.latestData)===null||i===void 0?void 0:i.dimensionValues)===null||s===void 0?void 0:s[e];return r?Array.from(r):[]}}class yL extends dm{_transformLabelSpec(e){this._addMarkLabelSpec(e,"bar"),this._addMarkLabelSpec(e,"bar","stackLabel")}}class Ja extends ms{constructor(){super(...arguments),this.type=z.waterfall,this.transformerConstructor=yL,this._stack=!1,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var e;return(e=this._totalData)===null||e===void 0?void 0:e.getLatestData()}initGroups(){const e=this.getGroupFields();e&&e.length&&(this._groups=new nZ(e),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],C(this._seriesField)&&(this._seriesField=hg)}getSeriesKeys(){return this._seriesField===hg?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var e;super.initData(),Ae(this._dataSet,"waterfallFillTotal",Kq),Ae(this._dataSet,"waterfall",Xq),(C(this._spec.total)||this._spec.total.type==="end")&&((e=this._rawData)===null||e===void 0||e.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const t=Qv(this.getViewData(),this._dataSet,{name:`${be}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",t.reRunAllTransform),this._totalData=new Ns(this._option,t),t.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:Yn,endAs:Jt,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var e,t,i,s;const r={yField:this.direction==="horizontal"?this._fieldY[0]:this.getStackValueField(),xField:this.direction==="horizontal"?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var l,h;return this.direction==="horizontal"?(l=this._xAxisHelper)===null||l===void 0?void 0:l.getScale(0).scale(0):(h=this._yAxisHelper)===null||h===void 0?void 0:h.getScale(0).scale(0)}},a=(t=(e=this._spec)===null||e===void 0?void 0:e.animationAppear)===null||t===void 0?void 0:t.preset,o=Oa(this);this._barMark.setAnimationConfig(Le((i=D.getAnimationInKey("waterfall"))===null||i===void 0?void 0:i(r,a),Ge("bar",this._spec,this._markAttributeContext),o)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(Le((s=D.getAnimationInKey("fadeInOut"))===null||s===void 0?void 0:s(),Ge("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(e){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(e)}addViewDataFilter(e){}reFilterViewData(){}onEvaluateEnd(e){super.onEvaluateEnd(e),this._totalData.updateData()}initMark(){var e;super.initMark();const t=this._createMark(Ja.mark.leaderLine,{key:"index",customShape:(e=this._spec.leaderLine)===null||e===void 0?void 0:e.customShape});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(e){var t;if(e){if(!this._labelMark&&(!((t=this._spec.label)===null||t===void 0)&&t.visible))return super.initLabelMarkStyle(e),void(this._labelMark=e);this._stackLabelMark=e,e.skipEncode=!0,e.setRule("stackLabel"),e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(e,{text:i=>{var s;return((s=this._spec.stackLabel)===null||s===void 0?void 0:s.valueType)==="absolute"?i.end:yD(i.end,i.start)}})}}totalPositionX(e,t,i=.5){const{dataToPosition:s,getBandwidth:r}=this._xAxisHelper;return this._direction==="vertical"?s([e[t]],{bandPosition:this._bandPosition})+.5*r(0)-this._barMark.getAttribute("width",e)*(.5-i):Ke(s([e[t]],{bandPosition:this._bandPosition}))}totalPositionY(e,t,i=.5){const{dataToPosition:s,getBandwidth:r}=this._yAxisHelper;return this._direction==="vertical"?Ke(s([e[t]],{bandPosition:this._bandPosition})):s([e[t]],{bandPosition:this._bandPosition})+.5*r(0)-this._barMark.getAttribute("height",e)*(.5-i)}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&(this._direction==="vertical"?this.setMarkStyle(this._leaderLineMark,{visible:e=>!C(e.lastIndex),x:e=>e.lastIndex?this.totalPositionX(e,"lastIndex",1):0,x1:e=>this.totalPositionX(e,"index",0),y:e=>this.totalPositionY(e,"lastEnd",0),y1:e=>this.totalPositionY(e,e.isTotal?"end":"start",0)},"normal",J.Series):this.setMarkStyle(this._leaderLineMark,{visible:e=>!C(e.lastIndex),x:e=>this.totalPositionX(e,"lastEnd",0),x1:e=>this.totalPositionX(e,e.isTotal?"end":"start",0),y:e=>e.lastIndex?this.totalPositionY(e,"lastIndex",1):0,y1:e=>this.totalPositionY(e,"index",0)},"normal",J.Series))}}Ja.type=z.waterfall,Ja.mark=ZO,Ja.transformerConstructor=yL;const sZ=()=>{rc(),La(),Qq(),Mr(),D.registerSeries(Ja.type,Ja)},Su=`${be}_BOX_PLOT_OUTLIER_VALUE`;var at;(function(n){n.OUTLIER="outlier",n.MAX="max",n.MIN="min",n.MEDIAN="median",n.Q1="q1",n.Q3="q3",n.SERIES_FIELD="seriesField"})(at||(at={}));const rZ=(n,e)=>{const t=[],{outliersField:i,dimensionField:s}=e;return(n[0].latestData||[]).forEach(r=>{let a=r[i];W(a)||(a=[a]),t.push(...a.map(o=>{const l={[Su]:o};return s.forEach(h=>{l[h]=r[h]}),l}))}),t};class aZ extends rn{constructor(){super(...arguments),this.getContentKey=e=>t=>{if(this.isOutlierMark(t))return e===at.OUTLIER?this.series.getOutliersField():e===at.SERIES_FIELD?this.series.getSeriesField():null;switch(e){case at.MIN:return this.series.getMinField();case at.MAX:return this.series.getMaxField();case at.MEDIAN:return this.series.getMedianField();case at.Q1:return this.series.getQ1Field();case at.Q3:return this.series.getQ3Field();case at.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=e=>t=>{if(this.isOutlierMark(t))return e===at.OUTLIER?t[Su]:e===at.SERIES_FIELD?t[this.series.getSeriesField()]:null;switch(e){case at.MIN:return t[this.series.getMinField()];case at.MAX:return t[this.series.getMaxField()];case at.MEDIAN:return t[this.series.getMedianField()];case at.Q1:return t[this.series.getQ1Field()];case at.Q3:return t[this.series.getQ3Field()];case at.SERIES_FIELD:return t[this.series.getSeriesField()]}return null},this.contentShapeColorCallback=e=>this.series.getShaftShape()==="line"?this.series.getMarkInName("boxPlot").getAttribute("stroke",e):this.series.getMarkInName("boxPlot").getAttribute("fill",e),this.getOutlierFillColor=e=>{var t;const i=this.series.getOutliersStyle();return(t=i==null?void 0:i.fill)!==null&&t!==void 0?t:this.series.getMarkInName("outlier").getAttribute("fill",e)},this.isOutlierMark=e=>P(e[Su])}getDefaultTooltipPattern(e){return{visible:!0,activeType:e,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(at.OUTLIER),value:this.getContentValue(at.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(at.MAX),value:this.getContentValue(at.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(at.Q3),value:this.getContentValue(at.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(at.MEDIAN),value:this.getContentValue(at.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(at.Q1),value:this.getContentValue(at.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(at.MIN),value:this.getContentValue(at.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(at.SERIES_FIELD),value:this.getContentValue(at.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1}]}}}class Au extends Ti{constructor(){super(...arguments),this.type=Au.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(e){const t=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),r=t==="bar"?"barBoxplot":"boxplot",a=this.getStyle("direction");this._product=i.glyph(r,e??i.rootMark).id(s).configureGlyph({direction:a}),this._compiledProductId=s}}Au.type="boxPlot";const oZ=()=>{D.registerMark(Au.type,Au),t6(),r6()};class uo extends Qn{constructor(){super(...arguments),this.type=z.boxPlot}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var e,t,i,s,r;super.setAttrFromSpec();const a=(t=(e=this._spec.boxPlot)===null||e===void 0?void 0:e.style)!==null&&t!==void 0?t:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=(i=a.lineWidth)!==null&&i!==void 0?i:2,this._boxWidth=a.boxWidth,this._shaftShape=(s=a.shaftShape)!==null&&s!==void 0?s:"line",this._shaftWidth=a.shaftWidth,this._boxFillColor=a.boxFill,this._strokeColor=a.stroke,this._shaftFillOpacity=this._shaftShape==="bar"?(r=a.shaftFillOpacity)!==null&&r!==void 0?r:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(uo.mark.boxPlot,{isSeriesMark:!0,progressive:e}),this._outlierMark=this._createMark(uo.mark.outlier,{progressive:e,key:oi,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var e,t,i,s,r;const a=this._boxPlotMark;if(a){const l={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:(e=this._boxFillColor)!==null&&e!==void 0?e:this._shaftShape==="line"?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:(t=this._strokeColor)!==null&&t!==void 0?t:this._shaftShape==="line"?this.getColorAttribute():"#000"},h=this._direction==="vertical"?Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},l),{boxWidth:()=>{var d;return(d=this._boxWidth)!==null&&d!==void 0?d:this._getMarkWidth()},ruleWidth:()=>{var d;return(d=this._shaftWidth)!==null&&d!==void 0?d:this._getMarkWidth()},q1q3Width:()=>{var d;return(d=this._boxWidth)!==null&&d!==void 0?d:this._getMarkWidth()},minMaxWidth:()=>{var d;return(d=this._shaftWidth)!==null&&d!==void 0?d:this._getMarkWidth()}}):Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},l),{boxHeight:()=>{var d;return(d=this._boxWidth)!==null&&d!==void 0?d:this._getMarkWidth()},ruleHeight:()=>{var d;return(d=this._shaftWidth)!==null&&d!==void 0?d:this._getMarkWidth()},q1q3Height:()=>{var d;return(d=this._boxWidth)!==null&&d!==void 0?d:this._getMarkWidth()},minMaxHeight:()=>{var d;return(d=this._shaftWidth)!==null&&d!==void 0?d:this._getMarkWidth()}});this.setMarkStyle(a,h,_e.STATE_NORMAL,J.Series),this._trigger.registerMark(a)}const o=this._outlierMark;o&&(this.setMarkStyle(o,{fill:(s=(i=this._outliersStyle)===null||i===void 0?void 0:i.fill)!==null&&s!==void 0?s:this.getColorAttribute(),size:oe((r=this._outliersStyle)===null||r===void 0?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},_e.STATE_NORMAL,J.Series),this._trigger.registerMark(o))}initBoxPlotMarkStyle(){var e,t;const i=this._boxPlotMark,s=this._direction==="vertical"?this._yAxisHelper:this._xAxisHelper;if(i&&s){const{dataToPosition:a}=s,o=(e=s==null?void 0:s.getScale)===null||e===void 0?void 0:e.call(s,0);this.setMarkStyle(i,{min:l=>Ke(a(this.getDatumPositionValues(l,this._minField),{bandPosition:this._bandPosition}),o),q1:l=>Ke(a(this.getDatumPositionValues(l,this._q1Field),{bandPosition:this._bandPosition}),o),median:l=>Ke(a(this.getDatumPositionValues(l,this._medianField),{bandPosition:this._bandPosition}),o),q3:l=>Ke(a(this.getDatumPositionValues(l,this._q3Field),{bandPosition:this._bandPosition}),o),max:l=>Ke(a(this.getDatumPositionValues(l,this._maxField),{bandPosition:this._bandPosition}),o)},_e.STATE_NORMAL,J.Series)}const r=this._outlierMark;if(r&&s){const{dataToPosition:a}=s,o=(t=s==null?void 0:s.getScale)===null||t===void 0?void 0:t.call(s,0),l=this._direction==="vertical"?{x:this.dataToPositionX.bind(this),y:h=>Ke(a(this.getDatumPositionValues(h,Su),{bandPosition:this._bandPosition}),o)}:{y:this.dataToPositionY.bind(this),x:h=>Ke(a(this.getDatumPositionValues(h,Su),{bandPosition:this._bandPosition}),o)};this.setMarkStyle(r,l,_e.STATE_NORMAL,J.Series)}}initData(){if(super.initData(),!this._data)return;Ae(this._dataSet,"foldOutlierData",rZ),Ae(this._dataSet,"addVChartProperty",Th);const e=new Ye(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});e.parse([this.getViewData()],{type:"dataview"}),e.name=`${be}_series_${this.id}_outlierData`,e.transform({type:"foldOutlierData",options:{dimensionField:this._direction==="vertical"?this._fieldX:this._fieldY,outliersField:this._outliersField}}),e.transform({type:"addVChartProperty",options:{beforeCall:cu.bind(this),call:lh}},!1),this._outlierDataView=new Ns(this._option,e)}init(e){super.init(e),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const e=this._direction==="vertical"?this._xAxisHelper:this._yAxisHelper,t=this._direction==="vertical"?this._fieldX:this._fieldY,i=e.getBandwidth(t.length-1)/t.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(e){super.onLayoutEnd(e),this._autoBoxWidth=null}_initAnimationSpec(e={}){const t=re({},e);return["appear","enter","update","exit","disappear"].forEach(i=>{t[i]&&t[i].type==="scaleIn"?t[i].type=this._shaftShape==="line"?"boxplotScaleIn":"barBoxplotScaleIn":t[i]&&t[i].type==="scaleOut"&&(t[i].type=this._shaftShape==="line"?"boxplotScaleOut":"barBoxplotScaleOut")}),t}initAnimation(){var e,t,i,s,r,a,o;const l=Oa(this);if(this._boxPlotMark){const h=this._initAnimationSpec((e=D.getAnimationInKey("scaleInOut"))===null||e===void 0?void 0:e()),d=this._initAnimationSpec(Ge("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(Le(h,d,l))}if(this._outlierMark){const h={appear:(t=this._spec.animationAppear)===null||t===void 0?void 0:t.symbol,disappear:(i=this._spec.animationDisappear)===null||i===void 0?void 0:i.symbol,enter:(s=this._spec.animationEnter)===null||s===void 0?void 0:s.symbol,exit:(r=this._spec.animationExit)===null||r===void 0?void 0:r.symbol,update:(a=this._spec.animationUpdate)===null||a===void 0?void 0:a.symbol};this._outlierMark.setAnimationConfig(Le((o=D.getAnimationInKey("scaleInOut"))===null||o===void 0?void 0:o(),h,l))}}initTooltip(){this._tooltipHelper=new aZ(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const e=super.getStatisticFields(),t=e.find(i=>i.key===this._outliersField);return t&&(t.operations=["array-min","array-max"]),e}onEvaluateEnd(e){super.onEvaluateEnd(e),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}uo.type=z.boxPlot,uo.mark=JO;const lZ=()=>{oZ(),Ba(),lm(),D.registerSeries(uo.type,uo)};class dh extends Ti{constructor(){super(...arguments),this.type=dh.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}_initProduct(e){const t=this.getVGrammarView(),i=this.getProductId();this.getStyle("textType")==="rich"?this._product=t.mark(ne.richtext,e??t.rootMark).id(i):this._product=t.mark(ne.text,e??t.rootMark).id(i),this._compiledProductId=i}}dh.type="text";const wn=()=>{D.registerMark(dh.type,dh),_O(),q8()};function ZM(n,e,t,i,s,r,a,o,l){n.setMarkStyle(e,{textAlign:h=>{if(l()==="vertical")return"center";const d=s(h),u=r(h);if(t==="middle")return"center";if(d>=u){if(t==="start")return"left";if(t==="end")return"right";if(t==="outside")return"left"}else{if(t==="start")return"right";if(t==="end")return"left";if(t==="outside")return"right"}return"center"},textBaseline:h=>{if(l()==="horizontal")return"middle";const d=a(h),u=o(h);if(t==="middle")return"middle";if(u>=d){if(t==="start")return"bottom";if(t==="end")return"top";if(t==="outside")return"bottom"}else{if(t==="start")return"top";if(t==="end")return"bottom";if(t==="outside")return"top"}return"middle"}}),n.setMarkStyle(e,{x:h=>{const d=l(),u=s(h),c=r(h);if(d==="vertical"||t==="middle")return(u+c)/2;if(u>=c){if(t==="start")return c+i;if(t==="end")return u-i;if(t==="outside")return u+i}else{if(t==="start")return c-i;if(t==="end")return u+i;if(t==="outside")return u-i}return(u+c)/2},y:h=>{const d=l(),u=a(h),c=o(h);if(d==="horizontal"||t==="middle")return(u+c)/2;if(u>=c){if(t==="start")return c+i;if(t==="end")return u-i;if(t==="outside")return u+i}else{if(t==="start")return c-i;if(t==="end")return u+i;if(t==="outside")return u-i}return(u+c)/2}},"normal",J.Series)}class hZ extends rn{getDefaultTooltipPattern(e){return{visible:!0,activeType:e,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction==="horizontal"?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1}]}}}const bL=n=>({type:"growCenterIn",options:{direction:n.direction==="horizontal"?"x":"y"}}),dZ={type:"fadeIn"},JM=n=>({type:"growCenterOut",options:{direction:n.direction==="horizontal"?"x":"y"}});function uZ(n,e){return e==="fadeIn"?dZ:bL(n)}const cZ=()=>{D.registerAnimation("rangeColumn",(n,e)=>({appear:uZ(n,e),enter:bL(n),exit:JM(n),disappear:JM(n)}))};class vL extends dm{_transformLabelSpec(e){var t;((t=e.label)===null||t===void 0?void 0:t.position)!=="bothEnd"&&this._addMarkLabelSpec(e,"bar")}}class ps extends ms{constructor(){super(...arguments),this.type=z.rangeColumn,this._barMarkType="rect",this._barName=z.bar,this.transformerConstructor=vL,this._stack=!1}initMark(){var e,t,i,s,r,a,o,l,h;this._initBarBackgroundMark();const d=(e=this._spec.label)===null||e===void 0?void 0:e.position;this._barMark=this._createMark(ps.mark.bar,{morph:Tr(this._spec,ps.mark.bar.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:(t=this._spec.bar)===null||t===void 0?void 0:t.customShape}),((i=this._spec.label)===null||i===void 0?void 0:i.visible)!==!1&&d==="bothEnd"&&(((r=(s=this._spec.label)===null||s===void 0?void 0:s.minLabel)===null||r===void 0?void 0:r.visible)!==!1&&(this._minLabelMark=this._createMark(ps.mark.minLabel,{markSpec:(a=this._spec.label)===null||a===void 0?void 0:a.minLabel})),((l=(o=this._spec.label)===null||o===void 0?void 0:o.maxLabel)===null||l===void 0?void 0:l.visible)!==!1&&(this._maxLabelMark=this._createMark(ps.mark.maxLabel,{markSpec:(h=this._spec.label)===null||h===void 0?void 0:h.maxLabel})))}initMarkStyle(){var e,t,i,s,r,a,o,l,h,d;super.initMarkStyle();const u=this._minLabelMark,c=(e=this._spec.label)===null||e===void 0?void 0:e.minLabel;if(u){this.setMarkStyle(u,{fill:(i=(t=c==null?void 0:c.style)===null||t===void 0?void 0:t.fill)!==null&&i!==void 0?i:this.getColorAttribute(),text:m=>{const y=this._spec.direction==="horizontal"?m[this._spec.xField[0]]:m[this._spec.yField[0]];return c!=null&&c.formatMethod?c.formatMethod(y,m):y}});const g=(s=c==null?void 0:c.position)!==null&&s!==void 0?s:"end",_=(r=c==null?void 0:c.offset)!==null&&r!==void 0?r:this._direction==="vertical"?-20:-25;ZM(this,u,g,_,m=>this._barMark.getAttribute("x",m),m=>this._direction==="vertical"?this._barMark.getAttribute("x",m)+this._barMark.getAttribute("width",m):this._barMark.getAttribute("x1",m),m=>this._barMark.getAttribute("y",m),m=>this._direction==="vertical"?this._barMark.getAttribute("y1",m):this._barMark.getAttribute("y",m)+this._barMark.getAttribute("height",m),()=>this._direction)}const f=this._maxLabelMark,p=(a=this._spec.label)===null||a===void 0?void 0:a.maxLabel;if(f){this.setMarkStyle(f,{fill:(l=(o=p==null?void 0:p.style)===null||o===void 0?void 0:o.fill)!==null&&l!==void 0?l:this.getColorAttribute(),text:m=>{const y=this._spec.direction==="horizontal"?m[this._spec.xField[1]]:m[this._spec.yField[1]];return p!=null&&p.formatMethod?p.formatMethod(y,m):y}});const g=(h=p==null?void 0:p.position)!==null&&h!==void 0?h:"start",_=(d=p==null?void 0:p.offset)!==null&&d!==void 0?d:this._direction==="vertical"?-20:-25;ZM(this,f,g,_,m=>this._barMark.getAttribute("x",m),m=>this._direction==="vertical"?this._barMark.getAttribute("x",m)+this._barMark.getAttribute("width",m):this._barMark.getAttribute("x1",m),m=>this._barMark.getAttribute("y",m),m=>this._direction==="vertical"?this._barMark.getAttribute("y1",m):this._barMark.getAttribute("y",m)+this._barMark.getAttribute("height",m),()=>this._direction)}}initLabelMarkStyle(e){e&&(this.setMarkStyle(e,{text:t=>{let i,s;return this._spec.direction==="horizontal"?(i=t[this._spec.xField[0]],s=t[this._spec.xField[1]]):(i=t[this._spec.yField[0]],s=t[this._spec.yField[1]]),i+"-"+s},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=e)}_dataToPosX(e){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(e,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(e){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(e,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(e){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(e,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(e){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(e,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var e,t,i,s,r;const a=Oa(this),o=(t=(e=this._spec)===null||e===void 0?void 0:e.animationAppear)===null||t===void 0?void 0:t.preset;this._barMark.setAnimationConfig(Le((i=D.getAnimationInKey("rangeColumn"))===null||i===void 0?void 0:i({direction:this.direction},o),Ge("bar",this._spec,this._markAttributeContext),a)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(Le((s=D.getAnimationInKey("fadeInOut"))===null||s===void 0?void 0:s(),Ge("label",this._spec,this._markAttributeContext),a)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(Le((r=D.getAnimationInKey("fadeInOut"))===null||r===void 0?void 0:r(),Ge("label",this._spec,this._markAttributeContext),a))}initTooltip(){this._tooltipHelper=new hZ(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}ps.type=z.rangeColumn,ps.mark=sB,ps.transformerConstructor=vL;const fZ=()=>{La(),wn(),cZ(),Mr(),D.registerSeries(ps.type,ps)};class Sg extends ps{constructor(){super(...arguments),this.type=z.rangeColumn3d,this._barMarkType="rect3d",this._barName=z.bar3d}}Sg.type=z.rangeColumn3d,Sg.mark=rB;const pZ=()=>{rL(),D.registerSeries(Sg.type,Sg)};class gZ extends rn{getDefaultTooltipPattern(e,t){if(e==="mark")return{visible:!0,activeType:e,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1}]};if(e==="dimension"&&t){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return t.forEach(({data:r})=>r.forEach(({series:a})=>{a.type==="rangeArea"&&s.push({seriesId:a.id,key:this.contentKeyCallback,value:o=>this.series.getSpec().direction==="horizontal"?o[this.series.getSpec().xField[0]]+"-"+o[this.series.getSpec().xField[1]]:o[this.series.getSpec().yField[0]]+"-"+o[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1})})),{visible:!0,activeType:e,title:i,content:s}}return null}}class uh extends ur{constructor(){super(...arguments),this.type=z.rangeArea}initMark(){var e;this._areaMark=this._createMark(uh.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:(e=this._spec.area)===null||e===void 0?void 0:e.customShape})}initMarkStyle(){var e,t,i,s,r;const a=(i=(t=(e=this.getSpec().area)===null||e===void 0?void 0:e.style)===null||t===void 0?void 0:t.curveType)!==null&&i!==void 0?i:(r=(s=this.getSpec().line)===null||s===void 0?void 0:s.style)===null||r===void 0?void 0:r.curveType,o=a===W0?this._direction==="vertical"?"monotoneX":"monotoneY":a,l=this._areaMark;l&&(this._direction==="vertical"?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:h=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:d}=this._yAxisHelper;return d(this.getDatumPositionValues(h,this._spec.yField[1]),{bandPosition:this._bandPosition})},y:this.dataToPositionY.bind(this)},"normal",J.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:h=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:d}=this._xAxisHelper;return d(this.getDatumPositionValues(h,this._spec.xField[1]),{bandPosition:this._bandPosition})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",J.Series),this.setMarkStyle(l,{fill:this.getColorAttribute(),stroke:!1},"normal",J.Series),this._invalidType!=="zero"&&this.setMarkStyle(l,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",J.Series),this.setMarkStyle(l,{curveType:o},"normal",J.Built_In),this._trigger.registerMark(l))}initTooltip(){this._tooltipHelper=new gZ(this),this._areaMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e),this.encodeDefined(this._areaMark,"defined")}}uh.type=z.rangeArea,uh.mark=hB;const _Z=()=>{U0(),D.registerSeries(uh.type,uh)};class ac extends ho{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=eu,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1,this._getInvalidDefined=e=>!(this.angleAxisHelper.isContinuous&&!Ws(e[this._angleField[0]]))&&!(this.radiusAxisHelper.isContinuous&&!Ws(e[this._radiusField[0]]))}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(e){return this._angleField=P(e)?N(e):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(e){return this._radiusField=P(e)?N(e):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(e){return this._innerRadiusField=N(e),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(e){return this._radiusScale=e,e}get angleScale(){return this._angleScale}setAngleScale(e){return this._angleScale=e,e}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(e){this._angleAxisHelper=e,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(e){this._radiusAxisHelper=e,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(e,t){if(C(e)||C(t)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(N(e)),s=this.radiusAxisHelper.dataToPosition(N(t));return this.angleAxisHelper.coordToPoint({angle:i,radius:s})}dataToPosition(e){return e&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(e,this._angleField),this.getDatumPositionValues(e,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(e){return this.dataToPosition(e).x}dataToPositionY(e){return this.dataToPosition(e).y}dataToPositionZ(e){return 0}positionToData(e){}radiusToData(e){}angleToData(e){}getStatisticFields(){var e,t;const i=[];return!((e=this.radiusAxisHelper)===null||e===void 0)&&e.getScale&&this._radiusField.forEach(s=>{const r={key:s,operations:[]};Ue(this.radiusAxisHelper.getScale(0).type)?r.operations=["max","min"]:r.operations=["values"],i.push(r)}),!((t=this.angleAxisHelper)===null||t===void 0)&&t.getScale&&this._angleField.forEach(s=>{const r={key:s,operations:[]};Ue(this.angleAxisHelper.getScale(0).type)?r.operations=["max","min"]:r.operations=["values"],i.push(r)}),i}setAttrFromSpec(){super.setAttrFromSpec(),P(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),P(this._spec.radius)&&(this._outerRadius=this._spec.radius),P(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),P(this._spec.sortDataByAxis)&&(this._sortDataByAxis=this._spec.sortDataByAxis===!0)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:e,height:t}=this._region.getLayoutRect();return Math.min(e/2,t/2)}fillData(){super.fillData(),this.sortDataByAxis&&this._sortDataInAxisDomain()}_sortDataInAxisDomain(){var e,t;!((t=(e=this.getViewData())===null||e===void 0?void 0:e.latestData)===null||t===void 0)&&t.length&&XB(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}}function mZ(n){return Ws(n)?Number.parseFloat(n):0}const yZ=(n,e)=>{const t=n.map(x=>Object.assign({},x));if(!t||t.length===0)return t;const{angleField:i,startAngle:s,endAngle:r,minAngle:a,asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:d,asRatio:u,asQuadrant:c,asK:f}=e,p=(x,S,A)=>{x[o]=S,x[l]=S+A,x[h]=S+A/2,x[d]=A,x[c]=Y5(S+A/2)};let g=0,_=-1/0;for(let x=0;x<t.length;x++){const S=mZ(t[x][i]);g+=S,_=Math.max(S,_),t[x][ty]=S}const m=r-s;let y=s,b=m,v=0;if(t.forEach(x=>{const S=x[ty],A=g?S/g:0;let k=A*m;k<a?(k=a,b-=a):v+=S;const w=y,M=y+k;x[u]=A,x[f]=_?S/_:0,p(x,w,k),y=M}),b<m)if(b<=.001){const x=m/t.length;t.forEach((S,A)=>{p(S,s+A*x,x)})}else{const x=b/v;y=s,t.forEach(S=>{const A=S[d]===a?a:S[ty]*x;p(S,y,A),y+=A})}return g!==0&&(t[t.length-1][l]=r),t};function cm(n,e,t){return(i,s,r)=>e?n.growField==="radius"?{overall:0}:{overall:n.growFrom(i,s,t)}:{overall:!1}}const QM=n=>({type:n.growField==="radius"?"growRadiusIn":"growAngleIn",options:cm(n,!0,Qt.appear)}),bZ={type:"fadeIn"},xL=n=>({type:n.growField==="radius"?"growRadiusIn":"growAngleIn",easing:"linear",options:cm(n,!0,Qt.enter)}),SL=n=>({type:n.growField==="radius"?"growRadiusOut":"growAngleOut",easing:"linear",options:cm(n,!0,Qt.exit)}),AL=n=>({type:n.growField==="radius"?"growRadiusOut":"growAngleOut",options:cm(n,!0,Qt.exit)});function kL(n,e){if(e===!1)return{};switch(e){case"fadeIn":return bZ;case"growRadius":return QM(Object.assign(Object.assign({},n),{growField:"radius"}));default:return QM(Object.assign(Object.assign({},n),{growField:"angle"}))}}const vZ=()=>{D.registerAnimation("pie",(n,e)=>({appear:kL(n,e),enter:xL(n),exit:SL(n),disappear:AL(n)}))},xZ=()=>{D.registerAnimation("pie3d",(n,e)=>({appear:kL(n,e),enter:xL(n),exit:SL(n),disappear:AL(n)}))};function SZ(n,e){var t,i,s,r;const a=(i=(t=e.options)===null||t===void 0?void 0:t.distance)!==null&&i!==void 0?i:10,o=j(e.duration)?e.duration/2:1e3,l=(s=e.options.easing)!==null&&s!==void 0?s:"cubicOut";return{oneByOne:e.oneByOne,loop:(r=e.loop)!==null&&r!==void 0&&r,timeSlices:[{duration:o,effects:{easing:l,channel:{x:{from:h=>n.getAttribute("x",h),to:h=>n.getAttribute("x",h)+Yr({angle:h[hr],radius:a}).x},y:{from:h=>n.getAttribute("y",h),to:h=>n.getAttribute("y",h)+Yr({angle:h[hr],radius:a}).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:h=>n.getAttribute("x",h),from:h=>n.getAttribute("x",h)+Yr({angle:h[hr],radius:a}).x},y:{to:h=>n.getAttribute("y",h),from:h=>n.getAttribute("y",h)+Yr({angle:h[hr],radius:a}).y}}}}]}}class X0 extends Ti{constructor(e,t){super(e,t),this.type=ch.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(i,s,r="normal",a,o)=>{var l;return o+((l=this.getAttribute("radiusOffset",s,r,a))!==null&&l!==void 0?l:0)},this.computeCenter=(i,s,r="normal",a,o)=>o+Yr({angle:s[hr],radius:this.getAttribute("centerOffset",s,r,a)})[i],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})}}class ch extends X0{constructor(){super(...arguments),this.type=ch.type}}ch.type="arc";const oc=()=>{fO(),H0(),D.registerMark(ch.type,ch)};class K0 extends kn{_transformLabelSpec(e){this._addMarkLabelSpec(e,"pie")}_mergeThemeToSpec(e,t){const i=this._theme;let s=e;if(this._shouldMergeThemeToSpec()){const r=this._getDefaultSpecFromChart(t);s=pe({},this._theme,r,e),s.label.position==="inside"?s.label=pe({},this._theme.innerLabel,s.label):s.label=pe({},this._theme.outerLabel,s.label)}return{spec:s,theme:i}}}class fh extends ac{constructor(){super(...arguments),this.transformerConstructor=K0,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=O_,this._endAngle=h0,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=e=>{const t=e[hr];if(C(t))return null;const i=this.computeDatumRadius(e),s=this.computeDatumInnerRadius(e),r=this.computeCenter(e),a=Yr({angle:t,radius:(i+s)/2});return{x:r.x+a.x,y:r.y+a.y}}}get center(){var e,t,i,s;return{x:(t=(e=this._spec)===null||e===void 0?void 0:e.centerX)!==null&&t!==void 0?t:this._region.getLayoutRect().width/2,y:(s=(i=this._spec)===null||i===void 0?void 0:i.centerY)!==null&&s!==void 0?s:this._region.getLayoutRect().height/2}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>{var e,t;return(t=(e=this._center)===null||e===void 0?void 0:e.x)!==null&&t!==void 0?t:this._region.getLayoutRect().width/2},y:()=>{var e,t;return(t=(e=this._center)===null||e===void 0?void 0:e.y)!==null&&t!==void 0?t:this._region.getLayoutRect().height/2}}),this._markAttributeContext.startAngleScale=e=>this.startAngleScale(e),this._markAttributeContext.endAngleScale=e=>this.endAngleScale(e)}setAttrFromSpec(){var e,t;super.setAttrFromSpec(),this._centerOffset=(e=this._spec.centerOffset)!==null&&e!==void 0?e:0,this._cornerRadius=(t=this._spec.cornerRadius)!==null&&t!==void 0?t:0;const i=X5(P(this._spec.startAngle)?st(this._spec.startAngle):this._startAngle,P(this._spec.endAngle)?st(this._spec.endAngle):this._endAngle);this._startAngle=i.startAngle,this._endAngle=i.endAngle,this._padAngle=P(this._spec.padAngle)?st(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=[]}initData(){super.initData();const e=this.getViewData();if(!e)return;Ae(this._dataSet,"pie",yZ),e.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,minAngle:P(this._spec.minAngle)?st(this._spec.minAngle):0,asStartAngle:bk,asEndAngle:vk,asRatio:aR,asMiddleAngle:hr,asRadian:sV,asQuadrant:nV,asK:iV}},!1);const t=new Ye(this._dataSet,{name:`${be}_series_${this.id}_viewDataLabel`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new Ns(this._option,t)}initMark(){var e;this._pieMark=this._createMark(Object.assign(Object.assign({},fh.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:Tr(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:Vs,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,customShape:(e=this._spec.pie)===null||e===void 0?void 0:e.customShape})}startAngleScale(e){return ff(bk)(e)}endAngleScale(e){return ff(vk)(e)}initMarkStyle(){const e=this._pieMark;e&&(this.setMarkStyle(e,{x:()=>{var t,i;return(i=(t=this._center)===null||t===void 0?void 0:t.x)!==null&&i!==void 0?i:this._region.getLayoutRect().width/2},y:()=>{var t,i;return(i=(t=this._center)===null||t===void 0?void 0:t.y)!==null&&i!==void 0?i:this._region.getLayoutRect().height/2},fill:this.getColorAttribute(),outerRadius:SM(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:SM(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},"normal",J.Series),this._trigger.registerMark(e))}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,t,i){if(super.initMarkStyleWithSpec(e,t,i),e.name===this._pieMarkName){const s=this.getSpec()[e.name];if(s)for(const r in s.state||{})this.setMarkStyle(e,this.generateRadiusStyle(s.state[r]),r,J.User_Mark)}}initLabelMarkStyle(e){var t,i,s,r,a,o;e&&this.setMarkStyle(e,{visible:ff(tV).bind(this),text:l=>l[this.getDimensionField()[0]],fill:((i=(t=this._spec.label)===null||t===void 0?void 0:t.style)===null||i===void 0?void 0:i.fill)||this.getColorAttribute(),angle:(r=(s=this._spec.label)===null||s===void 0?void 0:s.style)===null||r===void 0?void 0:r.angle,limit:(o=(a=this._spec.label)===null||a===void 0?void 0:a.style)===null||o===void 0?void 0:o.limit,z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){var e;super.initEvent(),(e=this._viewDataLabel.getDataView())===null||e===void 0||e.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(e){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(e)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(ye.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(e){if(!e)return;const t={};return e.outerRadius&&(t.outerRadius=()=>this.computeLayoutRadius()*e.outerRadius),e.innerRadius&&(t.innerRadius=()=>this.computeLayoutRadius()*e.innerRadius),e.cornerRadius&&(t.cornerRadius=()=>this.computeLayoutRadius()*e.cornerRadius),t}computeLayoutRadius(){const{width:e,height:t}=this._region.getLayoutRect();return Math.min(e/2,t/2)}computeCenter(e){return{x:this._pieMark.getAttribute("x",e,"normal"),y:this._pieMark.getAttribute("y",e,"normal")}}getRadius(e="normal"){var t,i,s,r,a,o,l;const h=e==="normal"?(s=(i=this.getSpec()[((t=this._pieMark)===null||t===void 0?void 0:t.name)||"pie"])===null||i===void 0?void 0:i.style)===null||s===void 0?void 0:s.outerRadius:(l=(o=(a=this.getSpec()[((r=this._pieMark)===null||r===void 0?void 0:r.name)||"pie"])===null||a===void 0?void 0:a.state)===null||o===void 0?void 0:o[e])===null||l===void 0?void 0:l.outerRadius;return h??this._outerRadius}getInnerRadius(e="normal"){var t,i,s,r,a,o,l;const h=e==="normal"?(s=(i=this.getSpec()[((t=this._pieMark)===null||t===void 0?void 0:t.name)||"pie"])===null||i===void 0?void 0:i.style)===null||s===void 0?void 0:s.innerRadius:(l=(o=(a=this.getSpec()[((r=this._pieMark)===null||r===void 0?void 0:r.name)||"pie"])===null||a===void 0?void 0:a.state)===null||o===void 0?void 0:o[e])===null||l===void 0?void 0:l.innerRadius;return h??this._innerRadius}computeRadius(e,t){return this.computeLayoutRadius()*e*(C(t)?1:t)+this._centerOffset}computeDatumRadius(e,t){return this.computeLayoutRadius()*this.getRadius(t)+this._centerOffset}_compareSpec(e,t,i){(i=i??{data:!0}).centerX=!0,i.centerX=!0,i.centerY=!0,i.centerOffset=!0,i.radius=!0,i.innerRadius=!0,i.cornerRadius=!0,i.startAngle=!0,i.endAngle=!0,i.padAngle=!0;const{centerX:s,centerY:r,centerOffset:a,radius:o,innerRadius:l,cornerRadius:h,startAngle:d,endAngle:u,padAngle:c}=t,f=super._compareSpec(e,t,i);return(e=e??{}).centerY===r&&e.centerX===s&&e.centerOffset===a&&e.radius===o&&e.innerRadius===l&&e.cornerRadius===h&&e.startAngle===d&&e.endAngle===u&&e.padAngle===c||(f.reRender=!0,f.change=!0),f}computeDatumInnerRadius(e,t){return this.computeLayoutRadius()*this.getInnerRadius(t)+this._centerOffset}dataToPosition(e){const t=e[hr];if(C(t))return null;const i=this.computeDatumRadius(e),s=this.computeCenter(e),r=Yr({angle:t,radius:i});return{x:s.x+r.x,y:s.y+r.y}}initAnimation(){var e,t;const i={growFrom:(r,a,o)=>{var l;if(o===Qt.appear)return this._startAngle;if(o===Qt.disappear)return this._endAngle;const h=[Qt.disappear,Qt.exit],d=a.mark.elements,u=r,c=u==null?void 0:u[oi];if(d.find(p=>{var g;return((g=p.data[0])===null||g===void 0?void 0:g[oi])<c})===void 0)return this._startAngle;if(d.find(p=>{var g;return((g=p.data[0])===null||g===void 0?void 0:g[oi])>c})===void 0)return this._endAngle;const f=[...d].reverse().find(p=>{var g;return((g=p.data[0])===null||g===void 0?void 0:g[oi])<c});return h.includes(o)?(l=f==null?void 0:f.getNextGraphicAttributes())===null||l===void 0?void 0:l.endAngle:f==null?void 0:f.getGraphicAttribute("endAngle",!0)}},s=(e=this._spec.animationAppear)===null||e===void 0?void 0:e.preset;if(this._pieMark){const r=Le((t=D.getAnimationInKey("pie"))===null||t===void 0?void 0:t(i,s),Ge("pie",this._spec,this._markAttributeContext));r.normal&&r.normal.type&&(r.normal=SZ(this._pieMark,r.normal)),this._pieMark.setAnimationConfig(r)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(e,t){return t}getActiveMarks(){return[this._pieMark]}}fh.transformerConstructor=K0,fh.mark=GO;class ix extends fh{constructor(){super(...arguments),this.type=z.pie}}ix.type=z.pie;const AZ=()=>{oc(),vZ(),D.registerSeries(ix.type,ix)};class ku extends X0{constructor(){super(...arguments),this.type=ku.type,this._support3d=!0}}ku.type="arc3d";const kZ=()=>{H0(),W8(),D.registerMark(ku.type,ku)};class wL extends K0{_transformLabelSpec(e){this._addMarkLabelSpec(e,"pie3d")}}class Ad extends fh{constructor(){super(...arguments),this.type=z.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=wL}setAttrFromSpec(){var e,t;super.setAttrFromSpec(),this._angle3d=(t=(e=this._spec)===null||e===void 0?void 0:e.angle3d)!==null&&t!==void 0?t:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const e=this._pieMark;e&&this.setMarkStyle(e,{beta:()=>this._angle3d},"normal",J.Series)}initLabelMarkStyle(e){if(!e)return;super.initLabelMarkStyle(e);const t={};e.setSupport3d(!0),t.beta=this._angle3d,t.anchor3d=i=>{var s,r,a,o;return[(r=(s=this._center)===null||s===void 0?void 0:s.x)!==null&&r!==void 0?r:this._region.getLayoutRect().width/2,(o=(a=this._center)===null||a===void 0?void 0:a.y)!==null&&o!==void 0?o:this._region.getLayoutRect().height/2]},t.angle=i=>{var s;const r=i[hr];return((s=this._spec.label)===null||s===void 0?void 0:s.position)==="inside"?$l(r):0},this.setMarkStyle(e,Object.assign(Object.assign({},t),{z:100}),void 0,J.Mark)}}Ad.type=z.pie3d,Ad.mark=WO,Ad.transformerConstructor=wL;const wZ=()=>{xZ(),kZ(),D.registerSeries(Ad.type,Ad)},eT=n=>{const e=n.growField==="angle"?0:n.innerRadius;return n.growField==="angle"?{type:n.growField==="angle"?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,i)=>i.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,i)=>i.getGraphicAttribute("outerRadius")}}}},MZ={type:"fadeIn"},TZ=n=>({type:n.growField==="angle"?"growAngleIn":"growRadiusIn"}),CZ=n=>({type:n.growField==="angle"?"growAngleOut":"growRadiusOut"}),PZ=n=>({type:n.growField==="angle"?"growAngleOut":"growRadiusOut"});function EZ(n,e){if(e===!1)return{};switch(e){case"fadeIn":return MZ;case"growAngle":return eT(Object.assign(Object.assign({},n),{growField:"angle"}));default:return eT(Object.assign(Object.assign({},n),{growField:"radius"}))}}const RZ=()=>{D.registerAnimation("rose",(n,e)=>({appear:EZ(n,e),enter:TZ(n),exit:CZ(n),disappear:PZ(n)}))};class ML extends ac{getStackGroupFields(){return this._angleField}getStackValueField(){return N(this._spec.valueField)[0]||N(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(Jt),this.setInnerRadiusField(Yn)}setValueFieldToPercent(){this.setRadiusField(ka),this.setInnerRadiusField(lu)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class TL extends kn{_transformLabelSpec(e){this._addMarkLabelSpec(e,"rose")}}class da extends ML{constructor(){super(...arguments),this.type=z.rose,this.transformerConstructor=TL,this._supportStack=!0,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=e=>this.startAngleScale(e),this._markAttributeContext.endAngleScale=e=>this.endAngleScale(e)}initRoseMark(){var e;this._roseMark=this._createMark(da.mark.rose,{morph:Tr(this._spec,da.mark.rose.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:(e=this._spec.rose)===null||e===void 0?void 0:e.customShape})}getRoseAngle(){var e,t,i;return(i=(t=(e=this.angleAxisHelper).getBandwidth)===null||t===void 0?void 0:t.call(e,this._groups?this._groups.fields.length-1:0))!==null&&i!==void 0?i:.5}startAngleScale(e){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(e,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(e){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(e,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const e=this._roseMark;e&&(this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>Ke(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var i;if(!this._stack)return 0;const s=Ke(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return s<=Number.MIN_VALUE?this._computeLayoutRadius()*((i=this._spec.innerRadius)!==null&&i!==void 0?i:0):s}}),this._trigger.registerMark(e))}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(e){var t,i,s,r,a,o,l,h;e&&this.setMarkStyle(e,{visible:(i=(t=this._spec)===null||t===void 0?void 0:t.label)===null||i===void 0?void 0:i.visible,text:d=>d[this.getDimensionField()[0]],fill:((r=(s=this._spec.label)===null||s===void 0?void 0:s.style)===null||r===void 0?void 0:r.fill)||this.getColorAttribute(),angle:(o=(a=this._spec.label)===null||a===void 0?void 0:a.style)===null||o===void 0?void 0:o.angle,limit:(h=(l=this._spec.label)===null||l===void 0?void 0:l.style)===null||h===void 0?void 0:h.limit,z:0})}initAnimation(){var e,t,i;const s=(t=(e=this._spec)===null||e===void 0?void 0:e.animationAppear)===null||t===void 0?void 0:t.preset;if(this._roseMark){const r={innerRadius:()=>{var a;return this._computeLayoutRadius()*((a=this._spec.innerRadius)!==null&&a!==void 0?a:0)}};this._roseMark.setAnimationConfig(Le((i=D.getAnimationInKey("rose"))===null||i===void 0?void 0:i(r,s),Ge("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}da.type=z.rose,da.mark=VO,da.transformerConstructor=TL;const OZ=()=>{D.registerSeries(da.type,da),oc(),RZ()};class BZ extends nn{constructor(e,t,i,s,r){super(e,t,i,s,r);const a=this.params.pointToCoord,o=this.params.coordToPoint;Y(a)&&Y(o)||(this.valid=!1),this._pointToCoord=a,this._coordToPoint=o}getEndProps(){return this.valid===!1?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:e,radius:t}=this._pointToCoord(this.from);j(e*t)||(this.valid=!1),this._fromAngle=e,this._fromRadius=t;const{angle:i,radius:s}=this._pointToCoord(this.to);j(i*s)||(this.valid=!1),this._toAngle=i,this._toRadius=s}onUpdate(e,t,i){if(this.valid!==!1)if(e){const{x:s,y:r}=this.getEndProps();i.x=s,i.y=r}else{const{x:s,y:r}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*t,radius:this._fromRadius+(this._toRadius-this._fromRadius)*t});i.x=s,i.y=r}}}class LZ extends qP{constructor(e,t,i,s,r){super(e,t,i,s,r);const a=this.params.pointToCoord,o=this.params.coordToPoint;this._pointToCoord=a,this._coordToPoint=o}onUpdate(e,t,i){this.points=this.points.map((s,r)=>{const a=this.polarPointInterpolation(this.interpolatePoints[r][0],this.interpolatePoints[r][1],t);return a.context=s.context,a}),i.points=this.points}polarPointInterpolation(e,t,i){const s=this._pointToCoord(e),r=this._pointToCoord({x:e.x1,y:e.y1}),a=this._pointToCoord(t),o=this._pointToCoord({x:t.x1,y:t.y1}),l=s.angle+(a.angle-s.angle)*i,h=s.radius+(a.radius-s.radius)*i,d=r.angle+(o.angle-r.angle)*i,u=r.radius+(o.radius-r.radius)*i,{x:c,y:f}=this._coordToPoint({angle:l,radius:h}),{x:p,y:g}=this._coordToPoint({angle:d,radius:u}),_=new Et(c,f,p,g);return _.defined=t.defined,_}}const CL=n=>({type:n==="in"?"fadeIn":"fadeOut"}),IZ=(n,e)=>({type:e==="in"?"growPointsIn":"growPointsOut",options:()=>({center:n.center()})});function Kc(n,e,t){return e==="fadeIn"?CL(t):IZ(n,t)}const DZ=(n,e)=>{const t=()=>{var a;return(a=n.center())===null||a===void 0?void 0:a.x},i=(a,o)=>o.getGraphicAttribute("x"),s=()=>{var a;return(a=n.center())===null||a===void 0?void 0:a.y},r=(a,o)=>o.getGraphicAttribute("y");return e==="in"?{channel:{x:{from:t,to:i},y:{from:s,to:r}}}:{channel:{x:{from:i,to:t},y:{from:r,to:s}}}};function tT(n,e,t){return e==="fadeIn"?CL(t):DZ(n,t)}const iT=(n,e)=>({custom:F3,customParameters:(t,i)=>{var s;return{group:i.getGraphicItem(),startAngle:(s=n.startAngle)!==null&&s!==void 0?s:Math.PI/2,orient:"clockwise",center:n.center(),radius:n.radius(),animationType:e}}}),FZ=()=>{D.registerAnimation("radar",(n,e)=>({appear:e==="clipIn"?void 0:Kc(n,e,"in"),enter:Kc(n,e,"in"),exit:Kc(n,e,"out"),disappear:e==="clipIn"?void 0:Kc(n,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:LZ,customParameters:n,duration:Jr.update.duration,easing:Jr.update.easing}]})),D.registerAnimation("radarSymbol",(n,e)=>({appear:e==="clipIn"?void 0:tT(n,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:e==="clipIn"?void 0:tT(n,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:BZ,customParameters:n,duration:Jr.update.duration,easing:Jr.update.easing}]})),D.registerAnimation("radarGroup",(n,e)=>({appear:iT(n,"in"),disappear:iT(n,"out")}))};class ta extends ML{constructor(){super(...arguments),this.type=z.radar,this.transformerConstructor=ic,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var e,t,i,s;const r={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},a=((e=this._spec.area)===null||e===void 0?void 0:e.visible)!==!1&&((i=(t=this._spec.area)===null||t===void 0?void 0:t.style)===null||i===void 0?void 0:i.visible)!==!1,o=(s=this._spec.seriesMark)!==null&&s!==void 0?s:"area";this.initAreaMark(r,a&&o==="area"),this.initLineMark(r,o==="line"||o==="area"&&!a),this.initSymbolMark(r,o==="point")}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(e,t){var i;this._areaMark=this._createMark(ta.mark.area,{progressive:e,isSeriesMark:t,customShape:(i=this._spec.area)===null||i===void 0?void 0:i.customShape})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>!t||!this.angleAxisHelper||!this.radiusAxisHelper?Number.NaN:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y,fill:this.getColorAttribute(),curveType:KB,closePath:!0},"normal",J.Series),this._invalidType!=="zero"&&this.setMarkStyle(e,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",J.Series),this.event.on(ye.viewDataStatisticsUpdate,{filter:t=>t.model===this},()=>{this.encodeDefined(e,"defined")}),this._trigger.registerMark(e))}initTooltip(){super.initTooltip(),this._lineMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._lineMark),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark),this._areaMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark)}initAnimation(){var e,t,i,s;const r={center:()=>{var o;return(o=this.angleAxisHelper)===null||o===void 0?void 0:o.center()},radius:()=>{const o=this.getLayoutRect();return Math.min(o.width,o.height)},startAngle:P(this._spec.startAngle)?st(this._spec.startAngle):O_,pointToCoord:o=>{var l;return(l=this.angleAxisHelper)===null||l===void 0?void 0:l.pointToCoord(o)},coordToPoint:o=>this.angleAxisHelper.coordToPoint(o)},a=(i=(t=(e=this._spec)===null||e===void 0?void 0:e.animationAppear)===null||t===void 0?void 0:t.preset)!==null&&i!==void 0?i:"clipIn";a==="clipIn"&&this._rootMark&&this._rootMark.setAnimationConfig(Le((s=D.getAnimationInKey("radarGroup"))===null||s===void 0?void 0:s(r,a),Ge("group",this._spec,this._markAttributeContext))),[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach(([o,l])=>{if(P(o)){const h=D.getAnimationInKey(l);o.setAnimationConfig(Le(h==null?void 0:h(r,a),Ge(o.name,this._spec,this._markAttributeContext)))}})}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(e){return t=>{var i,s,r,a;let o=(s=(i=this._seriesMark)===null||i===void 0?void 0:i.getAttribute(t,e))!==null&&s!==void 0?s:void 0;return t!=="fill"||o||(t="stroke",o=(a=(r=this._seriesMark)===null||r===void 0?void 0:r.getAttribute(t,e))!==null&&a!==void 0?a:void 0),t==="stroke"&&W(o)?o[0]:o}}}ta.type=z.radar,ta.mark=HO,ta.transformerConstructor=ic,li(ta,V0);const zZ=()=>{T0(),U0(),N0(),Ba(),FZ(),D.registerSeries(ta.type,ta)};class jZ extends rn{updateTooltipSpec(){var e;super.updateTooltipSpec(),P((e=this.spec)===null||e===void 0?void 0:e.mark)&&(this.spec.mark.updateContent=(t,i,s)=>{const r=[],a=t.filter(o=>o.key==="children");return a.length>0&&a[0].value.forEach(o=>{let l=!0;for(const h in o)r.push({shapeType:"circle",hasShape:l,shapeColor:this.contentShapeColorCallback(i[0].datum[0]),shapeStroke:this.contentShapeColorCallback(i[0].datum[0]),key:h,value:o[h]+""}),l=!1}),t.concat(r)})}getDefaultTooltipPattern(e){return e==="mark"?{visible:!0,activeType:e,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,key:"event_time",value:t=>Vr.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,i,s)=>{const r=[];return t[3].value.forEach(a=>{let o=!0;for(const l in a)r.push({shapeType:"circle",hasShape:o,shapeColor:this.contentShapeColorCallback(i[0].datum[0]),shapeStroke:this.contentShapeColorCallback(i[0].datum[0]),key:l,value:a[l]+""}),o=!1}),t.concat(r)}}:null}}const HZ=(n,e)=>{var t;const i=!((t=n[0])===null||t===void 0)&&t.latestData?n[0].latestData:n||[],s=[];return i.forEach(r=>{const a={};for(const l in r)l!==e&&(a[l]=r[l]);const o=r[e];o==null||o.forEach(l=>{s.push(Object.assign({},a,l))})}),s},GZ={fill:"#bbb",fillOpacity:.2};class yn extends Qn{constructor(){super(...arguments),this.type=z.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(e){P(e)&&(this._seriesGroupField=e)}getTitleField(){return this._titleField}setTitleField(e){P(e)&&(this._titleField=e)}getSubTitleField(){return this._subTitleField}setSubTitleField(e){P(e)&&(this._subTitleField=e)}getDotTypeField(){return this._dotTypeField}setDotTypeField(e){P(e)&&(this._dotTypeField=e)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(e){P(e)&&(this._highLightSeriesGroup=e)}setGridBackground(e){P(e)&&(this._gridBackground=e)}initData(){var e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map(t=>t[this._fieldY[0]]),Ae(this._option.dataSet,"objFlat",HZ),Ae(this._option.dataSet,"copyDataView",im),pr(this._option.dataSet,"dataview",c_),(e=this.getViewData())===null||e===void 0||e.transform({type:"objFlat",options:"dots",level:An.dotObjFlat},!1)}setSeriesField(e){P(e)&&(this._seriesField=e,this.getMarksInType(["line","area"]).forEach(t=>{t.setFacet(this._seriesField)}))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var e;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(pe(GZ,((e=this._spec.grid)===null||e===void 0?void 0:e.background)||{}))}initMark(){this._clipMark=this._createMark(yn.mark.group),this._containerMark=this._createMark(yn.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(yn.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(yn.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(yn.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(yn.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(yn.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(yn.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",J.Series),e.setInteractive(!1));const t=this._containerMark;t&&(this.setMarkStyle(t,{x:this._spec.leftAppendPadding},"normal",J.Series),t.setInteractive(!1));const i=this._gridBackgroundMark;i&&(this.setMarkStyle(i,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",J.Series),this._trigger.registerMark(i));const s=this._gridMark;s&&(this.setMarkStyle(s,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",J.Series),this._trigger.registerMark(s));const r=this._dotMark;r&&(this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",J.Series),this._trigger.registerMark(r));const a=this._titleMark;a&&(this.setMarkStyle(a,{fill:this.getColorAttribute(),text:h=>h[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",J.Series),this._trigger.registerMark(a));const o=this._subTitleMark;o&&(this.setMarkStyle(o,{fill:this.getColorAttribute(),text:h=>h[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",J.Series),this._trigger.registerMark(o));const l=this._symbolMark;l&&(this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",J.Series),this._trigger.registerMark(l))}dataToGridBackgroundPositionY(e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:t,getBandwidth:i}=this._yAxisHelper;return t(this.getDatumPositionValues(e,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:t,getBandwidth:i}=this._yAxisHelper;return t(this.getDatumPositionValues(e,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(e){var t,i,s,r;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:a,getScale:o}=this._xAxisHelper;return a(this.getDatumPositionValues(e,this._fieldX),{bandPosition:this._bandPosition})<o(0).range()[0]||a(this.getDatumPositionValues(e,this._fieldX),{bandPosition:this._bandPosition})>o(0).range()[1]?0:(r=(s=(i=(t=this._theme)===null||t===void 0?void 0:t.dot)===null||i===void 0?void 0:i.style)===null||s===void 0?void 0:s.fillOpacity)!==null&&r!==void 0?r:1}dataToGridBackgroundOpacity(e){return e[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(e){var t,i;super.onLayoutEnd(e);const s=(i=(t=this._spec)===null||t===void 0?void 0:t.leftAppendPadding)!==null&&i!==void 0?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",J.Series)}getDefaultColorDomain(){var e,t;return this._seriesGroupField?(e=this.getViewDataStatistics())===null||e===void 0?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?(t=this.getViewDataStatistics())===null||t===void 0?void 0:t.latestData[this._seriesField].values:[]}getColorAttribute(){var e,t,i;return{scale:(e=this._option.globalScale.getScale("color"))!==null&&e!==void 0?e:this._getDefaultColorScale(),field:(i=(t=this._seriesGroupField)!==null&&t!==void 0?t:this._seriesField)!==null&&i!==void 0?i:vn}}getDotColorScale(){var e,t,i;const s=this._dotTypeField?(e=this.getViewDataStatistics())===null||e===void 0?void 0:e.latestData[this._dotTypeField].values:this._seriesGroupField?(t=this.getViewDataStatistics())===null||t===void 0?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?(i=this.getViewDataStatistics())===null||i===void 0?void 0:i.latestData[this._seriesField].values:[],r=this._getDataScheme();return new Qu().domain(s).range(r)}getDotColorAttribute(){var e,t,i,s;return{scale:(e=this._option.globalScale.getScale("color"))!==null&&e!==void 0?e:this.getDotColorScale(),field:(s=(i=(t=this._dotTypeField)!==null&&t!==void 0?t:this._seriesGroupField)!==null&&i!==void 0?i:this._seriesField)!==null&&s!==void 0?s:vn}}initTooltip(){this._tooltipHelper=new jZ(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(e){super.onEvaluateEnd(e)}onMarkTreePositionUpdate(e){e.forEach(t=>{t.type==="group"?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()})}getDotData(){var e;return(e=this._dotMark)===null||e===void 0?void 0:e.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}yn.type=z.dot,yn.mark=YO;const WZ=()=>{Ba(),rc(),La(),wn(),D.registerSeries(yn.type,yn)};class VZ extends rn{getDefaultTooltipPattern(e){return e==="mark"?{visible:!0,activeType:e,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,key:"time",value:t=>Vr.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}const NZ=(n,e)=>{const{infoKey:t,fields:i,linkData:s,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=i(),d=s(),u=r(),c={};return u.forEach(f=>{const p={};for(const _ in f)_!==t&&(p[_]=f[_]);const g=f[t];g==null||g.forEach(_=>{c[_.node_name]=Object.assign({},p,_)})}),d.forEach(f=>{var p,g,_,m;f[a+"_xField"]=(p=c==null?void 0:c[f[a]])===null||p===void 0?void 0:p[l],f[a+"_yField"]=(g=c==null?void 0:c[f[a]])===null||g===void 0?void 0:g[h],f[o+"_xField"]=(_=c==null?void 0:c[f[o]])===null||_===void 0?void 0:_[l],f[o+"_yField"]=(m=c==null?void 0:c[f[o]])===null||m===void 0?void 0:m[h]}),d};class cr extends Qn{constructor(){super(...arguments),this.type=z.link}getFromField(){return this._fromField}setFromField(e){P(e)&&(this._fromField=e)}getToField(){return this._toField}setToField(e){P(e)&&(this._toField=e)}getDotTypeField(){return this._dotTypeField}setDotTypeField(e){P(e)&&(this._dotTypeField=e)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(e){P(e)&&(this._dotSeriesSpec=e)}_getDotData(){const e=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return e?e.getRawData().latestData:[]}initData(){var e;super.initData(),Ae(this._option.dataSet,"linkDotInfo",NZ),(e=this.getViewData())===null||e===void 0||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:An.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(cr.mark.group),this._containerMark=this._createMark(cr.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(cr.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(cr.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,t,i,s;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",J.Series),r.setInteractive(!1));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",J.Series),a.setInteractive(!1));const o=this._linkMark;o&&(this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",J.Series),this._trigger.registerMark(o));const l=this._arrowMark;if(l){const h=(s=(i=(t=(e=this._theme)===null||e===void 0?void 0:e.arrow)===null||t===void 0?void 0:t.style)===null||i===void 0?void 0:i.size)!==null&&s!==void 0?s:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:d=>this.dataToPositionArrowYTo(d,h),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:h,symbolType:d=>this.isPositionYFromHigher(d)?"triangleDown":"triangleUp"},"normal",J.Series),this._trigger.registerMark(l)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}dataToPositionXFrom(e){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:t}=this._xAxisHelper;return t(this.getDatumPositionValues(e,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:t}=this._yAxisHelper;return t(this.getDatumPositionValues(e,this._fromField+"_yField"))}dataToPositionXTo(e){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:t}=this._xAxisHelper;return t(this.getDatumPositionValues(e,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:t}=this._yAxisHelper;return t(this.getDatumPositionValues(e,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(e,t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(e)?-t/2:t/2;return i(this.getDatumPositionValues(e,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(e){return this.isPositionXOuterRange(e,this._fromField+"_xField")||this.isPositionXOuterRange(e,this._toField+"_xField")||e[this._fromField]===e[this._toField]?0:1}isPositionYFromHigher(e){return this.dataToPositionYFrom(e)<this.dataToPositionYTo(e)}isPositionXOuterRange(e,t){if(!this._xAxisHelper)return!1;const{dataToPosition:i,getScale:s}=this._xAxisHelper;return i(this.getDatumPositionValues(e,t),{bandPosition:this._bandPosition})<s(0).range()[0]||i(this.getDatumPositionValues(e,t),{bandPosition:this._bandPosition})>s(0).range()[1]}getDefaultColorDomain(){var e,t;return this._dotTypeField?(e=this.getViewDataStatistics())===null||e===void 0?void 0:e.latestData[this._dotTypeField].values:this._seriesField?(t=this.getViewDataStatistics())===null||t===void 0?void 0:t.latestData[this._seriesField].values:[]}getColorAttribute(){var e,t,i;return{scale:(e=this._option.globalScale.getScale("color"))!==null&&e!==void 0?e:this._getDefaultColorScale(),field:(i=(t=this._dotTypeField)!==null&&t!==void 0?t:this._seriesField)!==null&&i!==void 0?i:vn}}initTooltip(){this._tooltipHelper=new VZ(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(e){e.forEach(t=>{t.type==="group"?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()})}getDotInfoData(){var e,t;return(t=(e=this._linkMark)!==null&&e!==void 0?e:this._arrowMark)===null||t===void 0?void 0:t.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}cr.type=z.link,cr.mark=$O;const UZ=()=>{rc(),Ba(),D.registerSeries(cr.type,cr)};class Ch extends ac{constructor(){super(...arguments),this._supportStack=!0,this._arcGroupMark=null,this._getAngleValueStart=e=>{const t=this._getAngleAxis(),{tickMask:i}=this._spec;if(i!=null&&i.forceAlign&&this._isTickMaskVisible(t)){const s=e[this._stack?Yn:bf],r=this._getAngleAxisSubTickData(t),a=r[1].value-r[0].value,o=st(i.offsetAngle);let l;if(P(s)){const h=fk(r,u=>u.value-s),d=s>r[h].value-a/2?Math.min(h,r.length-1):h>0?h-1:void 0;d!==void 0&&(l=this.angleAxisHelper.dataToPosition([r[d].value-a/2]))}return C(l)&&(l=this.angleAxisHelper.dataToPosition([r[0].value-a/2])),l+o}return this._getAngleValueStartWithoutMask(e)},this._getAngleValueEnd=e=>{const t=this._getAngleAxis(),{tickMask:i}=this._spec;if(i!=null&&i.forceAlign&&this._isTickMaskVisible(t)){const s=e[this._stack?Jt:this._angleField[0]],r=this._getAngleAxisSubTickData(t),a=r[1].value-r[0].value,o=st(i.offsetAngle),l=fk(r,u=>u.value-s),h=s>r[l].value-a/2?Math.min(l,r.length-1):l>0?l-1:void 0;let d;return d=h!==void 0?this.angleAxisHelper.dataToPosition([r[h].value+a/2]):this.angleAxisHelper.dataToPosition([r[0].value-a/2]),d+o}return this._getAngleValueEndWithoutMask(e)}}setAttrFromSpec(){var e,t,i;super.setAttrFromSpec();const s=(e=this._option.globalInstance.getChart())===null||e===void 0?void 0:e.getSpec(),r=(t=this._spec.startAngle)!==null&&t!==void 0?t:s==null?void 0:s.startAngle;this._startAngle=P(r)?st(r):O_;const a=(i=this._spec.endAngle)!==null&&i!==void 0?i:s==null?void 0:s.endAngle;this._endAngle=P(a)?st(a):h0,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var e;return(e=this._angleField)===null||e===void 0?void 0:e[0]}getGroupFields(){return this._angleField}_convertMarkStyle(e){const t=super._convertMarkStyle(e);if(t.fill){const i=e.fill;(i==null?void 0:i.gradient)!=="conical"||P(i==null?void 0:i.startAngle)||P(i==null?void 0:i.endAngle)||(t.fill=Object.assign(Object.assign({},i),{startAngle:this._startAngle,endAngle:this._endAngle}))}return t}_getAngleValueStartWithoutMask(e){if(this._stack){const t=Ke(this.angleAxisHelper.dataToPosition([e[Yn]]),this.angleAxisHelper.getScale(0));if(j(t))return t}return this._startAngle}_getAngleValueEndWithoutMask(e){if(this._stack){const t=Ke(this.angleAxisHelper.dataToPosition([e[Jt]]),this.angleAxisHelper.getScale(0));if(j(t))return t}return this.angleAxisHelper.dataToPosition([e[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(Ch.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,x:0,y:0,path:()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:r}=this._spec,{angle:a,offsetAngle:o,style:l={}}=r,h=this._getAngleAxisSubTickData(t),{x:d,y:u}=this.angleAxisHelper.center(),c=this._computeLayoutRadius(),f=l;return h.map(({value:p})=>{const g=this.angleAxisHelper.dataToPosition([p])+st(o),_=st(a)/2;return Yx(Object.assign(Object.assign({},f),{x:d,y:u,startAngle:g-_,endAngle:g+_,innerRadius:c*this._innerRadius,outerRadius:c*this._outerRadius,fill:!0}))})}const{width:i,height:s}=this.getLayoutRect();return[eh({width:i,height:s,fill:!0})]}},"normal",J.Series),this._arcGroupMark.setInteractive(!1)}_getAngleAxis(){if(!this.angleAxisHelper)return;const e=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find(t=>t.id===e)}_getAngleAxisTickData(e){var t;return(t=e==null?void 0:e.getTickData())===null||t===void 0?void 0:t.getLatestData()}_isTickMaskVisible(e){const t=this._getAngleAxisTickData(e),{tickMask:i}=this._spec;return i&&i.visible!==!1&&(t==null?void 0:t.length)>1}_getAngleAxisSubTickData(e){var t;const i=this._getAngleAxisTickData(e),s=[],{subTick:r={},tick:a={}}=(t=e==null?void 0:e.getSpec())!==null&&t!==void 0?t:{},{tickCount:o=4}=r,{alignWithLabel:l}=a;if((i==null?void 0:i.length)>=2){const h=i[1].value-i[0].value;for(let d=0;d<i.length-1;d++){const u=i[d],c=i[d+1];s.push(u);for(let f=0;f<o;f++){const p=(f+1)/(o+1),g=(1-p)*u.value+p*(c?c.value:l?1:u.value+h);s.push({value:g})}}return s.push(i[i.length-1]),s}return i}}Ch.mark=E0;class Ag extends X0{constructor(){super(...arguments),this._cacheStateStyle={}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{innerPadding:0,outerPadding:0})}_filterStyle(e,t,i,s=this.stateStyle){var r,a,o,l,h,d,u,c,f,p,g,_,m,y,b,v,x,S;P(e.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(e.innerRadius),t,i,this._cacheStateStyle),P(e.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(e.outerRadius),t,i,this._cacheStateStyle);const A=(r=e.innerPadding)!==null&&r!==void 0?r:(o=(a=s[t])===null||a===void 0?void 0:a.innerPadding)===null||o===void 0?void 0:o.style,k=(l=e.outerPadding)!==null&&l!==void 0?l:(d=(h=s[t])===null||h===void 0?void 0:h.outerPadding)===null||d===void 0?void 0:d.style,w=(p=(u=e.innerRadius)!==null&&u!==void 0?u:(f=(c=this._cacheStateStyle[t])===null||c===void 0?void 0:c.innerRadius)===null||f===void 0?void 0:f.style)!==null&&p!==void 0?p:(_=(g=s[t])===null||g===void 0?void 0:g.innerRadius)===null||_===void 0?void 0:_.style,M=(v=(m=e.outerRadius)!==null&&m!==void 0?m:(b=(y=this._cacheStateStyle[t])===null||y===void 0?void 0:y.outerRadius)===null||b===void 0?void 0:b.style)!==null&&v!==void 0?v:(S=(x=s[t])===null||x===void 0?void 0:x.outerRadius)===null||S===void 0?void 0:S.style;if(w===0&&M===0)return e;const T=P(e.innerPadding)&&P(w)||P(e.outerPadding)&&P(M),E=P(e.innerRadius)&&A||P(e.outerRadius)&&k;if(T||E){const O=Object.assign({},e);return A&&P(w)&&(Y(w)?O.innerRadius=(B,R,L,I)=>w(B,R,L,I)+(Y(A)?A(B,R,L,I):A):Y(A)?O.innerRadius=(B,R,L,I)=>{const F=A(B,R,L,I);return w+F}:O.innerRadius=w+A),k&&P(M)&&(Y(M)?O.outerRadius=(B,R,L,I)=>M(B,R,L,I)-(Y(k)?k(B,R,L,I):k):Y(k)?O.outerRadius=(B,R,L,I)=>{const F=k(B,R,L,I);return M-F}:O.outerRadius=M-k),O}return e}}Ag.type="arc",Ag.constructorType="progressArc";const PL=()=>{fO(),H0(),D.registerMark(Ag.constructorType,Ag)},$Z=n=>({type:"growAngleIn",options:{overall:n.startAngle}}),YZ={type:"fadeIn"};function XZ(n,e){return e==="fadeIn"?YZ:$Z(n)}const EL=()=>{D.registerAnimation("circularProgress",(n,e)=>({appear:XZ(n,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}))};class co extends Ch{constructor(){super(...arguments),this.type=z.circularProgress,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=e=>{if(this.getGroupFields().length>1){const t=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(e,this.getGroupFields()));if(j(t))return t}return this.radiusAxisHelper.dataToPosition([e[this._radiusField[0]]])},this._getRadiusValueEnd=e=>{var t,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(e,this.getGroupFields()))+((i=(t=this.radiusAxisHelper).getBandwidth)===null||i===void 0?void 0:i.call(t,this._groups?this._groups.fields.length-1:0));if(j(s))return s}return this.radiusAxisHelper.dataToPosition([e[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var e;return this._progressMark=this._createMark(co.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,customShape:(e=this._spec.progress)===null||e===void 0?void 0:e.customShape}),this._progressMark}_initProgressMarkStyle(){var e;const t=this._progressMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:(e=this._spec.roundCap)!==null&&e!==void 0&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",J.Series),this._trigger.registerMark(t))}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var e;return this._trackMark=this._createMark(co.mark.track,{parent:this._arcGroupMark,customShape:(e=this._spec.track)===null||e===void 0?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&(this.setMarkStyle(e,{visible:t=>{const i=this.angleAxisHelper.getScale(0).range(),s=Math.min(i[0],i[i.length-1]),r=this._getAngleValueStartWithoutMask(t);return Math.abs(r-s)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this._stack?Yn:this._angleField[0],i=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:i[0]})},endAngle:()=>{const t=this._stack?Jt:this._angleField[0],i=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:i[i.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",J.Series),this._trigger.registerMark(e))}initAnimation(){var e,t,i,s;const r=(t=(e=this._spec)===null||e===void 0?void 0:e.animationAppear)===null||t===void 0?void 0:t.preset;this._progressMark.setAnimationConfig(Le((i=D.getAnimationInKey("circularProgress"))===null||i===void 0?void 0:i({startAngle:this._startAngle},r),Ge("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Le((s=D.getAnimationInKey("fadeInOut"))===null||s===void 0?void 0:s(),Ge("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}co.type=z.circularProgress,co.mark=UO;const KZ=()=>{PL(),oc(),EL(),Mr(),D.registerSeries(co.type,co)};function RL(n){return()=>n.direction==="vertical"?{orient:"negative"}:{orient:"positive"}}const qZ=n=>({type:n.direction==="horizontal"?"growWidthIn":"growHeightIn",options:RL(n)}),ZZ=n=>({type:n.direction==="horizontal"?"growWidthOut":"growHeightOut",options:RL(n)}),JZ={type:"fadeIn"};function QZ(n,e){return e===!1?{}:e==="fadeIn"?JZ:qZ(n)}const eJ=()=>{D.registerAnimation("linearProgress",(n,e)=>({appear:QZ(n,e),enter:{type:"grow"},disappear:ZZ(n)}))};class tJ extends rn{getDefaultTooltipPattern(e,t){const i=super.getDefaultTooltipPattern(e,t);return e==="mark"?i:e==="dimension"?(i.visible=!1,i):null}}class ua extends Qn{constructor(){super(...arguments),this.type=z.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this._initProgressGroupMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initProgressGroupMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var e;return this._progressMark=this._createMark(ua.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark,customShape:(e=this._spec.progress)===null||e===void 0?void 0:e.customShape}),this._progressMark}_initProgressMarkStyle(){var e,t,i,s,r,a,o,l;const h=this._progressMark;if(h){if(this._spec.direction==="vertical"){const d=(t=(e=this._spec.progress)===null||e===void 0?void 0:e.leftPadding)!==null&&t!==void 0?t:0,u=(s=(i=this._spec.progress)===null||i===void 0?void 0:i.rightPadding)!==null&&s!==void 0?s:0;this.setMarkStyle(h,{x:c=>{var f,p;return Ke(this.dataToPositionX(c),(p=(f=this._xAxisHelper)===null||f===void 0?void 0:f.getScale)===null||p===void 0?void 0:p.call(f,0))-this._spec.bandWidth/2+d},y:c=>{var f,p;return Ke(this.dataToPositionY(c),(p=(f=this._yAxisHelper)===null||f===void 0?void 0:f.getScale)===null||p===void 0?void 0:p.call(f,0))},height:()=>{var c;return(c=this._yAxisHelper)===null||c===void 0?void 0:c.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-d-u,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",J.Series)}else{const d=(a=(r=this._spec.progress)===null||r===void 0?void 0:r.topPadding)!==null&&a!==void 0?a:0,u=(l=(o=this._spec.progress)===null||o===void 0?void 0:o.bottomPadding)!==null&&l!==void 0?l:0;this.setMarkStyle(h,{x:c=>{var f,p;return Ke(this.dataToPositionX(c),(p=(f=this._xAxisHelper)===null||f===void 0?void 0:f.getScale)===null||p===void 0?void 0:p.call(f,0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:c=>{var f,p;return Ke(this.dataToPositionY(c),(p=(f=this._yAxisHelper)===null||f===void 0?void 0:f.getScale)===null||p===void 0?void 0:p.call(f,0))-this._spec.bandWidth/2+d},height:this._spec.bandWidth-d-u,width:()=>{var c;return(c=this._xAxisHelper)===null||c===void 0?void 0:c.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",J.Series)}this._trigger.registerMark(h)}}_initTrackMark(){var e;return this._trackMark=this._createMark(ua.mark.track,{parent:this._progressGroupMark,customShape:(e=this._spec.track)===null||e===void 0?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&(this._spec.direction==="vertical"?this.setMarkStyle(e,{x:t=>{var i,s;return Ke(this.dataToPositionX(t),(s=(i=this._xAxisHelper)===null||i===void 0?void 0:i.getScale)===null||s===void 0?void 0:s.call(i,0))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",J.Series):this.setMarkStyle(e,{x:0,y:t=>{var i,s;return Ke(this.dataToPositionY(t),(s=(i=this._yAxisHelper)===null||i===void 0?void 0:i.getScale)===null||s===void 0?void 0:s.call(i,0))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",J.Series),this._trigger.registerMark(e))}_initProgressGroupMark(){return this._progressGroupMark=this._createMark(ua.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}_initProgressGroupMarkStyle(){const e=this._progressGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,x:0,y:0,path:()=>{var t;const i=[];return(t=this._rawData)===null||t===void 0||t.rawData.forEach((s,r)=>{var a,o,l,h;if(this._spec.direction==="vertical"){const d=Ke(this.dataToPositionX(s),(o=(a=this._xAxisHelper)===null||a===void 0?void 0:a.getScale)===null||o===void 0?void 0:o.call(a,0))-this._spec.bandWidth/2,u=this._scaleY.range()[0];i.push(eh({x:d,y:0,height:u,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const d=Ke(this.dataToPositionY(s),(h=(l=this._yAxisHelper)===null||l===void 0?void 0:l.getScale)===null||h===void 0?void 0:h.call(l,0))-this._spec.bandWidth/2,u=this._scaleX.range()[1];i.push(eh({x:0,y:d,height:this._spec.bandWidth,width:u,cornerRadius:this._spec.cornerRadius,fill:!0}))}}),i}},"normal",J.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){var e,t,i,s;const r={direction:this.direction},a=(t=(e=this._spec)===null||e===void 0?void 0:e.animationAppear)===null||t===void 0?void 0:t.preset;this._progressMark.setAnimationConfig(Le((i=D.getAnimationInKey("linearProgress"))===null||i===void 0?void 0:i(r,a),Ge("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Le((s=D.getAnimationInKey("fadeInOut"))===null||s===void 0?void 0:s(),Ge("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new tJ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}ua.type=z.linearProgress,ua.mark=qO;const iJ=()=>{La(),eJ(),Mr(),D.registerSeries(ua.type,ua)},nT=[0],nJ="hidden",sT=20,sJ=[20,40],rJ=[200,500],aJ="circle",oJ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},lJ=!0,rT=1,hJ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],aT=`${be}_WORD_CLOUD_ANGLE`,dJ=`${be}_WORD_CLOUD_FILLING_ANGLE`,Ay=`${be}_WORD_CLOUD_WEIGHT`,oT=`${be}_WORD_CLOUD_TEXT`;class ca extends ho{constructor(){super(...arguments),this._fontSizeRange=[sT,sT],this._isWordCloudShape=!1}setValueField(e){P(e)&&(this._valueField=e)}setFontSizeRange(e){P(e)?this._fontSizeRange=e:this._fontSizeRange=sJ}setAttrFromSpec(){var e,t,i,s,r,a,o,l,h,d;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=(e=this._spec.colorMode)!==null&&e!==void 0?e:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=(t=this._spec.fontWeightRange)!==null&&t!==void 0?t:rJ,this._rotateAngles=(i=this._spec.rotateAngles)!==null&&i!==void 0?i:nT,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=(s=this._spec.maskShape)!==null&&s!==void 0?s:aJ,this._keepAspect=this._spec.keepAspect,this._random=(r=this._spec.random)!==null&&r!==void 0?r:lJ,this._fontPadding=(o=(a=this._spec.word)===null||a===void 0?void 0:a.padding)!==null&&o!==void 0?o:rT,this._textField=!((l=this._spec.word)===null||l===void 0)&&l.formatMethod?oT:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:nJ,layoutMode:"default",zoomToFit:oJ},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:nT,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._fillingFontPadding=(d=(h=this._spec.fillingWord)===null||h===void 0?void 0:h.padding)!==null&&d!==void 0?d:rT,this._isWordCloudShape=!hJ.includes(this._maskShape),this._defaultFontFamily=this._option.getTheme().fontFamily}initMark(){this._wordMark=this._createMark(ca.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(ca.mark.fillingWord))}initMarkStyle(){var e,t,i,s,r;const a=this._wordMark,o=this._fillingWordMark,l=(e=this._spec.word)!==null&&e!==void 0?e:{};a&&(this.setMarkStyle(a,{fill:this._colorHexField?h=>h[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:h=>h[this._textField],x:h=>h.x,y:h=>h.y,fontFamily:h=>h.fontFamily,fontSize:h=>h.fontSize,fontStyle:h=>h.fontStyle,fontWeight:h=>h.fontWeight,angle:h=>h.angle,visible:h=>!h.isFillingWord&&h.visible},"normal",J.Series),this.setMarkStyle(a,{fontFamily:(i=(t=l.style)===null||t===void 0?void 0:t.fontFamily)!==null&&i!==void 0?i:this._defaultFontFamily},"normal",J.User_Mark)),o&&(this.setMarkStyle(o,{fill:this._wordCloudShapeConfig.fillingColorHexField?h=>h[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:h=>h[this._textField],x:h=>h.x,y:h=>h.y,fontFamily:h=>h.fontFamily,fontSize:h=>h.fontSize,fontStyle:h=>h.fontStyle,fontWeight:h=>h.fontWeight,angle:h=>h.angle,visible:h=>h.isFillingWord&&h.visible},"normal",J.Series),this.setMarkStyle(o,{fontFamily:(r=(s=l.style)===null||s===void 0?void 0:s.fontFamily)!==null&&r!==void 0?r:this._defaultFontFamily},"normal",J.User_Mark)),this._trigger.registerMark(a),this._trigger.registerMark(o)}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark),this._fillingWordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._fillingWordMark)}initAnimation(){[this._wordMark,this._fillingWordMark].forEach(e=>{var t,i;if(e){const s=(i=(t=this._spec)===null||t===void 0?void 0:t.animationAppear)===null||i===void 0?void 0:i.preset,r={animationConfig:()=>{var a,o;return(o=(a=e.getAnimationConfig())===null||a===void 0?void 0:a.appear)===null||o===void 0?void 0:o[0]}};e.setAnimationConfig(Le(D.getAnimationInKey("wordCloud")(r,s),Ge("word",this._spec,this._markAttributeContext)))}})}getWordOrdinalColorScale(e,t){var i,s,r,a,o;const l=t?this._wordCloudShapeConfig.fillingColorList:this._colorList,h=e?(i=this.getViewData())===null||i===void 0?void 0:i.latestData.map(u=>u[e]):[],d=(r=l??((s=this._option.globalScale.getScale("color"))===null||s===void 0?void 0:s.range()))!==null&&r!==void 0?r:this._getDataScheme();return(o=(a=new Qu().domain(h)).range)===null||o===void 0?void 0:o.call(a,d)}getWordColorAttribute(e,t){var i,s;if(this._colorMode==="ordinal")return{scale:this.getWordOrdinalColorScale(e,t),field:(i=this._seriesField)!==null&&i!==void 0?i:vn};let r=(s=t?this._colorList:this._wordCloudShapeConfig.fillingColorList)!==null&&s!==void 0?s:this._option.globalScale.getScale("color").range();return r.length===1&&(r=[r[0],r[0]]),a=>r[0]}compile(){var e,t;super.compile();const{width:i,height:s}=this._region.getLayoutRect();if(!j(i)||!j(s)||!(s>0&&i>0))return;const r=[],a=this._valueField,o=new qn,l=this._fontWeightRange,h=this._rotateAngles,d=this._wordCloudShapeConfig.fillingRotateAngles;if(a){const[c,f]=ev((e=this.getViewData())===null||e===void 0?void 0:e.latestData.map(p=>+p[a]));o.domain([c,f],!0).range(l),r.push({type:"map",as:Ay,callback:p=>c===f?o.scale(f):o.scale(p[a])})}r.push({type:"map",as:aT,callback:()=>h[Math.floor(Math.random()*h.length)]}),r.push({type:"map",as:dJ,callback:()=>d[Math.floor(Math.random()*d.length)]});const u=(t=this._spec.word)!==null&&t!==void 0?t:{};u.formatMethod&&r.push({type:"map",as:oT,callback:u.formatMethod}),this._isWordCloudShape?r.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):(r.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.getProduct().transform(r)),this._data.getProduct().transform(r)}_wordCloudTransformOption(){var e,t,i,s,r;const{width:a,height:o}=this._region.getLayoutRect(),l=(t=(e=this._spec.word)===null||e===void 0?void 0:e.style)!==null&&t!==void 0?t:{};return{layoutType:Nn(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[a,o],shape:this._maskShape,dataIndexKey:Vs,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange==="auto"?null:this._fontSizeRange,padding:this._fontPadding,rotate:{field:aT},fontFamily:(s=(i=this._fontFamilyField)!==null&&i!==void 0?i:l.fontFamily)!==null&&s!==void 0?s:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:Ay}:null,fontStyle:(r=this._fontStyleField)!==null&&r!==void 0?r:l.fontStyle,randomVisible:this._random,clip:this._wordCloudConfig.drawOutOfBound==="clip",shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}}_wordCloudShapeTransformOption(){var e,t,i,s,r,a,o,l,h,d;const{width:u,height:c}=this._region.getLayoutRect(),f=(t=(e=this._spec.word)===null||e===void 0?void 0:e.style)!==null&&t!==void 0?t:{},p=(i=this._wordCloudShapeConfig)!==null&&i!==void 0?i:{},g=this._wordCloudShapeConfig.fillingRotateAngles;return{dataIndexKey:Vs,size:[u,c],shape:this._maskShape,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange==="auto"?null:this._fontSizeRange,padding:this._fontPadding,rotateList:this._rotateAngles,fontFamily:(r=(s=this._fontFamilyField)!==null&&s!==void 0?s:f.fontFamily)!==null&&r!==void 0?r:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:Ay}:null,fontStyle:(a=this._fontStyleField)!==null&&a!==void 0?a:f.fontStyle,fillingFontFamily:(l=(o=p.fillingFontFamilyField)!==null&&o!==void 0?o:f.fontFamily)!==null&&l!==void 0?l:this._defaultFontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:(h=p.fillingFontStyleField)!==null&&h!==void 0?h:f.fontStyle,fillingFontWeight:(d=p.fillingFontWeightField)!==null&&d!==void 0?d:f.fontWeight,fillingRotateList:g,fillingTimes:p.fillingTimes,fillingXStep:p.fillingXStep,fillingYStep:p.fillingYStep,fillingXRatioStep:p.fillingXRatioStep,fillingYRatioStep:p.fillingYRatioStep,fillingInitialOpacity:p.fillingInitialOpacity,fillingDeltaOpacity:p.fillingDeltaOpacity,fillingInitialFontSize:p.fillingInitialFontSize,fillingDeltaFontSize:p.fillingDeltaFontSize,ratio:p.ratio,fillingRatio:p.fillingRatio,removeWhiteBorder:p.removeWhiteBorder,textLayoutTimes:p.textLayoutTimes,fontSizeShrinkFactor:p.fontSizeShrinkFactor,stepFactor:p.stepFactor,layoutMode:p.layoutMode,importantWordCount:p.importantWordCount,globalShinkLimit:p.globalShinkLimit,fontSizeEnlargeFactor:p.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:p.fillingDeltaFontSizeFactor}}getStatisticFields(){const e=[];return e.push({key:this._nameField,operations:["values"]}),e.push({key:this._valueField,operations:["max","min"]}),e}dataToPosition(e){return null}dataToPositionX(e){return null}dataToPositionY(e){return null}dataToPositionZ(e){return null}valueToPosition(e,t){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(e){super.onLayoutEnd(e),this.compile()}getActiveMarks(){return[this._wordMark,this._fillingWordMark]}}ca.mark=Vv;const uJ=n=>({custom:z3,customParameters:(e,t)=>n,easing:"linear",loop:1/0,duration:6e3});function cJ(n,e,t){return n*t<e?n+(e-t*n)/(t-1):(e-n)/(t-1)}const fJ=n=>({channel:{fontSize:{from:0}},duration:200,delay:(e,t,i)=>{const s=n.animationConfig(),r=(s==null?void 0:s.duration)||200,a=(s==null?void 0:s.totalTime)||Jr.appear.duration,o=i.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return i.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*cJ(r,a,o)}});function pJ(n,e){return e===!1?{}:e==="fadeIn"?{type:"fadeIn"}:fJ(n)}const OL=()=>{D.registerAnimation("wordCloud",(n,e)=>({appear:pJ(n,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))},BL=()=>{D.registerAnimation("wordCloud3d",n=>({appear:uJ(n)}))},ky={triangleForward:yJ,triangleUpright:lT,triangle:lT,diamond:gJ,square:mJ,star:_J,cardioid:bJ,circle:vJ,pentagon:xJ};function gJ(){return function(n){const e=n%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}}function _J(){return function(n){const e=(n+.955)%(2*Math.PI/10);return(n+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}}function mJ(){return function(n){return Math.min(1/Math.abs(Math.cos(n)),1/Math.abs(Math.sin(n)))}}function lT(){return function(n){const e=(n+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function yJ(){return function(n){const e=n%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function bJ(){return function(n){return 1-Math.sin(n)}}function vJ(){return function(){return 1}}function xJ(){return function(n){const e=(n+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}function LL(n,e){const t=e[0],i=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(n){case"cardioid":r[1]=~~(i/2.7*.6),s=Math.floor(Math.min(t/2.3,i/2.6));break;case"triangleForward":s=i/Math.sqrt(.75)>t?Math.floor(t/2):Math.floor(i/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(i/1.5),s=Math.floor(Math.min(i/1.5,t/2));break;case"rect":s=Math.floor(Math.max(i/2,t/2));break;default:s=Math.floor(Math.min(t/2,i/2))}return{maxRadius:s,center:r}}const SJ=n=>ky[n]?ky[n]():ky.circle(),hT=(n,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-n)+n).toFixed()+"%)";function Ga(n){return Y(n)?n:function(){return n}}class Ph{constructor(e){var t,i;switch(this.options=re({},Ph.defaultOptions,e),Y(this.options.shape)?this.shape=this.options.shape:this.shape=SJ(this.options.shape),this.getText=(t=Ga(this.options.text))!==null&&t!==void 0?t:s=>s,this.getTextFontWeight=Ga(this.options.fontWeight),this.getTextFontSize=Ga(this.options.fontSize),this.getTextFontStyle=Ga(this.options.fontStyle),this.getTextFontFamily=Ga(this.options.fontFamily),this.outputCallback=(i=this.options.outputCallback)!==null&&i!==void 0?i:s=>s,this.options.color){case"random-dark":this.getTextColor=()=>hT(10,50);break;case"random-light":this.getTextColor=()=>hT(50,90);break;default:this.getTextColor=Ga(this.options.color)}if(C(this.options.rotate))if(this.options.useRandomRotate){const s=Math.abs(this.options.maxRotation-this.options.minRotation),r=Math.abs(Math.floor(this.options.rotationSteps)),a=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>this.options.rotateRatio===0||Math.random()>this.options.rotateRatio?0:s===0?a:r>0?a+Math.floor(Math.random()*r)*s/(r-1):a+Math.random()*s}else this.getTextRotate=()=>0;else this.getTextRotate=Y(this.options.rotate)?s=>{var r;return st((r=this.options.rotate(s))!==null&&r!==void 0?r:0)}:()=>{var s;return st((s=this.options.rotate)!==null&&s!==void 0?s:0)}}exceedTime(){var e;return this.options.progressiveStep>0?this.progressiveIndex>=(((e=this.currentStepIndex)!==null&&e!==void 0?e:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&new Date().getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var e;if(this.options.progressiveStep>0?this.currentStepIndex=((e=this.currentStepIndex)!==null&&e!==void 0?e:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex<this.data.length){this.progressiveResult=[];const t=this.data.length;let i=this.progressiveIndex;for(;i<t&&(this.layoutWord(i),i++,this.progressiveIndex=i,!this.exceedTime()););return this.progressiveResult}return this.result}initProgressive(){this.progressiveIndex=-1,this.options.progressiveStep>0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!C(this.progressiveIndex)&&this.progressiveIndex<this.data.length}release(){this.data=null,this.result=null,this.progressiveIndex=null,this.progressiveResult=null}}Ph.defaultOptions={fontFamily:'"Trebuchet MS", "Heiti TC", "微軟正黑體", "Arial Unicode MS", "Droid Fallback Sans", sans-serif',fontWeight:"normal",color:"random-dark",fontStyle:"normal",minFontSize:12,drawOutOfBound:!1,shrink:!1,minRotation:-Math.PI/2,maxRotation:Math.PI/2,rotationSteps:0,rotateRatio:.1,random:!1,shape:"circle",progressiveTime:0,progressiveStep:0,backgroundColor:"#fff"};const dT={archimedean:AJ,rectangular:kJ};function AJ(n){const e=n[0]/n[1];return t=>[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]}function kJ(n){const e=4*n[0]/n[1];let t=0,i=0;return s=>{const r=s<0?-1:1;switch(Math.sqrt(1+4*r*s)-r&3){case 0:t+=e;break;case 1:i+=4;break;case 2:t-=e;break;default:i-=4}return[t,i]}}class Vl extends Ph{constructor(e){var t;super(re({},Vl.defaultOptions,e)),this.cw=64,this.ch=2048,this._size=[256,256],this._isBoardExpandCompleted=!1,this._placeStatus=0,this._tTemp=null,this._dtTemp=null,this._dy=0,this.cacheMap=new Map,this.options.minFontSize<=Vl.defaultOptions.minFontSize&&(this.options.minFontSize=Vl.defaultOptions.minFontSize),this.spiral=ae(this.options.spiral)?(t=dT[this.options.spiral])!==null&&t!==void 0?t:dT.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=Ga(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(e){const t=this.data[e];if((""+t.text).trim()==="")return!0;const{maxRadius:i,center:s}=LL(this.options.shape,this._size);if(t.x=s[0],t.y=s[1],wJ(this.contextAndRatio,t,this.data,e,this.cw,this.ch),this._placeStatus=0,t.hasText&&this.place(this._board,t,this._bounds,i))return this.result.push(t),this._bounds?TJ(this._bounds,t):this._bounds=[{x:t.x+t.x0,y:t.y+t.y0},{x:t.x+t.x1,y:t.y+t.y1}],t.x-=this._size[0]>>1,t.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(t.fontSize),t.hasText&&this.shouldShrinkContinue()){if(this._placeStatus===1){const r=t.fontSize*this._originSize[0]/this.options.minFontSize,a=Math.max(t.width,t.height);if(a<=r)this.expandBoard(this._board,this._bounds,a/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,r/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(t.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(e,t){this.initProgressive(),this.result=[],this._size=[t.width,t.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(Fe.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const s=e.length;let r=0;this.result=[];const a=e.map(l=>({text:this.getText(l),fontFamily:this.getTextFontFamily(l),fontStyle:this.getTextFontStyle(l),fontWeight:this.getTextFontWeight(l),angle:this.getTextRotate(l),fontSize:~~this.getTextFontSize(l),padding:this.getTextPadding(l),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:l,x:0,y:0,width:0,height:0})).sort(function(l,h){return h.fontSize-l.fontSize});this.data=a;let o=0;for(;r<s&&(this.layoutWord(r)||o>=2?(r++,o=0):o++,this.progressiveIndex=r,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const l=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(l-this._size[1]/2)}return this.result}formatTagItem(e){const t=this._size,i=this.zoomRatio(),s=this.dy(),r=t[0]>>1,a=t[1]>>1,o=e.length,l=[];let h,d;for(let u=0;u<o;++u)h=e[u],d={},d.datum=h.datum,d.x=(h.x+r)*i,d.y=(h.y+a+s)*i,d.fontFamily=h.fontFamily,d.fontSize=h.fontSize*i,d.fontStyle=h.fontStyle,d.fontWeight=h.fontWeight,d.angle=h.angle,l.push(d);return l}output(){return this.outputCallback?this.outputCallback(this.formatTagItem(this.result)):this.formatTagItem(this.result)}progressiveOutput(){return this.outputCallback?this.outputCallback(this.formatTagItem(this.progressiveResult)):this.formatTagItem(this.progressiveResult)}updateBoardExpandStatus(e){this._isBoardExpandCompleted=e*(this._originSize[0]/this._size[0])<this.options.minFontSize}shouldShrinkContinue(){return!this.options.clip&&this.options.shrink&&!this._isBoardExpandCompleted}shrinkBoard(e){const t=e[0],i=e[1];if(i.x>=this._size[0]||i.y>=this._size[1])return;const s=Math.min(t.x,this._size[0]-i.x),r=Math.min(t.y,this._size[1]-i.y),a=2*Math.min(s/this._size[0],r/this._size[1]);this._size=this._size.map(o=>o*(1-a))}expandBoard(e,t,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let r=2*s>2?s:2;r%2!=0&&r++;let a=Math.ceil(this._size[1]*(r<<5)/this._size[0]);a%2!=0&&a++;const o=this._size[0],l=this._size[1],h=new Array(r).fill(0),d=new Array(a/2*(r+(o>>5))).fill(0);this.insertZerosToArray(e,l*(o>>5),d.length+r/2);for(let u=l-1;u>0;u--)this.insertZerosToArray(e,u*(o>>5),h.length);this.insertZerosToArray(e,0,d.length+r/2),this._size=[o+(r<<5),l+a],t&&(t[0].x+=(r<<5)/2,t[0].y+=a/2,t[1].x+=(r<<5)/2,t[1].y+=a/2)}insertZerosToArray(e,t,i){const s=Math.floor(i/6e4),r=i%6e4;for(let a=0;a<s;a++)e.splice(t+6e4*a,0,...new Array(6e4).fill(0));e.splice(t+6e4*s,0,...new Array(r).fill(0))}getContext(e){e.width=1,e.height=1;const t=e.getContext("2d").getImageData(0,0,1,1),i=Math.sqrt(t.data.length>>2);e.width=(this.cw<<5)/i,e.height=this.ch/i;const s=e.getContext("2d");return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:e}}place(e,t,i,s){let r=!1;if(this.shouldShrinkContinue()&&(t.width>this._size[0]||t.height>this._size[1]))return this._placeStatus=1,!1;const a=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(t,a))return null;const o=t.x,l=t.y,h=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),d=this.spiral(this._size);let u,c,f,p,g=-a;for(this._tTemp=null,this._dtTemp=null;u=d(g+=a);){c=u[0],f=u[1];const _=Math.sqrt(c**2+f**2);let m=Math.atan(f/c);c<0?m+=Math.PI:f<0&&(m=2*Math.PI+m);const y=this.shape(m);if(Math.min(Math.abs(c),Math.abs(f))>=h)break;if(_>=s)r&&this._tTemp===null&&(this._tTemp=g,this._dtTemp=a);else{if(t.x=o+~~(_*y*Math.cos(-m)),t.y=l+~~(_*y*Math.sin(-m)),p=t,this.options.clip)if(this.shouldShrinkContinue()){if(wy(p,this._size)){r&&this._tTemp===null&&(this._tTemp=g,this._dtTemp=a);continue}}else{if(PJ(p,this._size)){r&&this._tTemp===null&&(this._tTemp=g,this._dtTemp=a);continue}wy(p,this._size)&&(p=EJ(p,this._size))}else if(wy(p,this._size)){r&&this._tTemp===null&&(this._tTemp=g,this._dtTemp=a);continue}if(r=!0,(!i||CJ(p,i))&&(!i||!MJ(p,e,this._size))){const b=p.sprite,v=p.width>>5,x=this._size[0]>>5,S=p.x-(v<<4),A=127&S,k=32-A,w=p.y1-p.y0;let M,T=(p.y+p.y0)*x+(S>>5);for(let E=0;E<w;E++){M=0;for(let O=0;O<=v;O++)e[T+O]|=M<<k|(O<v?(M=b[E*v+O])>>>A:0);T+=x}return t.sprite=null,p.sprite=null,!0}}}return this._tTemp!==null&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,a),!1}clearCache(){this.cacheMap.clear()}setCache(e,t){const i=`${e.angle}-${t}`,s=e.x1-e.x0,r=e.y1-e.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:r});const{width:a,height:o}=this.cacheMap.get(i);(s<a&&r<o||s<=a&&r<o)&&this.cacheMap.set(i,{width:s,height:r})}isSizeLargerThanMax(e,t){const i=`${e.angle}-${t}`;if(!this.cacheMap.has(i))return!1;const{width:s,height:r}=this.cacheMap.get(i),a=e.x1-e.x0,o=e.y1-e.y0;return a>=s&&o>=r}}function wJ(n,e,t,i,s,r){if(e.sprite)return;const a=n.context,o=n.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,d=0;const u=t.length;let c,f,p,g,_;for(--i;++i<u;){if(e=t[i],a.save(),a.font=e.fontStyle+" "+e.fontWeight+" "+~~((e.fontSize+1)/o)+"px "+e.fontFamily,c=a.measureText(e.text+"m").width*o,p=e.fontSize<<1,e.angle){const b=Math.sin(e.angle),v=Math.cos(e.angle),x=c*v,S=c*b,A=p*v,k=p*b;c=Math.max(Math.abs(x+k),Math.abs(x-k))+31>>5<<5,p=~~Math.max(Math.abs(S+A),Math.abs(S-A))}else c=c+31>>5<<5;if(p>d&&(d=p),l+c>=s<<5&&(l=0,h+=d,d=0),h+p>=r)break;a.translate((l+(c>>1))/o,(h+(p>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=c,e.height=p,e.xoff=l,e.yoff=h,e.x1=c>>1,e.y1=p>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=c}const m=a.getImageData(0,0,(s<<5)/o,r/o).data,y=[];for(;--i>=0;){if(!(e=t[i]).hasText)continue;for(c=e.width,f=c>>5,p=e.y1-e.y0,g=0;g<p*f;g++)y[g]=0;if(l=e.xoff,l==null)return;h=e.yoff;let b=0,v=-1;for(_=0;_<p;_++){for(g=0;g<c;g++){const x=f*_+(g>>5),S=m[(h+_)*(s<<5)+(l+g)<<2]?1<<31-g%32:0;y[x]|=S,b|=S}b?v=_:(e.y0++,p--,_--,h++)}e.y1=e.y0+v,e.sprite=y.slice(0,(e.y1-e.y0)*f)}}function MJ(n,e,t){const i=t[0]>>5,s=n.sprite,r=n.width>>5,a=n.x-(r<<4),o=127&a,l=32-o,h=n.y1-n.y0;let d,u=(n.y+n.y0)*i+(a>>5);for(let c=0;c<h;c++){d=0;for(let f=0;f<=r;f++)if((d<<l|(f<r?(d=s[c*r+f])>>>o:0))&e[u+f])return!0;u+=i}return!1}function TJ(n,e){const t=n[0],i=n[1];e.x+e.x0<t.x&&(t.x=e.x+e.x0),e.y+e.y0<t.y&&(t.y=e.y+e.y0),e.x+e.x1>i.x&&(i.x=e.x+e.x1),e.y+e.y1>i.y&&(i.y=e.y+e.y1)}function CJ(n,e){return n.x+n.x1>e[0].x&&n.x+n.x0<e[1].x&&n.y+n.y1>e[0].y&&n.y+n.y0<e[1].y}Vl.defaultOptions={enlarge:!1,minFontSize:2};const PJ=(n,e)=>n.x+n.x0>e[0]||n.y+n.y0>e[0]||n.x+n.x1<0||n.y+n.y1<0,wy=(n,e)=>n.x+n.x0<0||n.y+n.y0<0||n.x+n.x1>e[0]||n.y+n.y1>e[1];function EJ(n,e){const t=n.sprite,i=n.y1-n.y0,s=n.width>>5;let r=0;const a=[],o=Math.max(-(n.y0+n.y),0),l=Math.min(i+(e[1]-(n.y1+n.y)),i),h=Math.max(-(n.x0+n.x),0)>>5,d=Math.min(s+(e[0]-(n.x1+n.x)>>5)+1,s);for(let g=0;g<i;g++){for(let _=0;_<s;_++)g<o||l<=g||_<h||d<=_||a.push(t[r+_]);r+=s}const u=h<<5,c=s-d<<5,f=o,p=i-l;return Object.assign(Object.assign({},n),{width:n.width-u-c,height:n.height-f-p,x0:n.x0+u,x1:n.x1-c,y0:n.y0+f,y1:n.y1-p,x:n.x+u/2-c/2,sprite:a})}let IL=class DL extends Ph{constructor(e){super(re({},DL.defaultOptions,e)),this.fillGridAt=(t,i)=>{t>=this.ngx||i>=this.ngy||t<0||i<0||(this.grid[t][i]=!1)},this.updateGrid=(t,i,s,r,a)=>{const o=a.occupied;let l=o.length;for(;l--;){const h=t+o[l][0],d=i+o[l][1];h>=this.ngx||d>=this.ngy||h<0||d<0||this.fillGridAt(h,d)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(e){if(this.pointsAtRadius[e])return this.pointsAtRadius[e];const t=8*e;let i=t;const s=[];for(e===0&&s.push([this.center[0],this.center[1],0]);i--;){const r=this.shape(i/t*2*Math.PI);s.push([this.center[0]+e*r*Math.cos(-i/t*2*Math.PI),this.center[1]+e*r*Math.sin(-i/t*2*Math.PI)*this.options.ellipticity,i/t*2*Math.PI])}return this.pointsAtRadius[e]=s,s}getTextInfo(e,t=1){var i;const s=this.options.clip?1:t,r=Math.max(Math.floor(this.getTextFontSize(e)*s),this.options.minFontSize);let a=this.getText(e)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*t))),!a)return null;const o=this.getTextFontWeight(e),l=this.getTextFontStyle(e),h=this.getTextRotate&&(i=this.getTextRotate(e))!==null&&i!==void 0?i:0,d=this.getTextFontFamily(e),u=document.createElement("canvas"),c=u.getContext("2d",{willReadFrequently:!0});c.font=l+" "+o+" "+r.toString(10)+"px "+d;const f=c.measureText(a).width,p=Math.max(r,c.measureText("m").width,c.measureText("W").width);let g=f+2*p,_=3*p;const m=Math.ceil(g/this.gridSize),y=Math.ceil(_/this.gridSize);g=m*this.gridSize,_=y*this.gridSize;const b=-f/2,v=.4*-p,x=Math.ceil((g*Math.abs(Math.sin(h))+_*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((g*Math.abs(Math.cos(h))+_*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;u.setAttribute("width",""+A),u.setAttribute("height",""+k),c.scale(1,1),c.translate(A/2,k/2),c.rotate(-h),c.font=l+" "+o+" "+r.toString(10)+"px "+d,c.fillStyle="#000",c.textBaseline="middle",c.fillText(a,b,v);const w=c.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const M=[];let T,E=S;const O=[x/2,S/2,x/2,S/2],B=(R,L,I)=>{let F=this.gridSize;for(;F--;){let H=this.gridSize;for(;H--;)if(w[4*((L*this.gridSize+F)*A+(R*this.gridSize+H))+3])return I.push([R,L]),R<O[3]&&(O[3]=R),R>O[1]&&(O[1]=R),L<O[0]&&(O[0]=L),void(L>O[2]&&(O[2]=L))}};for(;E--;)for(T=x;T--;)B(E,T,M);return{datum:e,occupied:M,bounds:O,gw:S,gh:x,fillTextOffsetX:b,fillTextOffsetY:v,fillTextWidth:f,fillTextHeight:p,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:d,angle:h,text:a}}canFitText(e,t,i,s,r){let a=r.length;for(;a--;){const o=e+r[a][0],l=t+r[a][1];if(o>=this.ngx||l>=this.ngy||o<0||l<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[o][l])return!1}return!0}layoutWord(e,t=1){const i=this.data[e],s=this.getTextInfo(i,t);if(!s||this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const o=s.bounds;if(o[1]-o[3]+1>this.ngx||o[2]-o[0]+1>this.ngy)return!1}let r=this.maxRadius+1;const a=o=>{const l=Math.floor(o[0]-s.gw/2),h=Math.floor(o[1]-s.gh/2),d=s.gw,u=s.gh;return!!this.canFitText(l,h,d,u,s.occupied)&&(s.distance=this.maxRadius-r,s.theta=o[2],this.outputText(l,h,s),this.updateGrid(l,h,d,u,s),!0)};for(;r--;){let o=this.getPointsAtRadius(this.maxRadius-r);if(this.options.random&&(o=[].concat(o),yC(o)),o.some(a))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(e,.75*t)}outputText(e,t,i){const s=this.getTextColor(i),r={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(e+i.gw/2)*this.gridSize,y:(t+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(r),this.progressiveResult&&this.progressiveResult.push(r)}initGrid(e){let t;if(this.grid=[],e){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let s=i.getImageData(0,0,1,1).data,r=e.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const a=(l,h)=>{let d=this.gridSize;for(;d--;){let u=this.gridSize;for(;u--;)for(t=4;t--;)if(r[4*((h*this.gridSize+d)*this.ngx*this.gridSize+(l*this.gridSize+u))+t]!==s[t])return void(this.grid[l][h]=!1)}};let o=this.ngx;for(;o--;){this.grid[o]=[];let l=this.ngy;for(;l--;)a(o,l),this.grid[o][l]!==!1&&(this.grid[o][l]=!0)}r=i=s=void 0}else{let i=this.ngx;for(;i--;){this.grid[i]=[];let s=this.ngy;for(;s--;)this.grid[i][s]=!0}}}layout(e,t){this.initProgressive(),this.data=e,this.pointsAtRadius=[],this.ngx=Math.floor(t.width/this.gridSize),this.ngy=Math.floor(t.height/this.gridSize);const{center:i,maxRadius:s}=LL(this.options.shape,[t.width,t.height]);this.center=t.origin?[t.origin[0]/this.gridSize,t.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(t.canvas),this.result=[];let r=0;for(;r<e.length&&(this.layoutWord(r),r++,this.progressiveIndex=r,!this.exceedTime()););return this.result}};IL.defaultOptions={gridSize:8,ellipticity:1};class fm extends Ph{constructor(e){super(re({},fm.defaultOptions,e)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(e){for(let t=0,i=this.result.length;t<i;t++)if(RJ(e,this.result[t]))return!1;return!0}getTextInfo(e){const t={datum:e,fontSize:this.getTextFontSize(e),fontWeight:this.getTextFontWeight(e),fontStyle:this.getTextFontStyle(e),fontFamily:this.getTextFontFamily(e),angle:this.getTextRotate(e),text:this.getText(e)+"",x:this.center[0],y:this.center[1]},i=Uu(t);return t.width=i.width(),t.height=i.height(),t.top=this.center[1]-t.height+.21*t.height,t.left=this.center[0]-t.width/2,t}layoutWord(e){const t=this.getTextInfo(this.data[e]);let i=2*Math.PI,s=0,r=t.left,a=t.top;const o=t.width,l=t.height;let h=1,d=this.fit(t);for(;!d&&s<this.maxRadius;)s+=.5,h=this.shape(s/this.maxRadius*2*Math.PI),i+=.5*(this.options.random?this.random()>.5?1:-1:e%2==0?1:-1),r=this.center[0]-o/2+s*h*Math.cos(i)*this.aspectRatio,a=this.center[1]-l/2+s*h*Math.sin(i),t.left=r,t.top=a,t.x=r+o/2,t.y=a+l/2,d=this.fit(t);return!!d&&!!(this.options.clip||t.left>=0&&t.left+t.width<=this.width&&t.top>=0&&t.top+t.height<=this.height)&&(this.result.push(t),!0)}layout(e,t){if(!(e!=null&&e.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(t.width*t.width+t.height*t.height)/2,this.center=[t.width/2,t.height/2],this.width=t.width,this.height=t.height,this.data=e.sort((s,r)=>this.getTextFontSize(r)-this.getTextFontSize(s));let i=0;for(;i<e.length&&(this.layoutWord(i),i++,this.progressiveIndex=i,!this.exceedTime()););return this.result}}function RJ(n,e){return!(n.left+n.width<e.left||n.top+n.height<e.top||n.left>e.left+e.width||n.top>e.top+e.height)}fm.defaultOptions={enlarge:!1};const OJ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},BJ=(n,e)=>{var t,i,s,r,a,o;if(n.size&&(n.size[0]<=0||n.size[1]<=0))return De.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=((t=n.size)!==null&&t!==void 0?t:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const d=n.fontFamily?za(n.fontFamily):"sans-serif",u=n.fontStyle?za(n.fontStyle):"normal",c=n.fontWeight?za(n.fontWeight):"normal",f=n.rotate?za(n.rotate):0,p=za(n.text),g=(i=n.spiral)!==null&&i!==void 0?i:"archimedean",_=n.padding?za(n.padding):1,m=(s=n.shape)!==null&&s!==void 0?s:"square",y=(r=n.shrink)!==null&&r!==void 0&&r,b=(a=n.enlarge)!==null&&a!==void 0&&a,v=(o=n.clip)!==null&&o!==void 0&&o,x=n.minFontSize,S=n.randomVisible,A=n.as||OJ,k=n.depth_3d,w=n.postProjection;let M=n.fontSize?za(n.fontSize):14;const T=n.fontSizeRange;if(T&&!oe(M)){const B=M,R=LJ(IJ(B,l),T);M=L=>R(B(L))}let E=Vl;n.layoutType==="fast"?E=fm:n.layoutType==="grid"&&(E=IL);const O=new E({text:p,padding:_,spiral:g,shape:m,rotate:f,fontFamily:d,fontStyle:u,fontWeight:c,fontSize:M,shrink:y,clip:v,enlarge:b,minFontSize:x,random:S,progressiveStep:n.progressiveStep,progressiveTime:n.progressiveTime,outputCallback:B=>{const R=[];let L,I;for(let F=0,H=B.length;F<H;F++)I=B[F],L=I.datum,L[A.x]=I.x,L[A.y]=I.y,L[A.fontFamily]=I.fontFamily,L[A.fontSize]=I.fontSize,L[A.fontStyle]=I.fontStyle,L[A.fontWeight]=I.fontWeight,L[A.angle]=I.angle,w==="StereographicProjection"&&DJ(h,I,L,A,k),R.push(L);return R}});return O.layout(l,{width:h[0],height:h[1]}),n.progressiveStep>0||n.progressiveTime>0?{progressive:O}:O.output()},za=n=>ae(n)||oe(n)||Y(n)?n:e=>e[n.field],My=n=>n<0?-Math.sqrt(-n):Math.sqrt(n),LJ=(n,e)=>{if(n[0]===n[1])return a=>e[0];const t=My(n[0]),i=My(n[1]),s=Math.min(t,i),r=Math.max(t,i);return a=>(My(a)-s)/(r-s)*(e[1]-e[0])+e[0]},IJ=(n,e)=>{let t=1/0,i=-1/0;const s=e.length;let r;for(let a=0;a<s;++a)r=Ds(n(e[a])),r<t&&(t=r),r>i&&(i=r);return e.length===1&&t===i&&(t-=1e4),[t,i]};function DJ(n,e,t,i,s){const r=Math.max(n[0],n[1])/2,a=FJ(n[0],n[1],r,{x:r,y:r,z:s??r},e);t[i.x]=a.x,t[i.y]=a.y,t[i.z]=a.z}function FJ(n,e,t,i,s){const{x:r,y:a}=s,o=r/n*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l<Math.PI/2?1:-1)*Math.pow(Math.min(l-Math.PI/2,1),2)/5,{x:t*Math.sin(l)*Math.cos(o)+i.x,y:t*Math.cos(l)+i.y,z:t*Math.sin(l)*Math.sin(o)+i.z}}const pm=()=>{ee.registerTransform("wordcloud",{transform:BJ,markPhase:"beforeJoin"},!0)};var kg;(function(n){n.BEFORE_WORDCLOUD_SHAPE_LAYOUT="beforeWordcloudShapeLayout",n.AFTER_WORDCLOUD_SHAPE_LAYOUT="afterWordcloudShapeLayout"})(kg||(kg={}));const zJ=(n,e)=>{if(e.length===1&&e[0]==="#537EF5")return!0;if(!Array.isArray(n)||!Array.isArray(e)||n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0},jJ=()=>{let n=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(n=(n+1)%e.length,e[n])},HJ=n=>/^[\u4e00-\u9fa5]+$/.test(n),FL=(n,e)=>{if(C(n))return 0;let t=0;for(const i of n)HJ(i)?t+=1:t+=.53;return t};function GJ(n){return n&&(pC(n)||gC(n)||n.startsWith("<svg"))?new Promise((e,t)=>{var i;const s=$x({image:n}),r=(i=s.resources)===null||i===void 0?void 0:i.get(n);r&&r.state==="success"&&r.data?e(r.data):(s.successCallback=()=>{var a;if(s){const o=(a=s.resources)===null||a===void 0?void 0:a.get(n);o&&o.state==="success"&&o.data?e(o.data):t(new Error("image load failed"+n))}else t(new Error("image load failed"+n))},s.failCallback=()=>{De.getInstance().error("image 加载失败!",n)})}):null}function WJ(n){return typeof n=="function"?n:function(){return n}}var VJ=function(n,e,t,i){return new(t||(t=Promise))(function(s,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?s(h.value):(d=h.value,d instanceof t?d:new t(function(u){u(d)})).then(a,o)}l((i=i.apply(n,e||[])).next())})};function NJ(n){return VJ(this,void 0,void 0,function*(){const e=yield GJ(n.shapeUrl);return n.removeWhiteBorder&&e?$J(e,n.tempCanvas,n.tempCtx):e})}function UJ(n,e){const{size:t,tempCanvas:i,tempCtx:s}=e,r=YJ(n,t);i.width=t[0],i.height=t[1],s.clearRect(0,0,i.width,i.height),s.drawImage(n,r.x,r.y,r.width,r.height);const a=s.getImageData(0,0,t[0],t[1]),o=new Array(t[0]*t[1]).fill(0);let l=1;const h=[[0,1],[1,0],[-1,0],[0,-1]];let d=[];for(let T=0;T<t[1];T++)for(let E=0;E<t[0];E++)if(o[T*t[0]+E]===0&&!wg(a,T,E)){o[T*t[0]+E]=l,d.push([T,E]);for(let O=0;O<d.length;O++)for(let B=0;B<4;B++){let R=d[O][0]+h[B][0],L=d[O][1]+h[B][1];R=R<0?0:R>=t[1]?t[1]-1:R,L=L<0?0:L>=t[0]?t[0]-1:L,o[R*t[0]+L]!==0||wg(a,R,L)||(o[R*t[0]+L]=l,d.push([R,L]))}l++,d=[]}const u={},c={},f={},p={},g={},_={},m={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let T=0;T<t[1];T++)for(let E=0;E<t[0];E++){const O=o[T*t[0]+E];O!==0&&(M(T,E)&&(u[O]=u[O]||[],u[O].push([E,T]),p[O]||(p[O]=[1/0,-1/0,1/0,-1/0]),T<p[O][0]&&(p[O][0]=T),T>p[O][1]&&(p[O][1]=T),E<p[O][2]&&(p[O][2]=E),E>p[O][3]&&(p[O][3]=E),E<m.x1&&(m.x1=E),E>m.x2&&(m.x2=E),T<m.y1&&(m.y1=T),T>m.y2&&(m.y2=T)),c[O]=c[O]||0,c[O]++)}const y=[];for(const T in u){const E=u[T],O=~~(E.reduce((H,G)=>H+G[0],0)/E.length),B=~~(E.reduce((H,G)=>H+G[1],0)/E.length);f[T]=[O,B],y.push(...E);const[R,L,I,F]=p[T];g[T]=~~Math.max(Math.sqrt((O-I)**2+(B-R)**2),Math.sqrt((O-F)**2+(B-L)**2),Math.sqrt((O-I)**2+(B-L)**2),Math.sqrt((O-F)**2+(B-R)**2)),_[T]=(F-I)/(L-R)}const b=Object.keys(f).map(T=>({label:T-1,boundary:u[T],area:c[T],center:f[T],maxPoint:p[T],maxR:g[T],ratio:_[T]}));m.width=m.x2-m.x1+1,m.height=m.y2-m.y1+1;const v=~~(y.reduce((T,E)=>T+E[0],0)/y.length),x=~~(y.reduce((T,E)=>T+E[1],0)/y.length),S=~~Math.max(Math.sqrt((v-m.x1)**2+(x-m.y1)**2),Math.sqrt((v-m.x2)**2+(x-m.y2)**2),Math.sqrt((v-m.x1)**2+(x-m.y2)**2),Math.sqrt((v-m.x2)**2+(x-m.y1)**2)),A=m.width/m.height,k=Object.keys(c).reduce((T,E)=>T+c[E],0),w={regions:b,labels:o,labelNumber:l-1};return Object.assign(e,{segmentation:w,shapeConfig:r,shapeBounds:m,shapeMaxR:S,shapeRatio:A,shapeCenter:[v,x],shapeArea:k});function M(T,E){const O=[[0,1],[1,0],[-1,0],[0,-1]];if(T===0||E===0||T===t[1]-1||E===t[0]-1)return!0;for(let B=0;B<4;B++){let R=T+O[B][0],L=E+O[B][1];if(R=R<0?0:R>=t[1]?t[1]-1:R,L=L<0?0:L>=t[0]?t[0]-1:L,o[R*t[0]+L]===0)return!0}return!1}}function wg(n,e,t){const i=n.width;return n.data[e*i*4+4*t+3]===0||n.data[e*i*4+4*t+0]===255&&n.data[e*i*4+4*t+1]===255&&n.data[e*i*4+4*t+2]===255}function $J(n,e,t){e.width=n.width,e.height=n.height,t.clearRect(0,0,e.width,e.height),t.drawImage(n,0,0);const i=e.width,s=t.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;r<a&&uT(s,i,r);)++r;for(;a-1>r&&uT(s,i,a-1);)--a;for(;o<l&&cT(s,i,o,r,a);)++o;for(;l-1>o&&cT(s,i,l-1,r,a);)--l;const h=t.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,t.clearRect(0,0,e.width,e.height),t.putImageData(h,0,0),e}function uT(n,e,t){for(let i=0;i<e;++i)if(!wg(n,t,i))return!1;return!0}function cT(n,e,t,i,s){for(let r=i;r<s;++r)if(!wg(n,r,t))return!1;return!0}function YJ(n,e){const t=n.width,i=n.height;let s=e[0]/t;i*s>e[1]&&(s=e[1]/i);const r=Math.floor(s*t),a=Math.floor(s*i);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}function XJ(n,e){const{segmentation:{regions:t}}=e;let i=-1/0,s=0,r=0;t.forEach((h,d)=>{const u=h.area;u>i&&(i=u,r=d),s+=u});let a=0;t.forEach(h=>{const d=h.area,u=Math.ceil(d/s*n.length),c=d/i;h.words=[],h.regionNum=u,h.regionWeight=c,a+=u}),a<n.length&&(t[r].wordsNum+=n.length-a);let o=r;const l=t.map(h=>h.regionNum);n.forEach(h=>{let d=0,u=0;h.regionIndex=-1;do{if(l[o]>0&&h.weight<=t[o].regionWeight){h.regionIndex=o,t[o].words.push(h),l[o]--,o=(o+1)%t.length;break}o=(o+1)%t.length,d++,u++,u>t.length+1&&(t.forEach(c=>{c.regionWeight+=.15}),u=0)}while(h.regionIndex===-1&&d<3*t.length);h.regionIndex===-1&&(h.regionIndex=r,t[r].words.push(h),l[r]--)}),t.forEach(h=>{h.words.sort((d,u)=>u.weight-d.weight)})}function KJ(n,e,t){const{size:i,stepFactor:s}=e,{segmentation:{regions:r},tempCtx:a,tempCanvas:o,boardSize:l,shapeCenter:h,shapeMaxR:d,shapeRatio:u}=t,c=q0(t);for(const f of r){const{words:p,center:g,maxR:_,ratio:m}=f;for(let y=0;y<p.length;y++){fo(o,a,n,y);const b=p[y];b.x=g[0],b.y=g[1],b.hasText&&b.sprite&&ph(c,b,_,m,i,l,s)&&(b.hasPlaced=!0)}}for(let f=0;f<e.textLayoutTimes;f++){const p=n.filter(g=>(g.hasPlaced||(g.hasText=!1,g.sprite=null,g.fontSize=Math.max(~~(g.fontSize*e.fontSizeShrinkFactor),e.minFontSize)),!g.hasPlaced));if(p.length===0)break;for(let g=0;g<p.length;g++){const _=p[g];fo(o,a,p,g),_.x=h[0],_.y=h[1],_.hasText&&ph(c,_,d,u,i,l,s)&&(_.hasPlaced=!0)}}e.board=c}function zL(n,e,t){const{stepFactor:i,importantWordCount:s,globalShinkLimit:r}=e,{size:a,segmentation:{regions:o},tempCtx:l,tempCanvas:h,boardSize:d,shapeCenter:u,shapeMaxR:c,shapeRatio:f}=t,p=q0(t);let g=p.slice(0);const _=e.fontSizeShrinkFactor;let m=null,y=1,b=1;const v=s;let x=0;n.length>v&&(x=n.sort((S,A)=>A.weight-S.weight)[v].weight);for(let S=0;S<o.length;S++){const A=o[S],{words:k,center:w,maxR:M,ratio:T}=A;let E=!1;for(let O=0;O<k.length;O++){fo(h,l,n,O);const B=k[O];if(B.x=w[0],B.y=w[1],!B.skip&&B.hasText&&B.sprite&&ph(g,B,M,T,a,d,i))B.hasPlaced=!0;else{if(!B.skip&&B.weight>x&&b>r){const R=B.datum[Symbol.for("vGrammar_id")];R!==m&&(m=R,y=b),b*=_,n.forEach(L=>{L.hasText=!1,L.sprite=null,L.fontSize=L.fontSize*_}),g=p.slice(0),E=!0;break}if(!B.skip&&B.datum[Symbol.for("vGrammar_id")]===m){n.forEach(R=>{R.hasText=!1,R.sprite=null,R.fontSize=R.fontSize/b}),B.skip=!0,b=y,m=null,g=p.slice(0),E=!0;break}}}E&&(S=-1)}for(let S=0;S<e.textLayoutTimes;S++){const A=n.filter(k=>(k.hasPlaced||(k.hasText=!1,k.sprite=null,k.fontSize=Math.max(~~(k.fontSize*e.fontSizeShrinkFactor),e.minFontSize)),!k.hasPlaced));if(A.length===0)break;for(let k=0;k<A.length;k++){const w=A[k];fo(h,l,A,k),w.x=u[0],w.y=u[1],w.hasText&&ph(g,w,c,f,a,d,i)&&(w.hasPlaced=!0)}}e.board=g}function qJ(n,e,t){const{size:i,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:d,shapeMaxR:u,shapeRatio:c}=t,f=q0(t);let p=f.slice(0);const g=e.fontSizeEnlargeFactor,_=Math.min(r,n.length);let m=0;n.length>_&&(m=n.sort((x,S)=>S.weight-x.weight)[_-1].weight);let y=0,b=1,v=!1;for(let x=0;x<a.length;x++){const S=a[x],{words:A,center:k,maxR:w,ratio:M}=S;let T=!1;for(let E=0;E<A.length;E++){fo(l,o,n,E);const O=A[E];if(O.x=k[0],O.y=k[1],O.hasText&&O.sprite&&ph(p,O,w,M,i,h,s)){if(O.hasPlaced=!0,O.weight>=m&&y++,y>=_&&!v){b*=g,n.forEach(B=>{B.hasText=!1,B.sprite=null,B.fontSize=B.fontSize*g}),p=f.slice(0),T=!0,y=0;break}}else{if(O.weight>=m&&b>1){n.forEach(B=>{B.hasText=!1,B.sprite=null,B.fontSize=B.fontSize/g}),b/=g,v=!0,p=f.slice(0),T=!0;break}if(O.weight>=m)return zL(n,e,t)}}T&&(x=-1)}for(let x=0;x<e.textLayoutTimes;x++){const S=n.filter(A=>(A.hasPlaced||(A.hasText=!1,A.sprite=null,A.fontSize=Math.max(~~(A.fontSize*e.fontSizeShrinkFactor),e.minFontSize)),!A.hasPlaced));if(S.length===0)break;for(let A=0;A<S.length;A++){const k=S[A];fo(l,o,S,A),k.x=d[0],k.y=d[1],k.hasText&&ph(p,k,u,c,i,h,s)&&(k.hasPlaced=!0)}}e.board=p}function ph(n,e,t,i,s,r,a){const o=e.x,l=e.y,h=ZJ(i),d=1*a;let u,c,f,p=-d;for(;u=h(p+=d);){const{wordSize:g,bounds:{dTop:_,dBottom:m,dLeft:y,dRight:b}}=e;if(c=u[0],f=u[1],Math.min(Math.abs(c),Math.abs(f))>=t)break;if(e.x=~~(o+c),e.y=~~(l+f),!(e.x-y<0||e.x+b>s[0]||e.y-_<0||e.y+m>s[1]||HL(e,n,r)))return jL(e,n,r),!0}return!1}function jL(n,e,t){const{wordSize:i}=n,s=n.sprite,r=i[0]>>5,a=t[0]>>5,o=n.x-(r<<4),l=o%32,h=32-l,d=i[1];let u,c=(n.y-(i[1]>>1))*a+(o>>5);if(l===0)for(let f=0;f<d;f++){for(let p=0;p<r;p++)e[c+p]|=s[f*r+p];c+=a}else for(let f=0;f<d;f++){u=0;for(let p=0;p<=r;p++)e[c+p]|=u<<h|(p<r?(u=s[f*r+p])>>>l:0);c+=a}}function HL(n,e,t){const{sprite:i,wordSize:s}=n,r=t[0]>>5,a=s[0]>>5,o=n.x-(a<<4),l=o%32,h=32-l,d=s[1];let u,c=(n.y-(s[1]>>1))*r+(o>>5);if(l===0)for(let f=0;f<d;f++){for(let p=0;p<a;p++)if(e[c+p]&i[f*a+p])return!0;c+=r}else for(let f=0;f<d;f++){u=0;for(let p=0;p<=a;p++)if((u<<h|(p<a?(u=i[f*a+p])>>>l:0))&e[c+p])return!0;c+=r}return!1}function ZJ(n){return function(e){return[n*(e*=.1)*Math.cos(e),e*Math.sin(e)]}}function fo(n,e,t,i){if(t[i].sprite||t[i].fontSize===0)return;const s=2048,r=Math.PI/180,a=t.length;n.width=s,n.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,d=0,u=0,c=0;const f=i;for(--i;++i<a;){const m=t[i],y=Math.max(m.fontSize,2);if(e.save(),e.font=m.fontStyle+" "+m.fontWeight+" "+y+"px "+m.fontFamily,o=e.measureText(m.text+"m").width+2*m.padding,l=2*y+2*m.padding,m.rotate!==0){const b=Math.sin(m.rotate*r),v=Math.cos(m.rotate*r),x=o*v,S=o*b,A=l*v,k=l*b;o=Math.max(Math.abs(x+k),Math.abs(x-k)),l=~~Math.max(Math.abs(S+A),Math.abs(S-A))}if(o=o+31>>5<<5,l=Math.ceil(l),l>u&&(u=l),h+o>=s&&(h=0,d+=u,u=l),d+l>=2048){if(d===0){m.hasText=!1;continue}break}d+l>=c&&(c=d+l),e.translate(h+(o>>1),d+(l>>1)),m.rotate!==0&&e.rotate(m.rotate*r),e.fillText(m.text,0,0),m.padding&&(e.lineWidth=2*m.padding,e.strokeText(m.text,0,0)),e.restore(),m.LT=[h,d],m.wordSize=[o,l],m.hasText=!0,h+=o}if(c===0)return;const p=e.getImageData(0,0,s,c).data;let g,_;for(;--i>=f;){const m=t[i];if(!m.hasText){m.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:y=[0,0],wordSize:b}=m;[h,d]=y;const v=b[0]>>5,x=new Array(v*b[1]).fill(0);let[S,A,k,w]=[1/0,-1/0,1/0,-1/0];for(_=0;_<b[1];_++){let M;for(g=0;g<b[0];g++)if(p[4*((d+_)*s+(h+g))+3]>0){const T=1<<31-g%32;x[v*_+(g>>5)]|=T,g<k&&(k=g),g>w&&(w=g),M|=T}M&&(_<S&&(S=_),_>A&&(A=_))}m.bounds={dTop:(b[1]>>1)-S,dBottom:A-(b[1]>>1),dLeft:(b[0]>>1)-k,dRight:w-(b[0]>>1)},m.sprite=x,delete m.LT}}function q0(n){const{segmentation:{labels:e},boardSize:t,size:i}=n,s=t[0]>>5,r=new Array(s*i[1]).fill(0);for(let a=0;a<i[1];a++)for(let o=0;o<i[0];o++)if(e[a*i[0]+o]===0){const l=1<<31-o%32;r[s*a+(o>>5)]|=l}if(t[0]>i[0]){const a=(1<<t[0]-i[0])-1;for(let o=0;o<i[1];o++)r[s*o+s-1]|=a}return r}function JJ(n,e,t){const{size:i,fillingTimes:s,fillingXStep:r,fillingYStep:a,getFillingFontStyle:o,getFillingFontWeight:l,getFillingFontFamily:h,fillingInitialFontSize:d,fillingDeltaFontSize:u,fillingInitialOpacity:c,fillingDeltaOpacity:f,fillingRotateList:p,getFillingPadding:g,random:_,board:m,minFillFoontSize:y}=e,{boardSize:b,shapeBounds:v,tempCtx:x,tempCanvas:S,randomGenerator:A}=t;let k=d,w=c;const M=[];for(let O=0;O<s;O++)T(k,w),k=Math.max(k>u?k-u:u,y),w=w>f?w-f:f;return M;function T(O,B){const R=n.map(Z=>{const{text:q,color:ie,fillingColor:K,hasPlaced:V,datum:te}=Z;return{x:0,y:0,weight:0,text:q,fontFamily:h(te),fontStyle:o(te),fontWeight:l(te),fontSize:O,rotate:p[~~(A()*p.length)],padding:g(te),opacity:B,visible:!0,color:ie,fillingColor:K,hasPlaced:V,datum:te}});E(R);let L=0;const{x1:I,y1:F,x2:H,y2:G}=v,[U,$]=[I+~~(A()*r*2),F+~~(A()*a*2)];for(let Z=$;Z<=G;Z+=a)for(let q=U;q<=H;q+=r){fo(S,x,R,L);const ie=R[L];ie.x=q,ie.y=Z;const{wordSize:K,bounds:V,hasPlaced:te}=ie;if(!te||!V){++L===R.length&&(L=0,_&&E(R));continue}const{dTop:le,dBottom:he,dLeft:Ce,dRight:ge}=V;ie.x-Ce<0||ie.x+ge>i[0]||ie.y-le<0||ie.y+he>i[1]||ie.hasText&&ie.sprite&&!HL(ie,m,b)&&(jL(ie,m,b),M.push(Object.assign({},ie)),++L===R.length&&(L=0,_&&E(R)))}}function E(O){return O.sort(()=>A()-.5)}}function QJ(n,e,t){XJ(n,t),e.layoutMode==="ensureMapping"?zL(n,e,t):e.layoutMode==="ensureMappingEnlarge"?qJ(n,e,t):KJ(n,e,t);const i=JJ(n,e,t),s=[],r=[];for(let a=0;a<n.length;a++)n[a].hasPlaced?r.push(n[a]):s.push(n[a]);return s.forEach(a=>a.visible=!1),{fillingWords:i,successedWords:r,failedWords:s}}var eQ=function(n,e,t,i){return new(t||(t=Promise))(function(s,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?s(h.value):(d=h.value,d instanceof t?d:new t(function(u){u(d)})).then(a,o)}l((i=i.apply(n,e||[])).next())})};const tQ={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},iQ=(n,e,t,i)=>eQ(void 0,void 0,void 0,function*(){var s,r,a;if(!n.size||C(n.size[0])||C(n.size[1])||n.size[0]<=0||n.size[1]<=0)return De.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];n.size=[Math.ceil(n.size[0]),Math.ceil(n.size[1])],n.shape||Ka("WordcloudShape shape must be specified."),n.text||Ka("WordcloudShape text must be specified."),i!=null&&i.emit&&i.emit(kg.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const o=e,l=n.as||tQ;if(!o||o.length===0)return[];const h={shapeUrl:n.shape,size:n.size,ratio:n.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:n.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},d=Fe.createCanvas({width:n.size[0],height:n.size[1]}),u=d.getContext("2d");u.textAlign="center",u.textBaseline="middle",h.tempCanvas=d,h.tempCtx=u;const c=n.size[0]+31>>5<<5;h.boardSize=[c,n.size[1]],h.random?h.randomGenerator=Math.random:h.randomGenerator=jJ();const f=yield NJ(h);if(!f)return[];const p=UJ(f,h),g=n.colorMode||"ordinal",_={getText:$i(n.text),getFontSize:$i(n.fontSize),fontSizeRange:n.fontSizeRange,colorMode:g,getColor:n.colorField?$i(n.colorField):$i(n.text),getFillingColor:$i(n.fillingColorField),colorList:n.colorList||(g==="ordinal"?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:$i(n.colorHexField),getFontFamily:$i(n.fontFamily||"sans-serif"),rotateList:n.rotateList||[0],getPadding:$i(n.padding||1),getFontStyle:$i(n.fontStyle||"normal"),getFontWeight:$i(n.fontWeight||"normal"),getFontOpacity:n.fontOpacity?$i(n.fontOpacity):()=>1};sQ(o,_,p);const m={size:n.size,ratio:n.ratio||.8,shapeUrl:n.shape,random:n.random===void 0||n.random,textLayoutTimes:n.textLayoutTimes||3,removeWhiteBorder:n.removeWhiteBorder||!1,layoutMode:n.layoutMode||"default",fontSizeShrinkFactor:n.fontSizeShrinkFactor||.8,stepFactor:n.stepFactor||1,importantWordCount:n.importantWordCount||10,globalShinkLimit:n.globalShinkLimit||.2,fontSizeEnlargeFactor:n.fontSizeEnlargeFactor||1.5,fillingRatio:n.fillingRatio||.7,fillingTimes:n.fillingTimes||4,fillingXStep:n.fillingXRatioStep?Math.max(Math.floor(n.size[0]*n.fillingXRatioStep),1):n.fillingXStep||4,fillingYStep:n.fillingYRatioStep?Math.max(Math.floor(n.size[1]*n.fillingYRatioStep),1):n.fillingYStep||4,fillingInitialFontSize:n.fillingInitialFontSize,fillingDeltaFontSize:n.fillingDeltaFontSize,fillingInitialOpacity:n.fillingInitialOpacity||.8,fillingDeltaOpacity:n.fillingDeltaOpacity||.05,getFillingFontFamily:$i(n.fillingFontFamily||"sans-serif"),getFillingFontStyle:$i(n.fillingFontStyle||"normal"),getFillingFontWeight:$i(n.fillingFontWeight||"normal"),getFillingPadding:$i(n.fillingPadding||.4),fillingRotateList:n.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:n.fillingDeltaFontSizeFactor||.2,fillingColorList:n.fillingColorList||["#537EF5"],sameColorList:!1,minInitFontSize:n.minInitFontSize||10,minFontSize:n.minFontSize||4,minFillFoontSize:n.minFillFoontSize||2},y=zJ(_.colorList,m.fillingColorList);m.sameColorList=y,nQ(o,_,m,n),rQ(o,_,m,p);const{getText:b,getFontFamily:v,getFontStyle:x,getFontWeight:S,getPadding:A,getColor:k,getFillingColor:w,getColorHex:M,fontSizeScale:T,colorScale:E,fillingColorScale:O,getFontOpacity:B,rotateList:R}=_,L=o.map(V=>{var te,le;return{x:0,y:0,weight:0,text:b(V),fontFamily:v(V),fontWeight:S(V),fontStyle:x(V),rotate:R[~~(h.randomGenerator()*R.length)],fontSize:Math.max(m.minInitFontSize,~~T(V)),opacity:B(V),padding:A(V),color:M&&M(V)||E&&E(k(V))||"black",fillingColor:!w||((te=n.colorField)===null||te===void 0?void 0:te.field)===((le=n.fillingColorField)===null||le===void 0?void 0:le.field)&&y?void 0:M&&M(V)||O&&O(w(V))||"black",datum:V,visible:!0,hasPlaced:!1}}),I=Vt(L.map(V=>V.fontSize));L.forEach(V=>V.weight=V.fontSize/I),L.sort((V,te)=>te.weight-V.weight);const{fillingWords:F,successedWords:H,failedWords:G}=QJ(L,m,p);let U,$;const Z=[];for(let V=0;V<L.length;++V)U=L[V],$=U.datum,$[l.x]=U.x,$[l.y]=U.y,$[l.fontFamily]=U.fontFamily,$[l.fontSize]=U.fontSize,$[l.fontStyle]=U.fontStyle,$[l.fontWeight]=U.fontWeight,$[l.angle]=st(U.rotate),$[l.opacity]=U.opacity,$[l.visible]=U.visible,$[l.isFillingWord]=!1,$[l.color]=U.color,Z.push($);const q=(r=(s=n.text)===null||s===void 0?void 0:s.field)!==null&&r!==void 0?r:"textKey",ie=(a=n.dataIndexKey)!==null&&a!==void 0?a:"defaultDataIndexKey",K=[];return F.forEach((V,te)=>{var le,he;const Ce={};Ce[l.x]=V.x,Ce[l.y]=V.y,Ce[l.fontFamily]=V.fontFamily,Ce[l.fontSize]=V.fontSize,Ce[l.fontStyle]=V.fontStyle,Ce[l.fontWeight]=V.fontWeight,Ce[l.angle]=st(V.rotate),Ce[l.opacity]=V.opacity,Ce[l.visible]=V.visible,Ce[l.isFillingWord]=!0,Ce[l.color]=w?((le=n.colorField)===null||le===void 0?void 0:le.field)===((he=n.fillingColorField)===null||he===void 0?void 0:he.field)&&y?V.color:V.fillingColor:m.fillingColorList[~~(h.randomGenerator()*m.fillingColorList.length)],Ce[q]=V.text,Ce[ie]=`${V.text}_${te}_fillingWords`,K.push(Ce)}),i!=null&&i.emit&&i.emit(kg.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:H,failedWords:G}),Z.concat(K)}),nQ=(n,e,t,i)=>{var s,r,a,o;const{colorMode:l,getColor:h,getFillingColor:d}=e,{sameColorList:u}=t;let c,f,p=e.colorList,g=t.fillingColorList;if(l==="ordinal"){const _=n.map(m=>h(m));if(c=m=>new ro().domain(_).range(p).scale(m),d&&(((s=i.colorField)===null||s===void 0?void 0:s.field)!==((r=i.fillingColorField)===null||r===void 0?void 0:r.field)||!u)){const m=n.map(y=>d(y));f=y=>new ro().domain(m).range(g).scale(y)}}else{p.length===1&&(p=[p[0],p[0]]);const _=new qn().domain(kd(h,n)).range(p);if(c=m=>_.scale(m),d&&(((a=i.colorField)===null||a===void 0?void 0:a.field)!==((o=i.fillingColorField)===null||o===void 0?void 0:o.field)||!u)){g.length===1&&(g=[g[0],g[0]]);const m=new qn().domain(kd(d,n)).range(g);f=y=>m.scale(y)}}Object.assign(e,{colorScale:c,fillingColorScale:f})},sQ=(n,e,t)=>{let{fontSizeRange:i}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&i){const o=new Cp().domain(kd(s,n)).range(i);a=l=>o.scale(s(l))}else if(s&&Y(s)&&!i){const[l,h]=kd(s,n),d=n.map(f=>({text:r(f),value:s(f),weight:h===l?1:(s(f)-l)/(h-l)})),u=fT(d,t,!0);i=[~~(.5*u),~~u];const c=new Cp().domain(kd(s,n)).range(i);a=f=>c.scale(s(f))}}else{const o=n.map(h=>({text:r(h)})),l=fT(o,t,!1);a=WJ(l)}Object.assign(e,{getFontSize:s,fontSizeRange:i,fontSizeScale:a})},fT=(n,e,t)=>{const i=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(i)/12),o=n.reduce((h,d)=>{const u=FL(d.text);return u<a?h+u*(t?(.5+.5*d.weight)**2:1):h},0);if(o===0)return 12;let l=20;if(r.length===1)l=Math.sqrt(s*(i/(1.7*o)));else{const h=[];for(let d=0;d<r.length;d++){const u=r[d].area,c=r[d].ratio,f=u/i;if(f<.1)continue;const p=f*(o*(c<1?2.7-c:1.7)),g=Math.sqrt(s*(u/p));h.push(g)}l=h.length?Math.min(...h):Math.sqrt(s*(i/(1.7*o)))}return l};function rQ(n,e,t,i){const{getText:s}=e;let{fillingInitialFontSize:r,fillingDeltaFontSize:a}=t;const{fillingRatio:o}=t,l=Math.ceil(Math.sqrt(i.shapeArea)/4);if(!r||!a){const h=o/100,d=n.reduce((c,f)=>{const p=FL(s(f));return p>l?c:c+p},0)/n.length;let u;if(d===0)u=8;else{const c=.2*i.shapeArea;u=Math.sqrt(h*(c/d))}r=~~u,a=u*t.fillingDeltaFontSizeFactor,Object.assign(t,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}const kd=(n,e)=>{let t=1/0,i=-1/0;const s=e.length;let r;for(let a=0;a<s;++a)r=Ds(n(e[a])),r<t&&(t=r),r>i&&(i=r);return e.length===1&&t===i&&(t-=1e4),[t,i]},$i=n=>n?typeof n=="string"||typeof n=="number"?()=>n:Y(n)?n:e=>e[n.field]:null,GL=()=>{ee.registerTransform("wordcloudShape",{transform:iQ,markPhase:"beforeJoin"},!0)};class wu extends ca{constructor(){super(...arguments),this.type=z.wordCloud}}wu.type=z.wordCloud;const WL=()=>{pm(),wn(),OL(),D.registerSeries(wu.type,wu)},aQ=()=>{GL(),pm(),wn(),OL(),D.registerSeries(wu.type,wu)};class Mu extends ca{constructor(){super(...arguments),this.type=z.wordCloud3d}_wordCloudTransformOption(){var e;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:(e=this._spec.postProjection)!==null&&e!==void 0?e:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var e;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:(e=this._spec.postProjection)!==null&&e!==void 0?e:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(ca.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(ca.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){super.initMarkStyle();const e=this._wordMark,t=this._fillingWordMark;e&&this.setMarkStyle(e,{z:i=>{var s;return(s=i.z)!==null&&s!==void 0?s:0}},"normal",J.Series),t&&this.setMarkStyle(t,{z:i=>{var s;return(s=i.z)!==null&&s!==void 0?s:0}},"normal",J.Series)}initAnimation(){var e,t,i;const s=(e=this._padding)!==null&&e!==void 0?e:{};this._wordMark&&this._wordMark.setAnimationConfig(Le((t=D.getAnimationInKey("wordCloud3d"))===null||t===void 0?void 0:t(()=>{var r;const a=this.getCompiler().getVGrammarView(),o=a.width()-s.left||0-s.right||0,l=a.height()-s.top||0-s.bottom||0,h=Math.max(o,l)/2;return{center:{x:h,y:h,z:(r=this._spec.depth_3d)!==null&&r!==void 0?r:h},r:h}}),Ge("word",this._spec,this._markAttributeContext))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(Le((i=D.getAnimationInKey("wordCloud3d"))===null||i===void 0?void 0:i(()=>{var r;const a=this.getCompiler().getVGrammarView(),o=a.width()-s.left||0-s.right||0,l=a.height()-s.top||0-s.bottom||0,h=Math.max(o,l)/2;return{center:{x:h,y:h,z:(r=this._spec.depth_3d)!==null&&r!==void 0?r:h},r:h}}),Ge("fillingWord",this._spec,this._markAttributeContext)))}}Mu.type=z.wordCloud3d;const VL=()=>{pm(),wn(),BL(),D.registerSeries(Mu.type,Mu)},oQ=()=>{GL(),pm(),wn(),BL(),D.registerSeries(Mu.type,Mu)},lQ=(n,e)=>{var t,i;const s=n.map(x=>Object.assign({},x));if(!s||s.length===0)return s;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:d,asLastValueRatio:u,asLastValue:c,asCurrentValue:f,asNextValue:p,heightVisual:g=!1,isCone:_=!0,range:m}=e,y=s.reduce((x,S)=>Math.max(x,Number.parseFloat(S[r])||-1/0),-1/0),b=s.reduce((x,S)=>Math.min(x,Number.parseFloat(S[r])||1/0),1/0),v=[(t=m==null?void 0:m.min)!==null&&t!==void 0?t:b,(i=m==null?void 0:m.max)!==null&&i!==void 0?i:y];return s.forEach((x,S)=>{var A,k;const w=Number.parseFloat(x[r]),M=Number.parseFloat((A=s[S-1])===null||A===void 0?void 0:A[r]),T=Number.parseFloat((k=s[S+1])===null||k===void 0?void 0:k[r]),E=j(T*w)&&w!==0?T/w:0,O=j(w*M)&&M!==0?w/M:0;c&&(x[c]=M),p&&(x[p]=T),a&&(x[a]=E),o&&(x[o]=S===0?1:O),l&&(x[l]=g===!0?E:1/s.length),h&&(x[h]=w/v[1]),d&&(x[d]=S===s.length-1?_?0:x[h]:T/v[1]),u&&(x[u]=S===0?1:M/v[1]),f&&(x[f]=w)}),s},hQ=(n,e)=>{var t,i;const s=(i=(t=n[0])===null||t===void 0?void 0:t.latestData)===null||i===void 0?void 0:i.map(r=>Object.assign({},r));return s&&s.length!==0&&(s.shift(),s.forEach(r=>{r[e.asIsTransformLevel]=!0})),s},dQ=`${be}_FUNNEL_TRANSFORM_RATIO`,nx=`${be}_FUNNEL_REACH_RATIO`,uQ=`${be}_FUNNEL_HEIGHT_RATIO`,qc=`${be}_FUNNEL_VALUE_RATIO`,pT=`${be}_FUNNEL_LAST_VALUE_RATIO`,gT=`${be}_FUNNEL_NEXT_VALUE_RATIO`,cQ=`${be}_FUNNEL_LAST_VALUE`,fQ=`${be}_FUNNEL_CURRENT_VALUE`,pQ=`${be}_FUNNEL_NEXT_VALUE`,_T=`${be}_FUNNEL_TRANSFORM_LEVEL`,qs=20,ja=5,gQ="80%",_Q=0;class mQ extends rn{constructor(){super(...arguments),this.titleValueCallback=(e,t)=>{var i,s,r;const a=this.series;return((i=t==null?void 0:t.mark)===null||i===void 0?void 0:i.name)==="transform"?"转化率":(s=this._getDimensionData(e))!==null&&s!==void 0?s:(r=e.properties)===null||r===void 0?void 0:r[`${a.getCategoryField()}`]},this.contentValueCallback=(e,t)=>{var i;return((i=t==null?void 0:t.mark)===null||i===void 0?void 0:i.name)==="transform"?`${(100*(e==null?void 0:e[nx])).toFixed(1)}%`:this._getMeasureData(e)},this.contentKeyCallback=(e,t)=>{var i;if(((i=t==null?void 0:t.mark)===null||i===void 0?void 0:i.name)==="transform")return"转化率";const{dimensionFields:s,seriesFields:r}=this._seriesCacheInfo,a=s[s.length-1];return P(r[0])?e==null?void 0:e[r[0]]:e==null?void 0:e[a]}}}class NL extends Ti{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class Tu extends NL{constructor(){super(...arguments),this.type=Tu.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}Tu.type="polygon";const yQ=()=>{D.registerMark(Tu.type,Tu),K8(),UB()};class Z0 extends kn{_transformLabelSpec(e){this._addMarkLabelSpec(e,"funnel"),e.isTransform&&this._addMarkLabelSpec(e,"transform","transformLabel")}}class gs extends ho{constructor(){super(...arguments),this.type=z.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=Z0,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(e){return this._categoryField=e,this._categoryField}getValueField(){return this._valueField}setValueField(e){return this._valueField=e,this._valueField}setAttrFromSpec(){var e,t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=(e=this._spec.funnelOrient)!==null&&e!==void 0?e:"top",this._shape=(t=this._spec.shape)!==null&&t!==void 0?t:"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;Ae(this._dataSet,"funnel",lQ),Ae(this._dataSet,"funnelTransform",hQ);const e=new Ye(this._dataSet,{name:`${be}_series_${this.id}_viewDataTransform`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new Ns(this._option,e)}getStatisticFields(){const e=[];return e.push({key:this._categoryField,operations:["values"]}),e.push({key:this._valueField,operations:["max","min"]}),e}_statisticViewData(){var e,t,i,s,r,a,o,l,h;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:fQ,asTransformRatio:dQ,asReachRatio:nx,asHeightRatio:uQ,asValueRatio:qc,asNextValueRatio:gT,asLastValueRatio:pT,asLastValue:cQ,asNextValue:pQ,range:{min:(t=(e=this._spec.range)===null||e===void 0?void 0:e.min)!==null&&t!==void 0?t:(s=(i=this.getViewDataStatistics().latestData)===null||i===void 0?void 0:i[this.getValueField()])===null||s===void 0?void 0:s.min,max:(a=(r=this._spec.range)===null||r===void 0?void 0:r.max)!==null&&a!==void 0?a:(l=(o=this.getViewDataStatistics().latestData)===null||o===void 0?void 0:o[this.getValueField()])===null||l===void 0?void 0:l.max}}}),(h=this._viewDataTransform.getDataView())===null||h===void 0||h.transform({type:"funnelTransform",options:{asIsTransformLevel:_T}})}initMark(){var e,t,i,s,r,a,o,l,h,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},gs.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:(e=this._theme)===null||e===void 0?void 0:e.funnel,morph:Tr(this._spec,this._funnelMarkName),defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0,customShape:(t=this._spec.funnel)===null||t===void 0?void 0:t.customShape}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},gs.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:(i=this._theme)===null||i===void 0?void 0:i.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),customShape:(s=this._spec.transform)===null||s===void 0?void 0:s.customShape})),(a=(r=this._spec)===null||r===void 0?void 0:r.outerLabel)===null||a===void 0?void 0:a.visible){const{line:u}=(o=this._spec.outerLabel)!==null&&o!==void 0?o:{},{line:c}=(h=(l=this._theme)===null||l===void 0?void 0:l.outerLabel)!==null&&h!==void 0?h:{};this._funnelOuterLabelMark.label=this._createMark(gs.mark.outerLabel,{themeSpec:(d=this._theme)===null||d===void 0?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0}),this._funnelOuterLabelMark.line=this._createMark(gs.mark.outerLabelLine,{themeSpec:c,markSpec:u,depend:[this._funnelOuterLabelMark.label]})}}initTooltip(){this._tooltipHelper=new mQ(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const e=this._funnelMark;e&&(this.setMarkStyle(e,{points:r=>this.getPoints(r),visible:r=>P(r[this._valueField]),fill:this.getColorAttribute()},"normal",J.Series),this._trigger.registerMark(e));const t=this._funnelTransformMark;t&&(this.setMarkStyle(t,{points:r=>this.getPoints(r)},"normal",J.Series),this._trigger.registerMark(t));const i=this._funnelOuterLabelMark.label;i&&this.setMarkStyle(i,{text:r=>{const a=`${r[this.getCategoryField()]}`;return Y(this._spec.outerLabel.formatMethod)?this._spec.outerLabel.formatMethod(a,r):a},x:r=>this._computeOuterLabelPosition(r).x,y:r=>this._computeOuterLabelPosition(r).y,textAlign:r=>this._computeOuterLabelPosition(r).align,textBaseline:r=>this._computeOuterLabelPosition(r).textBaseline,limit:r=>this._computeOuterLabelLimit(r)},"normal",J.Series);const s=this._funnelOuterLabelMark.line;s&&i&&this.setMarkStyle(s,{x:r=>this._computeOuterLabelLinePosition(r).x1,y:r=>this._computeOuterLabelLinePosition(r).y1,x1:r=>this._computeOuterLabelLinePosition(r).x2,y1:r=>this._computeOuterLabelLinePosition(r).y2},"normal",J.Series)}initLabelMarkStyle(e){var t,i;if(!e)return;const s=e.getTarget(),r=e.getComponent();s===this._funnelMark?(this._labelMark=e,this.setMarkStyle(e,{text:a=>`${a[this.getCategoryField()]} ${a[this.getValueField()]}`,x:a=>this._computeLabelPosition(a).x,y:a=>this._computeLabelPosition(a).y,maxLineWidth:a=>this._computeLabelLimit(a,this._spec.label),stroke:this.getColorAttribute()},"normal",J.Series),!((t=this._funnelOuterLabelMark)===null||t===void 0)&&t.label&&this._funnelOuterLabelMark.label.setDepend(r),!((i=this._funnelOuterLabelMark)===null||i===void 0)&&i.line&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:a=>`${(100*ff(nx).bind(this)(a)).toFixed(1)}%`,x:a=>this._computeLabelPosition(a).x,y:a=>this._computeLabelPosition(a).y,maxLineWidth:a=>this._computeLabelLimit(a,this._spec.transformLabel)},"normal",J.Series))}initAnimation(){var e,t,i,s,r,a,o;const l=(i=(t=(e=this._spec)===null||e===void 0?void 0:e.animationAppear)===null||t===void 0?void 0:t.preset)!==null&&i!==void 0?i:"clipIn";l==="clipIn"&&this._rootMark&&this._rootMark.setAnimationConfig(Le((s=D.getAnimationInKey("cartesianGroupClip"))===null||s===void 0?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const h=this.getRootMark().getProduct();if(h){const{x1:d,x2:u}=h.getBounds();return Math.max(d,u)}return this.getLayoutRect().width},height:()=>{const h=this.getRootMark().getProduct();if(h){const{y1:d,y2:u}=h.getBounds();return Math.max(d,u)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},l),Ge("group",this._spec,this._markAttributeContext))),[(r=this._funnelOuterLabelMark)===null||r===void 0?void 0:r.label].forEach(h=>{h&&h.setAnimationConfig(Le(D.getAnimationInKey("fadeInOut")(),Ge(h.name,this._spec,this._markAttributeContext)))}),[this._funnelMark,this._funnelTransformMark].forEach(h=>{h&&h.setAnimationConfig(Le(D.getAnimationInKey("funnel")({},l),Ge(h.name,this._spec,this._markAttributeContext)))}),!((a=this._funnelOuterLabelMark)===null||a===void 0)&&a.line&&this._funnelOuterLabelMark.line.setAnimationConfig(Le((o=D.getAnimationInKey("fadeInOut"))===null||o===void 0?void 0:o(),Ge("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var e;super.initEvent(),(e=this._viewDataTransform.getDataView())===null||e===void 0||e.target.addListener("change",t=>{this._viewDataTransform.updateData()})}getPoints(e){const t=this.isTransformLevel(e),i=this._getMainAxisLength(t)/2;let s,r;t?(s=this._shape==="rect"?this._getSecondaryAxisLength(e[pT])/2:this._getSecondaryAxisLength(e[qc])/2,r=this._getSecondaryAxisLength(e[qc])/2):(s=this._getSecondaryAxisLength(e[qc])/2,r=this._shape==="rect"?s:this._getSecondaryAxisLength(e[gT])/2);const{x:a,y:o}=this._getPositionByData(e),l=this._getPolygonPoints([a,o],s,r,s,r,i);return this._funnelAlign!=="center"&&this._adjustPoints(l),l}isTransformLevel(e){return!!(e!=null&&e[_T])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(e){var t,i,s;const r=(s=(i=(t=this.getViewData())===null||t===void 0?void 0:t.latestData)===null||i===void 0?void 0:i.find)===null||s===void 0?void 0:s.call(i,a=>a[this._categoryField]===e);return P(r)?this._getPolygonCenter(this.getPoints(r)):null}dataToPosition(e){return this.valueToPosition(e[this._categoryField])}dataToPositionX(e){return this.dataToPosition(e).x}dataToPositionY(e){return this.dataToPosition(e).y}dataToPositionZ(e){return 0}_getMainAxisLength(e=!1){var t;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,r=!!this._spec.isTransform,a=r?0:(t=this._spec.gap)!==null&&t!==void 0?t:0,o=r?Math.max(0,i-1):0,l=(s-a*Math.max(0,i-1))/(i+.5*o);return e?r?.5*l:0:l}_getSecondaryAxisLength(e){const t=Number.isNaN(e)||!Number.isFinite(e)?0:e,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*t}_getPositionByData(e){var t;const i=(t=this.getViewData().latestData)===null||t===void 0?void 0:t.findIndex(c=>c[this._categoryField]===e[this._categoryField]&&c[Vs]===e[Vs]);if(!P(i)||i<0)return{};const s=this.isTransformLevel(e),r=this._isHorizontal(),a=r?this.getLayoutRect().height:this.getLayoutRect().width,o=r?this.getLayoutRect().width:this.getLayoutRect().height,l=a/2;let h=0;const d=this._getMainAxisLength(),u=this._getMainAxisLength(!0);return h+=i*(d+u),h+=s?-u/2:d/2,!this._spec.isTransform&&this._spec.gap&&(h+=this._spec.gap*i),this._isReverse()&&(h=o-h),this._isHorizontal()?{x:h,y:l}:{x:l,y:h}}_getPolygonPoints(e,t,i,s,r,a){const o=e[0],l=e[1];switch(this._funnelOrient){case"left":return[{x:o-a,y:l+t},{x:o-a,y:l-s},{x:o+a,y:l-r},{x:o+a,y:l+i}];case"right":return[{x:o+a,y:l-s},{x:o+a,y:l+s},{x:o-a,y:l+i},{x:o-a,y:l-i}];case"bottom":return[{x:o+t,y:l+a},{x:o-s,y:l+a},{x:o-r,y:l-a},{x:o+i,y:l-a}];default:return[{x:o-t,y:l-a},{x:o+s,y:l-a},{x:o+r,y:l+a},{x:o-i,y:l+a}]}}_getPolygonCenter(e){if(this._isHorizontal()){const s=(e[0].x+e[3].x)/2,r=(e[0].y+e[3].y)/2;return{x:(s+(e[1].x+e[2].x)/2)/2,y:(r+(e[1].y+e[2].y)/2)/2}}const t=(e[0].x+e[3].x)/2,i=(e[0].y+e[3].y)/2;return{x:(t+(e[1].x+e[2].x)/2)/2,y:(i+(e[1].y+e[2].y)/2)/2}}_adjustPoints(e){let t,i,s;return this._isHorizontal()?(s="y",this._funnelOrient==="left"?(t=this._funnelAlign==="bottom"?-e[1].y:e[1].y,i=this._funnelAlign==="bottom"?-e[2].y:e[2].y):(t=this._funnelAlign==="bottom"?-e[0].y:e[0].y,i=this._funnelAlign==="bottom"?-e[3].y:e[3].y)):(s="x",this._funnelOrient==="top"?(t=this._funnelAlign==="left"?e[0].x:-e[0].x,i=this._funnelAlign==="left"?e[3].x:-e[3].x):(t=this._funnelAlign==="left"?e[1].x:-e[1].x,i=this._funnelAlign==="left"?e[2].x:-e[2].x)),e[0][s]-=t,e[1][s]-=t,e[2][s]-=i,e[3][s]-=i,e}_computeLabelPosition(e){const t=this.getPoints(e);return this._getPolygonCenter(t)}_computeLabelLimit(e,t){const i=t==null?void 0:t.limit;if(oe(i))return i;const s=this.getPoints(e);return i==="shapeSize"?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(e){var t,i;let s,r,a=(t=this._spec.outerLabel)===null||t===void 0?void 0:t.position,o="center",l="middle";if(a=this._isHorizontal()?["top","bottom"].includes(a)?a:this._funnelAlign==="bottom"?"top":"bottom":["left","right"].includes(a)?a:this._funnelAlign==="left"?"right":"left",((i=this._spec.outerLabel)===null||i===void 0?void 0:i.alignLabel)!==!1)({x:s,y:r}=this._getPositionByData(e)),a==="left"?(s=0,o="left"):a==="right"?(s=this.getLayoutRect().width,o="right"):a==="top"?(r=0,l="top"):a==="bottom"&&(r=this.getLayoutRect().height,l="bottom");else{const{x2:h,y2:d}=this._computeOuterLabelLinePosition(e);s=h,r=d,a==="left"?(s-=ja,o="right"):a==="right"?(s+=ja,o="left"):a==="top"?(r-=ja,l="bottom"):a==="bottom"&&(r+=ja,l="top")}return{x:s,y:r,align:o,textBaseline:l}}_computeOuterLabelLimit(e){var t,i,s,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(e));const o=this.getPoints(e),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),d=(s=(i=(t=this._labelMark)===null||t===void 0?void 0:t.getComponent())===null||i===void 0?void 0:i.getProduct().getGroupGraphicItem().find(({attribute:c,type:f})=>{var p;return f==="text"&&((p=c.data)===null||p===void 0?void 0:p[h])===e[h]},!0))===null||s===void 0?void 0:s.AABBBounds,u=d?d.x2-d.x1:0;return this.getLayoutRect().width/2-Math.max(l/2,u/2)-qs-2*((a=(r=this._spec.outerLabel)===null||r===void 0?void 0:r.spaceWidth)!==null&&a!==void 0?a:ja)}_computeOuterLabelLinePosition(e){var t,i,s,r,a,o,l,h,d,u,c;const f=this.getCategoryField(),p=(a=(r=(s=(i=(t=this._funnelOuterLabelMark)===null||t===void 0?void 0:t.label)===null||i===void 0?void 0:i.getProduct())===null||s===void 0?void 0:s.elements)===null||r===void 0?void 0:r.find(w=>{var M;return((M=w.data[0])===null||M===void 0?void 0:M[f])===e[f]}))===null||a===void 0?void 0:a.getBounds(),g=(h=(l=(o=this._labelMark)===null||o===void 0?void 0:o.getComponent())===null||l===void 0?void 0:l.getProduct().getGroupGraphicItem().find(({attribute:w,type:M})=>{var T;return M==="text"&&((T=w.data)===null||T===void 0?void 0:T[f])===e[f]},!0))===null||h===void 0?void 0:h.AABBBounds,_=(d=this._spec.outerLabel)!==null&&d!==void 0?d:{};let m,y,b,v;if(this._isHorizontal()){const w=(u=_.spaceWidth)!==null&&u!==void 0?u:ja,M=this.getPoints(e),T=(Math.abs(M[0].y-M[1].y)+Math.abs(M[2].y-M[3].y))/2;return this._spec.outerLabel.position==="top"||this._funnelAlign==="bottom"?(b=this._getPolygonCenter(M).y-T/2-w,v=_.alignLabel!==!1?(p==null?void 0:p.y2)+w:b-w,m=this._getPolygonCenter(M).x,b-v<qs&&(v=b-qs),y=m):(b=this._getPolygonCenter(M).y+T/2+w,v=_.alignLabel!==!1?(p==null?void 0:p.y1)-w:b+w,m=this._getPolygonCenter(M).x,v-b<qs&&(v=b+qs),y=m),{x1:m,x2:y,y1:b,y2:v}}const x=this.getPoints(e),S=(Math.abs(x[0].x-x[1].x)+Math.abs(x[2].x-x[3].x))/2,A=(g==null?void 0:g.x2)-(g==null?void 0:g.x1)||0,k=(c=_.spaceWidth)!==null&&c!==void 0?c:ja;return this._spec.outerLabel.position==="right"||this._funnelAlign==="left"?(m=this._getPolygonCenter(x).x+Math.max(A/2,S/2)+k,y=_.alignLabel!==!1?(p==null?void 0:p.x1)-k:m+k,b=this._getPolygonCenter(x).y,y-m<qs&&(y=m+qs),v=b):(m=this._getPolygonCenter(x).x-Math.max(A/2,S/2)-k,y=_.alignLabel!==!1?(p==null?void 0:p.x2)+k:m-k,b=this._getPolygonCenter(x).y,m-y<qs&&(y=m-qs),v=b),{x1:m,x2:y,y1:b,y2:v}}_computeMaxSize(){var e;const t=this._isHorizontal()?this.getLayoutRect().height:this.getLayoutRect().width,i=(e=this._spec.maxSize)!==null&&e!==void 0?e:gQ;return Ii(i,t)}_computeMinSize(){var e;const t=this._isHorizontal()?this.getLayoutRect().height:this.getLayoutRect().width,i=(e=this._spec.minSize)!==null&&e!==void 0?e:_Q;return Ii(i,t)}_isHorizontal(){return this._funnelOrient==="left"||this._funnelOrient==="right"}_isReverse(){return this._funnelOrient==="bottom"||this._funnelOrient==="right"}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._funnelMark]}}gs.type=z.funnel,gs.mark=XO,gs.transformerConstructor=Z0;const bQ=()=>{yQ(),wn(),rc(),D.registerSeries(gs.type,gs),D.registerAnimation("funnel",(n,e)=>Object.assign({appear:e==="clipIn"?void 0:{type:"fadeIn"}},om)),TK(),Mr()};class Cu extends NL{constructor(){super(...arguments),this.type=Cu.type}}Cu.type="pyramid3d";const vQ=()=>{D.registerMark(Cu.type,Cu),V8(),UB()};class UL extends Z0{_transformLabelSpec(e){this._addMarkLabelSpec(e,"funnel3d"),e.isTransform&&this._addMarkLabelSpec(e,"transform3d","transformLabel")}}class Hs extends gs{constructor(){super(...arguments),this.type=z.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=UL}initMark(){var e,t,i,s,r,a,o,l;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},Hs.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:(e=this._theme)===null||e===void 0?void 0:e.funnel3d,key:this._seriesField,isSeriesMark:!0,support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},Hs.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:(t=this._theme)===null||t===void 0?void 0:t.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),(s=(i=this._spec)===null||i===void 0?void 0:i.outerLabel)===null||s===void 0?void 0:s.visible){const{line:h}=(r=this._spec.outerLabel)!==null&&r!==void 0?r:{},{line:d}=(o=(a=this._theme)===null||a===void 0?void 0:a.outerLabel)!==null&&o!==void 0?o:{};this._funnelOuterLabelMark.label=this._createMark(Hs.mark.outerLabel,{themeSpec:(l=this._theme)===null||l===void 0?void 0:l.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(Hs.mark.outerLabelLine,{themeSpec:d,key:this._seriesField,markSpec:h,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const e=this._funnelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const i=this.getPoints(t),s=Math.max(Math.abs(i[0].x-i[1].x),Math.abs(i[2].x-i[3].x));return(this._computeMaxSize()-s)/2}},"normal",J.Series)}initLabelMarkStyle(e){var t,i;super.initLabelMarkStyle(e),this.setMarkStyle(e,{z:s=>{if(this._isHorizontal())return 0;const r=this.getPoints(s),a=Math.max(Math.abs(r[0].x-r[1].x),Math.abs(r[2].x-r[3].x));return(this._computeMaxSize()-a)/2}},"normal",J.Series),this._labelMark=e,!((t=this._funnelOuterLabelMark)===null||t===void 0)&&t.label&&this._funnelOuterLabelMark.label.setDepend(e.getComponent()),!((i=this._funnelOuterLabelMark)===null||i===void 0)&&i.line&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}Hs.type=z.funnel3d,Hs.mark=KO,Hs.transformerConstructor=UL;const xQ=()=>{vQ(),wn(),rc(),D.registerSeries(Hs.type,Hs)},Mg=(n,e)=>{const t=(n-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,t))},Tg=n=>{const e=n.mark.elements.filter(i=>i.diffState===Je.update),t=hi(e.map(i=>{var s;return(s=i==null?void 0:i.data)===null||s===void 0?void 0:s[0].depth}));return e.filter(i=>{var s;return((s=i==null?void 0:i.data)===null||s===void 0?void 0:s[0].depth)===t})},mT=(n,e,t)=>fe(n)?[e,t]:[hi(n.map(i=>1*i.getGraphicAttribute("startAngle",!1))),Vt(n.map(i=>1*i.getGraphicAttribute("endAngle",!1)))],SQ=n=>({channel:{startAngle:{from:(e,t)=>{const{startAngle:i,endAngle:s}=n.animationInfo(),r=Tg(t),a=mT(r,i,s);return Mg(e.startAngle,a)*(s-i)+i},to:e=>e.startAngle},endAngle:{from:(e,t)=>{const{startAngle:i,endAngle:s}=n.animationInfo(),r=Tg(t),a=mT(r,i,s);return Mg(e.endAngle,a)*(s-i)+i},to:e=>e.endAngle},outerRadius:{from:e=>e.innerRadius,to:e=>e.outerRadius},innerRadius:{from:e=>e.innerRadius,to:e=>e.innerRadius}}}),yT=n=>[hi(n.map(e=>1*e.getGraphicAttribute("startAngle",!1))),Vt(n.map(e=>1*e.getGraphicAttribute("endAngle",!1)))],bT=n=>({channel:{startAngle:{from:(e,t)=>t.getGraphicAttribute("startAngle",!1),to:(e,t)=>{const{startAngle:i,endAngle:s}=n.animationInfo(),r=Tg(t),a=yT(r);return Mg(t.getGraphicAttribute("startAngle",!1),a)*(s-i)+i}},endAngle:{from:(e,t)=>t.getGraphicAttribute("endAngle",!1),to:(e,t)=>{const{startAngle:i,endAngle:s}=n.animationInfo(),r=Tg(t),a=yT(r);return Mg(t.getGraphicAttribute("endAngle",!1),a)*(s-i)+i}},outerRadius:{from:(e,t)=>t.getGraphicAttribute("outerRadius",!1),to:()=>n.animationInfo().innerRadius},innerRadius:{from:(e,t)=>t.getGraphicAttribute("innerRadius",!1),to:()=>n.animationInfo().innerRadius}}}),AQ=(n,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},kQ=()=>{D.registerAnimation("sunburst",(n,e)=>({appear:AQ(n,e),enter:SQ(n),exit:bT(n),disappear:bT(n)}))},$L=(n,e=[],t)=>{const i=(t==null?void 0:t.maxDepth)>=0;return n.forEach(s=>{(!i||s.depth<=t.maxDepth)&&(e.push(t!=null&&t.callback?t.callback(s):s),s.children&&(i&&s.depth===t.maxDepth?(s.children=null,s.isLeaf=!0):$L(s.children,e,t)))}),e};function wQ(n,e,t,i,s){const r=n.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let d=0;d<a;++d)o+=r[d].value,l[d+1]=o;const h=(d,u,c,f,p,g,_)=>{if(d>=u-1){const A=r[d];return A.x0=f,A.y0=p,A.x1=g,void(A.y1=_)}const m=l[d],y=c/2+m;let b=d+1,v=u-1;for(;b<v;){const A=b+v>>>1;l[A]<y?b=A+1:v=A}y-l[b-1]<l[b]-y&&d+1<b&&--b;const x=l[b]-m,S=c-x;if(g-f>_-p){const A=c?(f*S+g*x)/c:g;h(d,b,x,f,p,A,_),h(b,u,S,A,p,g,_)}else{const A=c?(p*S+_*x)/c:_;h(d,b,x,f,p,g,A),h(b,u,S,f,A,g,_)}};h(0,a,n.value,e,t,i,s)}function gm(n,e,t,i,s,r={x0:"x0",x1:"x1",y0:"y0",y1:"y1"}){const a=n.children;let o,l=-1;const h=a.length,d=n.value&&(i-e)/n.value;for(;++l<h;)o=a[l],o[r.y0]=t,o[r.y1]=s,o[r.x0]=e,o[r.x1]=e+=o.value*d}function J0(n,e,t,i,s){const r=n.children;let a,o=-1;const l=r.length,h=n.value&&(s-t)/n.value;for(;++o<l;)a=r[o],a.x0=e,a.x1=i,a.y0=t,t+=a.value*h,a.y1=t}function MQ(n,e,t,i,s){(n.depth%2==1?J0:gm)(n,e,t,i,s)}function TQ(n,e,t,i,s,r){const a=[],o=e.children;let l,h,d=0,u=0;const c=o.length;let f,p,g,_,m,y,b,v,x,S=e.value;for(;d<c;){f=s-t,p=r-i;do g=o[u++].value;while(!g&&u<c);for(_=g,m=g,v=Math.max(p/f,f/p)/(S*n),x=g*g*v,b=Math.max(m/x,x/_);u<c;++u){if(h=o[u].value,g+=h,h<_&&(_=h),h>m&&(m=h),x=g*g*v,y=Math.max(m/x,x/_),y>b){g-=h;break}b=y}l=Object.assign({},e,{value:g,children:o.slice(d,u)}),a.push(l),f<p?gm(l,t,i,s,S?i+=p*g/S:r):J0(l,t,i,S?t+=f*g/S:s,r),S-=g,d=u}return a}const CQ=n=>(e,t,i,s,r)=>{TQ(n,e,t,i,s,r)},_m=(n,e,t=0,i=-1,s,r)=>{let a=0,o=i??-1,l=t;return n.forEach((h,d)=>{var u,c;const f={flattenIndex:++o,key:r?r(h):`${(u=s==null?void 0:s.key)!==null&&u!==void 0?u:""}-${d}`,maxDepth:-1,depth:t,index:d,value:h.value,isLeaf:!0,datum:s?s.datum.concat(h):[h],parentKey:s==null?void 0:s.key};if(!((c=h.children)===null||c===void 0)&&c.length){f.children=[],f.isLeaf=!1;const p=_m(h.children,f.children,t+1,o,f,r);f.value=C(h.value)?p.sum:Math.max(p.sum,f.value),o=p.flattenIndex,l=Math.max(p.maxDepth,l)}else f.isLeaf=!0,f.value=C(h.value)?0:h.value;a+=Math.abs(f.value),e.push(f)}),{sum:a,maxDepth:l,flattenIndex:o}},zo=(n,e,t,i)=>{let s=i;return n.forEach((r,a)=>{var o;s=e(r,a,t,s),!((o=r.children)===null||o===void 0)&&o.length&&(s=zo(r.children,e,r,s))}),i},xf=(n,e,t,i)=>{let s=i;return n.forEach((r,a)=>{var o;!((o=r.children)===null||o===void 0)&&o.length&&(s=xf(r.children,e,r,s)),s=e(r,a,t,s)}),s},vT={binary:wQ,dice:gm,slice:J0,sliceDice:MQ};class mm{constructor(e){var t;this._filterByArea=(r,a)=>{var o;const l=this._getMinAreaByDepth(r.depth);if(l>0&&r.value*a<l)return!1;if(!((o=r.children)===null||o===void 0)&&o.length){const h=r.children.filter(d=>this._filterByArea(d,a));h.length?h.length!==r.children.length&&(r.children=h):(r.isLeaf=!0,r.children=null)}return!0},this._getMinAreaByDepth=r=>{var a;return r<0?0:(a=W(this.options.minVisibleArea)?this.options.minVisibleArea[r]:this.options.minVisibleArea)!==null&&a!==void 0?a:0},this._getGapWidthByDepth=r=>{var a;return r<0?0:(a=W(this.options.gapWidth)?this.options.gapWidth[r]:this.options.gapWidth)!==null&&a!==void 0?a:0},this._getPaddingByDepth=r=>{var a;return r<0?0:(a=W(this.options.padding)?this.options.padding[r]:this.options.padding)!==null&&a!==void 0?a:0},this._getLabelPaddingByDepth=r=>{var a;return r<0?0:(a=W(this.options.labelPadding)?this.options.labelPadding[r]:this.options.labelPadding)!==null&&a!==void 0?a:0},this._layoutNode=r=>{const a=this._getGapWidthByDepth(r.depth);let o=r.x0,l=r.y0,h=r.x1,d=r.y1;if(r.maxDepth=this._maxDepth,a>0&&(o+=a/2,h-=a/2,l+=a/2,d-=a/2,o>h&&(o=(o+h)/2,h=o),l>d&&(l=(l+d)/2,d=l),r.x0=o,r.x1=h,r.y0=l,r.y1=d),r.children){const u=this._getLabelPaddingByDepth(r.depth),c=this._getPaddingByDepth(r.depth);c>0&&c<Math.min(h-o,d-l)/2&&(l+=c,d-=c,o+=c,h-=c),u>0&&(this.options.labelPosition==="top"&&l+u<d?(r.labelRect={x0:o,y0:l,x1:h,y1:l+u},l+=u):this.options.labelPosition==="bottom"&&d-u>l?(r.labelRect={x0:o,y0:d-u,x1:h,y1:d},d-=u):this.options.labelPosition==="left"&&o+u<h?(r.labelRect={x0:o,y0:l,x1:o+u,y1:d},o+=u):this.options.labelPosition==="right"&&h-u>o&&(r.labelRect={x0:h-u,y0:l,x1:h,y1:d},h-=u));const f=this._getGapWidthByDepth(r.depth+1);f>0&&(o-=f/2,h+=f/2,l-=f/2,d+=f/2),this._splitNode(r,o,l,h,d)}},this.options=Object.assign({},mm.defaultOpionts,e);const i=this.options.nodeKey,s=Y(i)?i:i?ys(i):null;this._getNodeKey=s,this._splitNode=this.options.splitType==="squarify"?CQ(this.options.aspectRatio):(t=vT[this.options.splitType])!==null&&t!==void 0?t:vT.binary,this._maxDepth=-1}layout(e,t){var i;if(!e||!e.length)return[];const s="width"in t?{x0:0,x1:t.width,y0:0,y1:t.height,width:t.width,height:t.height}:{x0:Math.min(t.x0,t.x1),x1:Math.max(t.x0,t.x1),y0:Math.min(t.y0,t.y1),y1:Math.max(t.y0,t.y1),width:Math.abs(t.x1-t.x0),height:Math.abs(t.y1-t.y0)},r=[],a=_m(e,r,0,-1,null,this._getNodeKey);if(this._maxDepth=a.maxDepth,a.sum<=0)return[];const o={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:a.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:r},l=s.width*s.height/a.sum;return this._filterByArea(o,l),this._layout(o),(i=o.children)!==null&&i!==void 0?i:[]}_filterChildren(e){const t=this.options.maxDepth;if(oe(t)&&t>=0&&e.depth>=t)return!1;const i=this.options.minChildrenVisibleArea;if(oe(i)&&Math.abs((e.x1-e.x0)*(e.y1-e.y0))<i)return!1;const s=this.options.minChildrenVisibleSize;return!oe(s)||!(Math.abs(e.x1-e.x0)<s||Math.abs(e.y1-e.y0)<s)}_layout(e){var t;this._filterChildren(e)||(e.children=null,e.isLeaf=!0),this._layoutNode(e),!((t=e.children)===null||t===void 0)&&t.length&&e.children.forEach(i=>{var s;!((s=i==null?void 0:i.children)===null||s===void 0)&&s.length?this._layout(i):this._layoutNode(i)})}}mm.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const PQ={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class Pu{constructor(e){this._layoutNode=s=>{if(s.maxDepth=this._maxDepth,s.children){const r=this._parsedInnerRadius[s.depth+1],a=this._parsedOutterRadius[s.depth+1];gm(s,s.startAngle,Math.min(r,a),s.endAngle,Math.max(r,a),PQ);const o=W(this.options.label)?this.options.label[s.depth+1]:this.options.label;s.children.forEach(l=>{if(l.x=this._parsedCenter[0],l.y=this._parsedCenter[1],o)return this._layoutLabel(l,ht(o)?{align:"center",rotate:"radial"}:o)})}},this.options=e?Object.assign({},Pu.defaultOpionts,e):Object.assign({},Pu.defaultOpionts);const t=this.options.nodeKey,i=Y(t)?t:t?ys(t):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(e,t){const i=e.x0+bn(this.options.center[0],e.width),s=e.y0+bn(this.options.center[1],e.height),r=Math.min(e.width/2,e.height/2),a=this.options.innerRadius,o=this.options.outerRadius,l=W(a),h=l?a.map(p=>bn(p,r)):bn(a,r),d=W(o),u=this.options.gapRadius,c=d?o.map(p=>bn(p,r)):bn(o,r),f=bC(0,t+1);if(l)this._parsedInnerRadius=f.map((p,g)=>{const _=h[g];return C(_)?r:_}),this._parsedOutterRadius=f.map((p,g)=>{var _;return d?c[g]:g<t?this._parsedInnerRadius[g+1]-(W(u)?(_=u[g])!==null&&_!==void 0?_:0:u):c});else if(d)this._parsedOutterRadius=f.map((p,g)=>C(c[g])?r:c[g]),this._parsedInnerRadius=f.map((p,g)=>{var _;return g===0?h:this._parsedOutterRadius[g-1]-(W(u)?(_=u[g])!==null&&_!==void 0?_:0:u)});else{const p=bn(a,r),g=(c-p)/(t+1);this._parsedInnerRadius=f.map((_,m)=>p+m*g),this._parsedOutterRadius=f.map((_,m)=>{var y;return this._parsedInnerRadius[m]+g-(W(u)?(y=u[m])!==null&&y!==void 0?y:0:u)})}this._parsedCenter=[i,s],this._maxRadius=r}layout(e,t){const i="width"in t?{x0:0,x1:t.width,y0:0,y1:t.height,width:t.width,height:t.height}:{x0:Math.min(t.x0,t.x1),x1:Math.max(t.x0,t.x1),y0:Math.min(t.y0,t.y1),y1:Math.max(t.y0,t.y1),width:Math.abs(t.x1-t.x0),height:Math.abs(t.y1-t.y0)};if(!e||!e.length)return[];const s=[],r=_m(e,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,r.maxDepth),this._maxDepth=r.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(e,t){this._layoutNode(t),e.forEach(i=>{var s;!((s=i==null?void 0:i.children)===null||s===void 0)&&s.length?this._layout(i.children,i):this._layoutNode(i)})}_layoutLabel(e,t){var i;const s=(e.startAngle+e.endAngle)/2,r=(t.align==="start"?e.innerRadius:t.align==="end"?e.outerRadius:(e.innerRadius+e.outerRadius)/2)+((i=t.offset)!==null&&i!==void 0?i:0),a=as({x:this._parsedCenter[0],y:this._parsedCenter[1]},r,s);if(e.label={x:a.x,y:a.y,textBaseline:"middle"},t.rotate==="tangential")e.label.angle=s-Math.PI/2,e.label.textAlign="center",e.label.maxLineWidth=Math.abs(e.endAngle-e.startAngle)*r;else{const o=s%(2*Math.PI),l=o<0?o+2*Math.PI:o;l>Math.PI/2&&l<1.5*Math.PI?(e.label.angle=l+Math.PI,e.label.textAlign=t.align==="start"?"end":t.align==="end"?"start":"center"):(e.label.angle=l,e.label.textAlign=t.align),e.label.maxLineWidth=e.isLeaf?void 0:Math.abs(e.outerRadius-e.innerRadius)}}}Pu.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const EQ=1664525,RQ=1013904223,xT=4294967296;function OQ(n=1){let e=n;return()=>(e=(EQ*e+RQ)%xT)/xT}function BQ(n,e){let t=0;const i=yC(Array.from(n),e),s=i.length;let r,a,o=[];for(;t<s;)r=i[t],a&&YL(a,r)?++t:(o=LQ(o,r),a=IQ(o),t=0);return a}function LQ(n,e){let t,i;if(Ty(e,n))return[e];for(t=0;t<n.length;++t)if(Zc(e,n[t])&&Ty(sd(n[t],e),n))return[n[t],e];for(t=0;t<n.length-1;++t)for(i=t+1;i<n.length;++i)if(Zc(sd(n[t],n[i]),e)&&Zc(sd(n[t],e),n[i])&&Zc(sd(n[i],e),n[t])&&Ty(XL(n[t],n[i],e),n))return[n[t],n[i],e];De.getInstance().error("error when packEncloseRandom")}function Zc(n,e){const t=n.radius-e.radius,i=e.x-n.x,s=e.y-n.y;return t<0||t*t<i*i+s*s}function YL(n,e){const t=n.radius-e.radius+1e-9*Math.max(n.radius,e.radius,1),i=e.x-n.x,s=e.y-n.y;return t>0&&t*t>i*i+s*s}function Ty(n,e){for(let t=0;t<e.length;++t)if(!YL(n,e[t]))return!1;return!0}function IQ(n){switch(n.length){case 1:return DQ(n[0]);case 2:return sd(n[0],n[1]);case 3:return XL(n[0],n[1],n[2])}}function DQ(n){return{x:n.x,y:n.y,radius:n.radius}}function sd(n,e){const t=n.x,i=n.y,s=n.radius,r=e.x,a=e.y,o=e.radius,l=r-t,h=a-i,d=o-s,u=Math.sqrt(l*l+h*h);return{x:(t+r+l/u*d)/2,y:(i+a+h/u*d)/2,radius:(u+s+o)/2}}function XL(n,e,t){const i=n.x,s=n.y,r=n.radius,a=e.x,o=e.y,l=e.radius,h=t.x,d=t.y,u=t.radius,c=i-a,f=i-h,p=s-o,g=s-d,_=l-r,m=u-r,y=i*i+s*s-r*r,b=y-a*a-o*o+l*l,v=y-h*h-d*d+u*u,x=f*p-c*g,S=(p*v-g*b)/(2*x)-i,A=(g*_-p*m)/x,k=(f*b-c*v)/(2*x)-s,w=(c*m-f*_)/x,M=A*A+w*w-1,T=2*(r+S*A+k*w),E=S*S+k*k-r*r,O=-(Math.abs(M)>1e-6?(T+Math.sqrt(T*T-4*M*E))/(2*M):E/T);return{x:i+S+A*O,y:s+k+w*O,radius:O}}function ST(n,e,t){const i=n.x-e.x;let s,r;const a=n.y-e.y;let o,l;const h=i*i+a*a;h?(r=e.radius+t.radius,r*=r,l=n.radius+t.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),t.x=n.x-s*i-o*a,t.y=n.y-s*a+o*i):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),t.x=e.x+s*i-o*a,t.y=e.y+s*a+o*i)):(t.x=e.x+t.radius,t.y=e.y)}function AT(n,e){const t=n.radius+e.radius-1e-6,i=e.x-n.x,s=e.y-n.y;return t>0&&t*t>i*i+s*s}function kT(n){const e=n._,t=n.next._,i=e.radius+t.radius,s=(e.x*t.radius+t.x*e.radius)/i,r=(e.y*t.radius+t.y*e.radius)/i;return s*s+r*r}function Jc(n){return{_:n,next:null,prev:null}}function FQ(n,e){const t=(n=N(n)).length;if(!t)return 0;let i=n[0];if(i.x=0,i.y=0,t===1)return i.radius;const s=n[1];if(i.x=-s.radius,s.x=i.radius,s.y=0,t===2)return i.radius+s.radius;let r=n[2];ST(s,i,r);let a,o,l,h,d,u,c,f=Jc(i),p=Jc(s),g=Jc(r);f.next=p,g.prev=p,p.next=g,f.prev=g,g.next=f,p.prev=f;for(let m=3;m<t;++m){c=!1,r=n[m],ST(f._,p._,r),g=Jc(r),a=p.next,o=f.prev,l=p._.radius,h=f._.radius;do if(l<=h){if(AT(a._,g._)){p=a,f.next=p,p.prev=f,--m,c=!0;break}l+=a._.radius,a=a.next}else{if(AT(o._,g._)){f=o,f.next=p,p.prev=f,--m,c=!0;break}h+=o._.radius,o=o.prev}while(a!==o.next);if(!c){for(g.prev=f,g.next=p,f.next=p.prev=p=g,d=kT(f),g=g.next;g!==p;)u=kT(g),u<d&&(f=g,d=u),g=g.next;p=f.next}}const _=[p._];for(g=p.next;g!==p;)_.push(g._),g=g.next;r=BQ(_,e);for(let m=0;m<t;++m)i=n[m],i.x-=r.x,i.y-=r.y;return r.radius}function wT(n){return function(e){e.children||(e.radius=Math.max(0,+n(e)||0))}}function Cy(n,e,t){return function(i){const s=i==null?void 0:i.children;if(s){let r;const a=s.length,o=n(i)*e||0;if(o)for(r=0;r<a;++r)s[r].radius+=o;const l=FQ(s,t);if(o)for(r=0;r<a;++r)s[r].radius-=o;i.radius=l+o}}}function MT(n,e){return function(t,i,s){t.radius*=n,t.maxDepth=e,s&&(t.x=s.x+n*t.x,t.y=s.y+n*t.y)}}class Eu{constructor(e){this.options=e;const t=e==null?void 0:e.nodeKey,i=Y(t)?t:t?ys(t):null;this._getNodeKey=i,this._getPadding=oe(e==null?void 0:e.padding)?s=>e.padding:W(e==null?void 0:e.padding)?s=>{var r;return(r=e.padding[s.depth+1])!==null&&r!==void 0?r:0}:()=>0,this._maxDepth=-1}layout(e,t){var i;const s="width"in t?{x0:0,x1:t.width,y0:0,y1:t.height,width:t.width,height:t.height}:{x0:Math.min(t.x0,t.x1),x1:Math.max(t.x0,t.x1),y0:Math.min(t.y0,t.y1),y1:Math.max(t.y0,t.y1),width:Math.abs(t.x1-t.x0),height:Math.abs(t.y1-t.y0)};if(!e||!e.length)return[];const r=[],a=_m(e,r,0,-1,null,this._getNodeKey);this._maxDepth=a.maxDepth;const o=OQ(),l={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:a.sum,datum:null,children:r,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:h,setRadius:d,padding:u,includeRoot:c}=(i=this.options)!==null&&i!==void 0?i:{};if(h!==!1){const f=Y(h)?this.options.nodeKey:Eu.defaultOpionts.nodeSort;zo([l],p=>{p.children&&p.children.length&&p.children.sort(f)})}if(d)zo([l],wT(d)),xf([l],Cy(this._getPadding,.5,o)),zo([l],MT(1,this._maxDepth));else{const f=Math.min(s.width,s.height);zo([l],wT(Eu.defaultOpionts.setRadius)),xf([l],Cy(f5,1,o)),u&&xf([l],Cy(this._getPadding,l.radius/f,o)),zo([l],MT(f/(2*l.radius),this._maxDepth))}return c?[l]:r}}Eu.defaultOpionts={setRadius:n=>Math.sqrt(n.value),padding:0,nodeSort:(n,e)=>e.value-n.value};const gh=(n,e={})=>{if(!n)return[];const t=[];return $L(n,t,e),t},zQ=(n,e)=>{if(!n)return n;const t=e(),{width:i,height:s}=t;return new Pu(t).layout(n,{width:i,height:s})},jQ=10;class HQ extends rn{constructor(){super(...arguments),this.contentKeyCallback=e=>e==null?void 0:e[this.series.getDimensionField()[0]]}}var ia;(function(n){n.DrillDown="drillDown",n.DrillUp="drillUp"})(ia||(ia={}));const GQ=(n,e)=>{const t=e.info(),i=e.keyField(),s=t==null?void 0:t.key;if(C(s))return n;if(t.type===ia.DrillDown){const r=SB(n,s,i,"children");return N(r)}if(t.type===ia.DrillUp){const r=AB(n,s,i,"children");if(r)return N(r)}return n};class Q0{_getDrillTriggerEvent(e){var t;const{mode:i}=this._drillParams;return(t=er(i))===null||t===void 0?void 0:t[e]}_hideTooltip(){const e=this.getChart().getAllComponents().find(t=>t.type===X.tooltip);e&&e.hideTooltip()}initDrillable(e){this._drillParams=e}initDrillableData(e){const{getRawData:t}=this._drillParams;Ae(e,"drillFilter",GQ),t().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:e,getRawData:t,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&e.on(this._getDrillTriggerEvent("start"),r=>{var a,o,l;if(C(r.datum)||C((a=r.datum)===null||a===void 0?void 0:a[s]))return void this.drillUp();this._hideTooltip();const h=r.datum[s],d=(l=(o=this._drillInfo)===null||o===void 0?void 0:o.path)!==null&&l!==void 0?l:[],u=B9(t().rawData,h,s,"children");d[d.length-1]===u[u.length-1]?this.drillUp():this.drillDown(u)})}drillDown(e=[]){const{getRawData:t,event:i}=this._drillParams;if(!W(e)||fe(e))return e;const s=e[e.length-1];return this._drillInfo={key:s,path:e,type:ia.DrillDown},t().reRunAllTransform(),i.emit(ye.drill,{value:{path:e,type:ia.DrillDown},model:this}),e}drillUp(){var e,t;const{getRawData:i,event:s}=this._drillParams,r=(t=(e=this._drillInfo)===null||e===void 0?void 0:e.path)!==null&&t!==void 0?t:[];if(!W(r)||fe(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:ia.DrillUp},i().reRunAllTransform(),s.emit(ye.drill,{value:{path:r,type:ia.DrillUp},model:this}),r}}class fa extends ac{constructor(){super(...arguments),this.type=z.sunburst}setCategoryField(e){return this._categoryField=e,this._categoryField}getCategoryField(){return this._categoryField}setValueField(e){return this._valueField=e,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var e;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField((e=this._spec.seriesField)!==null&&e!==void 0?e:Ma),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return(t=this._spec.drillField)!==null&&t!==void 0?t:Vs},getRawData:()=>this.getRawData()}),this._startAngle=st(this._spec.startAngle),this._endAngle=st(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const e=this.getRawData();e&&(this._spec.drill&&this.initDrillableData(this._dataSet),Ae(this._dataSet,"sunburstLayout",zQ),Ae(this._dataSet,"flatten",gh),e.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:i,gap:s,label:r}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[P(this._centerX)?this._centerX:this.getLayoutRect().width/2,P(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:i,gapRadius:s,label:r}}}),e.transform({type:"flatten",options:{callback:t=>{if(t.datum){const i=t.datum[t.depth];return Object.assign(Object.assign({},t),i)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:uu,operations:["max","min","values"]},{key:Ma,operations:["values"]}])}_addDataIndexAndKey(){const e=this.getRawData();C(e==null?void 0:e.dataSet)||(Ae(e.dataSet,"addVChartProperty",Th),e.transform({type:"addVChartProperty",options:{beforeCall:G0.bind(this),call:hm}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var e;if(this._sunburst.visible===!1)return;const t=this._createMark(fa.mark.sunburst,{isSeriesMark:!0,customShape:(e=this._spec.sunburst)===null||e===void 0?void 0:e.customShape});this._sunburstMark=t,this._trigger.registerMark(this._sunburstMark)}_initArcMarkStyle(){C(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:e=>e.x+(P(this._offsetX)?this._offsetX:0),y:e=>e.y+(P(this._offsetY)?this._offsetY:0),outerRadius:e=>e.outerRadius,innerRadius:e=>e.innerRadius,startAngle:e=>e.startAngle,endAngle:e=>e.endAngle,fill:this.getColorAttribute()},_e.STATE_NORMAL,J.Series)}_initLabelMark(){if(this._label.visible!==!0)return;const e=this._createMark(fa.mark.label,{isSeriesMark:!1});this._labelMark=e,this._trigger.registerMark(e)}_initLabelMarkStyle(){C(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:e=>{var t;const i=this._labelAutoVisible;return He(i)&&i.enable===!0?(e.endAngle-e.startAngle)*(e.outerRadius-e.innerRadius)>((t=i==null?void 0:i.circumference)!==null&&t!==void 0?t:jQ):this._spec.label.visible},x:e=>{var t;return((t=e.label)===null||t===void 0?void 0:t.x)+(P(this._offsetX)?this._offsetX:0)},y:e=>{var t;return((t=e.label)===null||t===void 0?void 0:t.y)+(P(this._offsetY)?this._offsetY:0)},textBaseline:e=>{var t;return(t=e.label)===null||t===void 0?void 0:t.textBaseline},textAlign:e=>{var t;return(t=e.label)===null||t===void 0?void 0:t.textAlign},angle:e=>{var t,i;return(i=(t=e.label)===null||t===void 0?void 0:t.angle)!==null&&i!==void 0?i:0},fontSize:10,text:e=>e.name},_e.STATE_NORMAL,J.Series)}initTooltip(){this._tooltipHelper=new HQ(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var e,t;const i={animationInfo:()=>({innerRadius:this._computeRadius(N(this.__innerRadius))[0],outerRadius:this._computeRadius(N(this.__outerRadius))[0],startAngle:N(this._startAngle)[0],endAngle:N(this._endAngle)[0]})},s=(t=(e=this._spec)===null||e===void 0?void 0:e.animationAppear)===null||t===void 0?void 0:t.preset;this.getMarksInType("arc").forEach(r=>{var a;r.setAnimationConfig(Le((a=D.getAnimationInKey("sunburst"))===null||a===void 0?void 0:a(i,s),Ge(r.name,this._spec,this._markAttributeContext)))}),this.getMarksInType("text").forEach(r=>{var a;r.setAnimationConfig(Le((a=D.getAnimationInKey("fadeInOut"))===null||a===void 0?void 0:a(),Ge(r.name,this._spec,this._markAttributeContext)))})}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(e){super.onLayoutEnd(e),this._rawData.reRunAllTransform()}_computeRadius(e){if(W(e))return e.map(s=>{const{width:r,height:a}=this.getRegion().getLayoutRect();return Math.min(r/2,a/2)*s});const{width:t,height:i}=this.getRegion().getLayoutRect();return Math.min(t/2,i/2)*e}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(e,t){}getActiveMarks(){return[this._sunburstMark]}}fa.type=z.sunburst,fa.mark=nB,li(fa,Q0);const WQ=()=>{D.registerSeries(fa.type,fa),oc(),wn(),Mr(),kQ()},VQ=(n,e)=>{if(!n)return n;const t=e(),{width:i,height:s}=t;return i===0||s===0?n:new Eu(t).layout(n,{width:i,height:s})};class NQ extends rn{constructor(){super(...arguments),this.contentKeyCallback=e=>e==null?void 0:e[this.series.getDimensionField()[0]]}}const UQ=n=>n==="fadeIn"?{type:"fadeIn"}:{type:"growRadiusIn"},$Q=()=>{D.registerAnimation("circlePacking",(n,e)=>({appear:UQ(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}))};class pa extends Qn{constructor(){super(...arguments),this.type=z.circlePacking}setCategoryField(e){return this._categoryField=e,this._categoryField}getCategoryField(){return this._categoryField}setValueField(e){return this._valueField=e,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var e;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField((e=this._spec.seriesField)!==null&&e!==void 0?e:Ma),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return(t=this._spec.drillField)!==null&&t!==void 0?t:Vs},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const e=this.getRawData();C(e)||(this._spec.drill&&this.initDrillableData(this._dataSet),Ae(this._dataSet,"circlePackingLayout",VQ),Ae(this._dataSet,"flatten",gh),e.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),e.transform({type:"flatten",options:{callback:t=>{if(t.datum){const i=t.datum[t.depth];return Object.assign(Object.assign({},t),i)}return t}}}))}_addDataIndexAndKey(){const e=this.getRawData();C(e==null?void 0:e.dataSet)||(Ae(e.dataSet,"addVChartProperty",Th),e.transform({type:"addVChartProperty",options:{beforeCall:G0.bind(this),call:hm}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var e,t;if(((e=this._circlePacking)===null||e===void 0?void 0:e.visible)===!1)return;const i=this._createMark(pa.mark.circlePacking,{isSeriesMark:!0,customShape:(t=this._spec.circlePacking)===null||t===void 0?void 0:t.customShape});this._circlePackingMark=i,this._trigger.registerMark(i)}_initCirclePackingMarkStyle(){C(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:e=>e.x,y:e=>e.y,outerRadius:e=>e.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:e=>e.depth},_e.STATE_NORMAL,J.Series)}_initLabelMark(){var e;if(((e=this._label)===null||e===void 0?void 0:e.visible)===!1)return;const t=this._createMark(pa.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t)}_initLabelMarkStyle(){C(this._labelMark)||this.setMarkStyle(this._labelMark,{x:e=>e.x,y:e=>e.y,text:e=>e.key,cursor:"pointer"},_e.STATE_NORMAL,J.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:uu,operations:["max","min","values"]},{key:Ma,operations:["values"]}])}initTooltip(){this._tooltipHelper=new NQ(this),this._tooltipHelper.updateTooltipSpec(),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var e;const t=(e=this._spec.animationAppear)===null||e===void 0?void 0:e.preset;this.getMarksInType("arc").forEach(i=>{var s;i.setAnimationConfig(Le((s=D.getAnimationInKey("circlePacking"))===null||s===void 0?void 0:s(void 0,t),Ge(i.name,this._spec,this._markAttributeContext)))}),this.getMarksInType("text").forEach(i=>{var s;i.setAnimationConfig(Le((s=D.getAnimationInKey("scaleInOut"))===null||s===void 0?void 0:s(),Ge(i.name,this._spec,this._markAttributeContext)))})}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(e){super.onLayoutEnd(e),this._rawData.reRunAllTransform()}_noAnimationDataKey(e,t){}getActiveMarks(){return[this._circlePackingMark]}}pa.type=z.circlePacking,pa.mark=aB,li(pa,Q0);const YQ=()=>{D.registerSeries(pa.type,pa),oc(),wn(),lm(),$Q()},KL=n=>{let e=0;return n.forEach((t,i)=>{var s;C(t.value)&&(!((s=t.children)===null||s===void 0)&&s.length?t.value=KL(t.children):t.value=0),e+=Math.abs(t.value)}),e};function TT(n){return n.depth}function CT(n,e){return e-1-n.endDepth}function XQ(n,e){return n.sourceLinks.length?n.depth:e-1}function KQ(n,e,t){return n.targetLinks.length?n.depth:n.sourceLinks.length?hi(n.sourceLinks.map(i=>t[i.target].depth))-1:0}const Qc=(n,e)=>n.y0-e.y0,PT=(n,e)=>{if(C(n.value))return null;const t=(e?n.targetLinks:n.sourceLinks).reduce((i,s)=>(C(s.value)?i.count+=1:i.sum+=s.value,i),{sum:0,count:0});return t.count>0?(n.value-t.sum)/t.count:null},qQ={left:TT,right:CT,justify:XQ,center:KQ,start:TT,end:CT};class lc{constructor(e){this._ascendingSourceBreadth=(s,r)=>Qc(this._nodeMap[s.source],this._nodeMap[r.source])||s.index-r.index,this._ascendingTargetBreadth=(s,r)=>Qc(this._nodeMap[s.target],this._nodeMap[r.target])||s.index-r.index,this.options=Object.assign({},lc.defaultOptions,e);const t=this.options.nodeKey,i=Y(t)?t:t?ys(t):null;this._getNodeKey=i,this._logger=De.getInstance(),this._alignFunc=Y(this.options.setNodeLayer)?s=>this.options.setNodeLayer(s.datum):qQ[this.options.nodeAlign]}layout(e,t){if(!e)return null;const i="width"in t?{x0:0,x1:t.width,y0:0,y1:t.height,width:t.width,height:t.height}:{x0:Math.min(t.x0,t.x1),x1:Math.max(t.x0,t.x1),y0:Math.min(t.y0,t.y1),y1:Math.max(t.y0,t.y1),width:Math.abs(t.x1-t.x0),height:Math.abs(t.y1-t.y0)};tk(this.options.direction)?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(e),r=s.nodes,a=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(r),this.computeNodeDepths(r),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(r),this._maxDepth<=1)return null;const o=this.computeNodeBreadths(r);return this.computeLinkBreadths(r),tk(this.options.direction)&&(r.forEach(l=>{const h=l.y0,d=l.y1;l.y0=l.x0,l.y1=l.x1,l.x0=h,l.x1=d}),a.forEach(l=>{l.vertical=!0;const h=l.x0,d=l.x1;l.x0=l.y0,l.x1=l.y1,l.y0=h,l.y1=d})),a.forEach(l=>{const h=this._nodeMap[l.source],d=this._nodeMap[l.target];l.sourceRect={x0:h.x0,x1:h.x1,y0:h.y0,y1:h.y1},l.targetRect={x0:d.x0,x1:d.x1,y1:d.y1,y0:d.y0}}),{nodes:r,links:a,columns:o}}computeHierarchicNodeLinks(e){const t=[],i=[],s={},r={},a=[];KL(e);const o=(l,h,d)=>{l.forEach((u,c)=>{var f,p;const g=this._getNodeKey?this._getNodeKey(u):d?`${d[d.length-1].key}-${c}`:`${h}-${c}`;if(s[g])s[g].value=void 0;else{const _={depth:h,datum:u,index:c,key:g,value:(f=u.value)!==null&&f!==void 0?f:0,sourceLinks:[],targetLinks:[]};s[g]=_,t.push(_)}d&&a.push({source:d[d.length-1].key,target:g,value:(p=u.value)!==null&&p!==void 0?p:0,parents:d}),u.children&&u.children.length&&o(u.children,h+1,d?d.concat([s[g]]):[s[g]])})};return o(e,0,null),a.forEach((l,h)=>{const d=`${l.source}-${l.target}`;if(r[d])return r[d].value+=l.value,void r[d].datum.push(l);const u={index:h,key:`${l.source}-${l.target}`,source:l.source,target:l.target,datum:[l],value:l.value,parents:l.parents.map(c=>c.key)};i.push(u),s[l.source].sourceLinks.push(u),s[l.target].targetLinks.push(u),r[d]=u}),{nodes:t,links:i,nodeMap:s}}computeSourceTargetNodeLinks(e){const t=[],i=[],s={};e.nodes&&e.nodes.forEach((a,o)=>{const l={depth:-1,datum:a,index:o,key:this._getNodeKey?this._getNodeKey(a):o,value:a.value,sourceLinks:[],targetLinks:[]};s[l.key]=l,t.push(l)});const r=[];return e.links.forEach((a,o)=>{if(C(a.source)||C(a.target)||e.nodes&&(!s[a.source]||!s[a.target]))return;e.nodes||s[a.source]||(s[a.source]={value:void 0,depth:-1,index:t.length,key:a.source,datum:null,sourceLinks:[],targetLinks:[]},t.push(s[a.source])),e.nodes||s[a.target]||(s[a.target]={value:void 0,depth:-1,index:t.length,key:a.target,datum:null,sourceLinks:[],targetLinks:[]},t.push(s[a.target]));const l={index:o,source:a.source,target:a.target,datum:a,value:a.value};this.options.divideNodeValueToLink&&C(a.value)&&r.push(l),i.push(l),s[a.source].sourceLinks.push(l),s[a.target].targetLinks.push(l)}),this.options.divideNodeValueToLink&&r.length&&r.forEach(a=>{const o=[PT(s[a.source]),PT(s[a.target],!0)].filter(l=>!C(l));o.length&&(a.value=hi(o))}),{nodeMap:s,nodes:t,links:i}}computeNodeLinks(e){let t;"links"in e?t=this.computeSourceTargetNodeLinks(e):(this._isHierarchic=!0,t=this.computeHierarchicNodeLinks(e.nodes));let i=t.nodes;const s=t.links;if(this.options.linkSortBy)for(let r=0,a=i.length;r<a;r++)i[r].sourceLinks.sort(this.options.linkSortBy),i[r].targetLinks.sort(this.options.linkSortBy);return this.options.dropIsolatedNode&&(i=i.filter(r=>r.targetLinks.length||r.sourceLinks.length)),{nodes:i,links:s,nodeMap:t.nodeMap}}computeNodeValues(e){for(let t=0,i=e.length;t<i;t++){const s=e[t];s.value=Math.max(C(s.value)?0:s.value,s.sourceLinks.reduce((r,a)=>{var o;return r+((o=a.value)!==null&&o!==void 0?o:0)},0),s.targetLinks.reduce((r,a)=>{var o;return r+((o=a.value)!==null&&o!==void 0?o:0)},0))}}computeNodeDepths(e){const t=e.length;let i,s,r=e,a=0;for(;r.length&&a<t;){i=[],s={};for(let o=0,l=r.length;o<l;o++){const h=r[o];h.depth=a;for(let d=0,u=h.sourceLinks.length;d<u;d++){const c=h.sourceLinks[d];s[c.target]||(i.push(this._nodeMap[c.target]),s[c.target]=!0)}}r=i,a+=1}a>t&&this._logger.warn("Error: there is a circular link"),this._maxDepth=a}computeNodeEndDepths(e){const t=e.length;let i,s,r=e,a=0;for(;r.length&&a<t;){i=[],s={};for(let o=0,l=r.length;o<l;o++){const h=r[o];h.endDepth=a;for(let d=0,u=h.targetLinks.length;d<u;d++){const c=h.targetLinks[d];s[c.source]||(i.push(this._nodeMap[c.source]),s[c.source]=!0)}}r=i,a+=1}a>t&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(e){const t=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,r=this._viewBox.width;let a=null,o=null,l=!1;if(ae(t)){const d=ai(parseFloat(t.replace("%",""))/100,0,1);let u=r/(this._maxDepth-1+d);s>0&&(u=Math.max(s,u)),a=u*d,o=u*(1-d),l=!0}else if(oe(t)){if(a=t,oe(i))o=i;else if(C(i)){let d=(r-t)/(this._maxDepth-1);s>0&&(d=Math.max(s,d)),o=d-t}l=!0}else Y(t)&&oe(i)&&(o=i);const h=[];for(let d=0,u=e.length;d<u;d++){const c=e[d];c.layer=this._isHierarchic?c.depth:ai(Math.floor(this._alignFunc(c,this._maxDepth,this._nodeMap)),0,this._maxDepth-1);const f=c.layer;f===this._maxDepth-1&&(c.isLastLayer=!0),l&&(c.x0=this._viewBox.x0+f*(a+o),c.x1=c.x0+a),h[f]?h[f].push(c):h[f]=[c]}if(this.options.nodeSortBy)for(let d=0,u=h.length;d<u;d++)h[d].sort(this.options.nodeSortBy);if(!l&&Y(t)){let d=this._viewBox.x0;for(let u=0;u<this._maxDepth;u++){const c=h[u];let f=0;for(let p=0,g=c.length;p<g;p++){const _=c[p],m=t(_);_.x0=d,_.x1=d+m,f=Math.max(a,m);const y=_.sourceLinks;for(let b=0,v=y.length;b<v;b++){const x=y[b];Y(i)&&i(x)}}d+=f}}return h}initializeNodeBreadths(e){const t=this.options.minLinkHeight;let i=this.options.minNodeHeight;(C(i)||i<t)&&(i=t);let s=0,r=null;if(Y(this.options.nodeGap))r=this.options.nodeGap,s=e.reduce((l,h)=>{const d=h.reduce((c,f)=>c+f.value,0),u=h.reduce((c,f)=>c+this.options.nodeGap(f),0);return Math.min(l,(this._viewBox.height-u)/d)},1/0);else{const l=e.reduce((d,u)=>Math.max(d,u.length),0),h=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/l);r=()=>h,this._gapY=h,s=e.reduce((d,u)=>{const c=u.reduce((f,p)=>f+p.value,0);return Math.min(d,(this._viewBox.height-(u.length-1)*h)/c)},1/0)}const a=this.options.gapPosition==="start",o=!a&&this.options.gapPosition!=="end";for(let l=0,h=e.length;l<h;l++){const d=e[l];let u=this._viewBox.y0,c=0;for(let p=0,g=d.length;p<g;p++){const _=d[p];c=r(_),a&&(u+=c),_.y0=u,_.y1=u+(i>0&&_.value!==0?Math.max(_.value*s,i):_.value*s),u=a?_.y1:_.y1+c;for(let m=0,y=_.sourceLinks.length;m<y;m++){const b=_.sourceLinks[m];b.thickness=t>0&&b.value!==0?Math.max(b.value*s,t):b.value*s}}let f=this._viewBox.y1-u+(o?c:0);if(f>0){if(this.options.crossNodeAlign!=="start")if(this.options.crossNodeAlign==="end")for(let p=0,g=d.length;p<g;++p){const _=d[p];_.y0+=f,_.y1+=f}else{f/=d.length+1;for(let p=0,g=d.length;p<g;++p){const _=d[p];_.y0+=f*(p+1),_.y1+=f*(p+1)}}}else if(f<0&&d.length>1&&(f/=d.length-1,c+f>0)){c+=f;for(let p=1,g=d.length;p<g;++p){const _=d[p];_.y0+=f*p,_.y1+=f*p}}this.reorderLinks(d)}}computeNodeBreadths(e){const t=this.computeNodeLayers(e);this.initializeNodeBreadths(t);const i=this.options.iterations;if(!this._isHierarchic&&!Y(this.options.setNodeLayer)&&!Y(this.options.nodeGap))for(let s=0;s<i;++s){const r=Math.pow(.99,s),a=Math.max(1-r,(s+1)/i);this.relaxRightToLeft(t,r,a),this.relaxLeftToRight(t,r,a)}return t}relaxLeftToRight(e,t,i){for(let s=1,r=e.length;s<r;++s){const a=e[s];for(let o=0,l=a.length;o<l;o++){const h=a[o];let d=0,u=0;for(let f=0,p=h.targetLinks.length;f<p;f++){const g=h.targetLinks[f],_=g.value*(h.layer-this._nodeMap[g.source].layer);d+=this.targetTop(this._nodeMap[g.source],h)*_,u+=_}if(!(u>0))continue;const c=(d/u-h.y0)*t;h.y0+=c,h.y1+=c,this.reorderNodeLinks(h)}C(this.options.nodeSortBy)&&a.sort(Qc),this.resolveCollisions(a,i)}}relaxRightToLeft(e,t,i){for(let s=e.length-2;s>=0;--s){const r=e[s];for(let a=0,o=r.length;a<o;a++){const l=r[a];let h=0,d=0;for(let c=0,f=l.sourceLinks.length;c<f;c++){const p=l.sourceLinks[c],g=p.value*(this._nodeMap[p.target].layer-l.layer);h+=this.sourceTop(l,this._nodeMap[p.target])*g,d+=g}if(!(d>0))continue;const u=(h/d-l.y0)*t;l.y0+=u,l.y1+=u,this.reorderNodeLinks(l)}this.options.nodeSortBy===void 0&&r.sort(Qc),this.resolveCollisions(r,i)}}resolveCollisions(e,t){const i=e.length>>1,s=e[i];this.resolveCollisionsBottomToTop(e,s.y0-this._gapY,i-1,t),this.resolveCollisionsTopToBottom(e,s.y1+this._gapY,i+1,t),this.resolveCollisionsBottomToTop(e,this._viewBox.y1,e.length-1,t),this.resolveCollisionsTopToBottom(e,this._viewBox.y0,0,t)}resolveCollisionsTopToBottom(e,t,i,s){for(;i<e.length;++i){const r=e[i],a=(t-r.y0)*s;a>1e-6&&(r.y0+=a,r.y1+=a),t=r.y1+this._gapY}}resolveCollisionsBottomToTop(e,t,i,s){for(;i>=0;--i){const r=e[i],a=(r.y1-t)*s;a>1e-6&&(r.y0-=a,r.y1-=a),t=r.y0-this._gapY}}targetTop(e,t){let i,s,r,a=e.y0-(e.sourceLinks.length-1)*this._gapY/2;for(i=0,s=e.sourceLinks.length;i<s&&(r=e.sourceLinks[i],r.target!==t.key);i++)a+=r.thickness+this._gapY;for(i=0,s=t.targetLinks.length;i<s&&(r=t.targetLinks[i],r.source!==e.key);i++)a-=r.thickness;return a}sourceTop(e,t){let i,s,r,a=t.y0-(t.targetLinks.length-1)*this._gapY/2;for(i=0,s=t.targetLinks.length;i<s&&(r=t.targetLinks[i],r.source!==e.key);i++)a+=r.thickness+this._gapY;for(i=0,s=e.sourceLinks.length;i<s&&(r=e.sourceLinks[i],r.target!==t.key);i++)a-=r.thickness;return a}computeLinkBreadths(e){for(let t=0,i=e.length;t<i;t++){const s=e[t];let r=s.y0,a=r;for(let o=0,l=s.sourceLinks.length;o<l;o++){const h=s.sourceLinks[o];h.y0=r+h.thickness/2,h.x0=s.x1,r+=h.thickness}for(let o=0,l=s.targetLinks.length;o<l;o++){const h=s.targetLinks[o];h.y1=a+h.thickness/2,h.x1=s.x0,a+=h.thickness}}}reorderNodeLinks(e){if(C(this.options.linkSortBy)){const t=e.targetLinks,i=e.sourceLinks;for(let s=0,r=t.length;s<r;s++){const a=t[s];this._nodeMap[a.source].sourceLinks.sort(this._ascendingTargetBreadth)}for(let s=0,r=i.length;s<r;s++){const a=i[s];this._nodeMap[a.target].targetLinks.sort(this._ascendingSourceBreadth)}}}reorderLinks(e){if(C(this.options.linkSortBy))for(let t=0,i=e.length;t<i;t++){const s=e[t];s.sourceLinks.sort(this._ascendingTargetBreadth),s.targetLinks.sort(this._ascendingSourceBreadth)}}}lc.defaultOptions={iterations:6,nodeAlign:"justify",direction:"horizontal",nodeWidth:24,nodeGap:8,crossNodeAlign:"middle",dropIsolatedNode:!0};const ZQ=(n,e)=>{const t=new lc(n).layout(Array.isArray(e)?e[0]:e,"width"in n?{width:n.width,height:n.height}:{x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1});return t?[t]:[]},JQ=()=>{ee.registerTransform("sankey",{transform:ZQ,markPhase:"beforeJoin"},!0)},qL=(n,e,t)=>{e.forEach(i=>{C(i[t])||n.add(i[t]),i.children&&i.children.length>0&&qL(n,i.children,t)})},ZL=n=>{n.forEach(e=>{e.value=ae(e.value)?+e.value:e.value,e.children&&e.children.length>0&&ZL(e.children)})},QQ=n=>{var e;if(!n||!W(n))return[];if(n.length>1){const t={links:[],nodes:[]};return n.forEach(i=>{i.id!=="links"&&i.id!=="nodes"||(t[i.id]=i.values)}),[t]}return!((e=n[0])===null||e===void 0)&&e.latestData?n[0].latestData:n},eee=(n,e)=>{var t,i;if(!n||!(e!=null&&e.view)||!n.length)return[];const s=e.view();if(s.x1-s.x0==0||s.y1-s.y0==0||s.x1-s.x0==-1/0||s.x1-s.x0==1/0||s.y1-s.y0==-1/0||s.y1-s.y0==1/0)return[];const r=n[0];if((e.sourceField!=="source"||e.targetField!=="target"||e.valueField!=="value")&&r.links){const l=[];r.links.forEach(h=>{const d={};for(const u in h)u===e.sourceField?d.source=h[e.sourceField]:u===e.targetField?d.target=h[e.targetField]:u===e.valueField?d.value=h[e.valueField]:d[u]=h[u];l.push(d)}),r.links=l}if(r.links){const l=[];r.links.forEach(h=>{const d={};for(const u in h)u==="value"?d.value=ae(h.value)?+h.value:h.value:d[u]=h[u];l.push(d)}),r.links=l}else!((i=(t=r.nodes)===null||t===void 0?void 0:t[0])===null||i===void 0)&&i.children&&ZL(r.nodes);const a=new lc(e),o=[];return o.push(a.layout(r,s)),o},tee=n=>{var e,t;return n&&W(n)&&(!((e=n[0])===null||e===void 0)&&e.latestData)&&n[0].latestData.length&&n[0].latestData[0]&&(t=n[0].latestData[0].nodes)!==null&&t!==void 0?t:[]},iee=n=>{var e,t;return n&&W(n)&&(!((e=n[0])===null||e===void 0)&&e.latestData)&&n[0].latestData.length&&n[0].latestData[0]&&(t=n[0].latestData[0].links)!==null&&t!==void 0?t:[]};class nee extends rn{getDefaultTooltipPattern(e,t){if(e==="mark")return{visible:!0,activeType:e,title:{key:void 0,value:i=>{if(i.source){if(oe(i.source)){const s=this.series.getSeriesKeys();return s[i.source]+" => "+s[i.target]}return i.source+" => "+i.target}return i.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:i=>i.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1}]};if(e==="dimension"&&t){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return t.forEach(({data:r})=>r.forEach(({series:a})=>{s.push({seriesId:a.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1})})),{visible:!0,activeType:e,title:i,content:s}}return null}}const see=(n,e=!0)=>({type:n.direction==="horizontal"?"growWidthIn":"growHeightIn",options:{overall:e&&n.growFrom(),orient:"positive"}}),ree=(n,e)=>e==="fadeIn"?{type:"fadeIn"}:see(n),aee=n=>n==="fadeIn"?{type:"fadeIn"}:{type:"linkPathGrowIn"},oee=()=>{D.registerAnimation("sankeyNode",(n,e)=>Object.assign({appear:ree(n,e)},om)),D.registerAnimation("sankeyLinkPath",(n,e)=>({appear:aee(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))};class Ru extends Ti{constructor(){super(...arguments),this.type=Ru.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(e){const t=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=t.glyph("linkPath",e??t.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}Ru.type="linkPath";const lee=()=>{f6(),D.registerMark(Ru.type,Ru)};class ga extends Qn{constructor(){super(...arguments),this.type=z.sankey,this._nodeLayoutZIndex=rt.Node,this._labelLayoutZIndex=rt.Label,this._viewBox=new _i,this._handleAdjacencyClick=e=>{const t=e.item;t&&t.mark.id().includes("node")?this._handleNodeAdjacencyClick(t):t&&t.mark.id().includes("link")?this._handleLinkAdjacencyClick(t):this._handleClearEmpty()},this._handleRelatedClick=e=>{const t=e.item;t&&t.mark.id().includes("node")?this._handleNodeRelatedClick(t):t&&t.mark.id().includes("link")?this._handleLinkRelatedClick(t):this._handleClearEmpty()},this._handleClearEmpty=()=>{const e=this._nodeMark.getProduct();if(!e||!e.elements||!e.elements.length)return;const t=e.elements,i=this._linkMark.getProduct();if(!i||!i.elements||!i.elements.length)return;const s=i.elements,r=this._labelMark.getProduct();if(!r||!r.elements||!r.elements.length)return;const a=r.elements;t.forEach(o=>{o.clearStates()}),s.forEach(o=>{o.clearStates()}),a.forEach(o=>{o.clearStates()})},this._handleNodeAdjacencyClick=e=>{const t=e.getDatum(),i=[t.key];if(this._linkMark){const s=this._linkMark.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((r,a)=>{r.clearStates();const o=r.getDatum(),l=o!=null&&o.parents?"parents":"source";if(N(o[l]).includes(t.key)){let h;if(i.includes(o.source)||i.push(o.source),i.includes(o.target)||i.push(o.target),l==="parents"){const d=o.datum;h=(d?d.filter(u=>u.parents.some(c=>c.key===t.key)).reduce((u,c)=>u+c.value,0):0)/o.value}r.addState("selected",{ratio:h})}else o.target===t.key?i.includes(o.source)||i.push(o.source):r.useStates(["blur"])})}if(this._nodeMark){const s=this._nodeMark.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach(r=>{r.clearStates(),i.includes(r.getDatum().key)||r.useStates(["blur"])})}if(this._labelMark){const s=this._labelMark.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach(r=>{r.clearStates(),i.includes(r.getDatum().key)||r.useStates(["blur"])})}},this._handleLinkAdjacencyClick=e=>{const t=e.getDatum(),i=[t.source,t.target];if(this._linkMark){const s=this._linkMark.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach(r=>{r.clearStates(),r===e?r.addState("selected",{ratio:1}):r.useStates(["blur"])})}if(this._nodeMark){const s=this._nodeMark.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach(r=>{r.clearStates(),i.includes(r.getDatum().key)||r.useStates(["blur"])})}if(this._labelMark){const s=this._labelMark.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach(r=>{r.clearStates(),i.includes(r.getDatum().key)||r.useStates(["blur"])})}},this._handleNodeRelatedClick=e=>{var t;const i=e.getDatum(),s=this._nodeMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements,a=this._linkMark.getProduct();if(!a||!a.elements||!a.elements.length)return;const o=a.elements;if((!((t=o[0].getDatum())===null||t===void 0)&&t.parents?"parents":"source")=="source"){const l=[i.key],h=[];if(o.forEach((d,u)=>{var c,f,p,g;d.clearStates();const _=d.getDatum(),m=_!=null&&_.parents?"parents":"source";if(N(_[m]).includes(i.key)){if(h.includes((c=_.key)!==null&&c!==void 0?c:_.index)||h.push((f=_.key)!==null&&f!==void 0?f:_.index),l.includes(_.source)||l.push(_.source),!l.includes(_.target)){l.push(_.target);let y=r.find(b=>b.data[0].key===_.target).data[0].sourceLinks;for(;(y==null?void 0:y.length)>0;){const b=[];return y.forEach(v=>{var x,S;if(!h.includes((x=v.key)!==null&&x!==void 0?x:v.index)&&(h.push((S=v.key)!==null&&S!==void 0?S:v.index),!l.includes(v.target))){l.push(v.target);const A=r.find(k=>k.data[0].key===v.target);b.push(A.data[0].targetLinks)}}),void(y=b)}}}else if(_.target===i.key&&(h.includes((p=_.key)!==null&&p!==void 0?p:_.index)||h.push((g=_.key)!==null&&g!==void 0?g:_.index),!l.includes(_.source))){l.push(_.source);let y=r.find(b=>b.data[0].key===_.source).data[0].targetLinks;for(;(y==null?void 0:y.length)>0;){const b=[];return y.forEach(v=>{var x,S;if(!h.includes((x=v.key)!==null&&x!==void 0?x:v.index)&&(h.push((S=v.key)!==null&&S!==void 0?S:v.index),!l.includes(v.source))){l.push(v.source);const A=r.find(k=>k.data[0].key===v.source);b.push(A.data[0].targetLinks)}}),void(y=b)}}}),this._linkMark){const d=this._linkMark.getProduct();if(!d||!d.elements||!d.elements.length)return;d.elements.forEach((u,c)=>{var f;u.clearStates(),h.includes((f=u.getDatum().key)!==null&&f!==void 0?f:u.getDatum().index)?u.useStates(["selected"]):u.useStates(["blur"])})}if(this._nodeMark){const d=this._nodeMark.getProduct();if(!d||!d.elements||!d.elements.length)return;d.elements.forEach(u=>{u.clearStates(),l.includes(u.getDatum().key)||u.useStates(["blur"])})}if(this._labelMark){const d=this._labelMark.getProduct();if(!d||!d.elements||!d.elements.length)return;d.elements.forEach(u=>{u.clearStates(),l.includes(u.getDatum().key)||u.useStates(["blur"])})}}else{const l=[i.key],h=i.targetLinks.reduce((d,u)=>(N(u.datum).forEach(c=>{const f=c.parents,p=f.length;for(let g=0;g<p;g++){const _=f[g].key,m=f[g+1]?f[g+1].key:i.key,y=c.value,b=d.find(v=>v.source===_&&v.target===m);b?b.value+=y:d.push({source:_,target:m,value:y})}}),d),[]);if(o.forEach((d,u)=>{d.clearStates();const c=d.getDatum(),f=c!=null&&c.parents?"parents":"source",p=c.datum,g=p?p.filter(m=>m[f].some(y=>y.key===i.key)):null,_=h.find(m=>m.source===c.source&&m.target===c.target);if(g&&g.length){l.includes(c.source)||l.push(c.source),l.includes(c.target)||l.push(c.target);const m=g.reduce((y,b)=>y+b.value,0)/c.value;return d.useStates(["selected"]),void d.addState("selected",{ratio:m})}if(_)return l.includes(c.source)||l.push(c.source),l.includes(c.target)||l.push(c.target),d.useStates(["selected"]),void d.addState("selected",{ratio:_.value/c.value});d.useStates(["blur"])}),this._nodeMark){const d=this._nodeMark.getProduct();if(!d||!d.elements||!d.elements.length)return;d.elements.forEach(u=>{u.clearStates(),l.includes(u.getDatum().key)||u.useStates(["blur"])})}if(this._labelMark){const d=this._labelMark.getProduct();if(!d||!d.elements||!d.elements.length)return;d.elements.forEach(u=>{u.clearStates(),l.includes(u.getDatum().key)||u.useStates(["blur"])})}}},this._handleLinkRelatedClick=e=>{var t;const i=this._nodeMark.getProduct();if(!i||!i.elements||!i.elements.length)return;const s=i.elements,r=this._linkMark.getProduct();if(!r||!r.elements||!r.elements.length)return;const a=r.elements;if((!((t=e.getDatum())===null||t===void 0)&&t.parents?"parents":"source")=="source"){if(this._linkMark){const o=this._linkMark.getProduct();if(!o||!o.elements||!o.elements.length)return;o.elements.forEach(l=>{l.clearStates()})}if(this._nodeMark){const o=this._nodeMark.getProduct();if(!o||!o.elements||!o.elements.length)return;o.elements.forEach(l=>{l.clearStates()})}if(this._labelMark){const o=this._labelMark.getProduct();if(!o||!o.elements||!o.elements.length)return;o.elements.forEach(l=>{l.clearStates()})}}else{const o=e.getDatum(),l=[o.source,o.target],h=[];if(N(o.datum).forEach(d=>{const u=d.parents,c=u.length;for(let f=0;f<c-1;f++){const p=u[f].key,g=u[f+1].key,_=d.value,m=h.find(y=>y.source===p&&y.target===g);h.push({source:u[f].key,target:u[f+1].key,value:d.value}),m?m.value+=_:h.push({source:p,target:g,value:_})}}),a.forEach(d=>{d.clearStates();const u=d.getDatum(),c=u.datum;if(u.source===o.source&&u.target===o.target)return d.useStates(["selected"]),void d.addState("selected",{ratio:1});const f=c?c.filter(g=>{const _=g.parents.map(m=>m.key);return _.includes(o.source)&&_.includes(o.target)}):null;if(f&&f.length){l.includes(u.source)||l.push(u.source),l.includes(u.target)||l.push(u.target);const g=f.filter(m=>m.parents.some((y,b)=>{var v;return y.key===o.source&&((v=m.parents[b+1])===null||v===void 0?void 0:v.key)===o.target})).reduce((m,y)=>m+y.value,0),_=g/u.value;return d.useStates(["selected"]),void d.addState("selected",{ratio:_})}const p=h.find(g=>g.source===u.source&&g.target===u.target);if(p)return l.includes(u.source)||l.push(u.source),l.includes(u.target)||l.push(u.target),d.useStates(["selected"]),void d.addState("selected",{ratio:p.value/u.value});d.useStates(["blur"])}),s.forEach(d=>{d.clearStates(),l.includes(d.getDatum().key)||d.useStates(["blur"])}),this._labelMark){const d=this._labelMark.getProduct();if(!d||!d.elements||!d.elements.length)return;d.elements.forEach(u=>{u.clearStates(),l.includes(u.getDatum().key)||u.useStates(["blur"])})}}}}getCategoryField(){return this._categoryField}setCategoryField(e){return this._categoryField=e,this._categoryField}getValueField(){return this._valueField}setValueField(e){return this._valueField=e,this._valueField}setAttrFromSpec(){var e,t,i;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField((e=this._spec.seriesField)!==null&&e!==void 0?e:this._spec.categoryField),this._labelLimit=(i=(t=this._spec.label)===null||t===void 0?void 0:t.limit)!==null&&i!==void 0?i:100}initData(){var e,t,i,s;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){Ae(this._dataSet,"sankeyLayout",eee),Ae(this._dataSet,"sankeyFormat",QQ),a.transform({type:"sankeyFormat"},!1),r.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this._spec.direction,nodeAlign:(e=this._spec.nodeAlign)!==null&&e!==void 0?e:"justify",nodeGap:(t=this._spec.nodeGap)!==null&&t!==void 0?t:8,nodeWidth:(i=this._spec.nodeWidth)!==null&&i!==void 0?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:(s=this._spec.minNodeHeight)!==null&&s!==void 0?s:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer},level:An.sankeyLayout});const{dataSet:o}=this._option;Ae(o,"sankeyNodes",tee),Ae(o,"flatten",gh);const l=new Ye(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.transform({type:"flatten",options:{callback:d=>{if(d.datum){const u=d.datum[d.depth];return Object.assign(Object.assign({},d),u)}return d}}},!1),l.transform({type:"addVChartProperty",options:{beforeCall:cu.bind(this),call:lh}},!1),this._nodesSeriesData=new Ns(this._option,l),Ae(o,"sankeyLinks",iee);const h=new Ye(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:cu.bind(this),call:lh}},!1),this._linksSeriesData=new Ns(this._option,h)}}initMark(){var e,t,i;const s=this._createMark(ga.mark.node,{isSeriesMark:!0,key:oi,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),customShape:(e=this._spec.node)===null||e===void 0?void 0:e.customShape});s&&(s.setZIndex(this._nodeLayoutZIndex),this._nodeMark=s);const r=this._createMark(ga.mark.link,{key:oi,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),customShape:(t=this._spec.link)===null||t===void 0?void 0:t.customShape});if(r&&(this._linkMark=r),(i=this._spec.label)===null||i===void 0?void 0:i.visible){const a=this._createMark(ga.mark.label,{key:oi,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});a&&(this._labelMark=a)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const e=this._nodeMark;e&&(this.setMarkStyle(e,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>{var i,s,r,a;return(r=(s=(i=this._spec.node)===null||i===void 0?void 0:i.style)===null||s===void 0?void 0:s.fill)!==null&&r!==void 0?r:(a=this._colorScale)===null||a===void 0?void 0:a.scale(this._getNodeNameFromData(t))}},_e.STATE_NORMAL,J.Mark),this._trigger.registerMark(e))}_initLinkMarkStyle(){var e;const t=this._linkMark;t&&(this.setMarkStyle(t,{x0:i=>i.x0,x1:i=>i.x1,y0:i=>i.y0,y1:i=>i.y1,thickness:i=>i.thickness,fill:i=>{var s,r,a,o,l,h;const d=(r=(s=this._spec.link)===null||s===void 0?void 0:s.style)===null||r===void 0?void 0:r.fill;if(d)return d;const u=this._spec.nodeKey||!((l=(o=(a=this._rawData.latestData[0])===null||a===void 0?void 0:a.nodes)===null||o===void 0?void 0:o[0])===null||l===void 0)&&l.children?i.source:this.getNodeList()[i.source];return(h=this._colorScale)===null||h===void 0?void 0:h.scale(u)},direction:(e=this._spec.direction)!==null&&e!==void 0?e:"horizontal"},_e.STATE_NORMAL,J.Series),this._trigger.registerMark(t))}_initLabelMarkStyle(){this._labelMark&&(this._spec.direction==="vertical"?this._spec.label.position==="inside-start"?this.setMarkStyle(this._labelMark,{x:e=>e.x0,y:e=>(e.y0+e.y1)/2,fill:"#ffffff",text:e=>this._createText(e),limit:e=>{var t;return(t=this._spec.label.limit)!==null&&t!==void 0?t:e.x1-e.x0},textAlign:"left",textBaseline:"middle"},_e.STATE_NORMAL,J.Series):this._spec.label.position==="inside-middle"?this.setMarkStyle(this._labelMark,{x:e=>(e.x0+e.x1)/2,y:e=>(e.y0+e.y1)/2,fill:"#ffffff",text:e=>this._createText(e),limit:e=>{var t;return(t=this._spec.label.limit)!==null&&t!==void 0?t:e.x1-e.x0},textAlign:"center",textBaseline:"middle"},_e.STATE_NORMAL,J.Series):this._spec.label.position==="inside-end"?this.setMarkStyle(this._labelMark,{x:e=>e.x1,y:e=>(e.y0+e.y1)/2,fill:"#ffffff",text:e=>this._createText(e),limit:e=>{var t;return(t=this._spec.label.limit)!==null&&t!==void 0?t:e.x1-e.x0},textAlign:"right",textBaseline:"middle"},_e.STATE_NORMAL,J.Series):this.setMarkStyle(this._labelMark,{x:e=>(e.x0+e.x1)/2,y:e=>e.y1>=this._viewBox.y2?e.y0:e.y1,fill:e=>{var t,i,s,r;return(s=(i=(t=this._spec.node)===null||t===void 0?void 0:t.style)===null||i===void 0?void 0:i.fill)!==null&&s!==void 0?s:(r=this._colorScale)===null||r===void 0?void 0:r.scale(this._getNodeNameFromData(e))},text:e=>this._createText(e),limit:this._labelLimit,textAlign:"center",textBaseline:e=>e.y1>=this._viewBox.y2?"bottom":"top"},_e.STATE_NORMAL,J.Series):this._spec.label.position==="inside-start"?this.setMarkStyle(this._labelMark,{x:e=>e.x0,y:e=>(e.y0+e.y1)/2,fill:"#ffffff",text:e=>this._createText(e),limit:e=>{var t;return(t=this._spec.label.limit)!==null&&t!==void 0?t:e.x1-e.x0},textAlign:"left",textBaseline:"middle"},_e.STATE_NORMAL,J.Series):this._spec.label.position==="inside-middle"?this.setMarkStyle(this._labelMark,{x:e=>(e.x0+e.x1)/2,y:e=>(e.y0+e.y1)/2,fill:"#ffffff",text:e=>this._createText(e),limit:e=>{var t;return(t=this._spec.label.limit)!==null&&t!==void 0?t:e.x1-e.x0},textAlign:"center",textBaseline:"middle"},_e.STATE_NORMAL,J.Series):this._spec.label.position==="inside-end"?this.setMarkStyle(this._labelMark,{x:e=>e.x1,y:e=>(e.y0+e.y1)/2,fill:"#ffffff",text:e=>this._createText(e),limit:e=>{var t;return(t=this._spec.label.limit)!==null&&t!==void 0?t:e.x1-e.x0},textAlign:"right",textBaseline:"middle"},_e.STATE_NORMAL,J.Series):this._spec.label.position==="left"?this.setMarkStyle(this._labelMark,{x:e=>e.x0,y:e=>(e.y0+e.y1)/2,fill:e=>{var t,i,s,r;return(s=(i=(t=this._spec.node)===null||t===void 0?void 0:t.style)===null||i===void 0?void 0:i.fill)!==null&&s!==void 0?s:(r=this._colorScale)===null||r===void 0?void 0:r.scale(this._getNodeNameFromData(e))},text:e=>this._createText(e),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},_e.STATE_NORMAL,J.Series):this._spec.label.position==="right"?this.setMarkStyle(this._labelMark,{x:e=>e.x1,y:e=>(e.y0+e.y1)/2,fill:e=>{var t,i,s,r;return(s=(i=(t=this._spec.node)===null||t===void 0?void 0:t.style)===null||i===void 0?void 0:i.fill)!==null&&s!==void 0?s:(r=this._colorScale)===null||r===void 0?void 0:r.scale(this._getNodeNameFromData(e))},text:e=>this._createText(e),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},_e.STATE_NORMAL,J.Series):this.setMarkStyle(this._labelMark,{x:e=>e.x1>=this._viewBox.x2?e.x0:e.x1,y:e=>(e.y0+e.y1)/2,fill:e=>{var t,i,s,r;return(s=(i=(t=this._spec.node)===null||t===void 0?void 0:t.style)===null||i===void 0?void 0:i.fill)!==null&&s!==void 0?s:(r=this._colorScale)===null||r===void 0?void 0:r.scale(this._getNodeNameFromData(e))},text:e=>this._createText(e),limit:this._labelLimit,textAlign:e=>e.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},_e.STATE_NORMAL,J.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark))}_createText(e){var t;if(C(e)||C(e.datum))return"";let i=e.datum[this._spec.categoryField]||"";return!((t=this._spec.label)===null||t===void 0)&&t.formatMethod&&(i=this._spec.label.formatMethod(i,e.datum)),i}initAnimation(){var e,t,i,s,r;const a={direction:this.direction,growFrom:()=>{var l,h;return this.direction==="horizontal"?(l=this._xAxisHelper)===null||l===void 0?void 0:l.getScale(0).scale(0):(h=this._yAxisHelper)===null||h===void 0?void 0:h.getScale(0).scale(0)}},o=(t=(e=this._spec)===null||e===void 0?void 0:e.animationAppear)===null||t===void 0?void 0:t.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(Le((i=D.getAnimationInKey("sankeyNode"))===null||i===void 0?void 0:i(a,o),Ge("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(Le((s=D.getAnimationInKey("sankeyLinkPath"))===null||s===void 0?void 0:s(a,o),Ge("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(Le((r=D.getAnimationInKey("fadeInOut"))===null||r===void 0?void 0:r(),Ge("label",this._spec,this._markAttributeContext)))}initEvent(){var e,t,i;super.initEvent(),(e=this._nodesSeriesData.getDataView())===null||e===void 0||e.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),(t=this._linksSeriesData.getDataView())===null||t===void 0||t.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=(i=this._spec.emphasis)!==null&&i!==void 0?i:{};this._option.disableTriggerEvent!==!0&&(s.enable&&s.effect==="adjacency"&&(s.trigger==="hover"?this.event.on("pointerover",{level:We.chart},this._handleAdjacencyClick):this.event.on("pointerdown",{level:We.chart},this._handleAdjacencyClick)),s.enable&&s.effect==="related"&&(s.trigger==="hover"?this.event.on("pointerover",{level:We.chart},this._handleRelatedClick):this.event.on("pointerdown",{level:We.chart},this._handleRelatedClick)))}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}initTooltip(){this._tooltipHelper=new nee(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}_setNodeOrdinalColorScale(){var e,t,i,s,r;const a=(t=(e=this._option)===null||e===void 0?void 0:e.globalScale)===null||t===void 0?void 0:t.getScale("color");if(a!=null&&a._specified)return void(this._colorScale=a);let o,l;a&&(o=a.domain(),l=a.range()),l||(l=this._getDataScheme()),o&&!C(o[0])||(o=this.getNodeList(),o.length>10&&(l=(i=this._getDataScheme()[1])===null||i===void 0?void 0:i.scheme));const h=new Qu;(r=(s=h.domain(o)).range)===null||r===void 0||r.call(s,l),this._colorScale=h}getNodeList(){var e,t,i;return!((e=this._rawData.latestData[0])===null||e===void 0)&&e.nodes?!((t=this._rawData.latestData[0].nodes[0])===null||t===void 0)&&t.children?Array.from(this.extractNamesFromTree(this._rawData.latestData[0].nodes,this._spec.categoryField)):this._rawData.latestData[0].nodes.map((s,r)=>s[this._spec.categoryField]):(i=this._rawData.latestData[0])===null||i===void 0?void 0:i.values.map((s,r)=>s[this._spec.categoryField])}_getNodeNameFromData(e){return e!=null&&e.datum?e==null?void 0:e.datum[this._spec.categoryField]:e[this._spec.categoryField]}extractNamesFromTree(e,t){const i=new Set;return e.forEach(s=>{i.add(s[t]),s.children&&this.extractNamesFromTree(s.children,t).forEach(r=>i.add(r))}),i}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(e,t){var i;return this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[e]&&(this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(!((i=this._viewDataStatistics.latestData)===null||i===void 0)&&i[e])?this._rawStatisticsCache[e]=this._viewDataStatistics.latestData[e]:this._rawData&&(this._rawStatisticsCache[e]={values:this._collectByField(e)})),this._rawStatisticsCache[e]}_collectByField(e){var t,i,s;const r=[],a=(i=(t=this.getRawData())===null||t===void 0?void 0:t.latestData)===null||i===void 0?void 0:i[0];if(!a)return[];if(a.links)!((s=a.nodes)===null||s===void 0)&&s.length&&a.nodes.forEach(o=>{o[this._seriesField]&&r.push(o[this._seriesField])});else if(a.nodes){const o=new Set;return qL(o,a.nodes,this._seriesField),Array.from(o)}return r}onLayoutEnd(e){super.onLayoutEnd(e),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}_noAnimationDataKey(e,t){}getActiveMarks(){return[this._nodeMark,this._linkMark]}}ga.type=z.sankey,ga.mark=eB;const hee=()=>{JQ(),La(),lee(),wn(),oee(),Mr(),D.registerSeries(ga.type,ga)},dee=(n,e)=>{if(!n||!(e!=null&&e.range))return n;const t=e.range();return t.x1-t.x0==0||t.y1-t.y0==0?n:new mm(e).layout(n,t)},uee=(n,e)=>{let t={},i=e.fields;if(Y(i)&&(i=i()),!(i!=null&&i.length)||!(n!=null&&n.length)||!n[0].latestData)return t;const s=n[0].latestData,r=gh(s);return t=ex([{latestData:r}],e),t};class cee extends rn{constructor(){super(...arguments),this.contentKeyCallback=e=>e==null?void 0:e[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const fee=n=>n==="fadeIn"?{type:"fadeIn"}:{type:"growCenterIn"},pee=()=>{D.registerAnimation("treemap",(n,e)=>({appear:fee(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))};class JL extends kn{_transformLabelSpec(e){this._addMarkLabelSpec(e,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(e,"leaf")}}class Is extends Qn{constructor(){super(...arguments),this.type=z.treemap,this.transformerConstructor=JL,this._viewBox=new _i,this._enableAnimationHook=this.enableMarkAnimation.bind(this)}getCategoryField(){return this._categoryField}setCategoryField(e){return this._categoryField=e,this._categoryField}getValueField(){return this._valueField}setValueField(e){return this._valueField=e,this._valueField}setAttrFromSpec(){var e;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField((e=this._spec.seriesField)!==null&&e!==void 0?e:Ma),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ft),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,i;return(i=(t=this._spec.drillField)!==null&&t!==void 0?t:this._categoryField)!==null&&i!==void 0?i:Vs},getRawData:()=>this.getRawData()}),j(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var e,t,i,s;super.initData(),this.getViewData()&&(this._spec.drill&&this.initDrillableData(this._dataSet),Ae(this._dataSet,"treemap",dee),Ae(this._dataSet,"flatten",gh),this.addViewDataFilter({type:"treemap",options:{range:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:!((e=this._spec.nonLeafLabel)===null||e===void 0)&&e.visible?(t=this._spec.nonLeafLabel)===null||t===void 0?void 0:t.padding:0,labelPosition:(i=this._spec.nonLeafLabel)===null||i===void 0?void 0:i.position,minVisibleArea:(s=this._spec.minVisibleArea)!==null&&s!==void 0?s:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize},level:An.treemapFilter}),this.addViewDataFilter({type:"flatten",options:{callback:r=>{if(r.datum){const a=r.datum[r.depth];return Object.assign(Object.assign({},r),a)}return r}},level:An.treemapFlatten}))}_addDataIndexAndKey(){var e;!((e=this._rawData)===null||e===void 0)&&e.dataSet&&(Ae(this._rawData.dataSet,"addVChartProperty",Th),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:G0.bind(this),call:hm}}))}getRawDataStatisticsByField(e,t){var i;if(!this._rawDataStatistics){const s=`${this.type}_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(s,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}return(i=this._rawDataStatistics.latestData)===null||i===void 0?void 0:i[e]}_createHierarchyDataStatistics(e,t){Ae(this._dataSet,"hierarchyDimensionStatistics",uee),Ae(this._dataSet,"flatten",gh);const i=new Ye(this._dataSet,{name:e});return i.parse(t,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const s=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&s.push({key:this._seriesField,operations:["values"]}),s}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:uu,operations:["max","min","values"]},{key:Ma,operations:["values"]}])}initMark(){var e,t;const i=this._createMark(Is.mark.nonLeaf,{isSeriesMark:!0,customShape:(e=this._spec.nonLeaf)===null||e===void 0?void 0:e.customShape});i&&(i.setTransform([{type:"filter",callback:r=>!this._shouldFilterElement(r,"nonLeaf")}]),this._trigger.registerMark(i),this._nonLeafMark=i);const s=this._createMark(Is.mark.leaf,{isSeriesMark:!0,customShape:(t=this._spec.leaf)===null||t===void 0?void 0:t.customShape});s&&(s.setTransform([{type:"filter",callback:r=>!this._shouldFilterElement(r,"leaf")}]),this._leafMark=s,this._trigger.registerMark(s))}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:e=>e.x0,y:e=>e.y0,x1:e=>e.x1,y1:e=>e.y1,fill:this.getColorAttribute()},_e.STATE_NORMAL,J.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:e=>e.x0,y:e=>e.y0,x1:e=>e.x1,y1:e=>e.y1,fill:this.getColorAttribute()},_e.STATE_NORMAL,J.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var i;return(i=t.datum[t.depth])===null||i===void 0?void 0:i[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},_e.STATE_NORMAL,J.Series))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var i;return(i=t.datum[t.depth])===null||i===void 0?void 0:i[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},_e.STATE_NORMAL,J.Series))}initAnimation(){this.getMarksInType("rect").forEach(e=>{var t;e.setAnimationConfig(Le((t=D.getAnimationInKey("treemap"))===null||t===void 0?void 0:t(),Ge(e.name,this._spec,this._markAttributeContext)))}),this.getMarksInType("text").forEach(e=>{var t;e.setAnimationConfig(Le((t=D.getAnimationInKey("fadeInOut"))===null||t===void 0?void 0:t(),Ge(e.name,this._spec,this._markAttributeContext)))})}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",e=>{this.handlePan(e)}),this.initZoomEventOfSeries(this),this.event.on("zoom",e=>{this.handleZoom(e)})),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new cee(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(e,t){const i=e.isLeaf;return t==="leaf"?!i:i}handlePan(e){const{delta:t}=e;if(t[0]===0&&t[1]===0)return;this._matrix.reset(),this._matrix.translate(t[0],t[1]);const{a:i,b:s,c:r,d:a,e:o,f:l}=this._matrix;this._matrix.multiply(i,s,r,a,o,l),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(e){const{scale:t,scaleCenter:i}=e;if(t===1)return;this._matrix.reset();const{x:s,y:r}=i;this._matrix.translate(s,r),this._matrix.scale(t,t),this._matrix.translate(-s,-r);const{a,b:o,c:l,d:h,e:d,f:u}=this._matrix;this._matrix.multiply(a,o,l,h,d,u),this.disableMarkAnimation(),this.event.on(de.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(e){super.onLayoutEnd(e),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach(e=>{var t;(t=e.getProduct().animate)===null||t===void 0||t.enable()}),[this._labelMark,this._nonLeafLabelMark].forEach(e=>{e&&e.getComponent()&&e.getComponent().getProduct().getGroupGraphicItem().enableAnimation()}),this.event.off(de.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach(e=>{var t;(t=e.getProduct().animate)===null||t===void 0||t.disable()}),[this._labelMark,this._nonLeafLabelMark].forEach(e=>{e&&e.getComponent()&&e.getComponent().getProduct().getGroupGraphicItem().disableAnimation()})}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}}Is.type=z.treemap,Is.mark=QO,Is.transformerConstructor=JL,li(Is,Q0),li(Is,Y0);const gee=()=>{La(),wn(),pee(),Mr(),D.registerSeries(Is.type,Is)},_ee=n=>({channel:{angle:{from:n.startAngle+Math.PI/2}}}),mee={type:"fadeIn"};function yee(n,e){return e==="fadeIn"?mee:_ee(n)}const bee=()=>{D.registerAnimation("gaugePointer",(n,e)=>{const t=yee(n,e);return{appear:t,enter:t,disappear:{type:"fadeOut"}}})};class _a extends Ch{constructor(){super(...arguments),this.type=z.gaugePointer,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null,this._stack=!1}setAttrFromSpec(){var e;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType=((e=this._spec.pointer)===null||e===void 0?void 0:e.type)==="rect"?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(_a.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},_a.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(_a.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const e=this._pointerMark,t=this._spec.pointer;e&&(this.setMarkStyle(e,{x:i=>{var s,r;const{x:a}=this._getPointerAnchor(i,t);return a-this._getPointerWidth()*((r=(s=t==null?void 0:t.center)===null||s===void 0?void 0:s[0])!==null&&r!==void 0?r:0)},y:i=>{var s,r;const{y:a}=this._getPointerAnchor(i,t);return a-this._getPointerHeight(i)*((r=(s=t==null?void 0:t.center)===null||s===void 0?void 0:s[1])!==null&&r!==void 0?r:0)},anchor:i=>{const{x:s,y:r}=this._getPointerAnchor(i,t);return[s,r]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType==="path"?this.setMarkStyle(e,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:i=>this._getPointerAngle(i)+Math.PI/2}):this.setMarkStyle(e,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:i=>this._getPointerAngle(i)-Math.PI/2}),this._trigger.registerMark(e))}initTooltip(){super.initTooltip(),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(e,t){var i;return(i=t.isOnCenter)===null||i===void 0||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([e[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(e){var t,i;const s=this._spec.pointer,r=this._radiusField[0];return P(this.radiusAxisHelper)&&P(r)?this.radiusAxisHelper.dataToPosition([e[r]])-((t=s==null?void 0:s.innerPadding)!==null&&t!==void 0?t:0)-((i=s==null?void 0:s.outerPadding)!==null&&i!==void 0?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(e){return this.angleAxisHelper.dataToPosition([e[this._angleField[0]]])}_getRotatedPointerCenterOffset(e){var t,i,s,r;const a=this._spec.pointer,o=this._getPointerWidth()*((i=(t=a==null?void 0:a.center)===null||t===void 0?void 0:t[0])!==null&&i!==void 0?i:0),l=-this._getPointerHeight(e)*((r=(s=a==null?void 0:a.center)===null||s===void 0?void 0:s[1])!==null&&r!==void 0?r:0),h=this._getPointerAngle(e)-Math.PI/2,d=Math.cos(h),u=Math.sin(h);return{x:o*d+l*u,y:-(l*d-o*u)}}initPinBackgroundMarkStyle(){const e=this._pinBackgroundMark,t=this._spec.pinBackground;e&&this.setMarkStyle(e,{x:i=>this._getPointerAnchor(i,t).x,y:i=>this._getPointerAnchor(i,t).y,scaleX:()=>t.width*this._computeLayoutRadius(),scaleY:()=>t.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const e=this._pinMark,t=this._spec.pin;e&&this.setMarkStyle(e,{x:i=>this._getPointerAnchor(i,t).x,y:i=>this._getPointerAnchor(i,t).y,scaleX:()=>t.width*this._computeLayoutRadius(),scaleY:()=>t.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){var e,t,i;const s=(t=(e=this._spec)===null||e===void 0?void 0:e.animationAppear)===null||t===void 0?void 0:t.preset;this._pointerMark.setAnimationConfig(Le((i=D.getAnimationInKey("gaugePointer"))===null||i===void 0?void 0:i({startAngle:this._startAngle},s),Ge("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}_a.type=z.gaugePointer,_a.mark=iB;const vee=()=>{uL(),La(),bee(),D.registerSeries(_a.type,_a)};class QL extends kn{_transformLabelSpec(e){this._addMarkLabelSpec(e,"segment")}}class ma extends Ch{constructor(){super(...arguments),this.type=z.gauge,this.transformerConstructor=QL,this._segmentMark=null,this._trackMark=null,this._stack=!1,this._padAngle=0}setAttrFromSpec(){var e;super.setAttrFromSpec(),this._padAngle=st((e=this._spec.padAngle)!==null&&e!==void 0?e:0)}initData(){var e;super.initData(),Ae(this._option.dataSet,"spiltSegment",(t,i)=>{const s=t.slice();return s.sort((r,a)=>r[this._angleField[0]]-a[this._angleField[0]]),s.forEach((r,a)=>{r[gy]=r[this._angleField[0]],r[bf]=a>0?s[a-1][gy]:void 0}),s}),(e=this.getViewData())===null||e===void 0||e.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(ma.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(ma.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var e;const t=this._segmentMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var i;return this._computeLayoutRadius()*((i=this._spec.innerRadius)!==null&&i!==void 0?i:0)},outerRadius:()=>{var i,s;return this._computeLayoutRadius()*((s=(i=this._spec.radius)!==null&&i!==void 0?i:this._spec.outerRadius)!==null&&s!==void 0?s:1)},cap:(e=this._spec.roundCap)!==null&&e!==void 0&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t))}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var e;const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var i;return this._computeLayoutRadius()*((i=this._spec.innerRadius)!==null&&i!==void 0?i:0)},outerRadius:()=>{var i,s;return this._computeLayoutRadius()*((s=(i=this._spec.radius)!==null&&i!==void 0?i:this._spec.outerRadius)!==null&&s!==void 0?s:1)},cap:(e=this._spec.roundCap)!==null&&e!==void 0&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStartWithoutMask(e){const t=this._getAngleValueStartWithoutPadAngle(e),i=this._getAngleValueEndWithoutPadAngle(e);return Math.min(t+this._padAngle/2,(t+i)/2)}_getAngleValueEndWithoutMask(e){const t=this._getAngleValueStartWithoutPadAngle(e),i=this._getAngleValueEndWithoutPadAngle(e);return Math.max(i-this._padAngle/2,(t+i)/2)}_getAngleValueStartWithoutPadAngle(e){return P(e[bf])?this.angleAxisHelper.dataToPosition([e[bf]]):this._startAngle}_getAngleValueEndWithoutPadAngle(e){return this.angleAxisHelper.dataToPosition([e[gy]])}initAnimation(){var e,t,i;const s=(t=(e=this._spec)===null||e===void 0?void 0:e.animationAppear)===null||t===void 0?void 0:t.preset;this._segmentMark.setAnimationConfig(Le((i=D.getAnimationInKey("circularProgress"))===null||i===void 0?void 0:i({startAngle:this._startAngle},s),Ge("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}ma.type=z.gauge,ma.mark=tB,ma.transformerConstructor=QL;const xee=()=>{PL(),EL(),D.registerSeries(ma.type,ma)};class Ou extends ZB{constructor(){super(...arguments),this.type=Ou.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}Ou.type="cell";const See=()=>{D.registerMark(Ou.type,Ou),Z8(),J7()};function Aee(n){return n===!1?{}:{type:"fadeIn"}}const kee=()=>{D.registerAnimation("heatmap",(n,e)=>Object.assign(Object.assign({},om),{appear:Aee(e)}))};class wee extends rn{getDefaultTooltipPattern(e,t){const i=super.getDefaultTooltipPattern(e,t);return P(i)&&e==="dimension"&&(i.visible=!1),i}}class eI extends kn{_transformLabelSpec(e){this._addMarkLabelSpec(e,"cell")}}class gr extends Qn{constructor(){super(...arguments),this.type=z.heatmap,this.transformerConstructor=eI}getFieldValue(){return this._fieldValue}setFieldValue(e){this._fieldValue=N(e)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var e,t;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(gr.mark.cell,{morph:Tr(this._spec,gr.mark.cell.name),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,progressive:i,customShape:(e=this._spec.cell)===null||e===void 0?void 0:e.customShape}),this._backgroundMark=this._createMark(gr.mark.cellBackground,{progressive:i,customShape:(t=this._spec.cellBackground)===null||t===void 0?void 0:t.customShape})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:e=>this.dataToPositionX(e),y:e=>this.dataToPositionY(e),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",J.Series),this._trigger.registerMark(this._cellMark)}initCellBackgroundMarkStyle(){var e,t,i;const s=tn((i=(t=(e=this._spec.cellBackground)===null||e===void 0?void 0:e.style)===null||t===void 0?void 0:t.padding)!==null&&i!==void 0?i:0);this.setMarkStyle(this._backgroundMark,{x:r=>{const a=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(r)-a/2+s[3]},y:r=>{const a=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(r)-a/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",J.Series)}getColorAttribute(){var e;return{scale:(e=this._option.globalScale.getScale("color"))!==null&&e!==void 0?e:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){var e,t,i;const s=(t=(e=this._spec)===null||e===void 0?void 0:e.animationAppear)===null||t===void 0?void 0:t.preset,r=Oa(this);this._cellMark.setAnimationConfig(Le((i=D.getAnimationInKey("heatmap"))===null||i===void 0?void 0:i(s),Ge("cell",this._spec,this._markAttributeContext),r))}getCellSize(e){var t,i;return(i=(t=e.getBandwidth)===null||t===void 0?void 0:t.call(e,0))!==null&&i!==void 0?i:6}initTooltip(){this._tooltipHelper=new wee(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}gr.type=z.heatmap,gr.mark=oB,gr.transformerConstructor=eI;const Mee=()=>{wn(),See(),kee(),D.registerSeries(gr.type,gr)},Tee=(n,e)=>{var t,i,s,r,a,o,l,h,d,u,c,f,p,g,_;if(!n||!(e!=null&&e.view)||!W(n))return n;const m=e.view();if(m.x1-m.x0==0||m.y1-m.y0==0||m.x1-m.x0==-1/0||m.x1-m.x0==1/0||m.y1-m.y0==-1/0||m.y1-m.y0==1/0)return n;const y=st((t=e.startAngle)!==null&&t!==void 0?t:-90),b=st((i=e.endAngle)!==null&&i!==void 0?i:270),v=Math.max((m.x1-m.x0)/2,(m.y1-m.y0)/2),x=bn((s=e.innerRadius)!==null&&s!==void 0?s:0,v),S=bn(e.outerRadius,v),A=[oe((r=e.center)===null||r===void 0?void 0:r[0])?e.center[0]:m.x0+bn((o=(a=e.center)===null||a===void 0?void 0:a[0])!==null&&o!==void 0?o:"50%",m.x1-m.x0),oe((l=e.center)===null||l===void 0?void 0:l[1])?e.center[1]:m.y0+bn((d=(h=e.center)===null||h===void 0?void 0:h[1])!==null&&d!==void 0?d:"50%",m.y1-m.y0)],k=ys(e.field),w=n.map(k),[M,T]=ev(w),E=M===T?U=>(x+S)/2:U=>x+(S-x)*(U-M)/(T-M),O=C(e.radiusField)?k:ys(e.radiusField),B=(c=(u=e==null?void 0:e.radiusRange)===null||u===void 0?void 0:u[1])!==null&&c!==void 0?c:5;let R=U=>B;if(O){const[U,$]=O!==k?ev(n.map(O)):[M,T],Z=(p=(f=e.radiusRange)===null||f===void 0?void 0:f[0])!==null&&p!==void 0?p:5,q=(_=(g=e.radiusRange)===null||g===void 0?void 0:g[1])!==null&&_!==void 0?_:5;U!==$&&(R=ie=>Z+(q-Z)*(O(ie)-U)/($-U))}const L=Math.min(y,b),I=Math.max(y,b),F=Cee(L,I,n.length),H=[],G=(I-L)/60;return n.forEach((U,$)=>{const Z=E(w[$]),q=R(U);let ie,K,V=F[$];for(let te=0;te<60&&(ie=A[0]+Z*Math.cos(V),K=A[1]+Z*Math.sin(V),Pee({x:ie,y:K,size:q},H)||ie-q<m.x0||ie+q>m.x1||K-q<m.y0||K+q>m.y1);te++)te<59&&(V+=G,V>I?V=L:V<L&&(V=I));H.push(Object.assign({[LO]:ie,[IO]:K,[DO]:q},U))}),H},Cee=(n,e,t)=>{let i=0,s=Math.max(Math.ceil(2*(e-n)/Math.PI),2),r=(e-n)/s,a=0,o=1,l=0,h=0;const d=[];let u=n;for(;l<t;)h<s&&(d.push(u+(h%2?Math.floor(h/2)+Math.floor(s/2):h/2)*r*o),h++),l++,h===s&&(h=0,a+=1,o*=-1,i===0?i=r/2:i/=2,u=o===-1?e-i:n+i,a>=2&&(r/=2,s*=2));return d},Pee=(n,e)=>!(!e||!e.length)&&e.some(t=>Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2)<Math.pow(n.size+t.size,2)),Eee=(n,e)=>{if(!n||!W(n))return[];const{keyword:t,categoryField:i}=e,s=n[0].latestData[0];return{[i]:t,[oi]:s==null?void 0:s[oi],[vn]:s==null?void 0:s[vn]}};class Bu extends Ti{constructor(){super(...arguments),this.type=Bu.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(e){const t=this.getVGrammarView(),i=this.getProductId();this._product=t.glyph("ripplePoint",e??t.rootMark).id(i),this._compiledProductId=i}}Bu.type="ripple";const Ree=()=>{D.registerMark(Bu.type,Bu),a6()},Oee=(n,e)=>e==="fadeIn"?{type:"fadeIn"}:{type:"scaleIn"},Bee=()=>{D.registerAnimation("correlation",(n,e)=>Object.assign({appear:Oee(0,e)},j0))};class tI extends kn{_transformLabelSpec(e){this._addMarkLabelSpec(e,"nodePoint"),this._addMarkLabelSpec(e,"centerPoint","centerLabel")}}class _r extends ac{constructor(){super(...arguments),this.type=z.correlation,this.transformerConstructor=tI,this._viewBox=new _i}getCategoryField(){return this._categoryField}setCategoryField(e){return this._categoryField=e,this._categoryField}getValueField(){return this._valueField}setValueField(e){return this._valueField=e,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(e){P(e)&&(this._seriesField=e)}getSizeField(){return this._sizeField}setSizeField(e){P(e)&&(this._sizeField=e)}getSizeRange(){return this._sizeRange}setSizeRange(e){P(e)&&(this._sizeRange=e)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var e,t,i;if(super.initData(),!this._data)return;Ae(this._dataSet,"correlation",Tee);const s=new to;pr(s,"dataview",c_),Ae(s,"correlationCenter",Eee);const r=new Ye(s,{name:`${this.type}_${this.id}_center`});r.parse([this.getViewData()],{type:"dataview"}),r.transform({type:"correlationCenter",options:{keyword:(i=(t=(e=this._spec.centerLabel)===null||e===void 0?void 0:e.style)===null||t===void 0?void 0:t.text)!==null&&i!==void 0?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new Ns(this._option,r)}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var e,t;const i=this._createMark(_r.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:oi,customShape:(e=this._spec.nodePoint)===null||e===void 0?void 0:e.customShape});i&&(i.setZIndex(rt.Node),this._nodePointMark=i);const s=this._createMark(_r.mark.ripplePoint,{key:oi,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(this._ripplePointMark=s);const r=this._createMark(_r.mark.centerPoint,{key:oi,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),customShape:(t=this._spec.centerPoint)===null||t===void 0?void 0:t.customShape});r&&(r.setZIndex(rt.Node),this._centerPointMark=r)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,t,i,s;const r=this._nodePointMark;if(!r)return;const a=(t=(e=this._spec.nodePoint)===null||e===void 0?void 0:e.style)!==null&&t!==void 0?t:{};this.setMarkStyle(r,{x:o=>o[LO],y:o=>o[IO],size:o=>o[DO],fill:(i=a.fill)!==null&&i!==void 0?i:this.getColorAttribute(),fillOpacity:(s=a.fillOpacity)!==null&&s!==void 0?s:1,lineWidth:0},_e.STATE_NORMAL,J.Series),this._trigger.registerMark(r)}_initRipplePointMarkStyle(){var e,t,i,s,r;const a=this._ripplePointMark;if(!a)return;const o=(t=(e=this._spec.ripplePoint)===null||e===void 0?void 0:e.style)!==null&&t!==void 0?t:{};this.setMarkStyle(a,{x:()=>{var l;return(l=this._spec.centerX)!==null&&l!==void 0?l:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var l;return(l=this._spec.centerY)!==null&&l!==void 0?l:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:(i=o.fill)!==null&&i!==void 0?i:this.getColorAttribute(),opacity:(s=o.fillOpacity)!==null&&s!==void 0?s:.2,ripple:(r=o.ripple)!==null&&r!==void 0?r:0},_e.STATE_NORMAL,J.Series)}_initCenterPointMarkStyle(){var e,t,i,s,r,a;const o=this._centerPointMark;o&&(this.setMarkStyle(o,{x:()=>{var l;return(l=this._spec.centerX)!==null&&l!==void 0?l:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var l;return(l=this._spec.centerY)!==null&&l!==void 0?l:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:(i=(t=(e=this._spec.centerPoint)===null||e===void 0?void 0:e.style)===null||t===void 0?void 0:t.fill)!==null&&i!==void 0?i:this.getColorAttribute(),fillOpacity:(a=(r=(s=this._spec.centerPoint)===null||s===void 0?void 0:s.style)===null||r===void 0?void 0:r.fillOpacity)!==null&&a!==void 0?a:1},_e.STATE_NORMAL,J.Series),this._trigger.registerMark(o))}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},_e.STATE_NORMAL,J.Series)}initAnimation(){var e,t;const i=(e=this._spec.animationAppear)===null||e===void 0?void 0:e.preset;this._nodePointMark.setAnimationConfig(Le((t=D.getAnimationInKey("correlation"))===null||t===void 0?void 0:t({},i),Ge("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(e){super.onLayoutEnd(e),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}_r.type=z.correlation,_r.mark=lB,_r.transformerConstructor=tI;const Lee=()=>{Ba(),Ree(),D.registerSeries(_r.type,_r),Bee()};class iI extends es{_isValidSeries(e){return e===z.map}_getDefaultSeriesSpec(e){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{type:e.type,nameField:e.nameField,valueField:e.valueField,seriesField:e.seriesField,map:e.map,nameProperty:e.nameProperty,centroidProperty:e.centroidProperty,nameMap:e.nameMap,area:e.area,defaultFillColor:e.defaultFillColor})}transformSpec(e){super.transformSpec(e),e.region.forEach(i=>{i.coordinate="geo"});const t=this._getDefaultSeriesSpec(e);e.series&&e.series.length!==0?e.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(t).forEach(s=>{s in i||(i[s]=t[s])})}):e.series=[t]}}class al extends yt{constructor(){super(...arguments),this.transformerConstructor=iI,this.type="map",this.seriesType=z.map}}al.type="map",al.seriesType=z.map,al.view="singleDefault",al.transformerConstructor=iI;const Iee=()=>{Yq(),D.registerChart(al.type,al)};class eS extends es{_isValidSeries(e){return!this.seriesType||e===this.seriesType}getIndicatorSpec(e){var t,i,s;const r=N(e.indicator),a=(t=e.innerRadius)!==null&&t!==void 0?t:(s=(i=e.series)===null||i===void 0?void 0:i[0])===null||s===void 0?void 0:s.innerRadius;return P(a)&&r.forEach(o=>{C(o.limitRatio)&&(o.limitRatio=a)}),r}_getDefaultSeriesSpec(e){const t=Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{radius:e.radius,outerRadius:e.outerRadius,innerRadius:e.innerRadius,startAngle:e.startAngle,endAngle:e.endAngle,sortDataByAxis:e.sortDataByAxis}),i=this.seriesType;return i&&(t.type=i,t[i]=e[i]),t}transformSpec(e){super.transformSpec(e),W(e.dataZoom)&&e.dataZoom.length>0&&e.dataZoom.forEach(i=>{i.filterMode==="axis"&&(i.filterMode="filter")});const t=this._getDefaultSeriesSpec(e);e.series&&e.series.length!==0?e.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(t).forEach(s=>{s in i||(i[s]=t[s])})}):e.series=[t],P(e.indicator)&&(e.indicator=this.getIndicatorSpec(e))}}class nI extends eS{needAxes(){return!1}_getDefaultSeriesSpec(e){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{seriesField:e.seriesField,categoryField:e.categoryField||e.radiusField,valueField:e.valueField||e.angleField,startAngle:e.startAngle,endAngle:e.endAngle,radius:e.radius,innerRadius:e.innerRadius,centerX:e.centerX,centerY:e.centerY})}_transformProgressAxisSpec(e,t,i,s,r){var a,o;e.axes||(e.axes=[]);let l=((a=e.axes)!==null&&a!==void 0?a:[]).find(u=>u.orient==="radius"),h=((o=e.axes)!==null&&o!==void 0?o:[]).find(u=>u.orient==="angle");h||(h=t,e.axes.push(h)),l||(l=i,e.axes.push(l)),C(h.type)&&(h.type="linear"),C(l.type)&&(l.type="band");const d=vu(h,{min:0,max:1});C(h.min)&&(h.min=d.min),C(h.max)&&(h.max=d.max),s&&Object.assign(h,pe({},s,h)),r&&Object.assign(l,pe({},r,l))}}class sI extends eS{needAxes(){return!0}_getDefaultSeriesSpec(e){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{categoryField:e.categoryField||e.angleField,valueField:e.valueField||e.radiusField})}transformSpec(e){var t;if(super.transformSpec(e),this.needAxes()){e.axes||(e.axes=[]);const i={radius:!1,angle:!1};((t=e.axes)!==null&&t!==void 0?t:[]).forEach(s=>{const{orient:r}=s;r==="radius"&&(i.radius=!0),r==="angle"&&(i.angle=!0)}),i.angle||e.axes.push({orient:"angle"}),i.radius||e.axes.push({orient:"radius"})}}}class hc extends eS{needAxes(){return!1}_getDefaultSeriesSpec(e){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{categoryField:e.categoryField||e.seriesField,valueField:e.valueField||e.angleField,center:e.center,centerOffset:e.centerOffset,cornerRadius:e.cornerRadius,padAngle:e.padAngle,minAngle:e.minAngle})}}class tS extends yt{constructor(){super(...arguments),this.transformerConstructor=hc}}tS.transformerConstructor=hc;class ol extends tS{constructor(){super(...arguments),this.transformerConstructor=hc,this.type="pie",this.seriesType=z.pie}}ol.type="pie",ol.seriesType=z.pie,ol.view="singleDefault",ol.transformerConstructor=hc;const Dee=()=>{AZ(),D.registerChart(ol.type,ol)};class rI extends hc{transformSpec(e){super.transformSpec(e),e.series.forEach(t=>{t.type==="pie3d"&&(t.angle3d=e.angle3d)})}}class ll extends tS{constructor(){super(...arguments),this.transformerConstructor=rI,this.type="pie3d",this.seriesType=z.pie3d}}ll.type="pie3d",ll.seriesType=z.pie3d,ll.view="singleDefault",ll.transformerConstructor=rI;const Fee=()=>{wZ(),D.registerChart(ll.type,ll)};class aI extends sI{_getDefaultSeriesSpec(e){var t,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{radius:(t=e.radius)!==null&&t!==void 0?t:eu,outerRadius:(i=e.outerRadius)!==null&&i!==void 0?i:eu,innerRadius:(s=e.innerRadius)!==null&&s!==void 0?s:0,seriesField:e.seriesField,stack:e.stack,percent:e.percent})}transformSpec(e){var t;super.transformSpec(e),((t=e.axes)!==null&&t!==void 0?t:[]).forEach(i=>{["domainLine","grid","label","tick"].forEach(s=>{i[s]||(i[s]={visible:!1})}),i.orient==="angle"&&C(i.bandPosition)&&(i.bandPosition=.5)}),e.crosshair=N(e.crosshair||{}).map(i=>pe({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},i))}}class hl extends yt{constructor(){super(...arguments),this.transformerConstructor=aI,this.type="rose",this.seriesType=z.rose,this._canStack=!0}}hl.type="rose",hl.seriesType=z.rose,hl.view="singleDefault",hl.transformerConstructor=aI;const zee=()=>{OZ(),D.registerChart(hl.type,hl)};class oI extends sI{_getDefaultSeriesSpec(e){var t;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{seriesField:e.seriesField,line:e.line,point:e.point,stack:e.stack,percent:e.percent,area:pe({visible:!1},e.area),seriesMark:(t=e.seriesMark)!==null&&t!==void 0?t:"area",activePoint:e.activePoint,pointDis:e.pointDis,pointDisMul:e.pointDisMul,markOverlap:e.markOverlap})}transformSpec(e){var t;super.transformSpec(e),((t=e.axes)!==null&&t!==void 0?t:[]).forEach(i=>{i.orient==="radius"&&(["domainLine","label","tick"].forEach(s=>{i[s]||(i[s]={visible:!1})}),i.grid||(i.grid={visible:!0,smooth:!0}))}),e.crosshair=N(e.crosshair||{}).map(i=>pe({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},i))}}class dl extends yt{constructor(){super(...arguments),this.transformerConstructor=oI,this.type="radar",this.seriesType=z.radar,this._canStack=!0}}dl.type="radar",dl.seriesType=z.radar,dl.view="singleDefault",dl.transformerConstructor=oI;const jee=()=>{zZ(),D.registerChart(dl.type,dl)};class lI extends es{_getDefaultSeriesSpec(e){const t=super._getDefaultSeriesSpec(e);return delete t.data,t}transformSpec(e){if(super.transformSpec(e),e.series&&e.series.length){const t=this._getDefaultSeriesSpec(e);e.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(t).forEach(s=>{s in i||(i[s]=t[s])})})}e.axes&&e.axes.length&&e.axes.forEach(t=>{Te(t,"trimPadding")&&pe(t,BB(this.type,e))})}}class wd extends yt{constructor(){super(...arguments),this.transformerConstructor=lI,this.type="common",this._canStack=!0}}wd.type="common",wd.view="singleDefault",wd.transformerConstructor=lI;const Hee=()=>{D.registerChart(wd.type,wd)},sx=12;class hI extends es{_getSeriesDataLength(e,t){var i,s;if(t.data){const a=N(t.data)[0];return a instanceof Ye?(i=a.latestData)===null||i===void 0?void 0:i.length:(s=a.values)===null||s===void 0?void 0:s.length}const r=N(e.data).find((a,o)=>t.dataId?a instanceof Ye?a.name===t.dataId:a.id===t.dataId:t.dataIndex===o);return r?r instanceof Ye?r.latestData.length:r.values.length:0}addAttrToComponentSpec(e,t,i){return Array.isArray(e)?e[0][t]=i:e[t]=i,e}transformSpec(e){var t,i,s,r,a,o,l,h,d,u,c;super.transformSpec(e);let f=0;const p=[],g=[],_=[],m=[],y=[],b=e.series.filter(k=>k.type!==z.link).length,v=(500-20*(b-1))/b,x=((t=e==null?void 0:e.appendPadding)===null||t===void 0?void 0:t.left)||0,S=((i=e==null?void 0:e.appendPadding)===null||i===void 0?void 0:i.right)||0;if(e!=null&&e.legends){p.push({modelId:`legendRow${f}`,col:1,row:f}),this.addAttrToComponentSpec(e.legends,"id",`legendRow${f}`);const k=N(e.legends);let w=(s=k[0].height)!==null&&s!==void 0?s:40;if(k[0].padding){const M=vr(k[0].padding);w+=Number((r=M==null?void 0:M.bottom)!==null&&r!==void 0?r:0),w+=Number((a=M==null?void 0:M.top)!==null&&a!==void 0?a:0),k[0].offsetY=Number((l=(o=k[0])===null||o===void 0?void 0:o.offsetY)!==null&&l!==void 0?l:0)+Number((h=M==null?void 0:M.top)!==null&&h!==void 0?h:0)}y.push({index:f,size:w}),f++}e!=null&&e.dataZoom&&(p.push({modelId:`dataZoomRow${f}`,col:1,row:f}),this.addAttrToComponentSpec(e.dataZoom,"id",`dataZoomRow${f}`),f++,y.push({index:f,size:10}),f++),g.push({id:`regionAxesRow${f}`}),p.push({modelId:`axesRow${f}`,col:1,row:f}),e.axes[0].id=`axesRow${f}`,e.axes[0].regionIndex=Array.from(Array(e.series.length),(k,w)=>w+1),f++,(d=e==null?void 0:e.series)===null||d===void 0||d.forEach(k=>{var w,M;if([z.bar,z.line,z.area,z.dot].includes(k.type)){if(p.push({modelId:`${k.type}Row${f}`,col:1,row:f}),p.push({modelId:`axesLeftRow${f}`,col:0,row:f}),g.push({id:`${k.type}Row${f}`,clip:!1}),y.push({index:f,size:(k==null?void 0:k.height)||v}),_.push({orient:"left",id:`axesLeftRow${f}`,type:k.type===z.dot?"band":"linear",visible:k.type!==z.dot,title:{visible:!0,autoRotate:!1,style:{text:k==null?void 0:k.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:typeof((w=k==null?void 0:k.grid)===null||w===void 0?void 0:w.visible)!="boolean"||((M=k==null?void 0:k.grid)===null||M===void 0?void 0:M.visible),style:(T,E)=>{var O,B,R,L,I;let F=0;if(E===0){const H=(O=k==null?void 0:k.grid)===null||O===void 0?void 0:O.style;F=(R=(B=H==null?void 0:H.lineWidth)!==null&&B!==void 0?B:H==null?void 0:H.strokeWidth)!==null&&R!==void 0?R:1}return{lineWidth:F,stroke:((I=(L=k==null?void 0:k.grid)===null||L===void 0?void 0:L.style)===null||I===void 0?void 0:I.stroke)||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:g.length-1}),k.type===z.dot){p.push({modelId:`scrollBarRightRow${f}`,col:2,row:f});const T=this._getSeriesDataLength(e,k);let E=0;T&&(E=((k==null?void 0:k.height)||v)/(30*T)),m.push(Object.assign({orient:"right",visible:k.type===z.dot&&E<1,id:`scrollBarRightRow${f}`,start:0,end:Math.min(E,1),filterMode:"axis",regionIndex:g.length-1,axisId:`axesLeftRow${f}`},N(e==null?void 0:e.scrollBar)[0]))}k.regionIndex=g.length-1,f++,y.push({index:f,size:(k==null?void 0:k.padding)||20}),f++,k.leftAppendPadding=x,k.type===z.dot&&(k.title.style.dx=-x,k.subTitle.style.dx=-x)}}),(u=e==null?void 0:e.series)===null||u===void 0||u.forEach(k=>{if(k.type===z.link){const w=k.dotSeriesIndex+1;p.push({modelId:`${k.type}Row${w}`,col:1,row:w-1}),k.regionIndex=e.series[k.dotSeriesIndex].regionIndex,k.leftAppendPadding=x,k.height=e.series[k.dotSeriesIndex].height,k.clipHeight=e.series[k.dotSeriesIndex].clipHeight}}),e!=null&&e.legends&&this.addAttrToComponentSpec(e.legends,"regionIndex",[g.length-1]);const A={type:"grid",col:4,row:f,colWidth:[{index:0,size:x},{index:2,size:sx},{index:3,size:S}],rowHeight:y,elements:p};e.layout=A,e.region=g,(c=e.axes)===null||c===void 0||c.push(..._),e.scrollBar=m}}var Gee=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};class Md extends yt{constructor(){super(...arguments),this.transformerConstructor=hI,this.type="sequence"}_createSeries(e,t){if(!e)return;const{spec:i}=t,s=Gee(t,["spec"]);let r;if(i.type===z.link&&(i.dotSeriesSpec=this._spec.series[i.dotSeriesIndex]),i.regionId&&(r=this.getRegionsInUserId(i.regionId)),r||(r=this.getRegionsInIndex(i.regionIndex?[i.regionIndex]:void 0)[0]),!r)return;const a=new e(i,Object.assign(Object.assign(Object.assign({},this._modelOption),s),{region:r,specKey:"series",globalScale:this._globalScale}));a&&(a.created(),this._series.push(a),r.addSeries(a))}}Md.type="sequence",Md.view="singleDefault",Md.transformerConstructor=hI;const Wee=()=>{WZ(),UZ(),D.registerChart(Md.type,Md)};class iS extends As{transformSpec(e){super.transformSpec(e),e.axes.forEach(t=>t.type="linear")}_getDefaultSeriesSpec(e){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{x2Field:e==null?void 0:e.x2Field,y2Field:e==null?void 0:e.y2Field,barMinHeight:e==null?void 0:e.barMinHeight})}}class nS extends yt{constructor(){super(...arguments),this.transformerConstructor=iS,this._canStack=!0}}nS.transformerConstructor=iS;class ym extends iS{transformSpec(e){super.transformSpec(e),Ra(e)}}class ul extends nS{constructor(){super(...arguments),this.transformerConstructor=ym,this.type="histogram",this.seriesType=z.bar}}ul.type="histogram",ul.seriesType=z.bar,ul.view="singleDefault",ul.transformerConstructor=ym;const Vee=()=>{sL(),D.registerChart(ul.type,ul)};class cl extends nS{constructor(){super(...arguments),this.transformerConstructor=ym,this.type="histogram3d",this.seriesType=z.bar3d}}cl.type="histogram3d",cl.seriesType=z.bar3d,cl.view="singleDefault",cl.transformerConstructor=ym;const Nee=()=>{aL(),D.registerChart(cl.type,cl)};class dI extends nI{_getDefaultSeriesSpec(e){var t,i;const s=super._getDefaultSeriesSpec(e);return Object.assign(Object.assign({},s),{cornerRadius:(t=e.cornerRadius)!==null&&t!==void 0?t:0,roundCap:(i=e.roundCap)!==null&&i!==void 0&&i,progress:e.progress,track:e.track,tickMask:e.tickMask})}transformSpec(e){super.transformSpec(e),this._transformProgressAxisSpec(e,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}class fl extends yt{constructor(){super(...arguments),this.transformerConstructor=dI,this.type="circularProgress",this.seriesType=z.circularProgress,this._canStack=!0}}fl.type="circularProgress",fl.seriesType=z.circularProgress,fl.view="singleDefault",fl.transformerConstructor=dI;const Uee=()=>{KZ(),D.registerChart(fl.type,fl)};class uI extends nI{_getDefaultSeriesSpec(e){const t=super._getDefaultSeriesSpec(e);return Object.assign(Object.assign({},t),{radiusField:e.radiusField,pin:e.pin,pinBackground:e.pinBackground,pointer:e.pointer})}_getDefaultCircularProgressSeriesSpec(e){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{type:z.circularProgress})}transformSpec(e){var t,i,s,r,a;super.transformSpec(e);let o=(t=e.series)===null||t===void 0?void 0:t.find(l=>l.type===z.gauge||l.type===z.circularProgress);C(o)&&(o=(i=e.gauge)!==null&&i!==void 0?i:this._getDefaultCircularProgressSeriesSpec(e),o.type==="circularProgress"&&(C(o.radiusField)&&C(o.categoryField)&&(o.radiusField=(r=(s=e.radiusField)!==null&&s!==void 0?s:e.categoryField)!==null&&r!==void 0?r:e.seriesField),C(o.valueField)&&C(o.angleField)&&(o.valueField=(a=e.valueField)!==null&&a!==void 0?a:e.angleField)),e.series.length===1?e.series.push(o):e.series.forEach(l=>{l.type===o.type&&Object.keys(o).forEach(h=>{h in l||(l[h]=o[h])})})),o.type===z.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:rt.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var t;e.axes||(e.axes=[]);const i={radius:null,angle:null};((t=e.axes)!==null&&t!==void 0?t:[]).forEach(s=>{const{orient:r}=s;r==="radius"&&(i.radius=s),r==="angle"&&(i.angle=s)}),i.angle||(i.angle={orient:"angle",visible:!0},e.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},e.axes.push(i.radius)),C(i.angle.type)&&(i.angle.type="linear"),C(i.radius.type)&&(i.radius.type="linear"),C(i.angle.zIndex)&&(i.angle.zIndex=rt.Region+50)}}class pl extends yt{constructor(){super(...arguments),this.transformerConstructor=uI,this.type="gauge",this.seriesType=z.gaugePointer}}pl.type="gauge",pl.seriesType=z.gaugePointer,pl.view="singleDefault",pl.transformerConstructor=uI;const $ee=()=>{vee(),xee(),D.registerChart(pl.type,pl)};class bm extends es{transformSpec(e){super.transformSpec(e);const t=this._getDefaultSeriesSpec(e);e.series&&e.series.length!==0?e.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(t).forEach(s=>{s in i||(i[s]=t[s])})}):e.series=[t]}}class sS extends yt{constructor(){super(...arguments),this.transformerConstructor=bm,this.type="wordCloud",this.seriesType=z.wordCloud}}sS.transformerConstructor=bm;class cI extends bm{_getDefaultSeriesSpec(e){const t=Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{nameField:e.nameField,valueField:e.valueField,seriesField:e.seriesField,fontFamilyField:e.fontFamilyField,fontWeightField:e.fontWeightField,fontStyleField:e.fontStyleField,colorHexField:e.colorHexField,colorMode:e.colorMode,colorList:e.colorList,rotateAngles:e.rotateAngles,fontWeightRange:e.fontWeightRange,fontSizeRange:e.fontSizeRange,maskShape:e.maskShape,keepAspect:e.keepAspect,random:e.random,wordCloudConfig:e.wordCloudConfig,wordCloudShapeConfig:e.wordCloudShapeConfig,word:e.word,fillingWord:e.fillingWord}),i=this.seriesType;return i&&(t.type=i,t[i]=e[i]),t}}class na extends sS{constructor(){super(...arguments),this.transformerConstructor=cI,this.type="wordCloud",this.seriesType=z.wordCloud}}na.type="wordCloud",na.seriesType=z.wordCloud,na.view="singleDefault",na.transformerConstructor=cI;const Yee=()=>{WL(),D.registerChart(na.type,na)},Xee=()=>{aQ(),WL(),D.registerChart(na.type,na)};class fI extends bm{_getDefaultSeriesSpec(e){const t=Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{nameField:e.nameField,valueField:e.valueField,seriesField:e.seriesField,fontFamilyField:e.fontFamilyField,fontWeightField:e.fontWeightField,fontStyleField:e.fontStyleField,colorHexField:e.colorHexField,colorMode:e.colorMode,colorList:e.colorList,rotateAngles:e.rotateAngles,fontWeightRange:e.fontWeightRange,fontSizeRange:e.fontSizeRange,depth_3d:e.depth_3d,maskShape:e.maskShape,keepAspect:e.keepAspect,random:e.random,wordCloudConfig:e.wordCloudConfig,wordCloudShapeConfig:e.wordCloudShapeConfig,word:e.word,fillingWord:e.fillingWord}),i=this.seriesType;return i&&(t.type=i,t[i]=e[i]),t}}class sa extends sS{constructor(){super(...arguments),this.transformerConstructor=fI,this.type="wordCloud3d",this.seriesType=z.wordCloud3d}}sa.type="wordCloud3d",sa.seriesType=z.wordCloud3d,sa.view="singleDefault",sa.transformerConstructor=fI;const Kee=()=>{VL(),D.registerChart(sa.type,sa)},qee=()=>{oQ(),VL(),D.registerChart(sa.type,sa)};class vm extends es{needAxes(){return!1}_getDefaultSeriesSpec(e){const t=Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{categoryField:e.categoryField,valueField:e.valueField,seriesField:e.seriesField,funnelAlign:e.funnelAlign,funnelOrient:e.funnelOrient,shape:e.shape,funnel:e.funnel,transform:e.transform,outerLabel:e.outerLabel,transformLabel:e.transformLabel,isTransform:e.isTransform,maxSize:e.maxSize,minSize:e.minSize,gap:e.gap,isCone:e.isCone,range:e.range}),i=this.seriesType;return i&&(t.type=i,t[i]=e[i]),t}transformSpec(e){super.transformSpec(e);const t=this._getDefaultSeriesSpec(e);e.series&&e.series.length!==0?e.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(t).forEach(s=>{s in i||(i[s]=t[s])})}):e.series=[t]}}class gl extends yt{constructor(){super(...arguments),this.transformerConstructor=vm,this.type="funnel",this.seriesType=z.funnel}}gl.type="funnel",gl.seriesType=z.funnel,gl.view="singleDefault",gl.transformerConstructor=vm;const Zee=()=>{bQ(),D.registerChart(gl.type,gl)};class _l extends yt{constructor(){super(...arguments),this.transformerConstructor=vm,this.type="funnel3d",this.seriesType=z.funnel3d}}_l.type="funnel3d",_l.seriesType=z.funnel3d,_l.view="singleDefault",_l.transformerConstructor=vm;const Jee=()=>{xQ(),D.registerChart(_l.type,_l)};class pI extends As{needAxes(){return!1}_getDefaultSeriesSpec(e){var t,i;const s=super._getDefaultSeriesSpec(e);return Object.assign(Object.assign({},s),{direction:(t=e.direction)!==null&&t!==void 0?t:"horizontal",cornerRadius:(i=e.cornerRadius)!==null&&i!==void 0?i:0,bandWidth:e.bandWidth,progress:e.progress,track:e.track})}transformSpec(e){var t,i;if(super.transformSpec(e),e.axes||(e.axes=[]),e.direction==="vertical"){let s=null,r=null;((t=e.axes)!==null&&t!==void 0?t:[]).forEach(o=>{const{orient:l}=o;l==="left"&&(s=o),l==="bottom"&&(r=o)}),s||(s={orient:"left",visible:!1},e.axes.push(s)),r||(r={orient:"bottom",visible:!1},e.axes.push(r)),C(r.type)&&(r.type="band"),C(s.type)&&(s.type="linear");const a=vu(s,{min:0,max:1});C(s.min)&&(s.min=a.min),C(s.max)&&(s.max=a.max)}else{let s=null,r=null;((i=e.axes)!==null&&i!==void 0?i:[]).forEach(o=>{const{orient:l}=o;l==="left"&&(s=o),l==="bottom"&&(r=o)}),s||(s={type:"band",orient:"left",visible:!1},e.axes.push(s)),r||(r={orient:"bottom",visible:!1},e.axes.push(r)),C(r.type)&&(r.type="linear"),C(s.type)&&(s.type="band");const a=vu(r,{min:0,max:1});C(r.min)&&(r.min=a.min),C(r.max)&&(r.max=a.max)}}}class ml extends yt{constructor(){super(...arguments),this.transformerConstructor=pI,this.type="linearProgress",this.seriesType=z.linearProgress,this._canStack=!0}}ml.type="linearProgress",ml.seriesType=z.linearProgress,ml.view="singleDefault",ml.transformerConstructor=pI;const Qee=()=>{iJ(),D.registerChart(ml.type,ml)};class gI extends As{_getDefaultSeriesSpec(e){var t,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{barGapInGroup:e.barGapInGroup,barBackground:e.barBackground,barMinHeight:e.barMinHeight});return s.bar=e.bar,e.direction==="horizontal"?s.xField=(t=e.xField)!==null&&t!==void 0?t:[e.minField,e.maxField]:s.yField=(i=e.yField)!==null&&i!==void 0?i:[e.minField,e.maxField],s}transformSpec(e){super.transformSpec(e),Ra(e)}}class yl extends yt{constructor(){super(...arguments),this.transformerConstructor=gI,this.type="rangeColumn",this.seriesType=z.rangeColumn}}yl.type="rangeColumn",yl.seriesType=z.rangeColumn,yl.view="singleDefault",yl.transformerConstructor=gI;const ete=()=>{fZ(),D.registerChart(yl.type,yl)};class _I extends As{_getDefaultSeriesSpec(e){var t,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{barGapInGroup:e.barGapInGroup});return s.bar3d=e.bar3d,e.direction==="horizontal"?s.xField=(t=e.xField)!==null&&t!==void 0?t:[e.minField,e.maxField]:s.yField=(i=e.yField)!==null&&i!==void 0?i:[e.minField,e.maxField],s}}class bl extends yt{constructor(){super(...arguments),this.transformerConstructor=_I,this.type="rangeColumn3d",this.seriesType=z.rangeColumn3d}}bl.type="rangeColumn3d",bl.seriesType=z.rangeColumn3d,bl.view="singleDefault",bl.transformerConstructor=_I;const tte=()=>{pZ(),D.registerChart(bl.type,bl)};class mI extends es{_getDefaultSeriesSpec(e){const t=P(e.startAngle)?e.startAngle:pd,i=P(e.endAngle)?e.endAngle:t+$l(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{categoryField:e.categoryField,valueField:e.valueField,seriesField:e.seriesField,centerX:e.centerX,centerY:e.centerY,offsetX:e.offsetX,offsetY:e.offsetY,startAngle:t,endAngle:i,innerRadius:e.innerRadius,outerRadius:e.outerRadius,gap:e.gap,labelLayout:e.labelLayout,label:e.label,labelAutoVisible:e.labelAutoVisible,drill:e.drill,drillField:e.drillField}),r=z.sunburst;return s.type=r,s[r]=e[r],s}transformSpec(e){super.transformSpec(e);const t=this._getDefaultSeriesSpec(e);e.series&&e.series.length!==0?e.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(t).forEach(s=>{s in i||(i[s]=t[s])})}):e.series=[t]}}class vl extends yt{constructor(){super(...arguments),this.transformerConstructor=mI,this.type="sunburst",this.seriesType=z.sunburst}}vl.type="sunburst",vl.seriesType=z.sunburst,vl.view="singleDefault",vl.transformerConstructor=mI;const ite=()=>{WQ(),D.registerChart(vl.type,vl)};class yI extends es{_getDefaultSeriesSpec(e){const t=Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{categoryField:e.categoryField,valueField:e.valueField,seriesField:e.seriesField,layoutPadding:e.layoutPadding,label:e.label,circlePacking:e.circlePacking,drill:e.drill,drillField:e.drillField}),i=z.circlePacking;return t.type=i,t[i]=e[i],t}transformSpec(e){super.transformSpec(e);const t=this._getDefaultSeriesSpec(e);e.series&&e.series.length!==0?e.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(t).forEach(s=>{s in i||(i[s]=t[s])})}):e.series=[t]}}class xl extends yt{constructor(){super(...arguments),this.transformerConstructor=yI,this.type="circlePacking",this.seriesType=z.circlePacking}}xl.type="circlePacking",xl.seriesType=z.circlePacking,xl.view="singleDefault",xl.transformerConstructor=yI;const nte=()=>{YQ(),D.registerChart(xl.type,xl)};class bI extends es{_getDefaultSeriesSpec(e){const t=Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{categoryField:e.categoryField,valueField:e.valueField,seriesField:e.seriesField,aspectRatio:e.aspectRatio,splitType:e.splitType,maxDepth:e.maxDepth,gapWidth:e.gapWidth,nodePadding:e.nodePadding,minVisibleArea:e.minVisibleArea,minChildrenVisibleArea:e.minChildrenVisibleArea,minChildrenVisibleSize:e.minChildrenVisibleSize,roam:e.roam,drill:e.drill,drillField:e.drillField,leaf:e.leaf,nonLeaf:e.nonLeaf,nonLeafLabel:e.nonLeafLabel}),i=this.seriesType;return i&&(t.type=i,t[i]=e[i]),t}transformSpec(e){super.transformSpec(e);const t=this._getDefaultSeriesSpec(e);e.series&&e.series.length!==0?e.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(t).forEach(s=>{s in i||(i[s]=t[s])})}):e.series=[t]}}class Sl extends yt{constructor(){super(...arguments),this.transformerConstructor=bI,this.type="treemap",this.seriesType=z.treemap}}Sl.type="treemap",Sl.seriesType=z.treemap,Sl.view="singleDefault",Sl.transformerConstructor=bI;const ste=()=>{gee(),D.registerChart(Sl.type,Sl)};class vI extends um{transformSpec(e){super.transformSpec(e),e.legends&&N(e.legends).forEach(t=>{t.select=!1,t.hover=!1,t.filter=!1}),Ra(e)}_getDefaultSeriesSpec(e){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{bar:e.bar,stackLabel:e.stackLabel,leaderLine:e.leaderLine,total:e.total})}}class Al extends ea{constructor(){super(...arguments),this.transformerConstructor=vI,this.type="waterfall",this.seriesType=z.waterfall}}Al.type="waterfall",Al.seriesType=z.waterfall,Al.view="singleDefault",Al.transformerConstructor=vI;const rte=()=>{sZ(),D.registerChart(Al.type,Al)};class xI extends As{_getDefaultSeriesSpec(e){var t;const i=[e.maxField,e.medianField,e.q1Field,e.q3Field,e.minField,e.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{boxPlot:e.boxPlot,direction:(t=e.direction)!==null&&t!==void 0?t:"vertical",minField:e.minField,maxField:e.maxField,q1Field:e.q1Field,medianField:e.medianField,q3Field:e.q3Field,outliersField:e.outliersField,outliersStyle:e.outliersStyle});return s[s.direction==="vertical"?"yField":"xField"]=i,s}transformSpec(e){super.transformSpec(e),e.axes||(e.axes=[{orient:"bottom"},{orient:"left"}]),Ra(e)}}class kl extends yt{constructor(){super(...arguments),this.transformerConstructor=xI,this.type="boxPlot",this.seriesType=z.boxPlot}}kl.type="boxPlot",kl.seriesType=z.boxPlot,kl.view="singleDefault",kl.transformerConstructor=xI;const ate=()=>{lZ(),D.registerChart(kl.type,kl)};class SI extends es{_getDefaultSeriesSpec(e){const t=Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{categoryField:e.categoryField,valueField:e.valueField,sourceField:e.sourceField,targetField:e.targetField,direction:e.direction,nodeAlign:e.nodeAlign,nodeGap:e.nodeGap,nodeWidth:e.nodeWidth,linkWidth:e.linkWidth,minStepWidth:e.minStepWidth,minNodeHeight:e.minNodeHeight,minLinkHeight:e.minLinkHeight,iterations:e.iterations,nodeKey:e.nodeKey,linkSortBy:e.linkSortBy,nodeSortBy:e.nodeSortBy,setNodeLayer:e.setNodeLayer,node:e.node,link:e.link,label:e.label,emphasis:e.emphasis}),i=this.seriesType;return i&&(t.type=i,t[i]=e[i]),t}transformSpec(e){super.transformSpec(e);const t=this._getDefaultSeriesSpec(e);e.series&&e.series.length!==0?e.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(t).forEach(s=>{s in i||(i[s]=t[s])})}):e.series=[t]}}class wl extends yt{constructor(){super(...arguments),this.transformerConstructor=SI,this.type="sankey",this.seriesType=z.sankey}}wl.type="sankey",wl.seriesType=z.sankey,wl.view="singleDefault",wl.transformerConstructor=SI;const ote=()=>{hee(),D.registerChart(wl.type,wl)};class AI extends As{_getDefaultSeriesSpec(e){var t,i;const s=Object.assign({},super._getDefaultSeriesSpec(e));return s.area=e.area,e.direction==="horizontal"?s.xField=(t=e.xField)!==null&&t!==void 0?t:[e.minField,e.maxField]:s.yField=(i=e.yField)!==null&&i!==void 0?i:[e.minField,e.maxField],s.stack=!1,s}transformSpec(e){super.transformSpec(e),Ra(e)}}class Ml extends yt{constructor(){super(...arguments),this.transformerConstructor=AI,this.type="rangeArea",this.seriesType=z.rangeArea}}Ml.type="rangeArea",Ml.seriesType=z.rangeArea,Ml.view="singleDefault",Ml.transformerConstructor=AI;const lte=()=>{_Z(),D.registerChart(Ml.type,Ml)};class kI extends As{_getDefaultSeriesSpec(e){const t=super._getDefaultSeriesSpec(e);return Object.assign(Object.assign({},t),{valueField:e.valueField,cell:e.cell})}}class Tl extends yt{constructor(){super(...arguments),this.transformerConstructor=kI,this.type="heatmap",this.seriesType=z.heatmap}}Tl.type="heatmap",Tl.seriesType=z.heatmap,Tl.view="singleDefault",Tl.transformerConstructor=kI;const hte=()=>{Mee(),D.registerChart(Tl.type,Tl)};class wI extends es{_getDefaultSeriesSpec(e){const t=Object.assign(Object.assign({},super._getDefaultSeriesSpec(e)),{categoryField:e.categoryField,valueField:e.valueField,seriesField:e.seriesField,sizeField:e.sizeField,sizeRange:e.sizeRange,centerX:e.centerX,centerY:e.centerY,innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,ripplePoint:e.ripplePoint,centerPoint:e.centerPoint,centerLabel:e.centerLabel,nodePoint:e.nodePoint,label:e.label}),i=z.correlation;return t.type=i,t[i]=e[i],t}transformSpec(e){super.transformSpec(e);const t=this._getDefaultSeriesSpec(e);e.series&&e.series.length!==0?e.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(t).forEach(s=>{s in i||(i[s]=t[s])})}):e.series=[t]}}class Cl extends yt{constructor(){super(...arguments),this.transformerConstructor=wI,this.type="correlation",this.seriesType=z.correlation}}Cl.type="correlation",Cl.seriesType=z.correlation,Cl.view="singleDefault",Cl.transformerConstructor=wI;const dte=()=>{Lee(),D.registerChart(Cl.type,Cl)};function ET(n){return n.length===2&&j(n[0])&&j(n[1])&&n[1]>=n[0]}function RT(n,e){const t=e[1]-e[0],i=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;t===0?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=t,r/=t);const a=n.getDomainSpec();return{total:t,negative:s,positive:r,includeZero:i,domain:e,extendable_min:!j(a.min),extendable_max:!j(a.max)}}function OT(n,e){const{positive:t,negative:i,extendable_min:s,extendable_max:r,domain:a}=n,{positive:o,negative:l,extendable_min:h,extendable_max:d,domain:u}=e;if(o>0){if(!h)return!1;let c=i/t;r&&(c=i/Math.max(t,o),a[1]=-a[0]/c),u[0]=-u[1]*c}else if(l>0){if(!d)return!1;let c=t/i;s&&(c=t/Math.max(i,i),a[0]=-a[1]/c),u[1]=-u[0]*c}return!0}function BT(n,e){const{extendable_min:t,extendable_max:i,domain:s}=n,{positive:r,negative:a,domain:o}=e;return(r!==0||a!==0)&&!(r>0&&!i)&&!(a>0&&!t)&&(s[0]=o[0],s[1]=o[1],!0)}function LT(n,e){const{positive:t,negative:i,extendable_max:s,domain:r}=n,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(s&&l){const d=Math.max(i,o)/Math.max(t,a);r[1]=-r[0]/d,h[0]=-h[1]*d}else if(l){const d=i/t;h[0]=-h[1]*d}else{if(!s)return!1;{const d=o/a;r[1]=-r[0]/d}}return!0}function IT(n,e){const{extendable_min:t,domain:i}=n,{extendable_max:s,domain:r}=e;return!(!t||!s)&&(i[0]=-i[1],r[1]=-r[0],!0)}const ute=(n,e)=>{const t=n.getScale(),i=e.getScale();if(!t||!i||!Ue(t.type)||!Ue(i.type))return;const s=t.domain().slice(),r=i.domain().slice();if(!ET(s)||!ET(r))return;const a=RT(n,s),o=RT(e,r),{positive:l,negative:h,extendable_min:d,extendable_max:u,includeZero:c}=a,{positive:f,negative:p,extendable_min:g,extendable_max:_,includeZero:m}=o;if(l===0&&h===0){if(!BT(a,o))return}else if(f===0&&p===0){if(!BT(o,a))return}else if(c||m)if(c&&!m){if(!OT(a,o))return}else if(m&&!c){if(!OT(o,a))return}else{if(h===p)return;if(h>p){if(!LT(a,o))return}else if(!LT(o,a))return}else{if(h===0&&f===0){if(!IT(a,o))return}else if(p===0&&l===0&&!IT(o,a))return;if(h===0&&p===0)if(s[0]===0&&r[0]>0){if(!g)return;r[0]=0}else{if(!(r[0]===0&&s[0]>0)||!d)return;s[0]=0}if(l===0&&f===0)if(s[1]===0&&r[1]>0){if(!_)return;r[1]=0}else{if(!(r[1]===0&&s[1]>0)||!u)return;s[1]=0}}t.domain(s),i.domain(r)},cte=(n,e)=>{var t,i,s,r,a;if(!n)return n;const o=(t=e==null?void 0:e.targetAxis)===null||t===void 0?void 0:t.call(e);if(!o)return n;const l=(i=e==null?void 0:e.currentAxis)===null||i===void 0?void 0:i.call(e);if(!l)return n;const h=(s=l.getTickData())===null||s===void 0?void 0:s.getDataView();if(!h||!h.transformsArr.find(y=>y.type==="ticks"))return n;const d=l.getScale();if(!d)return n;const u=(a=(r=o.getTickData())===null||r===void 0?void 0:r.getDataView())===null||a===void 0?void 0:a.latestData;if(!(u!=null&&u.length))return n;const c=o.getScale();if(!c)return n;const f=c.domain(),p=f[1]-f[0];if(p===0)return n;const g=d.domain(),_=g[1]-g[0];if(p===0)return n;const m=u.map(y=>{const b=(y.value-f[0])/p;return _*b+g[0]});return Gs(m)};class Lu extends LK{constructor(){super(Lu.type),this.type="AxisSyncPlugin"}_checkEnableSync(e){if(!Ue(e.getScale().type))return!1;const t=e.getSpec().sync;return!!(t!=null&&t.axisId)&&t}_getTargetAxis(e,t){const i=e.getOption().getChart().getComponentByUserId(t.axisId);return i!=null&&i.type.startsWith("cartesianAxis")?i:null}onInit(e,t){const i=this._checkEnableSync(t);if(!i||!i.zeroAlign)return;const s=this._getTargetAxis(t,i);s&&t.event.on(ye.scaleDomainUpdate,{filter:({model:r})=>r.id===t.id||r.id===s.id},()=>{ute(s,t)})}onDidCompile(e,t){const i=this._checkEnableSync(t);if(!i)return;const s=this._getTargetAxis(t,i);if(s&&i.tickAlign){Ae(t.getOption().dataSet,"tickAlign",cte);const r={targetAxis:()=>s,currentAxis:()=>t};t.addTransformToTickData({type:"tickAlign",options:r,level:Number.MAX_SAFE_INTEGER},!1)}}}Lu.pluginType="component",Lu.type="AxisSyncPlugin";const fte={AxisSyncPlugin:Lu};class rx extends Ti{constructor(e,t){super(e,t),this.type="component",this._componentType=t.componentType,this._mode=t.mode}_initProduct(e){const t=this.getVGrammarView(),i=this.getProductId();this._product=t.mark(ne.component,e??t.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}rx.type="component";const rS=()=>{D.registerMark(rx.type,rx)},pte=n=>n;class aS extends an{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(){return this._tickData}get visible(){return this._visible}getInverse(){return this._inverse}constructor(e,t){var i;super(e,t),this.specKey="axes",this._scales=[],this._visible=!0,this._tick=void 0,this._visible=(i=e.visible)===null||i===void 0||i}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var e,t;return N((t=(e=this._axisMark)===null||e===void 0?void 0:e.getProduct())===null||t===void 0?void 0:t.getGroupGraphicItem())}created(){var e,t,i,s,r,a,o,l,h,d,u,c,f,p,g,_,m;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this.getVisible()&&this._initData(),this._visible){const y=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:this.getOrient()==="angle"?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});if(this._axisMark=y,y.setZIndex(this.layoutZIndex),P(this._spec.id)&&y.setUserId(this._spec.id),this._marks.addMark(y),(e=this._spec.grid)===null||e===void 0?void 0:e.visible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:this.getOrient()==="angle"?ii.circleAxisGrid:ii.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});b.setZIndex((a=(s=(i=(t=this._spec.grid)===null||t===void 0?void 0:t.style)===null||i===void 0?void 0:i.zIndex)!==null&&s!==void 0?s:(r=this._spec.grid)===null||r===void 0?void 0:r.zIndex)!==null&&a!==void 0?a:rt.Axis_Grid),this._marks.addMark(b),this._gridMark=b}if(ht(this._spec.interactive)&&this._marks.forEach(b=>b.setInteractive(this._spec.interactive)),this._option.animation!==!1&&Te(this._option.getChart().getSpec(),"animation")!==!1&&this._spec.animation===!0){const b=Le((o=D.getAnimationInKey("axis"))===null||o===void 0?void 0:o(),{appear:(h=(l=this._spec.animationAppear)!==null&&l!==void 0?l:Te(this._option.getChart().getSpec(),"animationAppear.axis"))!==null&&h!==void 0?h:Te(this._option.getChart().getSpec(),"animationAppear"),disappear:(u=(d=this._spec.animationDisappear)!==null&&d!==void 0?d:Te(this._option.getChart().getSpec(),"animationDisappear.axis"))!==null&&u!==void 0?u:Te(this._option.getChart().getSpec(),"animationDisappear"),enter:(f=(c=this._spec.animationEnter)!==null&&c!==void 0?c:Te(this._option.getChart().getSpec(),"animationEnter.axis"))!==null&&f!==void 0?f:Te(this._option.getChart().getSpec(),"animationEnter"),exit:(g=(p=this._spec.animationExit)!==null&&p!==void 0?p:Te(this._option.getChart().getSpec(),"animationExit.axis"))!==null&&g!==void 0?g:Te(this._option.getChart().getSpec(),"animationExit"),update:(m=(_=this._spec.animationUpdate)!==null&&_!==void 0?_:Te(this._option.getChart().getSpec(),"animationUpdate.axis"))!==null&&m!==void 0?m:Te(this._option.getChart().getSpec(),"animationUpdate")});b.enter&&(b.update[0].customParameters={enter:b.enter[0]}),this._marks.forEach(v=>v.setAnimationConfig(b))}}}isSeriesDataEnable(){let e=!0;return xt(this._regions,t=>{var i;W((i=t.getViewDataStatistics())===null||i===void 0?void 0:i.latestData)&&(e=!1)},{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}setSeriesAndRegionsFromSpec(){const{seriesId:e,seriesIndex:t,regionId:i,regionIndex:s}=this._spec;P(e)&&(this._seriesUserId=N(e)),P(i)&&(this._regionUserId=N(i)),P(t)&&(this._seriesIndex=N(t)),P(s)&&(this._regionIndex=N(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map(r=>r.id)}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(ye.scaleUpdate,{filter:({model:t})=>(t==null?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=eV(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map(t=>t.getViewDataStatistics()).filter(t=>!!t);e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",()=>{this.updateScaleDomain()}):e.length===1&&e[0].target.addListener("change",()=>{this.updateScaleDomain()}),xt(this._regions,t=>{t.event.on(ye.rawDataUpdate,{filter:({model:i})=>(i==null?void 0:i.id)===t.id},()=>{this._clearRawDomain()})},{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}computeData(e){!this._tickData||e!=="force"&&ft(this._scale.range(),[0,1])||(this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData())}initScales(){this._scales=[this._scale];const e=[];if(xt(this._regions,t=>{const i=t.getGroups();i&&e.push(i)},{userId:this._seriesUserId,specIndex:this._seriesIndex}),e.length!==0){const t=Vt(e.map(i=>i.fields.length));for(let i=1;i<t;i++){const s=this._scale.clone();this._scales.push(s)}}}_compareSpec(e,t){const i=super._compareSpec(e,t);return i.reRender=!0,(t==null?void 0:t.type)!==(e==null?void 0:e.type)&&(i.reMake=!0),i}getLabelFormatMethod(){return this._spec.label.formatMethod?(e,t,i)=>this._spec.label.formatMethod(t.rawValue,t):null}getLabelItems(e){return W(this._tickData.getLatestData())?[this._tickData.getLatestData().map(t=>({id:t.value,label:t.value,value:e===0?0:this.dataToPosition([t.value])/e,rawValue:t.value})).filter(t=>t.value>=0&&t.value<=1)]:[]}_delegateAxisContainerEvent(e){e.addEventListener("*",(t,i)=>this._delegateEvent(e,t,i))}_getAxisAttributes(){var e,t,i,s,r,a,o,l,h,d,u;const c=this._spec;let f,p=c.title.angle;c.orient!=="left"&&c.orient!=="right"||!((e=c.title)===null||e===void 0)&&e.autoRotate&&C(c.title.angle)&&(p=c.orient==="left"?-90:90,f=Lq[c.orient]);const g=Nl(c.label,["style","formatMethod","state"]),_=(t=c.background)!==null&&t!==void 0?t:{},m=(i=c.title.background)!==null&&i!==void 0?i:{};return{orient:this.getOrient(),select:this._option.disableTriggerEvent!==!0&&c.select,hover:this._option.disableTriggerEvent!==!0&&c.hover,line:Iq(c.domainLine),label:Object.assign({style:Y(c.label.style)?(y,b,v,x)=>{var S;const A=c.label.style(y.rawValue,b,y,v,x);return ve(pe({},(S=this._theme.label)===null||S===void 0?void 0:S.style,A))}:ve(c.label.style),formatMethod:c.label.formatMethod?(y,b,v)=>c.label.formatMethod(b.rawValue,b):null,state:L9(c.label.state)},g),tick:c.tick.visible===!1?{visible:!1}:{visible:c.tick.visible,length:c.tick.tickSize,inside:c.tick.inside,alignWithLabel:c.tick.alignWithLabel,style:Y(c.tick.style)?(y,b,v,x)=>{var S;const A=c.tick.style(y,b,v,x);return ve(pe({},(S=this._theme.tick)===null||S===void 0?void 0:S.style,A))}:ve(c.tick.style),state:Po(c.tick.state),dataFilter:c.tick.dataFilter},subTick:c.subTick.visible===!1?{visible:!1}:{visible:c.subTick.visible,length:c.subTick.tickSize,inside:c.subTick.inside,count:c.subTick.tickCount,style:Y(c.subTick.style)?(y,b,v,x)=>{var S;const A=c.subTick.style(y,b,v,x);return ve(pe({},(S=this._theme.subTick)===null||S===void 0?void 0:S.style,A))}:ve(c.subTick.style),state:Po(c.subTick.state)},title:c.title.visible===!1?{visible:!1}:Object.assign({visible:c.title.visible,position:c.title.position,space:c.title.space,autoRotate:!1,angle:p?st(p):null,textStyle:pe({},f,ve(c.title.style)),padding:c.title.padding,shape:((s=c.title.shape)===null||s===void 0?void 0:s.visible)===!1?{visible:!1}:{visible:(r=c.title.shape)===null||r===void 0?void 0:r.visible,space:(a=c.title.shape)===null||a===void 0?void 0:a.space,style:ve((o=c.title.shape)===null||o===void 0?void 0:o.style)},background:m.visible===!1?{visible:!1}:{visible:m.visible,style:ve(m.style)},state:{text:Po(c.title.state),shape:Po((l=c.title.shape)===null||l===void 0?void 0:l.state),background:Po((h=c.title.background)===null||h===void 0?void 0:h.state)},pickable:((d=c.title.style)===null||d===void 0?void 0:d.pickable)!==!1,childrenPickable:((u=c.title.style)===null||u===void 0?void 0:u.pickable)!==!1},c.title),panel:_.visible===!1?{visible:!1}:{visible:_.visible,style:ve(_.style),state:Po(_.state)}}}_getGridAttributes(){const e=this._spec;return{alternateColor:e.grid.alternateColor,alignWithLabel:e.grid.alignWithLabel,style:Y(e.grid.style)?()=>(t,i)=>{var s,r;const a=e.grid.style((s=t.datum)===null||s===void 0?void 0:s.rawValue,i,t.datum);return ve(pe({},(r=this._theme.grid)===null||r===void 0?void 0:r.style,a))}:ve(e.grid.style),subGrid:e.subGrid.visible===!1?{visible:!1}:{type:"line",visible:e.subGrid.visible,alternateColor:e.subGrid.alternateColor,style:ve(e.subGrid.style)}}}_initTickDataSet(e){return pr(this._option.dataSet,"scale",pte),Ae(this._option.dataSet,"ticks",U5),new Ye(this._option.dataSet,{name:`${this.type}_${this.id}_ticks`}).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:e},!1)}_tickTransformOption(e){const t=this._tick||{},i=this._spec.label||{},{tickCount:s,forceTickCount:r,tickStep:a,tickMode:o}=t,{style:l,formatMethod:h,minGap:d}=i;return{sampling:this._spec.sampling!==!1,tickCount:s,forceTickCount:r,tickStep:a,tickMode:o,axisOrientType:this._orient,coordinateType:e,labelStyle:l,labelFormatter:h,labelGap:d}}addTransformToTickData(e,t){var i,s;(s=(i=this._tickData)===null||i===void 0?void 0:i.getDataView())===null||s===void 0||s.transform(e,t)}dataToPosition(e){return this._scale.scale(e)}}aS.specKey="axes";const xo=()=>{_6(),v6(),rS(),D.registerAnimation("axis",()=>({appear:{custom:v$},update:{custom:b$},exit:{custom:j3}}))};var DT=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};const gte=[fte.AxisSyncPlugin];class Cg extends aS{getOrient(){return this._orient}set autoIndentOnce(e){this._autoIndentOnce=e}getScales(){return this._scales}constructor(e,t){super(e,t),this.type=X.cartesianAxis,this.name=X.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=rt.Axis,this.layoutLevel=bs.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:i=>{this.computeData(i==null?void 0:i.value),xt(this._regions,s=>{const r=this.getOrient();At(r)?s.setXAxisHelper(this.axisHelper()):or(r)?s.setYAxisHelper(this.axisHelper()):Br(r)&&s.setZAxisHelper(this.axisHelper())},{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=i=>{let{x:s,y:r}=i;return j(s)&&(s+=+(this._orient==="left")*this.getLayoutRect().width),j(r)&&(r+=+(this._orient==="top")*this.getLayoutRect().height),{x:s,y:r}},this._transformLayoutRect=i=>{if(!this._visible)return i;const s=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":this._layout.layoutRectLevelMap.width===hn&&(i.width=s.x1<0?-s.x1:0);break;case"right":this._layout.layoutRectLevelMap.width===hn&&(i.width=s.x2>0?s.x2:0);break;case"top":this._layout.layoutRectLevelMap.height===hn&&(i.height=s.y1<0?-s.y1:0);break;case"bottom":this._layout.layoutRectLevelMap.height===hn&&(i.height=s.y2>0?s.y2:0)}return i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),this._layout.setRectInSpec(this._layoutCacheProcessing(i))},this._fixAxisOnZero=()=>{const{onZero:i,visible:s}=this._spec.domainLine;if(this.visible&&i&&s!==!1){const{onZeroAxisId:r,onZeroAxisIndex:a}=this._spec.domainLine,o=this._option.getComponentsByKey("axes"),l=At(this.getOrient()),h=u=>{var c;return(l?!At(u.getOrient()):At(u.getOrient()))&&Ue(u.getScale().type)&&u.getTickData()?(c=u.getTickData().getLatestData())===null||c===void 0?void 0:c.find(f=>f.value===0):u.getScale().ticks().includes(0)},d=o.filter(u=>h(u));if(d.length){let u;if(P(r))u=d.find(c=>c.id===r);else if(P(a)){const c=o[a];h(c)&&(u=c)}else u=d[0];if(u){const c=this._axisMark.getProduct(),f=u.valueToPosition(0);l?c.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:this._orient==="bottom"?-(u.getScale().range()[0]-f):f})}):c.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:this._orient==="left"?f:-(u.getScale().range()[1]-f)})})}}}},this._orient=jr(e,["z"]),Br(this._orient)&&(this.layoutType="absolute"),this._dataSet=t.dataSet}static getSpecInfo(e){const t=e[this.specKey];if(!t)return null;const i=e.direction==="horizontal";if(!W(t)){if(!XM(t))return null;const{axisType:o,componentName:l}=OM(t,i);return t.type=o,[{spec:t,specPath:[this.specKey],type:l}]}let s=!0;if(t.filter(o=>o.orient==="z")[0]){const o=t.filter(h=>h.orient==="bottom")[0],l=t.filter(h=>or(h.orient))[0];s=t.length===3&&o&&l}let r=t.map((o,l)=>({spec:o,index:l}));s||(r=r.filter(({spec:o})=>o.orient!=="z"));const a=[];return r.forEach(({spec:o,index:l})=>{if(!XM(o))return;const{axisType:h,componentName:d}=OM(o,i);o.type=h,a.push({spec:o,specIndex:l,specPath:[this.specKey,l],type:d})}),a}static createComponent(e,t){const{spec:i}=e,s=DT(e,["spec"]),r=D.getComponentInKey(s.type);return r?new r(i,Object.assign(Object.assign({},t),s)):(t.onError(`Component ${s.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=this._spec.autoIndent!==!1,this._layout.layoutOrient=this._orient}setLayout3dBox(e){this.layout3dBox=e}updateScaleRange(){let e=!1;const{width:t,height:i}=this.getLayoutRect(),{left:s,right:r,top:a,bottom:o}=this._innerOffset;let l=[];At(this.getOrient())?j(t)&&(l=this._inverse?[t-r,s]:[s,t-r]):Br(this.getOrient())?j(t)&&(l=this._inverse?[t-r,s]:[s,t-r],this._scale.range(l)):j(i)&&(l=this._inverse?[a,i-o]:[i-o,a]);const[h,d]=this._scale.range();return l[0]===h&&l[1]===d||(e=!0,this._scale.range(l)),e}init(e){var t;super.init(e),(t=this.pluginService)===null||t===void 0||t.load(gte.map(i=>new i)),this.callPlugin(i=>{this.pluginService&&i.onInit&&i.onInit(this.pluginService,this)})}setAttrFromSpec(){var e;if(super.setAttrFromSpec(),this.visible){At(this.getOrient())?bt(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):bt(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const i=this._getAxisAttributes();i.label.formatMethod=this.getLabelFormatMethod(),i.verticalFactor=this.getOrient()==="top"||this.getOrient()==="right"?-1:1,this._axisStyle=i}this._tick=this._spec.tick;const t=(e=this._option.getChart())===null||e===void 0?void 0:e.getSpec();this._inverse=j9(this._spec,(t==null?void 0:t.direction)==="horizontal")}onLayoutStart(e,t,i){if(super.onLayoutStart(e,t,i),!Br(this.getOrient())&&this._spec.innerOffset){const s=this._spec;or(this.getOrient())?["top","bottom"].forEach(r=>{this._innerOffset[r]=Ii(s.innerOffset[r],t.height,t)}):["left","right"].forEach(r=>{this._innerOffset[r]=Ii(s.innerOffset[r],t.width,t)})}}getSeriesStatisticsField(e){let t;return t=At(this.getOrient())?e.fieldX:Br(this.getOrient())?e.fieldZ:e.fieldY,Ue(this._scale.type)?t:[t[0]]}_tickTransformOption(e){var t,i;return Object.assign(Object.assign({},super._tickTransformOption(e)),{noDecimals:this._tick.noDecimals,labelLastVisible:(t=this._spec.label)===null||t===void 0?void 0:t.lastVisible,labelFlush:(i=this._spec.label)===null||i===void 0?void 0:i.flush})}_initData(){const e=this._initTickDataSet(this._tickTransformOption("cartesian"));e.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new wr(this._option,e)}axisHelper(){return{isContinuous:Ue(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(e=0)=>this._scales[e],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse===!0}}afterCompile(){var e;const t=(e=this._axisMark)===null||e===void 0?void 0:e.getProduct();t&&t.addEventListener(de.AFTER_ELEMENT_ENCODE,()=>{if(this._isLayout===!1&&(At(this.getOrient())?this.callPlugin(i=>{this.pluginService&&i.onDidLayoutHorizontal&&i.onDidLayoutHorizontal(this.pluginService,this)}):this.callPlugin(i=>{this.pluginService&&i.onDidLayoutVertical&&i.onDidLayoutVertical(this.pluginService,this)}),this._delegateAxisContainerEvent(t.getGroupGraphicItem()),this._unitText)){const i=t.graphicItem.AABBBounds,s=At(this._orient)?{x:i.x2,y:this.getLayoutStartPoint().y}:{x:this.getLayoutStartPoint().x,y:i.y1};this._unitText.setAttributes(s)}}),this.callPlugin(i=>{this.pluginService&&i.onDidCompile&&i.onDidCompile(this.pluginService,this)})}onLayoutEnd(e){this.updateScaleRange()?this.event.emit(ye.scaleUpdate,{model:this,value:"range"}):this.updateSeriesScale(),super.onLayoutEnd(e)}onRender(e){}changeRegions(e){}update(e){}resize(e){}collectScale(){const e=[];return xt(this._regions,t=>{e.push(this.getOrient()==="left"||this.getOrient()==="right"?t.scaleY:t.scaleX)},{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}collectData(e,t){const i=[];return xt(this._regions,s=>{var r,a,o;let l;if(l=e>0?(a=(r=s.getGroups())===null||r===void 0?void 0:r.fields)===null||a===void 0?void 0:a[e]:At(this.getOrient())?s.fieldX2?[...s.fieldX,s.fieldX2]:s.fieldX:Br(this.getOrient())?s.fieldZ:s.fieldY,l=W(l)?Ue(this._scale.type)?l:[l[0]]:[l],e||(this._dataFieldText=s.getFieldAlias(l[0])),l){const h=s.getViewData();if(t)l.forEach(d=>{i.push(s.getRawDataStatisticsByField(d,!1))});else if(h&&h.latestData&&h.latestData.length){const d=(o=s.getViewDataStatistics)===null||o===void 0?void 0:o.call(s);l.forEach(u=>{var c;!((c=d==null?void 0:d.latestData)===null||c===void 0)&&c[u]&&i.push(d.latestData[u])})}}},{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}updateSeriesScale(){const e=this.getOrient();xt(this._regions,t=>{At(e)?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):or(e)?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):Br(e)&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))},{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(e){let t={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return t;this._verticalLimitSize=At(this.getOrient())?e.height:e.width,this.setLayoutRect(e),!this.updateScaleRange()&&W(this._tickData.getLatestData())||this.computeData("range");const i={skipLayout:!1},s=At(this.getOrient());this.pluginService&&(s?this.callPlugin(o=>{o.onWillLayoutHorizontal&&o.onWillLayoutHorizontal(this.pluginService,i,this)}):this.callPlugin(o=>{o.onWillLayoutVertical&&o.onWillLayoutVertical(this.pluginService,i,this)}));const r=this._axisMark.getProduct();let a=!1;if(!i.skipLayout){const o=this._getUpdateAttribute(!0),l=r.getGroupGraphicItem(),h=pe(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,o,{line:{visible:!1}}),d=l.getBoundsWithoutRender(h);a=!0,this._latestBounds=d,isFinite(d.width())&&(t=this._appendAxisUnit(d,s))}return a||(this._latestBounds=r.getBounds()),t}updateLayoutAttribute(){if(!this.visible)return;const e=this.getLayoutStartPoint(),t=this._getUpdateAttribute(!1),{grid:i}=t,s=DT(t,["grid"]),r=this._axisMark.getProduct(),a=pe({x:e.x,y:e.y},this._axisStyle,s);r.encode(a),this._gridMark&&this._gridMark.getProduct().encode(pe({x:e.x,y:e.y},this._getGridAttributes(),i)),super.updateLayoutAttribute()}_getTitleLimit(e){var t,i,s,r,a;if(this._spec.title.visible&&C((t=this._spec.title.style)===null||t===void 0?void 0:t.maxLineWidth)){const o=(a=(s=(i=this._axisStyle.title)===null||i===void 0?void 0:i.angle)!==null&&s!==void 0?s:(r=this._spec.title.style)===null||r===void 0?void 0:r.angle)!==null&&a!==void 0?a:0;if(e){const d=this.getLayoutRect().width,u=Math.abs(Math.cos(o));return u<1e-6?1/0:d/u}const l=this.getLayoutRect().height,h=Math.abs(Math.sin(o));return h<1e-6?1/0:l/h}return null}_getUpdateAttribute(e){var t;let i=0,s=0;if(!e){const m=this.getRegions();let{x:y,y:b}=m[0].getLayoutStartPoint(),v=y+m[0].getLayoutRect().width,x=b+m[0].getLayoutRect().height;for(let S=1;S<m.length;S++){const A=m[S],{x:k,y:w}=A.getLayoutStartPoint(),{width:M,height:T}=A.getLayoutRect();y=Math.min(y,k),v=Math.max(v,M+k),b=Math.min(b,w),x=Math.max(x,T+w)}i=Math.abs(x-b),s=Math.abs(v-y)}const{width:r,height:a}=this.getLayoutRect(),o=At(this._orient),l=or(this._orient),h=Br(this._orient);let d={x:0,y:0},u=0,c=0;const f=this.layout3dBox?this.layout3dBox.length:0;if(o?(d={x:r,y:0},u=i,c=r):l&&(d={x:0,y:a},u=s,c=a),h){const m=(t=this.directionStr)!==null&&t!==void 0?t:"r2l",y=this.layout3dBox?this.layout3dBox.width:0;let b=[0,0],v=-Math.PI/2,x=0;m==="l2r"&&(x=this.layout3dBox.length,b=[0,0,0],v=Math.PI/2);const S=this.getLabelItems(r),A={start:{x:0,y:0},end:{x:f,y:0},z:x,alpha:v,anchor3d:b,title:{text:this._spec.title.text||this._dataFieldText,maxWidth:this._getTitleLimit(o)},items:S};return e||(A.grid={type:"line",start:{x:0,y:0},end:{x:f,y:0},items:S[0],verticalFactor:this._axisStyle.verticalFactor,depth:y,length:i,z:x,alpha:v,anchor3d:b}),A}let p=o?this.layout.minHeight:this.layout.minWidth;(o&&this._layout.layoutRectLevelMap.height===Fr||l&&this._layout.layoutRectLevelMap.width===Fr)&&(p=this._verticalLimitSize);const g=this.getLabelItems(c),_={start:{x:0,y:0},end:d,title:{text:this._spec.title.text||this._dataFieldText,maxWidth:this._getTitleLimit(o)},items:g,verticalLimitSize:this._verticalLimitSize,verticalMinSize:p};return e||(_.grid={type:"line",start:{x:0,y:0},end:d,items:g[0],verticalFactor:this._axisStyle.verticalFactor,depth:f,length:u}),_}initEvent(){super.initEvent(),this.visible&&(this.event.on(ye.layoutEnd,this._fixAxisOnZero),this.event.on(ye.layoutRectUpdate,()=>{this._clearLayoutCache()}))}_layoutCacheProcessing(e){return["width","height"].forEach(t=>{e[t]<this._layoutCache[t]?e[t]=this._layoutCache[t]:this._layoutCache[t]=e[t]}),this._autoIndentOnce&&this._hasAutoIndent?["x1","x2","y1","y2"].forEach(t=>{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]}):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach(t=>{this.layout.getLastComputeOutBounds()[t]<this._layoutCache._lastComputeOutBounds[t]?this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]:this._layoutCache._lastComputeOutBounds[t]=this.layout.getLastComputeOutBounds()[t]})),e}_clearLayoutCache(){this._hasAutoIndent=!1,this._layoutCache.width=0,this._layoutCache.height=0,this._layoutCache._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0}}onDataUpdate(){this._clearLayoutCache()}_appendAxisUnit(e,t){var i;if(this._spec.unit&&this._spec.unit.visible){const{text:s,style:r}=this._spec.unit;let a,o;t?(a={x:e.x2,y:this.getLayoutStartPoint().y},o={textAlign:"left",textBaseline:"middle"}):(a={x:this.getLayoutStartPoint().x,y:e.y1},o={textAlign:this._orient==="left"?"left":"right",textBaseline:"bottom"}),o=Object.assign(Object.assign(Object.assign({},o),r),{x:a.x,y:a.y,text:s}),this._unitText?this._unitText.setAttributes(o):(this._unitText=no(o),this._unitText.name="axis-unit",(i=this.getContainer())===null||i===void 0||i.add(this._unitText));const l=this._unitText.AABBBounds;t?(e.x2+=l.x2>e.x2?l.x2-e.x2:0,e.y2+=l.y2>e.y2?l.y2-e.y2:0):(e.x1+=l.x1<e.x1?l.x1-e.x1:0,e.y1+=l.y1<e.y1?l.y1-e.y1:0)}return e}_getNeedClearVRenderComponents(){return this._unitText?[this._unitText]:[]}}Cg.type=X.cartesianAxis,Cg.specKey="axes";const _te=Math.sqrt(50),mte=Math.sqrt(10),yte=Math.sqrt(2);class xm{constructor(){this._extend={}}setExtraAttrFromSpec(){P(this._spec.nice)&&(this._nice=this._spec.nice),P(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=vu(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var e;let t=5;const i=this._spec.tick||{};if(j(i.forceTickCount))t=i.forceTickCount;else if(Y(i.tickCount)){const a=this._scale.range();let o=Math.abs(a[a.length-1]-a[0]);o===1&&this._option&&(o=At(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height),t=i.tickCount({rangeSize:o,labelStyle:this._spec.label&&this._spec.label.style})}else t=j(i.tickCount)?i.tickCount:5;this._spec.niceType==="accurateFirst"&&(t=Math.max(5,t));const{min:s,max:r}=(e=this._domain)!==null&&e!==void 0?e:{};C(s)&&C(r)?this._nice&&this._scale.nice(t):P(s)&&C(r)?this._nice&&this._scale.niceMax(t):C(s)&&P(r)&&this._nice&&this._scale.niceMin(t)}setLogScaleNice(){var e;const{min:t,max:i}=(e=this._domain)!==null&&e!==void 0?e:{};C(t)&&C(i)?this._nice&&this._scale.nice():P(t)&&C(i)?this._nice&&this._scale.niceMax():C(t)&&P(i)&&this._nice&&this._scale.niceMin()}setScaleNice(){this._spec.type==="log"?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(e,t){return this.valueToPosition(e[0])}valueToPosition(e){return this._spec.type!=="log"||C(e)||e!==0&&e[0]!==0?this._scale.scale(e):this._scale.range()[0]}computeLinearDomain(e){const t=[];return e.length?e.forEach(i=>{const{min:s,max:r}=i;t[0]=t[0]===void 0?s:Math.min(t[0],s),t[1]=t[1]===void 0?r:Math.max(t[1],r)}):(t[0]=0,t[1]=0),this.expandDomain(t),this.includeZero(t),this.setDomainMinMax(t),t}expandDomain(e){if(!this._expand)return;let t=e[0],i=e[e.length-1];t===i&&(i===0?i=1:i>0?t=0:i<0&&(i=0)),P(this._expand.min)&&(e[0]=t-(i-t)*this._expand.min),P(this._expand.max)&&(e[e.length-1]=i+(i-t)*this._expand.max)}niceDomain(e){const{min:t,max:i}=vu(this._spec);if(P(t)||P(i)||this._spec.type!=="linear")return e;if(Math.abs(hi(e)-Vt(e))<=1e-12){let s=e[0];const r=s>=0?1:-1;if(s=Math.abs(s),s<1)e[0]=0,e[1]=1;else{let a=s/5;const o=Math.floor(Math.log(a)/Math.LN10),l=a/Math.pow(10,o);a=(l>=_te?10:l>=mte?5:l>=yte?2:1)*Math.pow(10,o),e[0]=0,e[1]=10*a}r<0&&(e.reverse(),e[0]*=-1,e[1]*=-1)}return e}includeZero(e){this._zero&&(e[0]=Math.min(e[0],0),e[e.length-1]=Math.max(e[e.length-1],0))}setExtendDomain(e,t){if(t===void 0)return void delete this._extend[e];this._extend[e]=t;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.setScaleNice(),this.event.emit(ye.scaleUpdate,{model:this,value:"domain"})}extendDomain(e){let t;const i=e.length-1,s=e[0]-e[i]>0,r=s?i:0,a=s?0:i;for(const o in this._extend)t=this._extend[o],t>e[a]&&(e[a]=t),t<e[r]&&(e[r]=t)}getDomainSpec(){return this._domain}setDomainMinMax(e){if(!this._domain)return;const{min:t,max:i}=this._domain;P(t)&&(e[0]=t),P(i)&&(e[1]=i)}setZero(e){this._zero!==e&&(this._zero=e,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const e=this.collectData(),t=this.computeDomain(e);this.updateScaleDomainByModel(t)}updateScaleDomainByModel(e){e=e??this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this.setScaleNice(),this.event.emit(ye.scaleDomainUpdate,{model:this}),this.event.emit(ye.scaleUpdate,{model:this,value:"domain"})}}class ya extends Cg{constructor(){super(...arguments),this.type=X.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new qn}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var e,t;super.initScales();const i=[0,1];P((e=this._domain)===null||e===void 0?void 0:e.min)&&(i[0]=this._domain.min),P((t=this._domain)===null||t===void 0?void 0:t.max)&&(i[1]=this._domain.max),this._scale.domain(i)}computeDomain(e){return this.computeLinearDomain(e)}axisHelper(){const e=super.axisHelper();return e.setExtendDomain=this.setExtendDomain.bind(this),e.valueToPosition=this.valueToPosition.bind(this),e}}ya.type=X.cartesianLinearAxis,ya.specKey="axes",li(ya,xm);const bte=()=>{xo(),D.registerComponent(ya.type,ya)};class MI{constructor(){this._rawDomainIndex=[]}dataToPosition(e,t={}){var i,s;if(e.length===0||this._scales.length===0)return 0;const{position:r,bandScale:a}=this.getPosition(e);return r+a.bandwidth()*((s=(i=t.bandPosition)!==null&&i!==void 0?i:this._spec.bandPosition)!==null&&s!==void 0?s:this._defaultBandPosition)}valueToPosition(e){return this._scale.scale(e)}updateGroupScaleRange(){let e=this._scale;this._scales.forEach((t,i)=>{i>0&&(t.range([0,e.bandwidth()]),e=t)})}getPosition(e){let t=0,i=this._scale;if(this._scales.length===1||e.length===1)t=this.valueToPosition(e[0]);else{const s=Math.min(e.length,this._scales.length);for(let r=0;r<s;r++)t+=this._scales[r].scale(e[r]);i=this._scales[s-1]}return{position:t,bandScale:i}}calcScales(e,t){var i,s;const{bandPadding:r,paddingInner:a,paddingOuter:o}=this._spec,l=W(r),h=W(a),d=W(o);for(let u=0;u<this._scales.length;u++){const c=l?r[u]:r,f=h?a[u]:a,p=d?o[u]:o;this._scales[u].paddingInner((i=f??c)!==null&&i!==void 0?i:e,!0).paddingOuter((s=p??c)!==null&&s!==void 0?s:t,!0)}}computeBandDomain(e){if(!e.length)return[];if(e.length===1)return e[0].values;const t=new Set;for(let i=0;i<e.length;i++)for(let s=0;s<e[i].values.length;s++)t.add(e[i].values[s]);return Array.from(t)}updateScaleDomain(){var e;if(!this.isSeriesDataEnable())return;!(!((e=this._rawDomainIndex)===null||e===void 0)&&e.length)&&this._scales.length&&this._updateRawDomain();const t=this._spec.domain;for(let i=0;i<this._scales.length;i++)if(t&&t.length&&i===0)this._scales[i].domain(t);else{const s=this.collectData(i),r=this.computeDomain(s);this._scales[i].domain(r.sort((a,o)=>this._rawDomainIndex[i][a]-this._rawDomainIndex[i][o]))}this.transformScaleDomain(),this.event.emit(ye.scaleDomainUpdate,{model:this}),this.event.emit(ye.scaleUpdate,{model:this,value:"domain"})}_updateRawDomain(){this._rawDomainIndex=[];const e=this._spec.domain;for(let t=0;t<this._scales.length;t++)if(e&&e.length&&t===0)this._scales[t].domain(e);else{const i=this.collectData(t,!0),s=this.computeDomain(i);this._rawDomainIndex[t]={},s.forEach((r,a)=>this._rawDomainIndex[t][r]=a)}}_clearRawDomain(){this._rawDomainIndex=[]}}class Td extends Cg{constructor(){super(...arguments),this.type=X.cartesianBandAxis,this._scale=new bo}computeDomain(e){return this.computeBandDomain(e)}updateScaleRange(){const e=super.updateScaleRange();return this.updateGroupScaleRange(),e}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const e=t=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:e,getBandwidth:t=>e(t).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse}}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){var e;if(this._scale&&(this._spec.bandSize&&this._scale.bandwidth(this._spec.bandSize),this._spec.maxBandSize&&this._scale.maxBandwidth(this._spec.maxBandSize),this._spec.minBandSize&&this._scale.minBandwidth(this._spec.minBandSize),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(this._spec.bandSize||this._spec.maxBandSize))){const t=WE(this._scale.domain().length,(e=this._spec.bandSize)!==null&&e!==void 0?e:this._spec.maxBandSize,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach(i=>i.setMaxWidth(t)):["left","right"].includes(this._orient)&&this._regions.forEach(i=>i.setMaxHeight(t))}}}Td.type=X.cartesianBandAxis,Td.specKey="axes",li(Td,MI);const vte=()=>{xo(),D.registerComponent(Td.type,Td)};class Pg extends ya{constructor(){super(...arguments),this.type=X.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:e=>{this.computeData(e==null?void 0:e.value),xt(this._regions,t=>{At(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())},{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var e;super.setAttrFromSpec(),this._tick=pe({},this._spec.tick,(e=this._spec.layers)===null||e===void 0?void 0:e[0])}_initData(){var e;if(super._initData(),(e=this._spec.layers)===null||e===void 0?void 0:e[1]){const t=new Ye(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:Object.assign(Object.assign({},this._tickTransformOption("cartesian")),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new wr(this._option,t)}}computeData(e){super.computeData(e),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){var e,t,i,s,r,a,o,l;const h=Vr.getInstance(),d=((t=(e=this._spec.layers)===null||e===void 0?void 0:e[1])===null||t===void 0?void 0:t.timeFormat)||"%Y%m%d",u=(((s=(i=this._spec.layers)===null||i===void 0?void 0:i[1])===null||s===void 0?void 0:s.timeFormatMode)||"local")==="local"?h.timeFormat:h.timeUTCFormat,c=((a=(r=this._spec.layers)===null||r===void 0?void 0:r[0])===null||a===void 0?void 0:a.timeFormat)||"%Y%m%d",f=(((l=(o=this._spec.layers)===null||o===void 0?void 0:o[0])===null||l===void 0?void 0:l.timeFormatMode)||"local")==="local"?h.timeFormat:h.timeUTCFormat;return(p,g,_,m,y)=>{var b;let v;return v=y===0?f(c,p):u(d,p),!((b=this._spec.label)===null||b===void 0)&&b.formatMethod?this._spec.label.formatMethod(v,g):v}}getLabelItems(e){const t=[];return W(this._tickData.getLatestData())&&t.push(this._tickData.getLatestData().map(i=>({id:i.value,label:i.value,value:e===0?0:this.dataToPosition([i.value])/e,rawValue:i.value}))),this._layerTickData&&W(this._layerTickData.getLatestData())&&t.push(this._layerTickData.getLatestData().map(i=>{const s=this.dataToPosition([i.value]);return{id:i.value,label:i.value,value:s/e,rawValue:i.value}})),t}transformScaleDomain(){}}Pg.type=X.cartesianTimeAxis,Pg.specKey="axes";const xte=()=>{xo(),D.registerComponent(Pg.type,Pg)};class Cd extends ya{constructor(){super(...arguments),this.type=X.cartesianLogAxis,this._zero=!1,this._scale=new i0}initScales(){var e;super.initScales(),this._scale.base((e=this._spec.base)!==null&&e!==void 0?e:10)}transformScaleDomain(){}}Cd.type=X.cartesianLogAxis,Cd.specKey="axes",li(Cd,xm);const Ste=()=>{xo(),D.registerComponent(Cd.type,Cd)};class Pd extends ya{constructor(){super(...arguments),this.type=X.cartesianSymlogAxis,this._zero=!1,this._scale=new n0}initScales(){var e;super.initScales(),this._scale.constant((e=this._spec.constant)!==null&&e!==void 0?e:10)}transformScaleDomain(){}}Pd.type=X.cartesianSymlogAxis,Pd.specKey="axes",li(Pd,xm);const Ate=()=>{xo(),D.registerComponent(Pd.type,Pd)},FT=n=>{var e;const t=(e=n.type)!==null&&e!==void 0?e:n.orient==="angle"?"band":"linear";return{axisType:t,componentName:`${X.polarAxis}-${t}`}};var zT=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};class Eg extends aS{constructor(){super(...arguments),this.type=X.polarAxis,this.name=X.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=rt.Axis,this._tick=void 0,this._center=null,this._startAngle=O_,this._endAngle=h0,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:e=>{this.computeData(e==null?void 0:e.value),xt(this._regions,t=>{this.getOrient()==="radius"?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()},{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=e=>{var t;const i=(t=this.getRegions())===null||t===void 0?void 0:t[0];return i?i.getLayoutStartPoint():e}}get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(e){var t,i;const s=e[this.specKey];if(!s)return null;if(!W(s)){if(!KM(s))return null;const{axisType:l,componentName:h}=FT(s);return s.center=e.center,s.startAngle=(t=e.startAngle)!==null&&t!==void 0?t:pd,s.endAngle=(i=e.endAngle)!==null&&i!==void 0?i:P(e.startAngle)?e.startAngle+360:pf,s.type=l,[{spec:s,specPath:[this.specKey],type:h}]}const r=[];let a;const o=[];return s.forEach((l,h)=>{var d,u,c,f,p;if(!KM(l))return;const{axisType:g,componentName:_}=FT(l);l.center=e.center,l.startAngle=(d=e.startAngle)!==null&&d!==void 0?d:pd,l.endAngle=(u=e.endAngle)!==null&&u!==void 0?u:P(e.startAngle)?e.startAngle+360:pf,l.outerRadius=(p=(f=(c=l.radius)!==null&&c!==void 0?c:e.outerRadius)!==null&&f!==void 0?f:e.radius)!==null&&p!==void 0?p:eu,l.type=g;const m={spec:l,specIndex:h,specPath:[this.specKey,h],type:_};r.push(m),l.orient==="radius"?o.push(m):a=h}),o.forEach(l=>{l.angleAxisIndex=a}),r}static createComponent(e,t){const{spec:i}=e,s=zT(e,["spec"]),r=D.getComponentInKey(s.type);return r?new r(i,Object.assign(Object.assign({},t),s)):(t.onError(`Component ${s.type} not found`),null)}setAttrFromSpec(){var e,t;super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient=this._spec.orient==="angle"?"angle":"radius",this._center=this._spec.center;const i=this.getChart().getSpec(),s=(e=this._spec.startAngle)!==null&&e!==void 0?e:i.startAngle,r=(t=this._spec.endAngle)!==null&&t!==void 0?t:i.endAngle;this._startAngle=st(s??pd),this._endAngle=st(r??(P(s)?s+360:pf)),this._inverse=this._spec.inverse}onLayoutEnd(e){this.updateScaleRange()&&(this.updateSeriesScale(),this.event.emit(ye.scaleUpdate,{model:this,value:"range"})),super.onLayoutEnd(e)}onRender(e){}changeRegions(){}_initData(){const e=this._initTickDataSet(this._tickTransformOption("polar"));e.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new wr(this._option,e)}_tickTransformOption(e){return Object.assign(Object.assign({},super._tickTransformOption(e)),{noDecimal:this._tick.noDecimals,startAngle:this.startAngle,labelOffset:bu(this._spec),getRadius:()=>this.getOuterRadius()})}afterCompile(){var e;const t=(e=this._axisMark)===null||e===void 0?void 0:e.getProduct();t&&t.addEventListener(de.AFTER_ELEMENT_ENCODE,()=>{this._isLayout===!1&&this._delegateAxisContainerEvent(t.getGroupGraphicItem())})}updateScaleRange(){const e=this._scale.range();let t;return t=this.getOrient()==="radius"?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!e||!t||e[0]!==t[0]||e[1]!==t[1])&&(this._scale.range(t),!0)}collectData(e,t){const i=[];return xt(this._regions,s=>{var r,a,o;let l;if(l=e>0?(a=(r=s.getGroups())===null||r===void 0?void 0:r.fields)===null||a===void 0?void 0:a[e]:this.getOrient()==="radius"?s.getRadiusField():s.getAngleField(),l=W(l)?Ue(this._scale.type)?l:[l[0]]:[l],e||(this._dataFieldText=s.getFieldAlias(l[0])),l){const h=s.getViewData();if(t)l.forEach(d=>{i.push(s.getRawDataStatisticsByField(d,!1))});else if(h&&h.latestData&&h.latestData.length){const d=(o=s.getViewDataStatistics)===null||o===void 0?void 0:o.call(s);l.forEach(u=>{var c;!((c=d==null?void 0:d.latestData)===null||c===void 0)&&c[u]&&i.push(d.latestData[u])})}}},{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}updateSeriesScale(){xt(this._regions,e=>{this.getOrient()==="radius"?(e.setRadiusScale(this._scale),e.radiusAxisHelper=this.axisHelper()):(e.setAngleScale(this._scale),e.angleAxisHelper=this.axisHelper())},{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(e){const t=this.getOrient()==="radius"?e.getRadiusField():e.getAngleField();return Ue(this._scale.type)?t:[t[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Ue(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:e=>this._scales[e],getAxisId:()=>this.id}}positionToData(e){const t=this.pointToCoord(e);return this.getOrient()==="radius"?this.invert(t.radius):this.invert(t.angle)}coordToPoint(e){const t=e.angle,{x:i,y:s}=this.getCenter(),r=Yr({angle:t,radius:e.radius});return{x:r.x+i,y:r.y+s}}pointToCoord(e){const{x:t,y:i}=this.getCenter();let s=e.x-t,r=e.y-i;const a=this._startAngle,o=this._endAngle,l=Math.sqrt(s*s+r*r);s/=l,r/=l;let h=Math.atan2(r,s);if(h<a)for(;h<=a;)h+=2*Math.PI;if(h>o)for(;h>=o;)h-=2*Math.PI;return{radius:l,angle:h}}getCenter(){var e,t;return{x:((e=this._center)===null||e===void 0?void 0:e.x)||this.getRefLayoutRect().width/2,y:((t=this._center)===null||t===void 0?void 0:t.y)||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){if(this._tickData){const e=this._tickData.getLatestData();if(!e||W(e))return e||[];this.computeData("force")}return this._scale.ticks()}updateLayoutAttribute(){this._visible&&(this.getOrient()==="radius"?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const e=this.getCenter(),t=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),s=this._endAngle-this._startAngle,r=W(this._tickData.getLatestData())?this._tickData.getLatestData().map(l=>{const h=this.dataToPosition([l.value]);return{id:l.value,label:l.value,value:(h-this._startAngle)/s,rawValue:l.value}}):[],a=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:e,radius:t,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle}),o=Object.assign(Object.assign({},a),{title:{text:this._spec.title.text||this._dataFieldText},items:r.length?[r]:[],orient:"angle"});this._spec.grid.visible&&(o.grid=Object.assign({type:"line",smoothLink:!0,items:r},a)),this._update(o)}_layoutRadiusAxis(){var e,t,i;const s=this.getCenter(),r=this.computeLayoutOuterRadius(),a=this.computeLayoutInnerRadius(),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=this.coordToPoint({angle:this._startAngle,radius:a}),h=wt.distancePP(l,o),d=W(this._tickData.getLatestData())?this._tickData.getLatestData().map(f=>{const p=this.dataToPosition([f.value]);return{id:f.value,label:f.value,value:(p-a)/h,rawValue:f.value}}):[],u=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:l,end:o,verticalFactor:-1}),c=Object.assign(Object.assign({},u),{title:{text:this._spec.title.text||this._dataFieldText},items:d.length?[d]:[],orient:"radius"});!((e=this._spec.grid)===null||e===void 0)&&e.visible&&(c.grid=Object.assign({items:d,type:!((t=this._spec.grid)===null||t===void 0)&&t.smooth?"circle":"polygon",center:s,closed:!0,sides:(i=this._getRelatedAngleAxis())===null||i===void 0?void 0:i.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},u)),this._update(c)}_getRelatedAngleAxis(){const e=this._option.angleAxisIndex;if(P(e))return this._option.getComponentByIndex(this.specKey,e)}computeLayoutOuterRadius(){var e;const t=(e=this._spec.outerRadius)!==null&&e!==void 0?e:this._spec.radius,i=t??this.getRefSeriesRadius().outerRadius,{width:s,height:r}=this.getRefLayoutRect();return Math.min(s,r)/2*i}computeLayoutInnerRadius(){var e;const t=(e=this._spec.innerRadius)!==null&&e!==void 0?e:this.getRefSeriesRadius().innerRadius,{width:i,height:s}=this.getRefLayoutRect();return Math.min(i,s)/2*t}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let e=eu,t=0;const i=this.getChart().getSpec();return xt(this.getRegions(),s=>{const r=s;if(UK(r.type)){const{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=r;j(a)&&(e=a),j(o)&&(t=o)}},{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:e,innerRadius:t}}_update(e){const{grid:t}=e,i=zT(e,["grid"]);this._axisMark.getProduct().encode(pe({},this._axisStyle,i)),this._gridMark&&this._gridMark.getProduct().encode(pe({},this._gridStyle,t))}invert(e){var t;if(this.getOrient()==="angle"&&this._scale.type==="band"){const i=this._scale.range(),s=i[i.length-1]-i[0],r=((t=this.getSpec().bandPosition)!==null&&t!==void 0?t:this._defaultBandPosition)===.5?0:this._scale.bandwidth()/2;if(i[0]<0){const a=(e+r+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(a)}return this._scale.invert((e+r)%s)}return this._scale.invert(e)}}Eg.type=X.polarAxis,Eg.specKey="axes";class Ed extends Eg{constructor(){super(...arguments),this.type=X.polarLinearAxis,this._zero=!0,this._nice=!0,this._scale=new qn}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(e){return this.computeLinearDomain(e)}}Ed.type=X.polarLinearAxis,Ed.specKey="axes",li(Ed,xm);const kte=()=>{xo(),D.registerComponent(Ed.type,Ed)};class Rd extends Eg{constructor(){super(...arguments),this.type=X.polarBandAxis,this._scale=new bo}computeDomain(e){return this.computeBandDomain(e)}updateScaleRange(){const e=super.updateScaleRange();return this.updateGroupScaleRange(),e}axisHelper(){const e=super.axisHelper();return Object.assign(Object.assign({},e),{getBandwidth:t=>e.getScale(t).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}transformScaleDomain(){}}Rd.type=X.polarBandAxis,Rd.specKey="axes",li(Rd,MI);const wte=()=>{xo(),D.registerComponent(Rd.type,Rd)};var Mte=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};function Tte(n,e){const{title:t={},item:i={},pager:s={},background:r={},type:a,id:o,visible:l,orient:h,position:d,data:u,filter:c,regionId:f,regionIndex:p,seriesIndex:g,seriesId:_,padding:m}=n,y=Mte(n,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return t.visible&&(y.title=pL(t)),fe(i.focusIconStyle)||ve(i.focusIconStyle),i.shape=cs(i.shape),i.label=cs(i.label),i.value=cs(i.value),i.background=cs(i.background),dn(i.maxWidth)&&(i.maxWidth=Number(i.maxWidth.substring(0,i.maxWidth.length-1))*e.width/100),dn(i.width)&&(i.width=Number(i.width.substring(0,i.width.length-1))*e.width/100),dn(i.height)&&(i.height=Number(i.height.substring(0,i.height.length-1))*e.width/100),y.item=i,fe(s.textStyle)||ve(s.textStyle),cs(s.handler),y.pager=s,r.visible&&!fe(r.style)&&(pe(y,r.style),P(r.padding)&&(y.padding=r.padding)),y}const Cte=(n,e)=>{const t=[],i={},{series:s,seriesField:r}=e;return s().forEach(a=>{const o=r(a);let l;l=o===a.getSeriesField()?a.getSeriesInfoList():a.getSeriesInfoInField(o),l.forEach(h=>{i[h.key]||(i[h.key]=!0,t.push(h))})}),t},Pte=(n,e)=>{var t,i,s;const{selected:r,field:a,data:o}=e,l=r(),h=o();if(l.length===0&&h.length)return[];if(l.length===h.length)return n;const d={};l.forEach(c=>{d[c]=!0});const u=(t=a())!==null&&t!==void 0?t:vn;return W(n)&&(!((i=n[0])===null||i===void 0)&&i.nodes)?(n[0].nodes=n[0].nodes.filter(c=>d[c.key]===!0),!((s=n[0])===null||s===void 0)&&s.links&&(n[0].links=n[0].links.filter(c=>d[c.source]===!0&&d[c.target]===!0))):P(u)&&(n=n.filter(c=>d[c[u]]===!0)),n};class oS extends an{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=rt.Legend,this.layoutLevel=bs.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{xt(this._regions,e=>{var t;(t=e.getViewData())===null||t===void 0||t.markRunning()},{userId:this._seriesUserId,specIndex:this._seriesIndex}),xt(this._regions,e=>{e.reFilterViewData()},{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var e;super.setAttrFromSpec(),this._orient=O0(this._spec.orient)?this._spec.orient:"left",this._position=(e=this._spec.position)!==null&&e!==void 0?e:"middle",this._visible=this._spec.visible!==!1;const{regionId:t,regionIndex:i,seriesId:s,seriesIndex:r}=this._spec;P(s)&&(this._seriesUserId=N(s)),P(t)&&(this._regionUserId=N(t)),P(r)&&(this._seriesIndex=N(r)),P(i)&&(this._regionUserIndex=N(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(e){}_compareSpec(e,t){const i=super._compareSpec(e,t);return i.reRender=!0,(e==null?void 0:e.orient)!==(t==null?void 0:t.orient)?(i.reMake=!0,i):(ft(t,e)||(i.reCompile=!0),i)}changeRegions(e){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new wr(this._option,e),this._initSelectedData(),xt(this._regions,t=>{t.event.on(ye.rawDataUpdate,{filter:({model:i})=>(i==null?void 0:i.id)===t.id},()=>{this._legendData.getDataView().reRunAllTransform()})},{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var t,i,s;const r=this._selectedData;C(e)||JSON.stringify(r)===JSON.stringify(e)||(this._selectedData=[...e],(i=(t=this.effect).onSelectedDataChange)===null||i===void 0||i.call(t),this.event.emit(ye.legendSelectedDataChange,{model:this}),(s=this._legendComponent)===null||s===void 0||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(e){if(super.afterSetLayoutStartPoint(e),this._legendComponent){const{x:t,y:i}=e;j(t*i)&&this._legendComponent.setAttributes({x:t,y:i})}}getBoundsInRect(e,t){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(e);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)ft(s,this._cacheAttrs)||this._legendComponent.setAttributes(pe({},s,{defaultSelected:this._selectedData}));else{const o=new(this._getLegendConstructor())(pe({},s,{defaultSelected:this._selectedData}));o.name="legend",this._legendComponent=o,this.getContainer().add(o),this._option.disableTriggerEvent||this._initEvent(),o.on("*",(l,h)=>this._delegateEvent(this._legendComponent,l,h))}this._cacheAttrs=s;const r=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,a=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if(this.layoutType!=="normal-inline"){const o=this.layoutOrient==="bottom"||this.layoutOrient==="top"?"horizontal":"vertical",l=this._position,{width:h,height:d}=t;let u=0,c=0;o==="horizontal"?l==="middle"?u=(h-r)/2:l==="end"&&(u=h-r):l==="middle"?c=(d-a)/2:l==="end"&&(c=d-a),this._legendComponent.setAttributes({dx:u,dy:c})}return i.x2=i.x1+r,i.y2=i.y1+a,i}onDataUpdate(){var e,t;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const i=this._getLegendAttributes(this.getLayoutRect());ft(i,this._cacheAttrs)||this._legendComponent.setAttributes(pe({},i,{defaultSelected:this._selectedData}))}(t=(e=this.effect).onSelectedDataChange)===null||t===void 0||t.call(e),this.event.emit(ye.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}oS.specKey="legends";class Rg extends oS{constructor(){super(...arguments),this.type=X.discreteLegend,this.name=X.discreteLegend}static getSpecInfo(e){const t=e[this.specKey];if(!t)return;if(!W(t))return t.type&&t.type!=="discrete"?void 0:[{spec:t,specIndex:0,specPath:[this.specKey],type:X.discreteLegend}];const i=[];return t.forEach((s,r)=>{s.type&&s.type!=="discrete"||i.push({spec:s,specIndex:r,specPath:[this.specKey,r],type:X.discreteLegend})}),i}init(e){super.init(e),xt(this._regions,t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._getLegendDefaultData()},level:An.legendFilter})},{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Ae(this._option.dataSet,"discreteLegendFilter",Pte),Ae(this._option.dataSet,"discreteLegendDataMake",Cte);const e=new Ye(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return e.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return xt(this._regions,i=>{t.push(i)},{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),e}_getSeriesLegendField(e){var t,i;const s=e.getSeriesField();if(!this._spec.scaleName||!e.getRawData())return s;const r=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!r)return s;if(this._spec.field)return this._spec.field;if(!Yo(r.domain))return s;const a=r.domain.find(o=>o.dataId===e.getRawData().name);return a&&(i=(t=a.fields)===null||t===void 0?void 0:t[0])!==null&&i!==void 0?i:s}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._getLegendDefaultData()}_getLegendDefaultData(){return Y(this._spec.data)?this._getLegendItems().map(e=>e.label):this._legendData.getLatestData().map(e=>e.key)}_addDefaultTitleText(e){var t,i,s,r;if(!((t=e.title)===null||t===void 0)&&t.visible&&C(e.title.text)&&C((i=e.title.style)===null||i===void 0?void 0:i.text)){const a=(r=(s=this._regions)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.getSeries()[0];if(!a)return;e.title.text=pg(a.getRawData(),a.getSeriesField())}}_getLegendAttributes(e){const t=this.layoutOrient==="bottom"||this.layoutOrient==="top"?"horizontal":"vertical",i=Object.assign(Object.assign({layout:t,items:this._getLegendItems(),zIndex:this.layoutZIndex},Tte(this._spec,e)),{maxWidth:e.width,maxHeight:e.height});return this._addDefaultTitleText(i),i}_getLegendConstructor(){return ZR}_initEvent(){if(this._legendComponent){const e=this._spec.filter!==!1;this._legendComponent.addEventListener(Dn.legendItemClick,t=>{const i=Te(t,"detail.currentSelected");e&&this.setSelectedData(i),this.event.emit(ye.legendItemClick,{model:this,value:i,event:t})}),this._legendComponent.addEventListener(Dn.legendItemHover,t=>{const i=Te(t,"detail");this.event.emit(ye.legendItemHover,{model:this,value:i,event:t})}),this._legendComponent.addEventListener(Dn.legendItemUnHover,t=>{const i=Te(t,"detail");this.event.emit(ye.legendItemUnHover,{model:this,value:i,event:t})})}}_getLegendItems(){const e=(this._legendData.getLatestData()||[]).map(t=>{var i,s;const r=t.style("fillOpacity"),a=t.style("strokeOpacity"),o=t.style("opacity"),l=t.style("texture");return{label:t.key,shape:{symbolType:(s=(i=t.style("symbolType"))!==null&&i!==void 0?i:t.shapeType)!==null&&s!==void 0?s:"circle",fillOpacity:j(r)?r:1,strokeOpacity:j(a)?a:1,opacity:j(o)?o:1,texturePadding:l?1:null,textureSize:l?4:null,texture:l,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}});return Y(this._spec.data)?this._spec.data(e,this._option.globalScale.getScale("color"),this._option.globalScale):e}}Rg.specKey="legends",Rg.type=X.discreteLegend;const Ete=()=>{D.registerComponent(Rg.type,Rg)},Rte=(n,e)=>{const{series:t,field:i,scale:s}=e,r=i();if(i&&r){let a=Number.MAX_VALUE,o=Number.MIN_VALUE;return t().forEach(l=>{const h=l.getRawDataStatisticsByField(r,!0),d=h==null?void 0:h.min,u=h==null?void 0:h.max;j(d)&&(a=d),j(u)&&(o=u)}),[a,o]}if(s){const a=s();return a?a.domain():[]}return[]},Ote=(n,e)=>{const{selected:t,field:i,data:s}=e,r=t(),a=i();if(r===s())return n;if(a&&!fe(r)){const[o,l]=r;return n.filter(h=>h[a]>=o&&h[a]<=l)}return n};var Bte=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};function Lte(n){const e=pe({},n),{title:t={},handler:i={},rail:s={},track:r={},startText:a,endText:o,handlerText:l,sizeBackground:h,background:d={},type:u,id:c,visible:f,orient:p,position:g,data:_,defaultSelected:m,field:y,filter:b,regionId:v,regionIndex:x,seriesIndex:S,seriesId:A,padding:k}=e,w=Bte(e,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return t.visible&&(w.title=pL(t)),w.showHandler=i.visible!==!1,fe(i.style)||(w.handlerStyle=ve(i.style)),P(s.width)&&(w.railWidth=s.width),P(s.height)&&(w.railHeight=s.height),fe(s.style)||(w.railStyle=ve(s.style)),fe(r.style)||(w.trackStyle=ve(r.style)),w.startText=cs(a),w.endText=cs(o),w.handlerText=cs(l),fe(h)||(w.sizeBackground=ve(h)),d.visible&&!fe(d.style)&&(pe(w,d.style),P(d.padding)&&(w.padding=d.padding)),w}function jT(n){return n==="color"||n==="size"}const Ite={color:X_,size:K_},Dte=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],Fte=[2,10];class Og extends oS{static getSpecInfo(e){const t=e[this.specKey];if(!t)return;if(!W(t))return jT(t.type)?[{spec:t,specIndex:0,specPath:[this.specKey],type:t.type==="color"?X.colorLegend:X.sizeLegend}]:void 0;const i=[];return t.forEach((s,r)=>{jT(s.type)&&i.push({spec:s,specIndex:r,specPath:[this.specKey,r],type:s.type==="color"?X.colorLegend:X.sizeLegend})}),i}constructor(e,t){super(e,t),this.type=X.colorLegend,this.name=X.colorLegend;const i=this._spec.type==="color"?X.colorLegend:X.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),xt(this._regions,t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()},level:An.legendFilter})},{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const e=this._option.globalScale;let t=this._spec.scale;return t||(t=this._legendType),e.getScale(t)}_initLegendData(){Ae(this._option.dataSet,"continuousLegendFilter",Ote),Ae(this._option.dataSet,"continuousLegendDataMake",Rte);const e=new Ye(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return e.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce((t,i)=>(t.push(...i.getSeries()),t),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),e}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(e){var t,i,s,r;if(!((t=e.title)===null||t===void 0)&&t.visible&&C(e.title.text)&&C((i=e.title.style)===null||i===void 0?void 0:i.text)){const a=this._field;if(a){const d=(r=(s=this._regions)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.getSeries()[0];return d?void(e.title.text=pg(d.getRawData(),a)):void 0}let o=this._spec.scale;o||(o=this._legendType);const l=this._option.globalScale.getScaleSpec(o);if(!Yo(l==null?void 0:l.domain))return;const h=l.domain[0];if(h.fields.length===0)return;e.title.text=pg(this._option.dataSet.getDataView(h.dataId),h.fields[0])}}_getLegendAttributes(e){var t,i;const s=this.layoutOrient==="bottom"||this.layoutOrient==="top"?"horizontal":"vertical",r=s==="horizontal"?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&o.type==="linear"&&(a=o.range()),fe(a)&&(a=this._legendType==="color"?Dte:Fte);let l=(t=this._legendData.getLatestData()[0])!==null&&t!==void 0?t:0,h=(i=this._legendData.getLatestData()[1])!==null&&i!==void 0?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=this._legendData.getLatestData()[0]===0?1:Math.max(0,this._legendData.getLatestData()[0]));const d=Object.assign({layout:s,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,[this._legendType==="color"?"colors":"sizeRange"]:a},Lte(this._spec));return this._addDefaultTitleText(d),d}_getLegendConstructor(){return Ite[this._legendType]}_initEvent(){if(this._legendComponent){const e=this._spec.filter!==!1;this._legendComponent.addEventListener("change",Us(t=>{const i=Te(t,"detail.value");e&&this.setSelectedData(i),this.event.emit(ye.legendFilter,{model:this,value:i,event:t})},30))}}}Og.specKey="legends",Og.type=X.continuousLegend;const zte=()=>{D.registerComponent(Og.type,Og)};function jte(n){return String(n).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\(/g,"&#40;").replace(/ /g," &nbsp;")}const Xi=(n,e,t)=>C(n)?n:Y(n)?n(e,t):n,Od=(n,e,t)=>{if(C(n))return n;if(W(n)){const i=[];return n.forEach(s=>{if(Y(s)){const r=s(e,t);P(r)&&i.push(r)}else i.push(s)}),i}return Y(n)?n(e,t):n};function Hte(n){var e;const t=!((e=n[0])===null||e===void 0)&&e.series?[{data:n,value:""}]:n;for(const{data:i}of t)for(const{datum:s}of i)for(const r of s??[])if(r)return r}const ef=(n,e)=>n?(e||(e=n.getBoundingClientRect()),n.offsetWidth>0?e.width/n.offsetWidth:e.height/n.offsetHeight):1,Py=(n,e)=>{var t;let i,s;(n==null?void 0:n.type)!=="rich"&&(n==null?void 0:n.type)!=="html"?(n=(n??"").toString(),e.multiLine?(i=n.split(`
  49. `),i=i.map((a,o)=>o<i.length-1?a+`
  50. `:a)):i=[n],s=i.map(a=>Object.assign(Object.assign({},e),{text:a}))):(s=n.text,i=n);const r=lH({wordBreak:(t=e.wordBreak)!==null&&t!==void 0?t:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:s});return{width:r.width(),height:r.height(),text:i}},Gte="vchart-tooltip-element",HT="vchart-tooltip-container",Wte=20,GT="",WT={key:"其他",value:"..."},Ey={offsetX:10,offsetY:10,sanitize:jte};class Bg{}Bg.dom=`${be}_TOOLTIP_HANDLER_DOM`,Bg.canvas=`${be}_TOOLTIP_HANDLER_CANVAS`;const tf=(n,e)=>{let t;if(P(n)){if(oe(n))t=n;else if(Y(n)){const i=n(e);oe(i)&&(t=i)}}return t},TI={left:["left","middle"],right:["right","middle"],inside:["middle","middle"],top:["middle","top"],lt:["left","top"],tl:["left","top"],rt:["right","top"],tr:["right","top"],bottom:["middle","bottom"],bl:["left","bottom"],lb:["left","bottom"],br:["right","bottom"],rb:["right","bottom"]},Hh=(n,e)=>{var t,i;return(i=(t=TI[n])===null||t===void 0?void 0:t[0])!==null&&i!==void 0?i:e},Gh=(n,e)=>{var t,i;return(i=(t=TI[n])===null||t===void 0?void 0:t[1])!==null&&i!==void 0?i:e},Vte=(n,e,t)=>{var i,s,r,a,o;if(!e||((i=t==null?void 0:t.event)===null||i===void 0?void 0:i.type)==="mouseout")return null;const l=Od(n.title,e,t),h=N(Od(n.content,e,t)),d={title:{value:(s=l==null?void 0:l.value)===null||s===void 0?void 0:s.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:u=Wte}=n,c=Xi(l==null?void 0:l.visible,e,t)!==!1;if(l&&c){const f=Hte(e);d.title={value:Xi(l==null?void 0:l.value,f,t),valueStyle:Xi(l==null?void 0:l.valueStyle,f,t),hasShape:l.hasShape}}else d.title={hasShape:!1,visible:!1};if(n.activeType==="mark")for(const f of h??[]){const p=VT((r=e[0])===null||r===void 0?void 0:r.datum[0],f,t);if(p.visible!==!1){if(d.content.length===u-1){d.content.push(Object.assign(Object.assign({},p),WT));break}if(!(d.content.length<u))break;d.content.push(p)}}else if(n.activeType==="dimension")for(const{data:f}of e){for(const{datum:p,series:g}of f){if(!Qr((a=g.tooltipHelper)===null||a===void 0?void 0:a.spec).includes("dimension"))continue;const _=(o=h==null?void 0:h.filter(m=>C(m.seriesId)||m.seriesId===g.id))!==null&&o!==void 0?o:[];for(const m of p){for(const y of _){const b=VT(m,y,t);if(b.visible!==!1){if(d.content.length===u-1){d.content.push(Object.assign(Object.assign({},b),WT));break}if(!(d.content.length<u))break;d.content.push(b)}}if(d.content.length>=u)break}if(d.content.length>=u)break}if(d.content.length>=u)break}return d.title&&(d.content.length>0&&d.content[0].shapeType?(C(d.title.shapeType)&&(d.title.shapeType=d.content[0].shapeType),C(d.title.shapeColor)&&(d.title.shapeColor=d.content[0].shapeColor)):d.title.hasShape=!1),d},VT=(n,e,t)=>{const i=Xi(e.key,n,t),s=Xi(e.value,n,t),r=Xi(e.visible,n,t)!==!1&&(P(i)||P(s)),a=Xi(e.isKeyAdaptive,n,t),o=Xi(e.spaceRow,n,t),l=Xi(e.shapeType,n,t),h=Xi(e.shapeColor,n,t),d=Xi(e.shapeFill,n,t),u=Xi(e.shapeStroke,n,t),c=Xi(e.shapeLineWidth,n,t),f=Xi(e.keyStyle,n,t),p=Xi(e.valueStyle,n,t);return{key:i,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:l,shapeFill:d,shapeStroke:u,shapeLineWidth:c,shapeHollow:e.shapeHollow,shapeColor:h,keyStyle:f,valueStyle:p,spaceRow:o,datum:n}},NT=(n,e,t)=>{var i,s;return(s=(i=n.tooltipHelper)===null||i===void 0?void 0:i.getDefaultTooltipPattern(e,t))!==null&&s!==void 0?s:null},Nte=(n,e,t,i)=>{var s,r,a,o,l,h,d;const u=Object.assign(Object.assign({},e),{activeType:n});if(n==="mark"&&t){const y=(r=(s=t.tooltipHelper)===null||s===void 0?void 0:s.spec)!==null&&r!==void 0?r:{};if(P(y.visible)||P(y.activeType)?u.visible=Qr(y).includes("mark"):P(e.visible)||P(e.activeType)?u.visible=Qr(e).includes("mark"):u.visible=!0,u.handler=(o=(a=y.handler)!==null&&a!==void 0?a:e.handler)!==null&&o!==void 0?o:void 0,(l=u.handler)===null||l===void 0?void 0:l.showTooltip)return u}else if(n==="dimension"&&(i!=null&&i.length)&&(CI(i).every(y=>{var b;return!Qr((b=y.tooltipHelper)===null||b===void 0?void 0:b.spec).includes("dimension")})?u.visible=!1:P(e.visible)||P(e.activeType)?u.visible=Qr(e).includes("dimension"):u.visible=!0,u.handler=(h=e.handler)!==null&&h!==void 0?h:void 0,(d=u.handler)===null||d===void 0?void 0:d.showTooltip))return u;const c=Ute(n,t,i),f=$te(n,t,i),p=pe({},ri(e[n]),f),g=c.title,_=nf(void 0,p,void 0,g);if(P(p.title))if(Y(p.title)){const y=p.title;p.title=(b,v)=>{var x;const S=(x=y(b,v))!==null&&x!==void 0?x:{};return Object.assign(Object.assign({},_),S)}}else p.title=Object.assign(Object.assign(Object.assign({},c.title),_),p.title);else p.title=Object.assign(Object.assign({},c.title),_);const m=N(c.content);if(P(p.content)){const y=Yte(m);if(Y(p.content)){const b=p.content;p.content=(v,x)=>{var S;const A=[];return N((S=b(v,x))!==null&&S!==void 0?S:[]).forEach(k=>{A.push(Object.assign(Object.assign({},nf(k,p,y)),k))}),A}}else{const b=[];N(p.content).forEach(v=>{b.push(Object.assign(Object.assign({},nf(v,p,y)),v))}),p.content=b}}else p.content=m.map(y=>Object.assign(Object.assign({},y),nf(void 0,p,void 0,y)));return u[n]=Object.assign(Object.assign(Object.assign({},c),p),{activeType:n}),u},Ute=(n,e,t)=>{var i;let s={};if(n==="mark"&&e)s=(i=NT(e,"mark"))!==null&&i!==void 0?i:{};else if(n==="dimension"&&(t!=null&&t.length)){const r=[];t[0].data.forEach(o=>{const{series:l}=o,h=[Object.assign(Object.assign({},t[0]),{data:[o]})],d=NT(l,"dimension",h);d&&r.push(d)});const a=[];r.forEach(({content:o})=>{Y(o)?a.push(o):a.push(...N(o))}),s=Object.assign(Object.assign({},r[0]),{content:a})}return s},$te=(n,e,t)=>{var i,s;let r={};if(n==="mark"&&e){const a=(s=(i=e.tooltipHelper)===null||i===void 0?void 0:i.spec)!==null&&s!==void 0?s:{};r=a.mark?ri(a.mark):{}}else if(n==="dimension"&&(t!=null&&t.length)){const a=CI(t).filter(o=>{var l;const h=(l=o.tooltipHelper)===null||l===void 0?void 0:l.spec;return P(h==null?void 0:h.dimension)&&Qr(h).includes("dimension")}).map(o=>o.tooltipHelper.spec.dimension);if(a.length){let o=[];a.every(({content:l})=>C(l))?o=void 0:a.forEach(({content:l})=>{C(l)||(Y(l)?o==null||o.push(l):o==null||o.push(...N(l)))}),r=Object.assign(Object.assign({},a[0]),{content:o})}}return r},CI=yh(n=>n.reduce((e,t)=>e.concat(t.data.map(i=>i.series).filter(P)),[])),Yte=n=>{const e={};return n.forEach(t=>{var i;const s=(i=t.seriesId)!==null&&i!==void 0?i:0;e[s]||(e[s]=t)}),e},nf=(n,e,t,i)=>{var s,r;const a=(r=t==null?void 0:t[(s=n==null?void 0:n.seriesId)!==null&&s!==void 0?s:0])!==null&&r!==void 0?r:t==null?void 0:t[0],o=new Set([].concat(Object.keys(n??{}),Object.keys(e??{}),Object.keys(a??{}),Object.keys(i??{})).filter(h=>h.toLowerCase().includes("shape"))),l={};return o.forEach(h=>{var d,u,c;const f=(c=(u=(d=n==null?void 0:n[h])!==null&&d!==void 0?d:e==null?void 0:e[h])!==null&&u!==void 0?u:a==null?void 0:a[h])!==null&&c!==void 0?c:i==null?void 0:i[h];f!==void 0&&(l[h]=f)}),l};var Zt;(function(n){n[n.success=0]="success",n[n.failed=1]="failed"})(Zt||(Zt={}));const Xte={fontFamily:me.defaultFontFamily,spacing:10,wordBreak:"break-word"};function Ro(n={},e,t){var i,s;return Object.assign(Object.assign({},t??Xte),{fill:(i=n.fill)!==null&&i!==void 0?i:n.fontColor,textAlign:n.textAlign,textBaseline:n.textBaseline,fontFamily:(s=n.fontFamily)!==null&&s!==void 0?s:e==null?void 0:e.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,lineHeight:n.lineHeight,spacing:n.spacing,multiLine:n.multiLine,maxWidth:n.maxWidth,wordBreak:n.wordBreak,autoWidth:n.autoWidth})}const Kte=n=>{var e;const{backgroundColor:t,border:i,shadow:s}=n,r={lineWidth:(e=i==null?void 0:i.width)!==null&&e!==void 0?e:0,shadow:!!s};i!=null&&i.color&&(r.stroke=i.color),t&&(r.fill=t),s&&(r.shadowColor=s.color,r.shadowBlur=s.blur,r.shadowOffsetX=s.x,r.shadowOffsetY=s.y,r.shadowSpread=s.spread);const{radius:a}=i??{};return P(a)&&(r.cornerRadius=[a,a,a,a]),r},qte=(n,e,t)=>{var i,s,r,a,o;const{style:l={},enterable:h,transitionDuration:d}=e,{panel:u={},titleLabel:c,shape:f,keyLabel:p,valueLabel:g,spaceRow:_}=l,m=tn(u.padding),y=vr(u.padding),b=Ro(c,t),v=Ro(p,t),x=Ro(g,t),S={fill:!0,size:(i=f==null?void 0:f.size)!==null&&i!==void 0?i:8,spacing:(s=f==null?void 0:f.spacing)!==null&&s!==void 0?s:6},A={panel:Kte(u),padding:m,title:{},content:[],titleStyle:{value:b,spaceRow:_},contentStyle:{shape:S,key:v,value:x,spaceRow:_},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:d},{title:k={},content:w=[]}=n;let M=y.left+y.right,T=y.top+y.bottom,E=0;const O=w.filter(V=>(V.key||V.value)&&V.visible!==!1),B=!!O.length;let R=0,L=0,I=0,F=0;if(B){const V=[],te=[],le=[],he=[];A.content=O.map((Ce,ge)=>{let ke=0;const{hasShape:xe,key:Re,shapeType:Pe="",shapeFill:Ei,shapeStroke:Tt,shapeLineWidth:Mn,shapeSize:fi,value:Tn,isKeyAdaptive:dt,spaceRow:Ct,keyStyle:ts,valueStyle:Cn,shapeColor:Ia,shapeHollow:Cr}=Ce,pi={height:0,spaceRow:Ct??_};if(P(Re)){const Bt=pe({},v,Ro(ts,void 0,{})),{width:tt,height:Ut,text:So}=Py(Re,Bt);pi.key=Object.assign(Object.assign({width:tt,height:Ut},Bt),{text:So}),dt?te.push(tt):V.push(tt),ke=Math.max(ke,Ut)}if(P(Tn)){const Bt=pe({},x,Ro(Cn,void 0,{})),{width:tt,height:Ut,text:So}=Py(Tn,Bt);pi.value=Object.assign(Object.assign({width:tt,height:Ut},Bt),{text:So}),le.push(tt),ke=Math.max(ke,Ut)}if(xe){const Bt={visible:!0,symbolType:Pe},tt=Ei??Ia;Cr?Bt.stroke=tt:Bt.fill=tt,Bt.stroke=Tt??tt,Bt.lineWidth=Mn,pi.shape=Bt;const Ut=fi??S.size;ke=Math.max(Ut,ke),he.push(Ut)}else pi.shape={visible:!1};return pi.height=ke,T+=ke,ge<O.length-1&&(T+=pi.spaceRow),pi}),R=V.length?Vt(V):0,L=te.length?Vt(te):0,I=le.length?Vt(le):0,F=he.length?Vt(he)+S.spacing:0,E=Math.max(F+R+v.spacing+I+x.spacing,F+L,E),A.hasContentShape=!!he.length,A.keyWidth=R,A.valueWidth=I}let H=0,G=0;const{visible:U=!0,value:$="",valueStyle:Z,spaceRow:q}=k;A.title.visible=U,A.title.spaceRow=q??_;let ie={};const K=()=>ie.autoWidth&&ie.multiLine!==!1;if(U){ie=pe({},b,Ro(Z,void 0,{})),K()&&(ie.multiLine=(r=ie.multiLine)===null||r===void 0||r,ie.maxWidth=(a=ie.maxWidth)!==null&&a!==void 0?a:B?Math.ceil(E):void 0);const{text:V,width:te,height:le}=Py($,ie);A.title.value=Object.assign(Object.assign({width:K()?Math.min(te,(o=ie.maxWidth)!==null&&o!==void 0?o:Number.MAX_VALUE):te,height:le},ie),{text:V}),H=A.title.value.width,G=A.title.value.height,T+=G+(B?A.title.spaceRow:0)}return A.title.width=H,A.title.height=G,K()?M+=E||H:M+=Math.max(H,E),B&&A.content.forEach(V=>{var te;const le=V.value;le&&((te=le.autoWidth)===null||te===void 0||te)&&(le.width=M-y.left-y.right-F-R-v.spacing-x.spacing,le.maxWidth||(le.maxWidth=Math.ceil(le.width)),A.valueWidth=Math.max(A.valueWidth,le.width))}),A.panel.width=M,A.panel.height=T,A};class PI{get id(){return this._id}get env(){return this._env}constructor(e,t){this._visible=!0,this._id="",this._attributes=null,this._isReleased=!1,this.showTooltip=(i,s,r)=>{var a;let o=!!r.changePositionOnly;return r.changePositionOnly&&((a=this._cacheActualTooltip)===null||a===void 0?void 0:a.activeType)===i||(o=!1,this._clearCacheOfContent()),o&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(o,s,r):this.changeTooltip(!0,r,o,i,s)},this._changeTooltip=(i,s,r,a,o)=>{var l,h,d,u,c,f,p,g,_,m,y,b,v;const x=this._component.getSpec();if(this._isReleased||!x)return Zt.failed;if(!i)return this._clearAllCache(),x.handler?(d=(h=(l=x.handler).hideTooltip)===null||h===void 0?void 0:h.call(l,s))!==null&&d!==void 0?d:Zt.success:(this._updateTooltip(!1,s),Zt.success);if(C(a)||C(o))return Zt.failed;let S;if(r&&this._cacheViewSpec?S=this._cacheViewSpec:(S=Nte(a,x,s.model,s.dimensionInfo),this._cacheViewSpec=S),S.visible===!1)return Zt.failed;if(S.handler)return(f=(c=(u=S.handler).showTooltip)===null||c===void 0?void 0:c.call(u,a,o,s))!==null&&f!==void 0?f:Zt.success;const A=S[a];if(!A)return Zt.failed;let k;return r&&this._cacheActualTooltip?k=this._cacheActualTooltip:(k=this._getActualTooltipContent(A,o,s),k.title=(g=(p=A.updateTitle)===null||p===void 0?void 0:p.call(A,k.title,o,s))!==null&&g!==void 0?g:k.title,k.content=(m=(_=A.updateContent)===null||_===void 0?void 0:_.call(A,k.content,o,s))!==null&&m!==void 0?m:k.content),C((y=k.title)===null||y===void 0?void 0:y.key)&&C((b=k.title)===null||b===void 0?void 0:b.value)&&!(!((v=k.content)===null||v===void 0)&&v.length)?Zt.failed:(this._cacheActualTooltip=k,this._changeTooltipPosition(!!r,o,s))},this._changeTooltipPosition=(i,s,r)=>{var a,o,l;if(this._isReleased)return Zt.failed;const h=r.event,d=this._cacheViewSpec,u=this._cacheActualTooltip;if(!d||!u)return Zt.failed;if(d.enterable){if(!this._isPointerEscaped&&this._isPointerMovingToTooltip(r))return this._isTooltipPaused||(this._isTooltipPaused=!0,this._cachePointerTimer=setTimeout(()=>{this._isPointerEscaped=!0},300)),Zt.success;this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerPosition=this._getPointerPositionRelativeToTooltipParent(r)}const c=u.activeType;if(d.handler)return(l=(o=(a=d.handler).showTooltip)===null||o===void 0?void 0:o.call(a,c,s,r))!==null&&l!==void 0?l:Zt.success;const f=d[c];if(!f)return Zt.failed;const p=this._getActualTooltipPosition(u,r,this._getTooltipBoxSize(u,i));u.position=p,f.updatePosition&&(u.position=f.updatePosition(u.position,s,r));let g=(f==null?void 0:f.visible)!==!1;return s&&h.type!=="pointerout"&&u.visible&&(u.title||u.content)||(g=!1),this._updateTooltip(g,Object.assign(Object.assign({},r),{changePositionOnly:i}),u),Zt.success},this._getActualTooltipContent=(i,s,r)=>{const a=Od(i.visible,s,r);let o=null;return o=Vte(i,s,r),Object.assign(Object.assign({},o),{visible:!!P(o)&&a!==!1,activeType:i.activeType,data:s})},this._getActualTooltipPosition=(i,s,r)=>{var a,o,l,h,d;const u=s.event,c={x:1/0,y:1/0},{offsetX:f,offsetY:p}=this._option,g=this._cacheViewSpec;if(!g)return this._cacheTooltipPosition=void 0,c;const{activeType:_,data:m}=i,y=g[_],b=Od(y.position,m,s),v=Od(y.positionMode,m,s),x=this._getParentElement(g),{width:S=0,height:A=0}=r??{},k=g.renderMode==="canvas",w=(a=s==null?void 0:s.chart)===null||a===void 0?void 0:a.getCanvasRect(),M=(o=w==null?void 0:w.width)!==null&&o!==void 0?o:Xo,T=(l=w==null?void 0:w.height)!==null&&l!==void 0?l:Ko;let E=!1;const O={width:0,height:0};let B={x:0,y:0},R={x:0,y:0},L=1,I=1;if(Nn(this._env)&&!g.confine){if(O.width=window.innerWidth,O.height=window.innerHeight,!k){R=(h=x==null?void 0:x.getBoundingClientRect())!==null&&h!==void 0?h:c;const dt=(d=this._compiler.getCanvas())!==null&&d!==void 0?d:this._chartContainer,Ct=dt==null?void 0:dt.getBoundingClientRect();B={x:Ct.x-R.x,y:Ct.y-R.y},L=ef(dt,Ct),I=ef(x,R)}}else O.width=M,O.height=T;const F=I/L;let H,G,U,$,Z,q;if(He(b)){const{left:dt,right:Ct,top:ts,bottom:Cn}=b;H=tf(dt,u),G=tf(ts,u),U=tf(Ct,u),$=tf(Cn,u)}else if(P(b)&&v!=="pointer"&&i.activeType==="mark"){E=!0;const dt=s.item,Ct=s.model,ts=dt==null?void 0:dt.getBounds(),Cn=Ct==null?void 0:Ct.getLayoutStartPoint();if(ts&&Cn){let{x1:Ia,y1:Cr,x2:pi,y2:Bt}=ts;switch(Ia+=Cn.x,pi+=Cn.x,Cr+=Cn.y,Bt+=Cn.y,Hh(b)){case"left":H=Ia-S*F-f;break;case"right":H=pi+f;break;case"middle":H=(Ia+pi)/2-S*F/2}switch(Gh(b)){case"top":G=Cr-A*F-p;break;case"bottom":G=Bt+p;break;case"middle":G=(Cr+Bt)/2-A*F/2}}}const{canvasX:ie,canvasY:K}=u;if(j(H))Z=H;else if(j(U))Z=M-S*F-U;else{const dt=ie;switch(Hh(b,"right")){case"middle":Z=dt-S*F/2;break;case"left":Z=dt-S*F-f;break;case"right":Z=dt+f}}if(j(G))q=G;else if(j($))q=T-A*F-$;else{const dt=K;switch(Gh(b,"bottom")){case"middle":q=dt-A*F/2;break;case"top":q=dt-A*F-p;break;case"bottom":q=dt+p}}Z*=L,q*=L,Nn(this._env)&&(Z+=B.x,q+=B.y),Z/=I,q/=I;const{width:V,height:te}=O,le=()=>Z*I+R.x<0,he=()=>(Z+S)*I+R.x>V,Ce=()=>q*I+R.y<0,ge=()=>(q+A)*I+R.y>te,ke=()=>{le()&&(E?Z=-R.x/I:Hh(b,"right")==="middle"?Z+=f+S/2:Z+=2*f+S)},xe=()=>{le()&&(Z=-R.x/I)},Re=()=>{he()&&(E?Z=(V-R.x)/I-S:Hh(b,"right")==="middle"?Z-=f+S/2:Z-=2*f+S)},Pe=()=>{he()&&(Z=(V-R.x)/I-S)},Ei=()=>{Ce()&&(E?q=-R.y/I:Gh(b,"bottom")==="middle"?q+=p+A/2:q+=2*p+A)},Tt=()=>{Ce()&&(q=0-R.y/I)},Mn=()=>{ge()&&(E?q=(te-R.y)/I-A:Gh(b,"bottom")==="middle"?q-=p+A/2:q-=2*p+A)},fi=()=>{ge()&&(q=(te-R.y)/I-A)};switch(Hh(b,"right")){case"middle":le()?(ke(),Pe()):(Re(),xe());break;case"left":ke(),Pe();break;case"right":Re(),xe()}switch(Gh(b,"bottom")){case"middle":Ce()?(Ei(),fi()):(Mn(),Tt());break;case"top":Ei(),fi();break;case"bottom":Mn(),Tt()}const Tn={x:Z,y:q};return this._cacheTooltipPosition=Tn,this._cacheTooltipSize={width:S,height:A},Tn},this._component=t,this._chartOption=t.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=t.getCompiler(),this._id=e,this._initFromSpec()}hideTooltip(e){return this.changeTooltip(!1,e)}release(){var e,t,i;this._clearAllCache();const s=(e=this._component.getSpec())!==null&&e!==void 0?e:{};s.handler?(i=(t=s.handler).release)===null||i===void 0||i.call(t):(this._removeTooltip(),this._isReleased=!0)}_clearAllCache(){this._clearCacheOfContent(),this._clearCacheOfPosition()}_clearCacheOfContent(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0}_clearCacheOfPosition(){this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerTimer=-1,this._cachePointerPosition=void 0,this._cacheTooltipPosition=void 0,this._cacheTooltipSize=void 0}_throttle(e){const t=this._component.getSpec();let i;return i=oe(t.throttleInterval)?t.throttleInterval:t.renderMode==="html"&&t.transitionDuration?50:10,Ta(e,i)}_getDefaultOption(){var e,t;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},Ey),{offsetX:(e=i==null?void 0:i.x)!==null&&e!==void 0?e:Ey.offsetX,offsetY:(t=i==null?void 0:i.y)!==null&&t!==void 0?t:Ey.offsetY})}_getTooltipBoxSize(e,t){var i,s,r,a,o,l;if(!t||C(this._attributes)){const h=(s=(i=this._chartOption)===null||i===void 0?void 0:i.getTheme())!==null&&s!==void 0?s:{};this._attributes=qte(e,this._component.getSpec(),h)}return{width:(a=(r=this._attributes)===null||r===void 0?void 0:r.panel)===null||a===void 0?void 0:a.width,height:(l=(o=this._attributes)===null||o===void 0?void 0:o.panel)===null||l===void 0?void 0:l.height}}_getPointerPositionRelativeToTooltipParent(e){var t,i;let{canvasX:s,canvasY:r}=e.event;const a={x:1/0,y:1/0},o=this._cacheViewSpec,l=o.renderMode==="canvas",h=this._getParentElement(o);let d={x:0,y:0},u={x:0,y:0},c=1,f=1;if(Nn(this._env)&&!o.confine&&!l){u=(t=h==null?void 0:h.getBoundingClientRect())!==null&&t!==void 0?t:a;const p=(i=this._compiler.getCanvas())!==null&&i!==void 0?i:this._chartContainer,g=p==null?void 0:p.getBoundingClientRect();d={x:g.x-u.x,y:g.y-u.y},c=ef(p,g),f=ef(h,u)}return s*=c,r*=c,Nn(this._env)&&(s+=d.x,r+=d.y),s/=f,r/=f,{x:s,y:r}}_isPointerMovingToTooltip(e){if(!this._cacheTooltipPosition||!this._cacheTooltipSize||!this._cachePointerPosition)return!1;const{width:t,height:i}=this._cacheTooltipSize,{x:s=0,y:r}=this._cacheTooltipPosition,a=this._getPointerPositionRelativeToTooltipParent(e);if(ad(a,{x1:s,y1:r,x2:s+t,y2:r+i},!1))return!0;const o={x:s,y:r},l={x:o.x+t,y:o.y},h={x:o.x,y:o.y+i},d={x:l.x,y:h.y},u=this._cachePointerPosition;return Va([u,o,l],a.x,a.y)||Va([u,h,d],a.x,a.y)||Va([u,o,d],a.x,a.y)||Va([u,l,h],a.x,a.y)}_getParentElement(e){return e.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption(),this.changeTooltip=this._throttle(this._changeTooltip),this.changeTooltipPosition=this._throttle(this._changeTooltipPosition)}reInit(){this._initFromSpec()}}const gt=(n,e)=>P(n)?W(n)?n.map(t=>`${t}px`).join(" "):`${n}px`:e??"initial",Zte=n=>{const e=n.split(" ").map(t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t));return e.length===1?e[0]:e};function Jte(n){var e,t,i,s,r;const{panel:a={},title:o,content:l,titleStyle:h={},contentStyle:d={},padding:u,keyWidth:c,valueWidth:f,enterable:p,transitionDuration:g}=n??{},{fill:_,shadow:m,shadowBlur:y,shadowColor:b,shadowOffsetX:v,shadowOffsetY:x,shadowSpread:S,cornerRadius:A,stroke:k,lineWidth:w=0,width:M=0,height:T=0}=a,{value:E={}}=h,{shape:O={},key:B={},value:R={}}=d,L=Qte(O),I=Wh(B),F=Wh(R),{bottom:H,left:G,right:U,top:$}=vr(u);return{panel:{width:gt(M+2*w),minHeight:gt(T+2*w),paddingBottom:gt(H),paddingLeft:gt(G),paddingRight:gt(U),paddingTop:gt($),borderColor:k,borderWidth:gt(w),borderRadius:gt(A),backgroundColor:_?`${_}`:"transparent",boxShadow:m?`${v}px ${x}px ${y}px ${S}px ${b}`:"initial",pointerEvents:p?"auto":"none",transitionDuration:g?`${g}ms`:"initial",transitionProperty:g?"transform":"initial",transitionTimingFunction:g?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:l!=null&&l.length?gt(o==null?void 0:o.spaceRow):"0px"},Wh(pe({},E,o==null?void 0:o.value))),content:{},shapeColumn:{common:L,items:[],width:gt(O.size),marginRight:gt((e=O.spacing)!==null&&e!==void 0?e:8),marginBottom:gt(-((i=(t=l==null?void 0:l[(l==null?void 0:l.length)-1])===null||t===void 0?void 0:t.spaceRow)!==null&&i!==void 0?i:0))},keyColumn:{common:I,items:l==null?void 0:l.map(({key:Z,spaceRow:q},ie)=>Object.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie<l.length-1?gt(q):"0px"},I),Wh(Z)),Z!=null&&Z.multiLine?{width:gt(Math.ceil(Z.width))}:void 0)),width:gt(c),marginRight:gt((s=B.spacing)!==null&&s!==void 0?s:26)},valueColumn:{common:F,items:l==null?void 0:l.map(({value:Z,spaceRow:q},ie)=>Object.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie<l.length-1?gt(q):"0px"},F),Wh(Z)),Z!=null&&Z.multiLine?{width:gt(Math.ceil(Z.width))}:void 0)),width:gt(f),marginRight:gt((r=R.spacing)!==null&&r!==void 0?r:0)}}}function Wh(n,e){if(!n)return;const{fontFamily:t,fontSize:i,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:d}=pe({},e,n),u={};return u.fontFamily=t,u.fontSize=gt(i),u.color=s,u.textAlign=r,u.lineHeight=gt(Bs(a,i)),u.fontWeight=o,u.whiteSpace=l?"initial":"nowrap",u.wordBreak=l?h??"break-word":"normal",u.maxWidth=gt(d),u}function Qte(n,e){if(!n)return;const{size:t}=pe({},e,n),i={};return i.width=gt(t),i}class $n{static isInstance(e){return!!e&&e.type===$n.type}setOption(e){this._option=e,Object.values(this.children).forEach(t=>t.setOption(e))}getParentEl(){return $n.isInstance(this.parent)?this.parent.product:this.parent}constructor(e,t,i){this.type=$n.type,this._renderContentCache=null,this.children={},this.parent=e,this._option=t,this.childIndex=i??0}init(e,t){}initAll(){this.init(),Object.values(this.children).forEach(e=>e.initAll())}setStyle(e){this.product&&e&&Object.keys(e).forEach(t=>{this.product.style[t]!==e[t]&&(this.product.style[t]=e[t])})}setContent(e){}setVisibility(e){if(!this.product)return;const{style:t}=this.product;t.visibility=e?"visible":"hidden",Object.values(this.children).forEach(i=>i.setVisibility(e))}getVisibility(){var e,t;return!!(!((t=(e=this.product)===null||e===void 0?void 0:e.style)===null||t===void 0)&&t.visibility)&&this.product.style.visibility!=="hidden"}release(){var e;if(Object.values(this.children).forEach(t=>t.release()),this.children={},this.product){try{(e=this.getParentEl())===null||e===void 0||e.removeChild(this.product)}catch{}this.product=null}}createElement(e,t,i,s){const r=$r==null?void 0:$r.createElement(e),a=this.getParentEl();if(!r||!a)return;t&&r.classList.add(...t),i&&Object.keys(i).forEach(l=>{r.style[l]=i[l]}),s&&(r.id=s);let o=this.childIndex;if($n.isInstance(this.parent)){let l=Number.MAX_VALUE;for(let h=0;h<a.children.length;h++){const d=Object.values(this.parent.children).find(u=>u.product===a.children[h]);d.childIndex>this.childIndex&&d.childIndex<l&&(l=d.childIndex,o=h)}}return o>=a.children.length?a.appendChild(r):a.insertBefore(r,a.children[o]),r}}$n.type="tooltipModel";const eie={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},tie={boxSizing:"border-box"},iie={display:"flex",whiteSpace:"nowrap"},nie={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},sie={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},rie={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},aie={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},oie={lineHeight:"normal"};class EI extends $n{init(e,t,i){if(!this.product){const s=this.createElement(i??"div",[...e??[],"shape"],void 0,t);this.product=s}}setStyle(e,t){super.setStyle(e),this.setSvg(t)}setContent(e){this.setSvg(e)}setSvg(e){const t=hie(e,this._option.valueToHtml);this.product&&t!==this._svgHtmlCache&&(this._svgHtmlCache=t,this.product.innerHTML=t)}release(){super.release(),this._svgHtmlCache=""}}const lie={star:"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"};function hie(n,e){var t,i,s,r,a,o,l;if(!(n!=null&&n.hasShape)||!n.symbolType)return"";const{symbolType:h,fill:d,stroke:u,hollow:c=!1}=n,f=n.size?e(n.size):"8px",p=n.marginTop?e(n.marginTop):"0px",g=n.lineWidth?e(n.lineWidth)+"px":"0px";let _="currentColor";const m=()=>u?e(u):_,y=Zte(f),b=M=>new Ud({symbolType:M,size:y,fill:!0});let v=b((t=lie[h])!==null&&t!==void 0?t:h);const x=v.getParsedPath();x.path||(v=b(x.pathStr));const S=v.getParsedPath().path,A=S.toString(),k=S.bounds;let w=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if(g!=="0px"){const[M,T,E,O]=w.split(" ").map(R=>Number(R)),B=Number(g.slice(0,-2));w=`${M-B/2} ${T-B/2} ${E+B} ${O+B}`}if(!d||ae(d)||c)return _=c?"none":d?e(d):"currentColor",`
  51. <svg width="${f}" height="${f}" viewBox="${w}"
  52. style="display: inline-block; vertical-align: middle; margin-top: ${p};">
  53. <path
  54. d="${A}"
  55. style="fill: ${_}; stroke: ${m()}; stroke-width: ${g}"
  56. >
  57. </path>
  58. </svg>`;if(He(d)){_=(i="gradientColor"+n.index)!==null&&i!==void 0?i:"";let M="";const T=((s=d.stops)!==null&&s!==void 0?s:[]).map(E=>`<stop offset="${e(E.offset.toString())}" stop-color="${e(E.color)}"/>`).join("");return d.gradient==="radial"?M=`<radialGradient id="${_}" cx="50%" cy="50%" r="50%" fx="0%" fy="0%">
  59. ${T}
  60. </radialGradient>`:d.gradient==="linear"&&(M=`<linearGradient id="${_}" x1="${100*((r=d.x0)!==null&&r!==void 0?r:0)}%" y1="${100*((a=d.y0)!==null&&a!==void 0?a:0)}%" x2="${100*((o=d.x1)!==null&&o!==void 0?o:0)}%" y2="${100*((l=d.y1)!==null&&l!==void 0?l:0)}%">
  61. ${T}
  62. </linearGradient>`),`
  63. <svg width="${f}" height="${f}" viewBox="-0.5 -0.5 1 1"
  64. style="display: inline-block; vertical-align: middle; margin-top: ${p};">
  65. ${M}
  66. <path
  67. d="${A}"
  68. style="fill: url(#${_}); stroke: ${m()}; stroke-width: ${g}"
  69. >
  70. </path>
  71. </svg>`}return""}class RI extends $n{init(e,t,i){this.product||(this.product=this.createElement(i??"span",e,void 0,t))}setContent(e,t){if(!this.product)return;let i=this._option.valueToHtml(e);t&&(i=i.replaceAll(`
  72. `,"<br>")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const UT={overflowWrap:"normal",wordWrap:"normal"};class Ry extends $n{constructor(e,t,i,s){super(e,t,s),this.className=i}init(){var e,t;this.product||(this.product=this.createElement("div",[this.className]));const i=(t=(e=this._option.getTooltipActual())===null||e===void 0?void 0:e.content)!==null&&t!==void 0?t:[];if(this.className!=="shape-box"||i.some(s=>s.hasShape&&s.shapeType)){Object.keys(this.children).forEach(s=>{const r=Ds(s);r>=i.length&&(this.children[r].release(),delete this.children[r])});for(let s=0;s<i.length;s++)if(!this.children[s]){if(this.className==="key-box"||this.className==="value-box"){const r=new RI(this.product,this._option,s);r.init([this.className.substring(0,this.className.indexOf("-"))],void 0,"div"),this.children[s]=r}else if(this.className==="shape-box"){const r=new EI(this.product,this._option,s);r.init(["shape"],void 0,"div"),this.children[s]=r}}}else Object.keys(this.children).forEach(s=>{const r=Ds(s);this.children[r].release(),delete this.children[r]})}setStyle(){var e,t,i,s;const r=this._option.getTooltipStyle();super.setStyle(pe({},nie,r.content,this._getContentColumnStyle()));const a=(t=(e=this._option.getTooltipActual())===null||e===void 0?void 0:e.content)!==null&&t!==void 0?t:[],o=(s=(i=this._option.getTooltipAttributes())===null||i===void 0?void 0:i.content)!==null&&s!==void 0?s:[];a.forEach((l,h)=>{var d,u,c,f,p;let g={};if(this.className==="key-box"){const{key:_,isKeyAdaptive:m}=l;g=pe({},m?rie:sie,Object.assign(Object.assign(Object.assign({height:gt(o[h].height)},UT),r.keyColumn.common),(d=r.keyColumn.items)===null||d===void 0?void 0:d[h])),ae(_)&&((u=_==null?void 0:_.trim)===null||u===void 0?void 0:u.call(_))!==""||oe(_)||g.visibility?g.visibility="visible":g.visibility="hidden",this.children[h].setStyle(g)}else this.className==="value-box"?(g=pe({},aie,Object.assign(Object.assign(Object.assign({height:gt(o[h].height)},UT),r.valueColumn.common),(c=r.valueColumn.items)===null||c===void 0?void 0:c[h])),this.children[h].setStyle(g)):this.className==="shape-box"&&(g=pe({},oie,Object.assign(Object.assign({height:gt(o[h].height+o[h].spaceRow)},r.shapeColumn.common),(f=r.shapeColumn.items)===null||f===void 0?void 0:f[h])),(p=this.children[h])===null||p===void 0||p.setStyle(g,this._getShapeSvgOption(l,h)))})}setContent(){var e,t,i,s;const r=(t=(e=this._option.getTooltipActual())===null||e===void 0?void 0:e.content)!==null&&t!==void 0?t:[],a=(s=(i=this._option.getTooltipAttributes())===null||i===void 0?void 0:i.content)!==null&&s!==void 0?s:[];r.forEach((o,l)=>{var h,d,u,c,f,p,g;let _;if(this.className==="key-box"){const m=o.key;_=ae(m)&&((h=m==null?void 0:m.trim)===null||h===void 0?void 0:h.call(m))!==""||oe(m)?m:GT,(d=this.children[l])===null||d===void 0||d.setContent(_,(u=a[l].key)===null||u===void 0?void 0:u.multiLine)}else if(this.className==="value-box"){const m=o.value;_=ae(m)&&((c=m==null?void 0:m.trim)===null||c===void 0?void 0:c.call(m))!==""||oe(m)?m:GT,(f=this.children[l])===null||f===void 0||f.setContent(_,(p=a[l].value)===null||p===void 0?void 0:p.multiLine)}else this.className==="shape-box"&&(_=this._getShapeSvgOption(o,l),(g=this.children[l])===null||g===void 0||g.setContent(_))})}_getContentColumnStyle(){var e,t;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=(t=(e=this._option.getTooltipActual())===null||e===void 0?void 0:e.content)!==null&&t!==void 0?t:[];return Object.assign(Object.assign({},i.shapeColumn),this.className!=="shape-box"||s.some(r=>r.hasShape&&r.shapeType)?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(e,t){var i,s,r,a,o,l;const h=this._option.getTooltipStyle(),d=Object.assign(Object.assign({},h.shapeColumn),(i=h.shapeColumn.items)===null||i===void 0?void 0:i[t]),u=Object.assign(Object.assign({},h.keyColumn),(s=h.keyColumn.items)===null||s===void 0?void 0:s[t]);return{hasShape:e.hasShape,symbolType:e.shapeType,size:d.width,fill:(r=e.shapeFill)!==null&&r!==void 0?r:e.shapeColor,stroke:e.shapeStroke,lineWidth:e.shapeLineWidth,hollow:e.shapeHollow,marginTop:`calc((${(o=(a=u.lineHeight)!==null&&a!==void 0?a:u.fontSize)!==null&&o!==void 0?o:"18px"} - ${(l=d.width)!==null&&l!==void 0?l:"8px"}) / 2)`,index:t}}}class die extends $n{init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const e=new Ry(this.product,this._option,"shape-box",0);e.init(),this.shapeBox=e,this.children[e.childIndex]=e}_initKeyBox(){const e=new Ry(this.product,this._option,"key-box",1);e.init(),this.keyBox=e,this.children[e.childIndex]=e}_initValueBox(){const e=new Ry(this.product,this._option,"value-box",2);e.init(),this.valueBox=e,this.children[e.childIndex]=e}setStyle(e){super.setStyle(pe({},iie,e)),Object.values(this.children).forEach(t=>{t.setStyle()})}setContent(){Object.values(this.children).forEach(e=>{e.setContent()})}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class uie extends $n{init(){const e=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:t}=e;t!=null&&t.hasShape&&(t!=null&&t.shapeType)?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const e=new EI(this.product,this._option,0);e.init(),this.shape=e,this.children[e.childIndex]=e}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const e=new RI(this.product,this._option,1);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(e){var t,i,s,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),{title:l}=o;super.setStyle(pe({},eie,a.title,e)),(t=this.shape)===null||t===void 0||t.setStyle({paddingRight:(i=a.shapeColumn.common)===null||i===void 0?void 0:i.marginRight},{hasShape:l==null?void 0:l.hasShape,symbolType:l==null?void 0:l.shapeType,size:(s=a.shapeColumn.common)===null||s===void 0?void 0:s.width,fill:l==null?void 0:l.shapeColor,hollow:l==null?void 0:l.shapeHollow}),(r=this.textSpan)===null||r===void 0||r.setStyle({color:"inherit"})}setContent(){var e,t,i,s,r,a;const o=this._option.getTooltipStyle(),l=this._option.getTooltipActual(),h=this._option.getTooltipAttributes(),{title:d}=l;this.init(),(e=this.shape)===null||e===void 0||e.setStyle(void 0,{hasShape:d==null?void 0:d.hasShape,symbolType:d==null?void 0:d.shapeType,size:(t=o.shapeColumn.common)===null||t===void 0?void 0:t.width,fill:d==null?void 0:d.shapeColor,hollow:d==null?void 0:d.shapeHollow}),(i=this.textSpan)===null||i===void 0||i.setStyle({color:"inherit"}),(s=this.textSpan)===null||s===void 0||s.setContent(d==null?void 0:d.value,(a=(r=h.title)===null||r===void 0?void 0:r.value)===null||a===void 0?void 0:a.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class cie extends $n{constructor(e,t,i,s){super(e,t,0),this.title=null,this.content=null,this._classList=i,this._id=s}setVisibility(e){if(super.setVisibility(e),!this.product)return;const{classList:t}=this.product;e?t.add("visible"):t.remove("visible")}init(){var e;const t=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=t;(i==null?void 0:i.visible)!==!1&&P(i==null?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle(),((e=t.content)!==null&&e!==void 0?e:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(e,t){const i=this.createElement("div",e,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},t);this.product=i}_initTitle(){const e=new uie(this.product,this._option,0);e.init(),this.title=e,this.children[e.childIndex]=e}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const e=new die(this.product,this._option,1);e.init(),this.content=e,this.children[e.childIndex]=e}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const e=this._option.getTooltipStyle();super.setStyle(pe({},tie,e.panel)),Object.values(this.children).forEach(t=>t.setStyle())}setContent(){Object.values(this.children).forEach(e=>{e.setContent()})}release(){super.release(),this.title=null,this.content=null}}class fie extends PI{getVisibility(){var e;return!!(!((e=this.model)===null||e===void 0)&&e.getVisibility())}setVisibility(e){var t;e!==this.getVisibility()&&((t=this.model)===null||t===void 0||t.setVisibility(e))}constructor(e,t){super(e,t),this.type=Bg.dom,this._tooltipContainer=$r==null?void 0:$r.body,this._initStyle(),this.initEl()}initEl(){const e=this._component.getSpec(),t=e.parentElement;if($r&&t){for(let i=0;i<t.children.length;i++)if(t.children[i].classList.contains(HT)){this._container=t.children[i];break}this._container||(this._container=$r.createElement("div"),this._container.style.position="relative",this._container.classList.add(HT),t.appendChild(this._container)),this.model=new cie(this._container,{valueToHtml:this._option.sanitize,getTooltipStyle:()=>this._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes},[e.className],this.id)}}_removeTooltip(){var e;(e=this.model)===null||e===void 0||e.release(),this._container=null}_updateTooltip(e,t,i){var s,r;if(e&&this.model){t.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(e);let{x:a=0,y:o=0}=(s=i.position)!==null&&s!==void 0?s:{};const l=this.model.product;if(l){if(!((r=this._cacheViewSpec)===null||r===void 0)&&r.updateElement){this._cacheViewSpec.updateElement(l,i,t);const h=this._getActualTooltipPosition(i,t,{width:l.offsetWidth,height:l.offsetHeight});a=h.x,o=h.y}l.style.transform=`translate3d(${a}px, ${o}px, 0)`}}else this.setVisibility(e)}_initStyle(){this._domStyle=Jte(this._attributes)}_getParentElement(e){var t;return(t=this._container)!==null&&t!==void 0?t:super._getParentElement(e)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}}class pie extends PI{constructor(e,t){var i;super(e,t),this.type=Bg.canvas,this._tooltipCanvasId=(i=this._chartOption.modeParams)===null||i===void 0?void 0:i.tooltipCanvasId}_initTooltipComponent(e){const t=this._getLayer(e);this._tooltipComponent=new sO({autoCalculatePosition:!1,autoMeasure:!1}),t.add(this._tooltipComponent)}_getLayer(e){if(this._layer)return this._layer;this._layer=e.createLayer(this._tooltipCanvasId);const t=this._layer.layerHandler.canvas.nativeCanvas;return t&&t.style&&(t.style.touchAction="none",t.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(e,t,i){this._visible=e;const s=this._compiler.getStage();if(!s)return;if(!e)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(s);const r=i==null?void 0:i.position;t.changePositionOnly?P(r)&&this._tooltipComponent.setAttributes(r):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),r)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var e;return(e=this._tooltipComponent)===null||e===void 0?void 0:e.attribute.visibleAll}release(){var e;super.release(),(e=this._layer)===null||e===void 0||e.release()}}const Lr=(n,e)=>P(e)?n.map(t=>e[t]):void 0,Zs=(n,e)=>t=>n.every((i,s)=>t[i]===(e==null?void 0:e[s])),Ha=n=>!C(n)&&(W(n)?n.length>0&&n.every(P):Object.keys(n).length>0);function gie(n,e,t,i){var s,r,a,o,l;const h=Object.assign({regionIndex:0},e),d=i.getRegionsInUserIdOrIndex(P(h.regionId)?[h.regionId]:void 0,P(h.regionIndex)?[h.regionIndex]:void 0)[0];if(!d)return"none";const u=d.getSeries(),c=[];u.forEach(v=>{var x,S,A,k,w,M,T,E;const O=v.getDimensionField(),B=v.getMeasureField(),R=v.getSeriesField(),L=P(R)?n[R]:void 0,I=P(R)&&(k=(A=(S=(x=v.getViewDataStatistics)===null||x===void 0?void 0:x.call(v))===null||S===void 0?void 0:S.latestData[R])===null||A===void 0?void 0:A.values)!==null&&k!==void 0?k:[],F=Lr(O,n);let H=Lr(B,n);const G=Ha(H),U=!G&&P(R)&&C(L)&&I.length>0;if(v.coordinate==="cartesian"){const $=v,Z=O.map((ie,K)=>[ie,K]).filter(([,ie])=>C(F==null?void 0:F[ie]));let q=[F??[]];Z.length>0&&Z.forEach(([ie,K])=>{var V,te,le,he;const Ce=(he=(le=(te=(V=v.getViewDataStatistics)===null||V===void 0?void 0:V.call(v))===null||te===void 0?void 0:te.latestData[ie])===null||le===void 0?void 0:le.values)!==null&&he!==void 0?he:[],ge=[];q.forEach(ke=>{Ce.forEach(xe=>{var Re;const Pe=(Re=ke==null?void 0:ke.slice())!==null&&Re!==void 0?Re:[];Pe[K]=xe,ge.push(Pe)})}),q=ge}),q.forEach(ie=>{var K,V;if(U){const te=(K=$.getViewData())===null||K===void 0?void 0:K.latestData.filter(Zs(O,ie));I.forEach(le=>{const he=te.find(ge=>ge[R]===le);if(H=Lr(B,he),!Ha(H))return;const Ce=$.dataToPosition(he);C(Ce)||isNaN(Ce.x)||isNaN(Ce.y)||c.push({pos:Ce,data:{dimensionFields:O,dimensionData:ie,measureFields:B,measureData:H,hasMeasureData:G,groupField:R,groupData:le},series:v})})}else{const te=(V=$.getViewData())===null||V===void 0?void 0:V.latestData.find(Zs(O,ie));if(!G&&(H=Lr(B,te),!Ha(H)))return;const le=$.dataToPosition(te);if(C(le)||isNaN(le.x)||isNaN(le.y))return;c.push({pos:le,data:{dimensionFields:O,dimensionData:ie,measureFields:B,measureData:H,hasMeasureData:G,groupField:R,groupData:L},series:v})}})}else if(v.coordinate==="polar")if(v.type===z.pie){const $=v,Z=(w=$.getViewData())===null||w===void 0?void 0:w.latestData.find(Zs(O,F));if(!G&&(H=Lr(B,Z),!Ha(H)))return;const q=$.dataToCentralPosition(Z);if(C(q)||isNaN(q.x)||isNaN(q.y))return;c.push({pos:q,data:{dimensionFields:O,dimensionData:F,measureFields:B,measureData:H,hasMeasureData:G,groupField:R,groupData:L},series:v})}else{const $=v;if(U){const Z=((M=$.getViewData())===null||M===void 0?void 0:M.latestData.filter(Zs(O,F))).find(q=>q[R]===L);I.forEach(q=>{if(H=Lr(B,Z),!Ha(H))return;const ie=$.dataToPosition(Z);C(ie)||isNaN(ie.x)||isNaN(ie.y)||c.push({pos:ie,data:{dimensionFields:O,dimensionData:F,measureFields:B,measureData:H,hasMeasureData:G,groupField:R,groupData:q},series:v})})}else{const Z=(T=$.getViewData())===null||T===void 0?void 0:T.latestData.find(Zs(O,F));if(!G&&(H=Lr(B,Z),!Ha(H)))return;const q=$.dataToPosition(Z);if(C(q)||isNaN(q.x)||isNaN(q.y))return;c.push({pos:q,data:{dimensionFields:O,dimensionData:F,measureFields:B,measureData:H,hasMeasureData:G,groupField:R,groupData:L},series:v})}}else if(v.coordinate==="geo"){const $=v,Z=(E=$.getViewData())===null||E===void 0?void 0:E.latestData.find(Zs(O,F));if(!G&&(H=Lr(B,Z),!Ha(H)))return;const q=$.dataToPosition(Z);if(C(q)||isNaN(q.x)||isNaN(q.y))return;c.push({pos:q,data:{dimensionFields:O,dimensionData:F,measureFields:B,measureData:H,hasMeasureData:G,groupField:R,groupData:L},series:v})}});const f=(s=h.activeType)!==null&&s!==void 0?s:c.length>1?"dimension":"mark",p=d.getLayoutStartPoint(),g=d.getLayoutRect(),_=i.globalInstance.getContainer(),m=Object.assign({x:0,y:0},_?LD(_):{}),y=v=>{var x;const{dimensionFields:S,dimensionData:A,measureFields:k,measureData:w,groupField:M,groupData:T}=v.data;return(x=v.series.getViewData())===null||x===void 0?void 0:x.latestData.find(O=>Zs(S,A)(O)&&Zs(k,w)(O)&&(C(M)||Zs([M],[T])(O)))},b=v=>{var x,S;const A=(M=>({x:Math.min(Math.max(M.x,0),g.width),y:Math.min(Math.max(M.y,0),g.height)}))(v),k=(x=h.x)!==null&&x!==void 0?x:p.x+A.x,w=(S=h.y)!==null&&S!==void 0?S:p.y+A.y;return{canvasX:k,canvasY:w,clientX:m.x+k,clientY:m.y+w}};if(f==="dimension"){const v=c[0];if(!v)return"none";const x=new Map;c.forEach(w=>{var M;x.has(w.series)||x.set(w.series,[]),(M=x.get(w.series))===null||M===void 0||M.push(w)});const S=[{value:n[v.data.dimensionFields[0]],data:[...x.keys()].map(w=>{var M,T;return{series:w,datum:(T=(M=x.get(w))===null||M===void 0?void 0:M.map(E=>y(E)))!==null&&T!==void 0?T:[]}})}],A={changePositionOnly:!1,dimensionInfo:S,chart:(r=i.globalInstance.getChart())!==null&&r!==void 0?r:void 0,datum:void 0,model:void 0,source:Xe.chart,event:b({x:c.reduce((w,M)=>w+M.pos.x,0)/c.length,y:c.reduce((w,M)=>w+M.pos.y,0)/c.length}),item:void 0,itemMap:new Map};(a=t==null?void 0:t.showTooltip)===null||a===void 0||a.call(t,f,S,A);const k=i.globalInstance;return Un.globalConfig.uniqueTooltip&&Un.hideTooltip(k.id),f}if(f==="mark"){const v=c[0];if(!v)return"none";const x=Object.assign(Object.assign({},y(v)),n),S={changePositionOnly:!1,chart:(o=i.globalInstance.getChart())!==null&&o!==void 0?o:void 0,datum:x,model:v.series,source:Xe.chart,event:b(v.pos),item:void 0,itemMap:new Map};(l=t==null?void 0:t.showTooltip)===null||l===void 0||l.call(t,f,[{datum:[x],series:v.series}],S);const A=i.globalInstance;return Un.globalConfig.uniqueTooltip&&Un.hideTooltip(A.id),f}return"none"}class OI{constructor(e){this._showTooltipByHandler=(t,i)=>{var s,r;return this.component.event.emit(ye.tooltipShow,Object.assign(Object.assign({},i),{tooltipData:t,activeType:this.activeType,tooltip:this.component})),!((s=this.component.tooltipHandler)===null||s===void 0)&&s.showTooltip&&P(t)?(r=this.component.tooltipHandler.showTooltip(this.activeType,t,i))!==null&&r!==void 0?r:Zt.success:Zt.failed},this.component=e}_preprocessDimensionInfo(e){const t=[];if(e==null||e.forEach(i=>{const s=Object.assign(Object.assign({},i),{data:i.data.filter(({series:r})=>{var a,o;return((o=(a=r.getSpec())===null||a===void 0?void 0:a.tooltip)===null||o===void 0?void 0:o.visible)!==!1})});s.data.length>0&&t.push(s)}),t.length>0)return t}_getDimensionInfo(e){var t,i;let s;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:e.event.viewX,y:e.event.viewY};if(a.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},o),s=[...(t=PB(r,o))!==null&&t!==void 0?t:[],...(i=wB(r,o))!==null&&i!==void 0?i:[]],s.length===0)s=void 0;else if(s.length>1){const l=s.filter(h=>{var d;const u=h.axis;if(!wi(u.getScale().type))return!1;let c;for(const f of(d=u==null?void 0:u.getRegions())!==null&&d!==void 0?d:[]){for(const p of f.getSeries())if(p.coordinate==="cartesian"){c=p;break}if(P(c))break}return P(c)&&c.getDimensionField()[0]===c.fieldY[0]?u.getOrient()==="left"||u.getOrient()==="right":u.getOrient()==="bottom"||u.getOrient()==="top"});s=l.length?l:s.slice(0,1)}return s}}class _ie extends OI{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(e,t,i){const s=Object.assign(Object.assign({},t),{dimensionInfo:this._preprocessDimensionInfo(e),changePositionOnly:i});return this._showTooltipByHandler(e,s)}shouldHandleTooltip(e,t){var i,s;const{tooltipInfo:r}=t;if(C(r))return!1;const a=(i=e.model)===null||i===void 0?void 0:i.tooltipHelper;return!!((s=a==null?void 0:a.activeType)!==null&&s!==void 0?s:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(e){var t;return{tooltipInfo:this._getDimensionInfo(e),ignore:[...(t=this.component.getOption().getAllSeries())!==null&&t!==void 0?t:[]].some(i=>{var s;const r=(s=i.tooltipHelper)===null||s===void 0?void 0:s.ignoreTriggerSet.dimension;return e.model&&(r==null?void 0:r.has(e.model))||e.mark&&(r==null?void 0:r.has(e.mark))})}}}const $T=n=>P(n)&&!W(n),Oy=n=>P(n)&&W(n);class mie extends OI{constructor(){super(...arguments),this.activeType="mark"}showTooltip(e,t,i){const{datum:s,series:r,dimensionInfo:a}=e,o=[{datum:[s],series:r}],l=Object.assign(Object.assign({},t),{dimensionInfo:this._preprocessDimensionInfo(a),changePositionOnly:i});return this._showTooltipByHandler(o,l)}shouldHandleTooltip(e,t){var i;const{tooltipInfo:s}=t;if(C(s))return!1;const r=(i=e.model)===null||i===void 0?void 0:i.tooltipHelper;return!!(r!=null&&r.activeType.includes("mark"))}getMouseEventData(e){var t;let i,s;if(((t=e.model)===null||t===void 0?void 0:t.modelType)==="series"){const r=e.model,a=r.tooltipHelper,o=a==null?void 0:a.activeTriggerSet.mark,l=a==null?void 0:a.ignoreTriggerSet.mark;o!=null&&o.has(e.model)||o!=null&&o.has(e.mark)?i={mark:e.mark,datum:e.datum,series:r,dimensionInfo:this._getDimensionInfo(e)}:(l!=null&&l.has(e.model)||l!=null&&l.has(e.mark))&&(s=!0)}return{tooltipInfo:i,ignore:s}}}class BI extends sc{_shouldMergeThemeToSpec(){return!1}_initTheme(e,t){const{spec:i,theme:s}=super._initTheme(e,t);return i.style=pe({},this._theme,i.style),{spec:i,theme:s}}}class Bd extends an{constructor(){super(...arguments),this.layoutZIndex=1,this.type=X.tooltip,this.name=X.tooltip,this.transformerConstructor=BI,this.specKey="tooltip",this.layoutType="none",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._mountEvent=(e,t,i)=>{this.event.on(e,t,i),this._eventList.push({eventType:e,handler:i})},this._getMouseOutHandler=e=>t=>{var i,s;if(this._alwaysShow||!this._isTooltipShown&&!(!((s=(i=this.tooltipHandler)===null||i===void 0?void 0:i.isTooltipShown)===null||s===void 0)&&s.call(i)))return;const r=Nn(this._option.mode),{clientX:a,clientY:o}=t.event;r&&this._isPointerOnTooltip(t)||r&&e&&this._isPointerInChart({x:a,y:o})||this._handleChartMouseOut(t)},this._handleChartMouseOut=e=>{this._alwaysShow||this._spec.triggerOff!=="none"&&(this._hideTooltipByHandler(Object.assign({},e)),this._cacheInfo=void 0)},this._handleMouseMove=e=>{if(this.tooltipHandler||this._initHandler(),this._processor||this._initProcessor(),this._alwaysShow||this._isPointerOnTooltip(e))return;const t=this._getMouseEventData(e),{tooltipInfo:{dimension:i},ignore:{mark:s,dimension:r}}=t;let a=!1,o=!1;a=this._showTooltipByMouseEvent("mark",t,e),a||(o=this._showTooltipByMouseEvent("dimension",t,e)),a||o||zK(e)||(s&&$T(this._cacheInfo)?a=this._showTooltipByMouseEvent("mark",t,e,!0):r&&Oy(this._cacheInfo)?o=this._showTooltipByMouseEvent("dimension",t,e,!0):P(i)&&(o=this._showTooltipByMouseEvent("dimension",t,e))),a||o&&!C(i)||this._handleChartMouseOut(e)},this._showTooltipByMouseEvent=(e,t,i,s)=>{const r=this._processor[e];if(!r.shouldHandleTooltip(i,{tooltipInfo:t.tooltipInfo[e],ignore:t.ignore[e]}))return!1;let a;if(s)a=!r.showTooltip(this._cacheInfo,i,!0);else{const l=t.tooltipInfo[e],h=this._isSameAsCacheInfo(l);a=!r.showTooltip(l,i,h),a&&(this._cacheInfo=l)}a&&(this._isTooltipShown=!0);const o=this._option.globalInstance;return a&&Un.globalConfig.uniqueTooltip&&Un.hideTooltip(o.id),a},this._getMouseEventData=e=>{const t={tooltipInfo:{},ignore:{}};return Object.keys(this._processor).forEach(i=>{const{tooltipInfo:s,ignore:r}=this._processor[i].getMouseEventData(e);t.tooltipInfo[i]=s,t.ignore[i]=r}),t},this._hideTooltipByHandler=e=>{var t,i,s;if(!this._isTooltipShown&&!(!((i=(t=this.tooltipHandler)===null||t===void 0?void 0:t.isTooltipShown)===null||i===void 0)&&i.call(t)))return Zt.success;if(this.event.emit(ye.tooltipHide,Object.assign(Object.assign({},e),{source:Xe.chart,tooltip:this})),(s=this.tooltipHandler)===null||s===void 0?void 0:s.hideTooltip){const r=this.tooltipHandler.hideTooltip(e);return r||(this._isTooltipShown=!1),r}return Zt.failed}}static getSpecInfo(e){const t=e[this.specKey];if(!t)return null;if(!W(t))return[{spec:t,specPath:[this.specKey],type:X.tooltip}];const i=[];return t.forEach((s,r)=>{i.push({spec:s,specIndex:r,specPath:[this.specKey,r],type:X.tooltip})}),i}isTooltipShown(){return this._isTooltipShown}changeRegions(e){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(e){}onLayoutEnd(e){}onRender(e){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var e,t;super.release(),this._eventList.forEach(({eventType:i,handler:s})=>{this.event.off(i,s)}),this._eventList=[],(t=(e=this.tooltipHandler)===null||e===void 0?void 0:e.release)===null||t===void 0||t.call(e),this._isTooltipShown=!1}beforeRelease(){this.event.emit(ye.tooltipHide,{tooltip:this}),this.event.emit(ye.tooltipRelease,{tooltip:this})}_initHandler(){var e,t,i;const s=(e=this._spec.renderMode)!==null&&e!==void 0?e:"html",r=this._option.globalInstance.getTooltipHandlerByUser();if(r)this.tooltipHandler=r;else{const a=s==="canvas"?pie:fie,o=`${this._spec.className}-${(t=this._option.globalInstance.id)!==null&&t!==void 0?t:0}-${(i=this._option.specIndex)!==null&&i!==void 0?i:0}`;this.tooltipHandler=new a(o,this)}}_initProcessor(){this._processor={mark:new mie(this),dimension:new _ie(this)}}_initEvent(){var e;if(this._option.disableTriggerEvent)return;const t=(e=this._spec.trigger)!==null&&e!==void 0?e:"hover",i=this._option.mode;t==="hover"?(this._mountEvent("pointermove",{level:We.chart},this._handleMouseMove),(va(i)||xa(i))&&(this._mountEvent("pointerdown",{level:We.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerout",{source:"canvas"},this._getMouseOutHandler(!1))):t==="click"&&(this._mountEvent("pointertap",{level:We.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0)))}reInit(e){var t,i;super.reInit(e),this.tooltipHandler?(i=(t=this.tooltipHandler).reInit)===null||i===void 0||i.call(t):this._initHandler()}setAttrFromSpec(){var e;super.setAttrFromSpec();const t=this._spec;this._spec=Object.assign(Object.assign({},t),{visible:!P(t.visible)||t.visible,activeType:Qr(t),renderMode:"html",trigger:P(t.trigger)?t.trigger:"hover",className:P(t.className)?t.className:Gte,enterable:!!P(t.enterable)&&t.enterable,transitionDuration:P(t.transitionDuration)?t.transitionDuration:150}),this._spec.triggerOff=P(t.triggerOff)?t.triggerOff:this._spec.trigger,P(t.renderMode)?this._spec.renderMode=t.renderMode:xa(this._option.mode)&&(this._spec.renderMode="canvas"),P(t.mark)&&(this._spec.mark=Object.assign(Object.assign({},ri(t.mark)),{activeType:"mark"})),P(t.dimension)&&(this._spec.dimension=Object.assign(Object.assign({},ri(t.dimension)),{activeType:"dimension"})),P(t.parentElement)?ae(t.parentElement)?this._spec.parentElement=(e=globalThis==null?void 0:globalThis.document)===null||e===void 0?void 0:e.getElementById(t.parentElement):this._spec.parentElement=t.parentElement:Nn(this._option.mode)&&(this._spec.parentElement=$r==null?void 0:$r.body),P(t.confine)?this._spec.confine=t.confine:this._spec.confine=this._spec.renderMode==="canvas"}showTooltip(e,t){var i;if(this.tooltipHandler||this._initHandler(),this._processor||this._initProcessor(),!(!((i=this.tooltipHandler)===null||i===void 0)&&i.showTooltip))return!1;const s=gie(e,t,this.tooltipHandler,this._option);return s!=="none"&&(this._alwaysShow=!!(t!=null&&t.alwaysShow)),s}hideTooltip(){const e={changePositionOnly:!1,item:void 0,datum:void 0,source:Xe.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(e)}_isSameAsCacheInfo(e){if(e===this._cacheInfo)return!0;if(C(this._cacheInfo)||C(e))return!1;if(Oy(e)){if($T(this._cacheInfo))return!1;const i=this._cacheInfo;return i.length===e.length&&e.every((s,r)=>kB(s,i[r]))}if(Oy(this._cacheInfo))return!1;const t=this._cacheInfo;return(e==null?void 0:e.datum)===t.datum&&(e==null?void 0:e.mark)===t.mark&&(e==null?void 0:e.series)===t.series}_isPointerInChart(e){const t=this._option.globalInstance;if(!t.getChart())return!1;const{x:i,y:s}=e,r=t.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return i>=a&&i<=a+l&&s>=o&&s<=o+h}_isPointerOnTooltip(e){var t,i;if(this._spec.enterable&&this._spec.renderMode==="html"){const{event:s}=e;let r;if(P(s.nativeEvent)){const o=s.nativeEvent;r=o.relatedTarget,o.composedPath&&o.composedPath().length>0&&(r=o.composedPath()[0])}else r=s.relatedTarget;const a=(i=(t=this.tooltipHandler)===null||t===void 0?void 0:t.getTooltipContainer)===null||i===void 0?void 0:i.call(t);if(P(a)&&P(r)&&ID(r,a))return!0}return!1}getVisible(){return this._spec.visible!==!1}}Bd.type=X.tooltip,Bd.transformerConstructor=BI,Bd.specKey="tooltip";const yie=()=>{D.registerComponent(Bd.type,Bd)};function bie(n){return n===Yt["desktop-browser"]||n===Yt["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:va(n)||xa(n)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}var YT;(function(n){n[n.ALL=3]="ALL",n[n.HORIZONTAL=2]="HORIZONTAL",n[n.VERTICAL=1]="VERTICAL",n[n.NONE=0]="NONE"})(YT||(YT={}));var XT=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};const vie={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class lS extends an{get enableRemain(){return this.triggerOff==="none"}constructor(e,t){super(e,t),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=rt.CrossHair_Grid,this.labelZIndex=rt.CrossHair,this.trigger="hover",this.triggerOff="hover",this._handleEvent=Ta(i=>{if(!this._option)return;const{event:s}=i,r=this._option.getCompiler().getStage().getLayer(void 0),a={x:s.viewX,y:s.viewY};r.globalTransMatrix.transformPoint({x:s.viewX,y:s.viewY},a);const o=a.x-this.getLayoutStartPoint().x,l=a.y-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(o,l)},10),this.enable=!0,this.showDefault=!0}_getLimitBounds(){var e,t;if(!this._limitBounds){const{width:i,height:s}=(t=(e=this._option.globalInstance.getChart())===null||e===void 0?void 0:e.getCanvasRect())!==null&&t!==void 0?t:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(e,t){const i=super._compareSpec(e,t);return i.reMake||ft(t,e)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(this._option.disableTriggerEvent)return;const e=this._getTriggerEvent();if(e){const{in:t,out:i}=e;N(t).forEach((s,r)=>this._registerEvent(s,W(i)?i[r]:i))}}_registerEvent(e,t){this.event.on(e,{source:Xe.chart},this._handleEvent),this.event.on(t,{level:We.chart},(...i)=>{this.enableRemain||this.hide()})}_eventOff(e){this.event.off(e,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_getTriggerEvent(){const{mode:e=Yt["desktop-browser"]}=this._option,t=bie(e);if(t){const i=this.trigger||"hover",s=r=>r==="click"?"clickOut":"hoverOut";if(W(i)){let r=[],a=[];return i.forEach(o=>{r=r.concat(t[o]),a=a.concat(t[s(o)])}),{in:r,out:a}}return{in:t[i],out:t[s(i)]}}return null}_getAxisInfoByField(e){var t,i;const s=(i=(t=this._option)===null||t===void 0?void 0:t.getComponentsByKey)===null||i===void 0?void 0:i.call(t,"axes");if(!(s!=null&&s.length))return null;let r=Te(this._spec,`${e}Field.bindingAxesIndex`);if(r||(r=[],s.forEach((f,p)=>{vie[e].includes(f.getOrient())&&r.push(p)})),!r.length)return null;const a=new Map;let o=1/0,l=1/0,h=-1/0,d=-1/0;const{x:u,y:c}=this.getLayoutStartPoint();return r.forEach(f=>{o=1/0,l=1/0,h=-1/0,d=-1/0;const p=s.find(g=>g.getSpecIndex()===f);p&&(p.getRegions().forEach(g=>{const{x:_,y:m}=g.getLayoutStartPoint();o=Math.min(o,_-u),l=Math.min(l,m-c),h=Math.max(h,_+g.getLayoutRect().width-u),d=Math.max(d,m+g.getLayoutRect().height-c)}),a.set(f,{x1:o,y1:l,x2:h,y2:d,axis:p}))}),a}changeRegions(e){}onLayoutEnd(e){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd(e)}onRender(e){}_releaseEvent(){const e=this._getTriggerEvent();if(e){const{in:t,out:i}=e;W(t)?t.forEach(s=>this._eventOff(s)):this._eventOff(t),W(i)?i.forEach(s=>this._eventOff(s)):this._eventOff(i)}}_firstSeries(){for(let e=0;e<this._regions.length;e++){const t=this._regions[e].getSeries();for(let i=0;i<t.length;i++){const s=t[i];if(s)return s}}return null}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:e,triggerOff:t,labelZIndex:i,gridZIndex:s}=this._spec;e&&(this.trigger=e),this.triggerOff=t||this.trigger,i!==void 0&&(this.labelZIndex=i),s!==void 0&&(this.gridZIndex=s)}_parseField(e,t){var i,s,r,a;const o={},{line:l={},label:h={},visible:d}=e;o.visible=d,o.type=l.type||"line";const u=l.style||{},{strokeOpacity:c,fillOpacity:f,opacity:p,stroke:g,fill:_,lineWidth:m}=u,y=XT(u,["strokeOpacity","fillOpacity","opacity","stroke","fill","lineWidth"]),b=o.type==="line";let v=b?c:f;if(oe(p)&&(v=(v??1)*p),o.style=(l==null?void 0:l.visible)===!1?{visible:!1}:Object.assign({opacity:v,pickable:!1,visible:!0},y),b)o.style.stroke=g||_,o.style.lineWidth=Te(l,"width",m||2);else{o.style.fill=_||g,!((r=(s=(i=this._spec[t])===null||i===void 0?void 0:i.line)===null||s===void 0?void 0:s.style)===null||r===void 0)&&r.stroke&&(o.style.stroke=this._spec[t].line.style.stroke);const E=Te(l,"width");if(typeof E=="string"){const O=parseInt(E.substring(0,E.length-1),10)/100;o.style.sizePercent=O}else typeof E!="number"&&typeof E!="function"||(o.style.size=E)}const x=h.labelBackground||{},S=h.style||{},A=x.style||{},{fill:k="rgba(47, 59, 82, 0.9)",stroke:w,outerBorder:M}=A,T=XT(A,["fill","stroke","outerBorder"]);return o.label=h!=null&&h.visible?{visible:!0,formatMethod:h.formatMethod,minWidth:x.minWidth,maxWidth:x.maxWidth,padding:x.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},S),{fill:(a=S.fill)!==null&&a!==void 0?a:"#fff",stroke:Te(S,"stroke")}),panel:(ht(x==null?void 0:x.visible)?x!=null&&x.visible:x)?Object.assign({visible:!0,pickable:!1,fill:k,stroke:w,outerBorder:Object.assign({stroke:k,distance:0,lineWidth:3},M)},T):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}:{visible:!1},o}_filterAxisByPoint(e,t,i){return e&&e.forEach(s=>{const r=s.axis;if(K5(s,t,i)&&e.delete(r.getSpecIndex()),r.type.startsWith("polarAxis")){const a=r.getCenter(),o=r.getInnerRadius(),l=r.getOuterRadius(),h=wt.distancePP({x:t,y:i},a);(h>l||h<o)&&e.delete(r.getSpecIndex())}}),e}}lS.specKey="crosshair";class Lg extends lS{static getSpecInfo(e){const t=e[this.specKey];if(C(t))return;if(!W(t))return t.xField||t.yField?[{spec:t,specPath:[this.specKey],type:X.cartesianCrosshair}]:void 0;const i=[];return t.forEach((s,r)=>{(s.xField||s.yField)&&i.push({spec:s,specIndex:r,specPath:[this.specKey,r],type:X.cartesianCrosshair})}),i}constructor(e,t){super(e,t),this.type=X.cartesianCrosshair,this.name=X.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:e,yField:t}=this._spec;if(e!=null&&e.visible&&e.defaultSelect){const{axisIndex:i,datum:s}=e.defaultSelect;this._defaultCrosshair(i,s,1)}if(t!=null&&t.visible&&t.defaultSelect){const{axisIndex:i,datum:s}=t.defaultSelect;this._defaultCrosshair(i,s,2)}}_defaultCrosshair(e,t,i){const s=this._option.getComponentsByKey("axes").find(r=>r.getSpecIndex()===e);s&&(i===1?(this._currValueX.clear(),this._currValueX.set(e,{axis:s,v:t})):(this._currValueY.clear(),this._currValueY.set(e,{axis:s,v:t})),this.layoutByValue(i))}_findAllAxisContains(e,t){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,e,t),yAxisMap:this._filterAxisByPoint(s,e,t)}}_getValueAt(e,t){let i=e.getScale().invert(t);return Ue(e.getScale().type)&&j(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(e,t){At(t.getOrient())?this._currValueX.set(t.getSpecIndex(),{v:e,axis:t}):this._currValueY.set(t.getSpecIndex(),{v:e,axis:t})}_getAllAxisValues(e,t,i,s){let r=!1;return e.forEach(a=>{wi(a.axis.getScale().type)&&(r?this.enable=!1:r=!0)}),!!this.enable&&(e.forEach((a,o)=>{const l=a.axis;i.set(o,{v:this._getValueAt(l,t-(s?l.getLayoutStartPoint().x-this.getLayoutStartPoint().x:l.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:l})}),!0)}_layoutCrosshair(e,t){const{xAxisMap:i,yAxisMap:s}=this._findAllAxisContains(e,t);if(i&&i.size===0||s&&s.size===0){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),i&&i.size&&this._getAllAxisValues(i,e,this._currValueX,!0),s&&s.size&&this._getAllAxisValues(s,t,this._currValueY,!1),this.layoutByValue(3)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(e=3){var t,i,s,r;if(!this.enable)return;const a=this._firstSeries();if(!a)return;let o={height:0,leftPos:0,rightPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1,axis:null},l={width:0,leftPos:0,topPos:0,bottomPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1,axis:null};const h=(y,b)=>{b.forEach(({axis:v})=>{v.getRegions().forEach(x=>{y.x1=Math.min(y.x1,x.getLayoutStartPoint().x),y.y1=Math.min(y.y1,x.getLayoutStartPoint().y),y.x2=Math.max(y.x2,x.getLayoutStartPoint().x+x.getLayoutRect().width),y.y2=Math.max(y.y2,x.getLayoutStartPoint().y+x.getLayoutRect().height)})})};let d=0,u=0;if(this._currValueX.size){const y=Array.from(this._currValueX.values())[0];d=y.axis.getScale().scale(y.v)+y.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x,o.axis=y.axis}if(this._currValueY.size){const y=Array.from(this._currValueY.values())[0];u=y.axis.getScale().scale(y.v)+y.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y,l.axis=y.axis}o.visible=!!this._currValueX.size&&Number.isFinite(d),l.visible=!!this._currValueY.size&&Number.isFinite(u);const c={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},f={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let p;h(c,this._currValueX),h(f,this._currValueY);let g,_=0,m=0;if(this._xHair&&this._currValueX.forEach(({axis:y,v:b})=>{var v;b=b??"";const x=y.getScale();if(wi(x.type))p=x.bandwidth(),p===0&&x.step&&(_=x.step());else if(Ue(x.type)){const S=a.fieldX[0],A=a.fieldX2,k=qM(a.getViewData().latestData,+b,S,A);if(k){const w=a.dataToPositionX(k);A?(p=Math.abs(w-a.dataToPositionX1(k)),b=`${k[S]} ~ ${k[A]}`):p=1,d=w}}if(!((v=this._xHair.label)===null||v===void 0)&&v.visible){const S=bu(y.getSpec());y.getOrient()==="bottom"?(o.bottom.visible=!0,o.bottom.text=b,o.bottom.dx=0,o.bottom.dy=S):y.getOrient()==="top"&&(o.top.visible=!0,o.top.text=b,o.top.dx=0,o.top.dy=-S)}}),this._yHair&&this._currValueY.forEach(({axis:y,v:b})=>{var v;b=b??"";const x=y.getScale();if(wi(x.type))g=x.bandwidth(),g===0&&x.step&&(m=x.step());else if(Ue(x.type)){const S=a.fieldY[0],A=a.fieldY2,k=qM(a.getViewData().latestData,+b,S,A);if(k){const w=a.dataToPositionY(k);A?(g=Math.abs(w-a.dataToPositionY1(k)),b=`${k[S]} ~ ${k[A]}`):g=1,u=w}}if(!((v=this._yHair.label)===null||v===void 0)&&v.visible){const S=bu(y.getSpec());y.getOrient()==="left"?(l.left.visible=!0,l.left.text=b,l.left.dx=-S,l.left.dy=0):y.getOrient()==="right"&&(l.right.visible=!0,l.right.text=b,l.right.dx=S,l.right.dy=0)}}),this.enableRemain&&!o.visible&&P(this._cacheXCrossHairInfo))o=this._cacheXCrossHairInfo;else if(o.leftPos=c.x1,o.rightPos=c.x2,o.topPos=c.y1,o.height=c.y2-c.y1,o.x=d+this.getLayoutStartPoint().x,(i=(t=this._xHair)===null||t===void 0?void 0:t.label)===null||i===void 0?void 0:i.formatMethod){const{top:y,bottom:b}=o;b.visible&&(b.text=this._xHair.label.formatMethod(b.text,"bottom")),y.visible&&(y.text=this._xHair.label.formatMethod(y.text,"top"))}if(this.enableRemain&&!l.visible&&P(this._cacheYCrossHairInfo))l=this._cacheYCrossHairInfo;else if(l.leftPos=f.x1,l.topPos=f.y1,l.bottomPos=f.y2,l.width=f.x2-f.x1,l.y=u+this.getLayoutStartPoint().y,(r=(s=this._yHair)===null||s===void 0?void 0:s.label)===null||r===void 0?void 0:r.formatMethod){const{left:y,right:b}=l;y.visible&&(y.text=this._yHair.label.formatMethod(y.text,"left")),b.visible&&(b.text=this._yHair.label.formatMethod(b.text,"right"))}e&&(this._layoutHorizontal(l,g??0,m),this._layoutVertical(o,p??0,_)),this.enableRemain&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},o),{_isCache:!0}),this._cacheYCrossHairInfo=Object.assign(Object.assign({},l),{_isCache:!0}))}_layoutVertical(e,t,i){var s,r;if(e._isCache&&this.enableRemain||!this._xHair)return;const{x:a,topPos:o,height:l,top:h,bottom:d,visible:u}=e;if(u){const c=this._xHair.type;let f;if(c==="line")f={start:{x:a+t/2,y:o},end:{x:a+t/2,y:o+l}};else if(c==="rect"){const p=this._getRectSize(this._xHair,t,e.axis),{leftPos:g,rightPos:_}=e;f={start:{x:Math.max(a-p/2-i/2,g),y:o},end:{x:Math.min(a+t+p/2+i/2,_),y:o+l}}}if(this._updateCrosshair("x",c,f),h.visible){const p=Object.assign(Object.assign(Object.assign({x:a+t/2,y:o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},(s=this._xHair.label)===null||s===void 0?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._xTopLabel,p,g=>{g.name="crosshair-x-top-label",this._xTopLabel=g})}else this._xTopLabel&&this._xTopLabel.hideAll();if(d.visible){const p=Object.assign(Object.assign(Object.assign({x:a+t/2,y:o+l},d),this._xHair.label),{textStyle:Object.assign(Object.assign({},(r=this._xHair.label)===null||r===void 0?void 0:r.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._xBottomLabel,p,g=>{g.name="crosshair-x-bottom-label",this._xBottomLabel=g})}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(e,t,i){var s,r;if(e._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:a,width:o,y:l,left:h,right:d,visible:u}=e;if(u){const c=this._yHair.type;let f;if(c==="line")f={start:{x:a,y:l+t/2},end:{x:a+o,y:l+t/2}};else if(c==="rect"){const p=this._getRectSize(this._yHair,t,e.axis),{topPos:g,bottomPos:_}=e;f={start:{x:a,y:Math.max(l-p/2-i/2,g)},end:{x:a+o,y:Math.min(l+t+p/2+i/2,_)}}}if(this._updateCrosshair("y",c,f),h.visible){const p=Object.assign(Object.assign(Object.assign({x:a,y:l+t/2},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},(s=this._yHair.label)===null||s===void 0?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,p,g=>{g.name="crosshair-y-left-label",this._yLeftLabel=g})}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(d.visible){const p=Object.assign(Object.assign(Object.assign({x:a+o,y:l+t},d),this._yHair.label),{textStyle:Object.assign(Object.assign({},(r=this._yHair.label)===null||r===void 0?void 0:r.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,p,g=>{g.name="crosshair-y-right-label",this._yRightLabel=g})}else this._yRightLabel&&this._yRightLabel.hideAll()}}_getRectSize(e,t,i){var s,r,a;let o=0;if(!((s=e.style)===null||s===void 0)&&s.sizePercent)o=(e.style.sizePercent-1)*t;else if(typeof((r=e.style)===null||r===void 0?void 0:r.size)=="number")o=e.style.size-t;else if(typeof((a=e.style)===null||a===void 0?void 0:a.size)=="function"){const l=i.getLayoutRect();o=e.style.size(l,i)-t}return o}_parseFieldInfo(){const{xField:e,yField:t}=this._spec;e&&e.visible&&(this._xHair=this._parseField(e,"xField")),t&&t.visible&&(this._yHair=this._parseField(t,"yField"))}_updateCrosshair(e,t,i){const s=this.getContainer();let r,a;e==="x"?(r=this._xCrosshair,a=this._xHair.style):(r=this._yCrosshair,a=this._yHair.style),r?r.setAttributes(i):(t==="line"?r=new qu(Object.assign(Object.assign({},i),{lineStyle:a,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent})):t==="rect"&&(r=new F_(Object.assign(Object.assign({},i),{rectStyle:a,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent}))),s==null||s.add(r),e==="x"?this._xCrosshair=r:this._yCrosshair=r)}_updateCrosshairLabel(e,t,i){const s=this.getContainer();e?e.setAttributes(t):(i(e=new Ss(t)),s==null||s.add(e)),fL(e,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}Lg.specKey="crosshair",Lg.type=X.cartesianCrosshair;const xie=()=>{D.registerComponent(Lg.type,Lg)};var KT=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};class Ig extends lS{static getSpecInfo(e){const t=e[this.specKey];if(C(t))return;if(!W(t))return t.categoryField||t.valueField?[{spec:t,specPath:[this.specKey],type:X.polarCrosshair}]:void 0;const i=[];return t.forEach((s,r)=>{(s.categoryField||s.valueField)&&i.push({spec:s,specIndex:r,specPath:[this.specKey,r],type:X.polarCrosshair})}),i}constructor(e,t){super(e,t),this.type=X.polarCrosshair,this.name=X.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:e,valueField:t}=this._spec;if(e!=null&&e.visible&&e.defaultSelect){const{axisIndex:i,datum:s}=e.defaultSelect;this._defaultCrosshair(i,s,1)}if(t!=null&&t.visible&&t.defaultSelect){const{axisIndex:i,datum:s}=t.defaultSelect;this._defaultCrosshair(i,s,2)}}_defaultCrosshair(e,t,i){const s=this._option.getComponentsByKey("axes").find(r=>r.getSpecIndex()===e);if(s){if(i===1){this._currValueAngle.clear();const r={angle:s.valueToPosition(t),radius:s.getOuterRadius()},a=s.coordToPoint(r);this._currValueAngle.set(e,this._getValueByAxis(s,a))}else{this._currValueRadius.clear();const r={angle:s.startAngle,radius:s.valueToPosition(t)},a=s.coordToPoint(r);this._currValueRadius.set(e,this._getValueByAxis(s,a))}this.layoutByValue(3)}}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}_findAllAxisContains(e,t){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,e,t),radiusAxisMap:this._filterAxisByPoint(s,e,t)}}_getAllAxisValues(e,t,i){let s=!1;return e.forEach(r=>{wi(r.axis.getScale().type)&&(s?this.enable=!1:s=!0)}),!!this.enable&&(e.forEach((r,a)=>{const o=r.axis;i.set(a,this._getValueByAxis(o,t))}),!0)}_getValueByAxis(e,t){const{x:i,y:s}=e.getLayoutStartPoint(),{x:r,y:a}=this.getLayoutStartPoint();let o=e.positionToData({x:t.x-(i-r),y:t.y-(s-a)});Ue(e.getScale().type)&&j(+o)&&(o=(+o).toFixed(2));const l={x:e.getCenter().x+this.getLayoutStartPoint().x,y:e.getCenter().y+this.getLayoutStartPoint().y};return{v:o,axis:e,center:l,innerRadius:e.getInnerRadius(),radius:e.getOuterRadius(),startAngle:e.startAngle,endAngle:e.endAngle,distance:wt.distancePP(t,e.getCenter()),coord:e.pointToCoord(t),point:t}}_layoutCrosshair(e,t){const{angleAxisMap:i,radiusAxisMap:s}=this._findAllAxisContains(e,t);if(i.size!==0||s.size!==0)this._currValueAngle.clear(),this._currValueRadius.clear(),i&&this._getAllAxisValues(i,{x:e,y:t},this._currValueAngle),s&&this._getAllAxisValues(s,{x:e,y:t},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(e=3){var t,i,s,r;if(!this.enable)return;const a=this._firstSeries();if(!a)return;let o={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},l={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:a.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this._angleHair){o.visible=!!this._currValueAngle.size;const h=a.angleAxisHelper.getBandwidth(0);this._currValueAngle.forEach(d=>{var u,{axis:c,v:f,coord:p}=d,g=KT(d,["axis","v","coord"]);f=f??"",pe(o,g);const _=a.angleAxisHelper.dataToPosition([f]);o.angle=_,!((u=this._angleHair.label)===null||u===void 0)&&u.visible&&(o.label.visible=!0,o.label.text=f,o.label.offset=bu(c.getSpec())),o.startAngle=_-h/2,o.endAngle=_+h/2})}if(this._radiusHair&&(l.visible=!!this._currValueRadius.size,this._currValueRadius.forEach(h=>{var d,{axis:u,v:c,coord:f}=h,p=KT(h,["axis","v","coord"]);c=c??"",!((d=this._radiusHair.label)===null||d===void 0)&&d.visible&&(l.label.visible=!0,l.label.text=c,l.label.offset=bu(u.getSpec())),l.angle=f.angle,l.axis=u,pe(l,p)})),this.enableRemain&&!o.visible&&P(this._cacheAngleCrossHairInfo))o=this._cacheAngleCrossHairInfo;else if(!((i=(t=this._angleHair)===null||t===void 0?void 0:t.label)===null||i===void 0)&&i.formatMethod&&o.label.visible){const{label:h}=o;h.text=this._angleHair.label.formatMethod(h.text,"angle")}if(this.enableRemain&&!l.visible&&P(this._cacheRadiusCrossHairInfo))l=this._cacheRadiusCrossHairInfo;else if(!((r=(s=this._radiusHair)===null||s===void 0?void 0:s.label)===null||r===void 0)&&r.formatMethod&&l.label.visible){const{label:h}=l;h.text=this._radiusHair.label.formatMethod(h.text,"radius")}e&&(this._layoutHorizontal(l),this._layoutVertical(o)),this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},o),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},l),{_isCache:!0}))}_layoutVertical(e){var t;if(e._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,innerRadius:r,radius:a,label:o,startAngle:l,endAngle:h,center:d,visible:u}=e;if(u){const c=this._angleHair.type==="rect"?"sector":"line";let f;if(f=c==="sector"?{center:d,innerRadius:r,radius:a,startAngle:l,endAngle:h}:{start:as(d,r,s),end:as(d,a,s)},this._angleCrosshair)this._angleCrosshair.setAttributes(f);else{let p;c==="line"?p=new qu(Object.assign(Object.assign({},f),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex})):c==="sector"&&(p=new j_(Object.assign(Object.assign({},f),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex}))),this._angleCrosshair=p,i.add(p)}if(o.visible){const p=JE(s),g=Object.assign(Object.assign(Object.assign(Object.assign({},as(d,a+o.offset,s)),this._angleHair.label),o),{textStyle:Object.assign(Object.assign({},(t=this._angleHair.label)===null||t===void 0?void 0:t.textStyle),{textAlign:p.align,textBaseline:p.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,g,_=>{_.name="crosshair-angle-label",this._angleLabelCrosshair=_})}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(e){var t;if(e._isCache&&this.enableRemain)return;const{center:i,startAngle:s,endAngle:r,distance:a,sides:o,axis:l,label:h,point:d,radius:u,innerRadius:c,visible:f}=e,p=this.getContainer();if(f){const g=this._radiusHair.smooth?"circle":"polygon";let _=a;if(g==="polygon"){const y=l.getCenter(),b=Af(y,d),v=(r-s)/o,x=Math.floor((b-s)/v),S=x*v+s,A=Math.min((x+1)*v+s,r),k=as(y,a,S),w=as(y,a,A),M=MC([w.x,w.y],[k.x,k.y],[y.x,y.y],[d.x,d.y]);M&&(_=ai(wt.distancePN(d,M[0],M[1])+a,c,u))}const m={center:i,startAngle:s,endAngle:r,radius:_,sides:o};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(m);else{let y;y=g==="polygon"?new H_(Object.assign(Object.assign({},m),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new z_(Object.assign(Object.assign({},m),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=y,p.add(y)}if(h.visible){const y=Q5(s),b=Object.assign(Object.assign(Object.assign(Object.assign({},as(i,_,s)),this._radiusHair.label),h),{textStyle:Object.assign(Object.assign({},(t=this._radiusHair.label)===null||t===void 0?void 0:t.textStyle),{textAlign:y.align,textBaseline:y.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,b,v=>{v.name="crosshair-radius-label",this._radiusLabelCrosshair=v})}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var e;const{categoryField:t,valueField:i}=this._spec;t&&t.visible&&(this._angleHair=this._parseField(t,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=(e=i==null?void 0:i.line)===null||e===void 0?void 0:e.smooth)}_updateCrosshairLabel(e,t,i){const s=this.getContainer();e?e.setAttributes(t):(e=new Ss(t),s==null||s.add(e),i(e)),fL(e,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}Ig.specKey="crosshair",Ig.type=X.polarCrosshair;const Sie=()=>{D.registerComponent(Ig.type,Ig)};class hS extends an{get orient(){return this._orient}setStartAndEnd(e,t,i=["percent","percent"]){const[s="percent",r="percent"]=i,a=s==="percent"?e:this._dataToStatePoint(e),o=r==="percent"?t:this._dataToStatePoint(t);this._handleChange(a,o,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(e){this._handleChartZoom({zoomDelta:1.2,zoomX:e==null?void 0:e.x,zoomY:e==null?void 0:e.y})}zoomOut(e){this._handleChartZoom({zoomDelta:.8,zoomX:e==null?void 0:e.x,zoomY:e==null?void 0:e.y})}_handleChange(e,t,i){var s,r;(r=(s=this._spec)===null||s===void 0?void 0:s.zoomLock)!==null&&r!==void 0&&r||t-e<this._minSpan||this._maxSpan}_isReverse(){const e=this._relatedAxisComponent;if(!e)return!1;const t=e.getScale();return t.range()[0]>t.range()[1]&&(!e.getInverse()||this._isHorizontal)}_updateRangeFactor(e,t){const i=this._relatedAxisComponent.getScale(),s=this._isReverse(),r=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(e){case"startHandler":i.rangeFactorEnd(r[1]);break;case"endHandler":i.rangeFactorStart(r[0]);break;default:i.rangeFactorStart(r[0],!0),i.rangeFactorEnd(r[1])}else switch(e){case"startHandler":i.rangeFactorStart(r[0]);break;case"endHandler":i.rangeFactorEnd(r[1]);break;default:i.rangeFactorEnd(r[1],!0),i.rangeFactorStart(r[0])}const a=i.rangeFactor();a?(this._start=s?1-a[1]:a[0],this._end=s?1-a[0]:a[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(e,t){super(e,t),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._stateField="x",this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.effect={onZoomChange:i=>{var s,r;const a=this._relatedAxisComponent;if(a&&this._filterMode==="axis"){const o=a.getScale(),l=a.getSpec();this._auto&&this._getAxisBandSize(l)&&this._spec.ignoreBandSize&&(o.bandwidth("auto"),o.maxBandwidth("auto"),o.minBandwidth("auto")),this._updateRangeFactor(i,"zoomChange"),(r=(s=this._component)===null||s===void 0?void 0:s.setStartAndEnd)===null||r===void 0||r.call(s,this._start,this._end),a.effect.scaleUpdate()}else xt(this._regions,o=>{var l;(l=o.getViewData())===null||l===void 0||l.markRunning()},{userId:this._seriesUserId,specIndex:this._seriesIndex}),xt(this._regions,o=>{o.reFilterViewData()},{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(i,s,r)=>{var a,o;return this._startValue=i,this._endValue=s,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),(o=(a=this.effect).onZoomChange)===null||o===void 0||o.call(a,r),!0},this._handleChartZoom=i=>{var s,r;if(!this._activeRoam)return;const{zoomDelta:a,zoomX:o,zoomY:l}=i,{x:h,y:d}=this._regions[0].getLayoutStartPoint(),{width:u,height:c}=this._regions[0].getLayoutRect(),f=Math.abs(this._start-this._end),p=(r=(s=this._spec.roamZoom)===null||s===void 0?void 0:s.rate)!==null&&r!==void 0?r:1;if(f>=1&&a<1||f<=.01&&a>1)return;const g=this._isHorizontal?o:l,_=f*(a-1)*p;let m=_/2,y=_/2;if(g){const x=this._isHorizontal?h:d,S=this._isHorizontal?u:c;m=Math.abs(x-g)/Math.abs(S-x)*_,y=Math.abs(S-g)/Math.abs(S-x)*_}const b=ai(this._start+m,0,1),v=ai(this._end-y,0,1);this._handleChange(Math.min(b,v),Math.max(b,v),!0)},this._handleChartScroll=(i,s)=>{var r;if(!this._activeRoam)return!1;const{scrollX:a,scrollY:o}=i;let l=this._isHorizontal?a:o;const h=this._isHorizontal?Ve(a/o)>=.5:Ve(o/a)>=.5;return this._scrollAttr.reverse||(l=-l),h&&this._handleChartMove(l,(r=this._scrollAttr.rate)!==null&&r!==void 0?r:1),h},this._handleChartDrag=(i,s)=>{var r;if(!this._activeRoam)return;const[a,o]=i;let l=this._isHorizontal?a:o;this._dragAttr.reverse&&(l=-l),this._handleChartMove(l,(r=this._dragAttr.rate)!==null&&r!==void 0?r:1)},this._handleChartMove=(i,s)=>{const r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(i)>=1e-6){if(i>0&&this._end<1){const a=Math.min(1-this._end,i/r)*s;this._handleChange(this._start+a,this._end+a,!0)}else if(i<0&&this._start>0){const a=Math.max(-this._start,i/r)*s;this._handleChange(this._start+a,this._end+a,!0)}}},this._orient=jr(e),this._isHorizontal=MB(this._orient)==="horizontal"}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}_setAxisFromSpec(){if(P(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):P(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),C(this._spec.field)&&!this._relatedAxisComponent){const e=this._option.getComponentsByKey("axes"),t=e.find(i=>i._orient===this._orient);if(t)this._relatedAxisComponent=t;else{const i=e.find(s=>!Ue(s.getScale().type));this._relatedAxisComponent=i}}this._relatedAxisComponent&&this._filterMode==="axis"&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var e,t;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?(t=(e=this._relatedAxisComponent).getBindSeriesFilter)===null||t===void 0?void 0:t.call(e):null;if(P(i)&&(P(i.userId)&&(this._seriesUserId=N(i.userId)),P(i.specIndex)&&(this._seriesIndex=N(i.specIndex))),P(this._spec.seriesId)){const s=N(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter(r=>s.includes(r)):this._seriesUserId=s}if(P(this._spec.seriesIndex)){const s=N(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter(r=>s.includes(r)):this._seriesIndex=s}if(P(this._spec.regionIndex)){const s=this._option.getRegionsInIndex(N(this._spec.regionIndex));this._regions=this._regions.filter(r=>s.includes(r))}else if(P(this._spec.regionId)){const s=N(this._spec.regionId);this._regions=s.length?this._regions.filter(r=>s.includes(r.id)):[]}}onDataUpdate(){const e=this._computeDomainOfStateScale(Ue(this._stateScale.type));this._stateScale.domain(e,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(e){const t=this._data.getLatestData().map(i=>i[this._stateField]);if(e){const i=t.map(s=>1*s);return t.length?[hi(i),Vt(i)]:[-1/0,1/0]}return t}_initEvent(){this._initCommonEvent()}_initData(){const e=[],t=[],i=[];if(this._relatedAxisComponent){const a={};xt(this._regions,o=>{var l,h;const d=o.coordinate==="cartesian"?o.getXAxisHelper():o.coordinate==="polar"?o.angleAxisHelper:null,u=o.coordinate==="cartesian"?o.getYAxisHelper():o.coordinate==="polar"?o.radiusAxisHelper:null;if(!d||!u)return;const c=d.getAxisId()===this._relatedAxisComponent.id?d:u.getAxisId()===this._relatedAxisComponent.id?u:this._isHorizontal?d:u,f=c===d?u:d,p=Ue(f.getScale(0).type);e.push(o.getRawData());const g=o.getSpec(),_=N(g.xField),m=N(g.yField),y=o.coordinate==="cartesian"?_[0]:(l=g.angleField)!==null&&l!==void 0?l:g.categoryField,b=o.coordinate==="cartesian"?m[0]:(h=g.radiusField)!==null&&h!==void 0?h:g.valueField;if(a[o.id]=o.type==="link"?"from_xField":c===d?y:b,t.push(a[o.id]),this._valueField){const v=o.type==="link"?"from_yField":f===d?y:b;i.push(p?v:null)}},{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=a}else C(this._spec.valueField),xt(this._regions,a=>{e.push(a.getRawData()),t.push(this._field),this._valueField&&i.push(this._spec.valueField)},{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;pr(s,"dataview",c_),Ae(s,"dataFilterComputeDomain",jq);const r=new Ye(s,{name:`${this.type}_${this.id}_data`});r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,stateFields:t,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new wr(this._option,r),r.reRunAllTransform(),s.multipleDataViewAddListener(e,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var e;super.setAttrFromSpec(),this._spec.roamZoom===!0||this._spec.roamZoom?this._zoomAttr=re({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,this._spec.roamDrag===!0||this._spec.roamDrag?this._dragAttr=re({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,this._spec.roamScroll===!0||this._spec.roamScroll?this._scrollAttr=re({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=(e=this._spec.visible)===null||e===void 0||e}_statePointToData(e){const t=this._stateScale;let i=t.range();this._isReverse()&&(i=i.slice().reverse());const s=i[0]+(i[1]-i[0])*e;return t.invert(s)}_dataToStatePoint(e){const t=this._stateScale,i=t.scale(e);let s=t.range();return!this._isHorizontal&&Ue(t.type)&&(s=s.slice().reverse()),(i-s[0])/(s[1]-s[0])}_modeCheck(e,t){return e==="start"?t==="percent"&&this._spec.start||t==="value"&&this._spec.startValue:t==="percent"&&this._spec.end||t==="value"&&this._spec.endValue}_setStateFromSpec(){var e,t;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[r,a]=this._spec.rangeMode;this._modeCheck("start",r)&&this._modeCheck("end",a)&&(i=r==="percent"?this._spec.start:this._dataToStatePoint(this._spec.startValue),s=a==="percent"?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else i=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,s=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(i),this._endValue=this._statePointToData(s),this._start=i,this._end=s,this._minSpan=(e=this._spec.minSpan)!==null&&e!==void 0?e:0,this._maxSpan=(t=this._spec.maxSpan)!==null&&t!==void 0?t:1,Ue(this._stateScale.type)&&this._stateScale.domain[0]!==this._stateScale.domain[1]&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&this._filterMode==="axis"||this._start===0&&this._end===1||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(e){var t;return(t=this._originalStateFields)===null||t===void 0?void 0:t[e.id]}_initStateScale(){const e=[0,1];if(this._relatedAxisComponent){const t=this._relatedAxisComponent.getScale(),i=Ue(t.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=t.clone(),i){const r=s.map(a=>1*a);this._stateScale.domain(s.length?[hi(r),Vt(r)]:[0,1],!0).range(e)}else this._stateScale.domain(s,!0).range(e)}else this._stateScale=new bo,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(e)}init(e){super.init(e),this._addTransformToSeries(),this._start===0&&this._end===1||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&this._filterMode==="axis"||(Ae(this._option.dataSet,"dataFilterWithNewDomain",zq),xt(this._regions,e=>{e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return(t=this._field)!==null&&t!==void 0?t:this._parseFieldOfSeries(e)},isContinuous:()=>Ue(this._stateScale.type)},level:An.dataZoomFilter})},{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(e){}_compareSpec(e,t){const i=super._compareSpec(e,t);return i.reMake||ft(t,e)||(i.reRender=!0,i.reMake=!0),i}reInit(e){super.reInit(e),this._marks.forEach(t=>{t.getMarks().forEach(i=>{this.initMarkStyleWithSpec(i,this._spec[i.name])})})}changeRegions(){}update(e){}resize(e){}_parseDomainFromState(e,t){if(Ue(this._stateScale.type))return[Math.min(t,e),Math.max(t,e)];const i=this._stateScale.domain(),s=i.indexOf(e),r=i.indexOf(t);return i.slice(Math.min(s,r),Math.max(s,r)+1)}_initCommonEvent(){var e,t,i,s,r,a,o;const l={delayType:(t=(e=this._spec)===null||e===void 0?void 0:e.delayType)!==null&&t!==void 0?t:"throttle",delayTime:P((i=this._spec)===null||i===void 0?void 0:i.delayType)?(r=(s=this._spec)===null||s===void 0?void 0:s.delayTime)!==null&&r!==void 0?r:30:0,realTime:(o=(a=this._spec)===null||a===void 0?void 0:a.realTime)===null||o===void 0||o};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,l),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,l),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,l)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}onLayoutStart(e,t,i){super.onLayoutStart(e,t,i);const s=this._autoUpdate(e),r=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[r]:s?this[`_${r}`]:0},{[r]:J.Built_In})}getBoundsInRect(e){const t={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(t.y2=t.y1+this._height,t.x2=t.x1+e.width):(t.x2=t.x1+this._width,t.y2=t.y1+e.height),t}hide(){var e;(e=this._component)===null||e===void 0||e.hideAll()}show(){var e;(e=this._component)===null||e===void 0||e.showAll()}_getAxisBandSize(e){const t=e==null?void 0:e.bandSize,i=e==null?void 0:e.maxBandSize,s=e==null?void 0:e.minBandSize;if(t||s||i)return{bandSize:t,maxBandSize:i,minBandSize:s}}_autoUpdate(e){var t,i,s,r,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=l==null?void 0:l.getSpec(),d=l==null?void 0:l.getScale(),u=this._getAxisBandSize(h);if(wi(d.type)&&(e==null?void 0:e.height)===((t=this._cacheRect)===null||t===void 0?void 0:t.height)&&(e==null?void 0:e.width)===((i=this._cacheRect)===null||i===void 0?void 0:i.width)&&this._fixedBandSize===(u==null?void 0:u.bandSize))return this._cacheVisibility;let c=!0;if(this._isHorizontal&&(e==null?void 0:e.width)!==((s=this._cacheRect)===null||s===void 0?void 0:s.width)?d.range(l.getInverse()?[e.width,0]:[0,e.width]):(e==null?void 0:e.height)!==((r=this._cacheRect)===null||r===void 0?void 0:r.height)&&d.range(l.getInverse()?[0,e.height]:[e.height,0]),this._cacheRect={width:e==null?void 0:e.width,height:e==null?void 0:e.height},this._fixedBandSize=u==null?void 0:u.bandSize,wi(d.type)){u&&(this._start||this._end)&&this._updateRangeFactor(null,"auto");const[f,p]=(a=d.rangeFactor())!==null&&a!==void 0?a:[];c=(!C(f)||!C(p))&&!(f===0&&p===1)}else{const[f,p]=(o=d.rangeFactor())!==null&&o!==void 0?o:[this._start,this._end];c=!(f===0&&p===1)}return this.setStartAndEnd(this._start,this._end),c?this.show():this.hide(),this._cacheVisibility=c,c}_getNeedClearVRenderComponents(){return[this._component]}}li(hS,Y0);class LI extends sc{_mergeThemeToSpec(e,t){const i=this._theme;let s=e;if(this._shouldMergeThemeToSpec()){const r=o=>{const l=pe({selectedBackgroundChart:{line:{},area:{}}},this._theme,o),{selectedBackgroundChart:h={}}=o,{line:d,area:u}=h;return d&&d.visible!==!1&&(l.selectedBackgroundChart.line.style=Object.assign(Object.assign({},l.selectedBackgroundChart.line.style),{visible:!0})),u&&u.visible!==!1&&(l.selectedBackgroundChart.area.style=Object.assign(Object.assign({},l.selectedBackgroundChart.area.style),{visible:!0})),l},a=e;s=W(a)?a.map(o=>r(o)):r(a)}return this._adjustPadding(s),{spec:s,theme:i}}}class Ld extends hS{static getSpecInfo(e){const t=e[this.specKey];if(C(t))return;if(!W(t))return[{spec:t,specPath:[this.specKey],type:X.dataZoom}];const i=[];return t.forEach((s,r)=>{i.push({spec:s,specIndex:r,specPath:[this.specKey,r],type:X.dataZoom})}),i}constructor(e,t){var i;super(e,t),this.type=X.dataZoom,this.name=X.dataZoom,this.transformerConstructor=LI,this.specKey="dataZoom",this.layoutZIndex=rt.DataZoom,this.layoutLevel=bs.DataZoom,this.layoutType="region-relative",this._dataToPositionX=s=>{const r=this._orient==="left"?this._middleHandlerSize:0,a=this._isHorizontal?this._startHandlerSize/2:0,o=this._isHorizontal?this._stateScale:this._valueScale,l=this._isHorizontal?this._stateField:this._valueField;return o.scale(s[l])+this.getLayoutStartPoint().x+r+a},this._dataToPositionX2=s=>{const r=this._orient==="left"?this._middleHandlerSize:0,a=this._isHorizontal?this._startHandlerSize/2:0,o=this._isHorizontal?this._stateScale:this._valueScale,l=o.domain()[0];return o.scale(l)+this.getLayoutStartPoint().x+r+a},this._dataToPositionY=s=>{const r=this._isHorizontal?this._middleHandlerSize:0,a=this._isHorizontal?0:this._startHandlerSize/2,o=this._isHorizontal?this._valueScale:this._stateScale,l=this._isHorizontal?this._valueField:this._stateField;return o.scale(s[l])+this.getLayoutStartPoint().y+r+a},this._dataToPositionY2=s=>{const r=this._isHorizontal?this._middleHandlerSize:0,a=this._isHorizontal?0:this._startHandlerSize/2,o=this._isHorizontal?this._valueScale:this._stateScale,l=o.domain()[0];return o.scale(l)+this.getLayoutStartPoint().y+r+a},this._valueField="y",this._filterMode=(i=e.filterMode)!==null&&i!==void 0?i:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var e,t,i,s,r,a,o,l,h,d;super.setAttrFromSpec(),ht(this._spec.roam)&&(this._zoomAttr.enable=this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode),this._backgroundSize=(t=(e=this._spec.background)===null||e===void 0?void 0:e.size)!==null&&t!==void 0?t:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),C((r=(s=(i=this._spec)===null||i===void 0?void 0:i.startHandler)===null||s===void 0?void 0:s.style)===null||r===void 0?void 0:r.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),C((l=(o=(a=this._spec)===null||a===void 0?void 0:a.endHandler)===null||o===void 0?void 0:o.style)===null||l===void 0?void 0:l.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const u=(h=this._spec.startHandler.style.visible)===null||h===void 0||h,c=(d=this._spec.endHandler.style.visible)===null||d===void 0||d;this._startHandlerSize=u?this._spec.startHandler.style.size:0,this._endHandlerSize=c?this._spec.endHandler.style.size:0}onLayoutEnd(e){this._updateScaleRange(),this._cacheVisibility!==!1&&super.onLayoutEnd(e)}_initValueScale(){const e=this._computeDomainOfValueScale();if(e){const t=new qn;t.domain(e),this._valueScale=t}}_updateScaleRange(){var e,t;const i=(this._startHandlerSize+this._endHandlerSize)/2;if(!this._stateScale||!this._valueScale)return;let s;const r=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,a=(t=(e=this._relatedAxisComponent)===null||e===void 0?void 0:e.getScale().range())!==null&&t!==void 0?t:[0,r];this._isHorizontal?(s=this._visible?[0,this._computeWidth()-i]:a,this._stateScale.range(s),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):this.layoutOrient==="left"?(s=this._visible?[0,this._computeHeight()-i]:a,this._stateScale.range(s),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(s=this._visible?[0,this._computeHeight()-i]:a,this._stateScale.range(s),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._cacheVisibility!==!1&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const e=this._data.getLatestData().map(i=>i[this._valueField]),t=e.map(i=>1*i);return e.length?[hi(t),Vt(t)]:null}_computeMiddleHandlerSize(){var e,t,i,s;let r=0;if(!((t=(e=this._spec)===null||e===void 0?void 0:e.middleHandler)===null||t===void 0)&&t.visible){const a=(i=this._spec.middleHandler.icon.style.size)!==null&&i!==void 0?i:8,o=(s=this._spec.middleHandler.background.size)!==null&&s!==void 0?s:40;r+=Math.max(a,o)}return r}_computeWidth(){return this._visible===!1?0:oe(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return this._visible===!1?0:oe(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_isScaleValid(e){if(!e||!e.domain())return!1;const t=e.domain();return(!Ue(e.type)||t[0]!==t[1])&&(!wi(e.type)||aD(t).length!==1)}_getAttrs(e){var t,i,s,r,a;const o=(t=this._spec)!==null&&t!==void 0?t:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:o.showDetail,brushSelect:(i=o.brushSelect)!==null&&i!==void 0&&i,zoomLock:(s=o.zoomLock)!==null&&s!==void 0&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:o.delayType,delayTime:P(o.delayType)?(r=o.delayTime)!==null&&r!==void 0?r:30:0,realTime:(a=o.realTime)===null||a===void 0||a,previewData:e&&this._data.getLatestData(),previewPointsX:e&&this._dataToPositionX,previewPointsY:e&&this._dataToPositionY},this._getComponentAttrs())}_createOrUpdateComponent(){if(this._visible){const e=this._isHorizontal?this._stateScale:this._valueScale,t=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(e)&&this._isScaleValid(t),s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const r=this.getContainer();this._component=new FR(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData(a=>this._statePointToData(a)),this._component.addEventListener("change",a=>{const{start:o,end:l,tag:h}=a.detail;this._handleChange(o,l,void 0,h)}),r.add(this._component),this._updateScaleRange()}}}_handleChange(e,t,i,s){super._handleChange(e,t,i),i&&this._component&&this._component.setStartAndEnd(e,t),this._start=e,this._end=t,this._handleStateChange(this._statePointToData(e),this._statePointToData(t),s)&&this.event.emit(ye.dataZoomChange,{model:this,value:{filterData:this._filterMode!=="axis",start:e,end:t,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){var e;const t=this._data.getDataView();if(t.reRunAllTransform(),(e=this._component)===null||e===void 0||e.setPreviewData(t.latestData),this._valueScale){const i=this._computeDomainOfValueScale();i&&this._valueScale.domain(i)}}_getComponentAttrs(){var e,t,i,s,r,a,o,l,h,d,u;const{middleHandler:c={},startText:f={},endText:p={},backgroundChart:g={},selectedBackgroundChart:_={}}=this._spec;return{backgroundStyle:ve((e=this._spec.background)===null||e===void 0?void 0:e.style),startHandlerStyle:ve((t=this._spec.startHandler)===null||t===void 0?void 0:t.style),middleHandlerStyle:c.visible?{visible:!0,icon:ve((i=c.icon)===null||i===void 0?void 0:i.style),background:{size:(s=c.background)===null||s===void 0?void 0:s.size,style:ve((r=c.background)===null||r===void 0?void 0:r.style)}}:{visible:!1},endHandlerStyle:ve((a=this._spec.endHandler)===null||a===void 0?void 0:a.style),startTextStyle:{padding:f.padding,formatMethod:f.formatMethod,textStyle:ve(f.style)},endTextStyle:{padding:p.padding,formatMethod:p.formatMethod,textStyle:ve(p.style)},selectedBackgroundStyle:ve(this._spec.selectedBackground.style),dragMaskStyle:ve((o=this._spec.dragMask)===null||o===void 0?void 0:o.style),backgroundChartStyle:{line:pe(ve((l=g.line)===null||l===void 0?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},ve((h=g.area)===null||h===void 0?void 0:h.style))},selectedBackgroundChartStyle:{line:pe(ve((d=_.line)===null||d===void 0?void 0:d.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},ve((u=_.area)===null||u===void 0?void 0:u.style))},disableTriggerEvent:this._option.disableTriggerEvent}}_getNeedClearVRenderComponents(){return[this._component]}}Ld.type=X.dataZoom,Ld.transformerConstructor=LI,Ld.specKey="dataZoom";const Aie=()=>{D.registerComponent(Ld.type,Ld)};class Dg extends hS{static getSpecInfo(e){const t=e[this.specKey];if(C(t))return;if(!W(t))return[{spec:t,specPath:[this.specKey],type:X.scrollBar}];const i=[];return t.forEach((s,r)=>{i.push({spec:s,specIndex:r,specPath:[this.specKey,r],type:X.scrollBar})}),i}constructor(e,t){var i;super(e,t),this.type=X.scrollBar,this.name=X.scrollBar,this.specKey="scrollBar",this.layoutZIndex=rt.DataZoom,this.layoutLevel=bs.DataZoom,this.layoutType="region-relative",this._filterMode=(i=e.filterMode)!==null&&i!==void 0?i:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),ht(this._spec.roam)&&(this._zoomAttr.enable=!1,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode)}onLayoutEnd(e){var t,i;this._updateScaleRange(),(i=(t=this.effect).onZoomChange)===null||i===void 0||i.call(t),super.onLayoutEnd(e)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return oe(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:sx}_computeHeight(){return oe(this._spec.height)?this._spec.height:this._isHorizontal?sx:this.getLayoutRect().height}_getAttrs(){var e,t,i,s,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:(e=this._spec)===null||e===void 0?void 0:e.delayType,delayTime:P((t=this._spec)===null||t===void 0?void 0:t.delayType)?(s=(i=this._spec)===null||i===void 0?void 0:i.delayTime)!==null&&s!==void 0?s:30:0,realTime:(a=(r=this._spec)===null||r===void 0?void 0:r.realTime)===null||a===void 0||a},this._getComponentAttrs())}_createOrUpdateComponent(){const e=this._getAttrs();if(this._component)this._component.setAttributes(e);else{const t=this.getContainer();this._component=new mR(e),this._component.addEventListener("scroll",i=>{const s=i.detail.value;this._handleChange(s[0],s[1])}),t.add(this._component)}}_handleChange(e,t,i){super._handleChange(e,t,i),i&&this._component&&this._component.setAttribute("range",[e,t]),this._start=e,this._end=t,this._handleStateChange(this._statePointToData(e),this._statePointToData(t))&&this.event.emit(ye.scrollBarChange,{model:this,value:{filterData:this._filterMode!=="axis",start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scroll",e=>{const t=e.detail.value;this._handleChange(t[0],t[1])})}_getComponentAttrs(){const{rail:e,slider:t,innerPadding:i}=this._spec,s={};return C(i)||(s.padding=i),fe(e==null?void 0:e.style)||(s.railStyle=ve(e.style)),fe(t==null?void 0:t.style)||(s.sliderStyle=ve(t.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}Dg.type=X.scrollBar,Dg.specKey="scrollBar";const kie=()=>{D.registerComponent(Dg.type,Dg)},wie=(n,e)=>{const{datum:t,title:i,content:s}=e,r=[],a=t.call(null);return i.visible&&r.push({type:"title",index:0,datum:a,spec:i}),N(s).forEach((o,l)=>{o.visible&&r.push({type:"content",index:l,datum:a,spec:o})}),r};class _h extends an{constructor(){super(...arguments),this.type=X.indicator,this.name=X.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=rt.Indicator,this.layoutLevel=bs.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(e){if(this.type!==_h.type)return null;const t=e[this.specKey];if(!W(t))return t.visible===!1?[]:[{spec:t,specPath:[this.specKey],type:X.indicator}];const i=[];return t.forEach((s,r)=>{s&&s.visible!==!1&&i.push({spec:s,specIndex:r,specPath:[this.specKey,r],type:X.indicator})}),i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=N(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}onRender(e){}changeRegions(e){}initEvent(){this._option.disableTriggerEvent||this._spec.trigger!=="none"&&(this._spec.trigger==="hover"?(this.event.on("hovered",e=>{e.model&&!this.isRelativeModel(e.model)||this.updateDatum(e.value[0])}),this.event.on("unhovered",e=>{e.model&&!this.isRelativeModel(e.model)||this.updateDatum(null)})):(this.event.on("selected",e=>{e.model&&!this.isRelativeModel(e.model)||this.updateDatum(e.value[0])}),this.event.on("unselected",e=>{e.model&&!this.isRelativeModel(e.model)||this.updateDatum(null)})))}updateDatum(e){this._activeDatum=e,this._displayData.updateData();const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t)}initData(){Ae(this._option.dataSet,"indicatorFilter",wie);const e=new Ye(this._option.dataSet,{name:`${this.type}_${this.id}_data`});e.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),e.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new wr(this._option,e)}updateLayoutAttribute(){const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e),super.updateLayoutAttribute()}_getIndicatorAttrs(){const e=this._regions[0],{width:t,height:i}=e.getLayoutRect(),{x:s,y:r}=e.getLayoutStartPoint(),a=[];return N(this._spec.content).forEach(o=>{const l=pe({},this._theme.content,o);a.push({visible:l.visible!==!1&&(!l.field||this._activeDatum!==null),space:l.space||this._gap,autoLimit:l.autoLimit,autoFit:l.autoFit,fitPercent:l.fitPercent,style:Object.assign(Object.assign({},ve(l.style)),{text:this._createText(l.field,l.style.text)})})}),{visible:this._spec.visible!==!1&&(this._spec.fixed!==!1||this._activeDatum!==null),size:{width:t,height:i},zIndex:this.layoutZIndex,x:s,y:r,dx:this._spec.offsetX?el(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?el(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:this._spec.title.visible!==!1&&(!P(this._spec.title.field)||this._activeDatum!==null),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:Object.assign(Object.assign({},ve(this._spec.title.style)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:a}}_createOrUpdateIndicatorComponent(e){if(this._indicatorComponent)ft(e,this._cacheAttrs)||this._indicatorComponent.setAttributes(e);else{const t=this.getContainer(),i=new U$(e);i.name="indicator",t.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",(s,r)=>this._delegateEvent(this._indicatorComponent,s,r))}return this._cacheAttrs=e,this._indicatorComponent}_createText(e,t){var i;return e?this._activeDatum?this._activeDatum[e]:"":Y(t)?(i=t(this._activeDatum,void 0))!==null&&i!==void 0?i:"":t??""}_computeLayoutRadius(){const e=this._regions[0],{width:t,height:i}=e.getLayoutRect();return Math.min(t/2,i/2)}isRelativeModel(e){return xt(this._regions,t=>e===t)||this._regions.includes(e)}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}}_h.type=X.indicator,_h.specKey="indicator";const Mie=()=>{D.registerComponent(_h.type,_h)},Tie=(n,e)=>{const t=n[0].latestData;return iR(t,e.field)},Cie=(n,e)=>{const t=n[0].latestData;return o0(t,e.field)};function Pie(n,e){const t=n[0].latestData;return nR(t,e.field)}function Eie(n,e){const t=n[0].latestData;return sR(t,e.field)}function Rie(n,e){const t=n[0].latestData;return rR(t,e.field)}function Oie(n,e){const t=n[0].latestData;return q5(t,e.field)}function Bie(n,e){const t=n[0].latestData;return Z5(t,e.field)}function dS(n,e){const t=[];return e.forEach(i=>{const s={x:null,y:null};if(P(i.x)){const r=i.x;W(r)?s.x=r.map(a=>sf(a,n,i)):s.x=sf(r,n,i)}if(P(i.y)){const r=i.y;W(r)?s.y=r.map(a=>sf(a,n,i)):s.y=sf(r,n,i)}i.getRefRelativeSeries&&(s.getRefRelativeSeries=i.getRefRelativeSeries),t.push(s)}),t}const Lie={min:Tie,max:Cie,sum:Pie,average:Eie,variance:Rie,standardDeviation:Oie,median:Bie};function sf(n,e,t){const i=t.getRelativeSeries(),s=t.getStartRelativeSeries(),r=t.getEndRelativeSeries(),a=i.getData().getLatestData(),o=s.getData().getLatestData(),l=r.getData().getLatestData();if(Y(n))return n(a,o,l,i,s,r);if(_s(n)){const{aggrType:h,field:d}=n;return Lie[h](e,{field:d})}return n}const Iie=["sum","average","min","max","variance","standardDeviation","median"];var Die=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};function Fg(n,e,t){if(!t)return!1;const i=n.map(a=>1*a),s=hi(i),r=Vt(i);return e<s||e>r}function qT(n,e,t,i,s,r){var a,o;const{relativeSeries:l}=i;let h;return oe(n.x)&&Fg(e,n.x,t)&&((o=l==null?void 0:(a=l.getXAxisHelper()).setExtendDomain)===null||o===void 0||o.call(a,"marker_xAxis_extend",n.x)),h=dn(n.x)?Pl(n.x,s)+r.x:l.getXAxisHelper().dataToPosition([n.x])+r.x,h}function ZT(n,e,t,i,s,r){var a,o;const{relativeSeries:l}=i;let h;return oe(n.y)&&Fg(e,n.y,t)&&((o=(a=l.getYAxisHelper())===null||a===void 0?void 0:a.setExtendDomain)===null||o===void 0||o.call(a,"marker_yAxis_extend",n.y)),h=dn(n.y)?Pl(n.y,s)+r.y:l.getYAxisHelper().dataToPosition([n.y])+r.y,h}function Pl(n,e){return Number(n.substring(0,n.length-1))*e/100}function By(n){return Iie.includes(n)}function zg(n,e,t,i,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=t.getRegion(),l=o.getLayoutStartPoint(),h=Math.abs(Math.min(a.x,l.x)-Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width)),d=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),u={relativeSeries:i,startRelativeSeries:e,endRelativeSeries:t},c=[],f=n.latestData[0]&&n.latestData[0].latestData?n.latestData[0].latestData:n.latestData,p=i.getXAxisHelper().getScale(0).domain(),g=i.getYAxisHelper().getScale(0).domain();return f.forEach(_=>{const m=P(_.x),y=P(_.y);if(m&&y){const b=qT(_,p,s,u,h,a),v=ZT(_,g,s,u,d,a);c.push([{x:b,y:v}])}else if(P(_.x)){const b=qT(_,p,s,u,h,a),v=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),x=Math.min(a.y,l.y);c.push([{x:b,y:v},{x:b,y:x}])}else if(P(_.y)){const b=Math.min(a.x,l.x),v=ZT(_,g,s,u,d,a),x=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);c.push([{x:b,y:v},{x,y:v}])}}),c}function uS(n,e,t,i){const s=[],r=n.latestData[0]&&n.latestData[0].latestData?n.latestData[0].latestData:n.latestData,a=W(i);return r.forEach((o,l)=>{var h,d,u,c;const f=o!=null&&o.getRefRelativeSeries?o.getRefRelativeSeries():e,p=f.getRegion(),g=p.getLayoutStartPoint(),{width:_,height:m}=p.getLayoutRect();let y=0,b=0;if(i){const k=a?i[l]:i,w=k.x,M=k.y;w&&(y=dn(w)?Number(w.substring(0,w.length-1))*_/100:w),M&&(b=dn(M)?Number(M.substring(0,M.length-1))*m/100:M)}const v=f.getXAxisHelper().getScale(0).domain(),x=f.getYAxisHelper().getScale(0).domain(),S=N(o.x),A=N(o.y);S.length===1&&oe(S[0])&&Fg(v,S[0],t)&&((d=(h=f.getXAxisHelper())===null||h===void 0?void 0:h.setExtendDomain)===null||d===void 0||d.call(h,"marker_xAxis_extend",S[0])),A.length===1&&oe(A[0])&&Fg(x,A[0],t)&&((c=(u=f.getYAxisHelper())===null||u===void 0?void 0:u.setExtendDomain)===null||c===void 0||c.call(u,"marker_yAxis_extend",A[0])),s.push({x:f.getXAxisHelper().dataToPosition(S)+g.x+y,y:f.getYAxisHelper().dataToPosition(A)+g.y+b})}),s}function cS(n,e,t){if(t){const r=e.getRegion(),{x:a,y:o}=r.getLayoutStartPoint(),{width:l,height:h}=r.getLayoutRect();return n.map(d=>{let{x:u,y:c}=d;return dn(u)&&(u=Pl(u,l)),u+=a,dn(c)&&(c=Pl(c,h)),c+=o,{x:u,y:c}})}const{width:i,height:s}=e.getOption().getChart().getCanvasRect();return n.map(r=>{let{x:a,y:o}=r;return dn(a)&&(a=Pl(a,i)),dn(o)&&(o=Pl(o,s)),{x:a,y:o}})}function fS(n){let e=1/0,t=-1/0,i=1/0,s=-1/0;return n.forEach(r=>{const a=r.getLayoutStartPoint(),o=r.getLayoutRect();a.x<e&&(e=a.x),a.x+o.width>t&&(t=a.x+o.width),a.y<i&&(i=a.y),a.y+o.height>s&&(s=a.y+o.height)}),{minX:e,maxX:t,minY:i,maxY:s}}function pS(n){const{labelBackground:e={},style:t,shape:i}=n,s=Die(n,["labelBackground","style","shape"]);if(n.visible!==!1){const r=s;return i!=null&&i.visible?r.shape=Object.assign({visible:!0},ve(i.style)):r.shape={visible:!1},e.visible!==!1?(r.panel=Object.assign({visible:!0},ve(e.style)),P(e.padding)&&(r.padding=tn(e.padding))):(r.panel={visible:!1},r.padding=0),t&&(r.textStyle=ve(t)),r}return{visible:!1}}class gS extends an{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(e,t,i){const s=e==="x"?i.getSpec().xField:i.getSpec().yField;return ae(t)&&By(t)?{field:s,aggrType:t}:t}_processSpecX(e){const t=this._relativeSeries;return Object.assign({x:this._getFieldInfoFromSpec("x",e,t)},this._getAllRelativeSeries())}_processSpecY(e){const t=this._relativeSeries;return Object.assign({y:this._getFieldInfoFromSpec("y",e,t)},this._getAllRelativeSeries())}_processSpecXY(e,t){const i=this._relativeSeries;return Object.assign({x:this._getFieldInfoFromSpec("x",e,i),y:this._getFieldInfoFromSpec("y",t,i)},this._getAllRelativeSeries())}_processSpecCoo(e){var t;return((t=e.coordinates)!==null&&t!==void 0?t:N(e.coordinate)).map(i=>{const s=this._getSeriesByIdOrIndex(i.refRelativeSeriesId,i.refRelativeSeriesIndex),{xField:r,yField:a}=s.getSpec(),{xFieldDim:o,xFieldIndex:l,yFieldDim:h,yFieldIndex:d}=i;let u=r;P(l)&&(u=N(r)[l]),o&&N(r).includes(o)&&(u=o);let c=a;P(d)&&(c=N(a)[d]),h&&N(a).includes(h)&&(c=h);const f=Object.assign({x:void 0,y:void 0},this._getAllRelativeSeries());return ae(i[u])&&By(i[u])?f.x={field:u,aggrType:i[u]}:f.x=N(u).map(p=>i[p]),ae(i[c])&&By(i[c])?f.y={field:c,aggrType:i[c]}:f.y=N(c).map(p=>i[p]),f.getRefRelativeSeries=()=>s,f})}updateLayoutAttribute(){var e,t,i;if((e=this._spec.visible)===null||e===void 0||e){if(!this._markerComponent){const s=this._createMarkerComponent();s.name=(t=this._spec.name)!==null&&t!==void 0?t:this.type,s.id=(i=this._spec.id)!==null&&i!==void 0?i:`${this.type}-${this.id}`,this._markerComponent=s,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",(r,a)=>this._delegateEvent(this._markerComponent,r,a))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(e,t){var i,s;let r;return r=(i=this._option.getSeriesInUserIdOrIndex(P(e)?[e]:[],[t]))===null||i===void 0?void 0:i[0],r||(r=(s=this._relativeSeries)!==null&&s!==void 0?s:this._getFirstSeries()),r}_bindSeries(){const e=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(e.relativeSeriesId,e.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(e.startRelativeSeriesId,e.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(e.endRelativeSeriesId,e.endRelativeSeriesIndex)}initEvent(){}onRender(e){}changeRegions(e){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var e;if(this._firstSeries)return this._firstSeries;const t=l0(this._regions);return t?(this._firstSeries=t,t):((e=this._option)===null||e===void 0||e.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(e,t,i){C(this._spec.offsetX)||(this._layoutOffsetX=Ii(this._spec.offsetX,t.width,t)),C(this._spec.offsetY)||(this._layoutOffsetY=Ii(this._spec.offsetY,t.height,t)),super.onLayoutStart(e,t,i)}}function Fie(n,e){const t=n[0].latestData;return J5(t,e.fieldX,e.fieldY)}function zie(n,e,t,i=0){const s=[],r=n.y-e.y,a=n.x-e.x;switch(t){case"top":s.push(n),s.push({x:n.x,y:r>0?n.y-i-Math.abs(r):n.y-i}),s.push({x:e.x,y:r>0?e.y-i:e.y-i-Math.abs(r)}),s.push(e);break;case"bottom":s.push(n),s.push({x:n.x,y:r<0?n.y+i+Math.abs(r):n.y+i}),s.push({x:e.x,y:r<0?e.y+i:e.y+i+Math.abs(r)}),s.push(e);break;case"left":s.push(n),s.push({x:a>0?n.x-i-Math.abs(a):n.x-i,y:n.y}),s.push({x:a>0?e.x-i:e.x-i-Math.abs(a),y:e.y}),s.push(e);break;case"right":s.push(n),s.push({x:a>0?n.x+i:n.x+i+Math.abs(a),y:n.y}),s.push({x:a>0?e.x+i+Math.abs(a):e.x+i,y:e.y}),s.push(e)}return s}function jie(n,e,t,i=0){const s=n.y-e.y,r=n.x-e.x;return t==="bottom"?{dx:r>0?-r/2:Math.abs(r/2),dy:s>0?i:Math.abs(s)+i}:t==="top"?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:s>0?-(Math.abs(s)+i):-i}:t==="left"?{dx:r>0?-r-i:-i,dy:s>0?-s/2:Math.abs(s/2)}:t==="right"?{dx:r>0?i:Math.abs(r)+i,dy:s>0?-s/2:Math.abs(s/2)}:{}}function _S(n,e){if(e&&e.getRelativeSeries){const t=e.getRelativeSeries();if(t){const i=t.getViewData();return i&&i.latestData&&i.latestData.length?n:[]}}return n}class jg extends gS{constructor(){super(...arguments),this.type=X.markLine,this.name=X.markLine,this.specKey="markLine",this.layoutZIndex=rt.MarkLine}static getSpecInfo(e){const t=e[this.specKey];if(fe(t))return;if(!W(t)&&t.visible!==!1)return[{spec:t,specPath:[this.specKey],type:X.markLine}];const i=[];return t.forEach((s,r)=>{s.visible!==!1&&i.push({spec:s,specIndex:r,specPath:[this.specKey,r],type:X.markLine})}),i}_createMarkerComponent(){var e,t,i;const{label:s={},startSymbol:r={},endSymbol:a={}}=this._spec,o={zIndex:this.layoutZIndex,interactive:(e=this._spec.interactive)!==null&&e!==void 0&&e,points:[{x:0,y:0},{x:0,y:0}],lineStyle:(t=this._spec.line)===null||t===void 0?void 0:t.style,clipInRange:(i=this._spec.clip)!==null&&i!==void 0&&i,label:pS(s)};return r.visible?o.startSymbol=Object.assign(Object.assign({},r),{visible:!0,style:ve(r.style)}):o.startSymbol={visible:!1},a.visible?o.endSymbol=Object.assign(Object.assign({},a),{visible:!0,style:ve(a.style)}):o.endSymbol={visible:!1},new GR(o)}_markerLayout(){var e,t,i,s,r,a,o;const l=this._spec,h=this._markerData,d=this._startRelativeSeries,u=this._endRelativeSeries,c=this._relativeSeries,f=P(l.coordinates),p=P(l.process),g=p&&P(l.process.x),_=p&&P(l.process.y),m=f&&(!p||"process"in l&&"xy"in l.process),y=P(l.positions),b=(e=l.autoRange)!==null&&e!==void 0&&e;let v=[];if(this._isXYLayout||f&&g||f&&_){const M=zg(h,d,u,c,b);v=M.length===1?M[0]:M.map(T=>T[0])}else m?v=uS(h,c,b,l.coordinatesOffset):y&&(v=cS(l.positions,c,l.regionRelative));const x=this._relativeSeries.getViewData().latestData,S=h.latestData[0]&&h.latestData[0].latestData?h.latestData[0].latestData:h.latestData;let A;if(l.clip||!((t=l.label)===null||t===void 0)&&t.confine){const{minX:M,maxX:T,minY:E,maxY:O}=fS([d.getRegion(),u.getRegion(),c.getRegion()]);A={x:M,y:E,width:T-M,height:O-E}}const k=(s=(i=this._markerComponent)===null||i===void 0?void 0:i.attribute)!==null&&s!==void 0?s:{},w=Object.assign(Object.assign({},k.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(S,x):(r=k.label)===null||r===void 0?void 0:r.text});if(this._spec.type==="type-step"){const{multiSegment:M,mainSegmentIndex:T}=this._spec.line||{},{connectDirection:E,expandDistance:O=0}=this._spec;let B;if(dn(O)){const I=d.getRegion(),F=I.getLayoutStartPoint(),H=u.getRegion(),G=H.getLayoutStartPoint();if(E==="bottom"||E==="top"){const U=Math.abs(Math.min(F.y,G.y)-Math.max(F.y+I.getLayoutRect().height,G.y+H.getLayoutRect().height));B=Number(O.substring(0,O.length-1))*U/100}else{const U=Math.abs(Math.min(F.x,G.x)-Math.max(F.x+I.getLayoutRect().width,G.x+H.getLayoutRect().width));B=Number(O.substring(0,O.length-1))*U/100}}else B=O;const R=zie(v[0],v[1],E,B);let L;L=M&&P(T)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},jie(v[0],v[1],E,B)),{refX:0,refY:0}),(a=this._markerComponent)===null||a===void 0||a.setAttributes({points:M?[[R[0],R[1]],[R[1],R[2]],[R[2],R[3]]]:R,label:Object.assign(Object.assign(Object.assign({},w),L),{textStyle:Object.assign(Object.assign({},k.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:A,multiSegment:M,mainSegmentIndex:T,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else(o=this._markerComponent)===null||o===void 0||o.setAttributes({points:v,label:w,limitRect:A,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_initDataView(){const e=this._spec,t=this._relativeSeries,i="x"in e,s="y"in e,r="x1"in e,a="y1"in e,o="coordinates"in e,l=i&&!s&&!a,h=i&&s&&a,d=s&&!i&&!r,u=s&&i&&r,c=i&&s&&r&&a;if(this._markerData=t.getViewData(),!(l||d||h||u||c||o))return;let f;Ae(this._option.dataSet,"markerAggregation",dS),Ae(this._option.dataSet,"markerRegression",Fie),Ae(this._option.dataSet,"markerFilter",_S),this._isXYLayout=l||h||d||u||c;let p=t.getViewData(),g=!0,_=!1;if(c){const{x:y,x1:b,y:v,y1:x}=e;f=[this._processSpecXY(y,v),this._processSpecXY(b,x)]}else if(l)f=[this._processSpecX(e.x)];else if(d)f=[this._processSpecY(e.y)];else if(h){const{x:y,y:b,y1:v}=e;f=[this._processSpecXY(y,b),this._processSpecXY(y,v)]}else if(u){const{x:y,x1:b,y:v}=e;f=[this._processSpecXY(y,v),this._processSpecXY(b,v)]}else if(o){if(f=this._processSpecCoo(e),g=!1,p=new Ye(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([t.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:f}),e.process&&"x"in e.process&&(f=[this._processSpecX(e.process.x)],g=!0),e.process&&"y"in e.process&&(f=[this._processSpecY(e.process.y)],g=!0),e.process&&"xy"in e.process){const{xField:y,yField:b}=t.getSpec();f={fieldX:y,fieldY:b},_=!0}}else g=!1;const m=new Ye(this._option.dataSet);m.parse([p],{type:"dataview"}),g&&m.transform({type:"markerAggregation",options:f}),_&&m.transform({type:"markerRegression",options:f}),(g||_)&&m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",()=>{this._markerLayout()}),this._markerData=m}}jg.type=X.markLine,jg.specKey="markLine";const Hie=()=>{D.registerComponent(jg.type,jg)};class Hg extends an{get orient(){return this._orient}constructor(e,t){super(e,t),this.type=X.title,this.specKey=X.title,this.layoutType="normal",this.layoutZIndex=rt.Title,this.layoutLevel=bs.Title,this._orient="top",this._orient=O0(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(e){const t=e[this.specKey];if(!t||t.visible===!1)return null;if(!W(t))return[{spec:t,specPath:[this.specKey],type:X.title}];const i=[];return t.forEach((s,r)=>{s.visible!==!1&&i.push({spec:s,specIndex:r,specPath:[this.specKey,r],type:X.title})}),i}onRender(e){}_compareSpec(e,t){const i=super._compareSpec(e,t);return(t==null?void 0:t.orient)!==(e==null?void 0:e.orient)&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(e){}update(e){}resize(e){}afterSetLayoutStartPoint(e){j(e.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",e.x),j(e.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",e.y),super.afterSetLayoutStartPoint(e)}getBoundsInRect(e){let t={};this.setLayoutRect(e);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),t=this._getTitleLayoutRect();const{x:s,y:r}=this.getLayoutStartPoint();return{x1:s,y1:r,x2:s+t.width,y2:r+t.height}}_getTitleLayoutRect(){const e=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:j(e.width())?e.width():0,height:this._spec.height?this._spec.height:j(e.height())?e.height():0}}_getTitleAttrs(){var e,t,i,s,r,a,o,l,h;const d=Math.max(0,(e=this._spec.width)!==null&&e!==void 0?e:this.getLayoutRect().width);return Object.assign(Object.assign({},Nl(this._spec,["padding"])),{textType:(t=this._spec.textType)!==null&&t!==void 0?t:"text",text:(i=this._spec.text)!==null&&i!==void 0?i:"",subtextType:(s=this._spec.subtextType)!==null&&s!==void 0?s:"text",subtext:(r=this._spec.subtext)!==null&&r!==void 0?r:"",x:(a=this._spec.x)!==null&&a!==void 0?a:0,y:(o=this._spec.y)!==null&&o!==void 0?o:0,width:d,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:(l=this._spec.align)!==null&&l!==void 0?l:"left",verticalAlign:(h=this._spec.verticalAlign)!==null&&h!==void 0?h:"top",textStyle:Object.assign({width:d},this._spec.textStyle),subtextStyle:Object.assign({width:d},this._spec.subtextStyle)})}_createOrUpdateTitleComponent(e){if(this._titleComponent)ft(e,this._cacheAttrs)||this._titleComponent.setAttributes(e);else{const t=this.getContainer(),i=new QR(e);i.name="title",t.add(i),this._titleComponent=i,i.on("*",(s,r)=>this._delegateEvent(i,s,r))}return this._cacheAttrs=e,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}Hg.type=X.title,Hg.specKey=X.title;const Gie=()=>{D.registerComponent(Hg.type,Hg)};class Gg extends gS{constructor(){super(...arguments),this.type=X.markArea,this.name=X.markArea,this.specKey="markArea",this.layoutZIndex=rt.MarkArea}static getSpecInfo(e){const t=e[this.specKey];if(fe(t))return;if(!W(t)&&t.visible!==!1)return[{spec:t,specPath:[this.specKey],type:X.markArea}];const i=[];return t.forEach((s,r)=>{s.visible!==!1&&i.push({spec:s,specIndex:r,specPath:[this.specKey,r],type:X.markArea})}),i}_createMarkerComponent(){var e,t,i,s;const r=(e=this._spec.label)!==null&&e!==void 0?e:{},a={zIndex:this.layoutZIndex,interactive:(t=this._spec.interactive)!==null&&t!==void 0&&t,points:[{x:0,y:0}],areaStyle:ve((i=this._spec.area)===null||i===void 0?void 0:i.style),clipInRange:(s=this._spec.clip)!==null&&s!==void 0&&s,label:pS(r)};return new VR(a)}_markerLayout(){var e,t,i,s,r;const a=this._spec,o=this._markerData,l=this._startRelativeSeries,h=this._endRelativeSeries,d=this._relativeSeries,u=P(a.x)&&P(a.x1),c=P(a.y)&&P(a.y1),f=u&&c,p=P(a.coordinates),g=P(a.positions),_=(e=a.autoRange)!==null&&e!==void 0&&e;let m=[],y=[];f?(y=zg(o,l,h,d,_),m=[{x:y[0][0].x,y:y[1][0].y},y[0][0],{x:y[1][0].x,y:y[0][0].y},y[1][0]]):u||c?(y=zg(o,l,h,d,_),m=[...y[0],y[1][1],y[1][0]]):p?m=uS(o,d,_,a.coordinatesOffset):g&&(m=cS(a.positions,d,a.regionRelative));const b=this._relativeSeries.getViewData().latestData,v=o?o.latestData[0]&&o.latestData[0].latestData?o.latestData[0].latestData:o.latestData:b;let x;if(a.clip||!((t=a.label)===null||t===void 0)&&t.confine){const{minX:S,maxX:A,minY:k,maxY:w}=fS([l.getRegion(),h.getRegion(),d.getRegion()]);x={x:S,y:k,width:A-S,height:w-k}}this._markerComponent&&this._markerComponent.setAttributes({points:m,label:Object.assign(Object.assign({},(i=this._markerComponent.attribute)===null||i===void 0?void 0:i.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(v,b):(r=(s=this._markerComponent.attribute)===null||s===void 0?void 0:s.label)===null||r===void 0?void 0:r.text}),limitRect:x,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_initDataView(){const e=this._spec,t=this._relativeSeries,i=P(e.x)&&P(e.x1),s=P(e.y)&&P(e.y1),r=i&&s,a=P(e.coordinates);if(!i&&!s&&!a)return null;let o;r?o=[this._processSpecXY(e.x,e.y),this._processSpecXY(e.x1,e.y1)]:i?o=[this._processSpecX(e.x),this._processSpecX(e.x1)]:s?o=[this._processSpecY(e.y),this._processSpecY(e.y1)]:a&&(o=this._processSpecCoo(e));const l=t.getViewData();Ae(this._option.dataSet,"markerAggregation",dS),Ae(this._option.dataSet,"markerFilter",_S);const h=new Ye(this._option.dataSet,{name:`${this.type}_${this.id}_data`});h.parse([l],{type:"dataview"}),h.transform({type:"markerAggregation",options:o}),o&&h.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),h.target.on("change",()=>{this._markerLayout()}),this._markerData=h}}Gg.type=X.markArea,Gg.specKey="markArea";const Wie=()=>{D.registerComponent(Gg.type,Gg)},JT=n=>{const e=Object.assign({},n);return ve(e)},Vie=n=>{const e=Object.assign({},n);return ve(e)},rf=n=>Object.assign(Object.assign({},n),{style:Object.assign({},ve(n.style))}),II=n=>{var e,t,i,s,r,a,o,l,h,d,u,c,f,p;const g=JT((t=(e=n==null?void 0:n.slider)===null||e===void 0?void 0:e.trackStyle)!==null&&t!==void 0?t:{}),_=JT((s=(i=n==null?void 0:n.slider)===null||i===void 0?void 0:i.railStyle)!==null&&s!==void 0?s:{}),m=Vie((a=(r=n==null?void 0:n.slider)===null||r===void 0?void 0:r.handlerStyle)!==null&&a!==void 0?a:{}),y=rf((l=(o=n==null?void 0:n.controller)===null||o===void 0?void 0:o.start)!==null&&l!==void 0?l:{}),b=rf((d=(h=n==null?void 0:n.controller)===null||h===void 0?void 0:h.pause)!==null&&d!==void 0?d:{}),v=rf((c=(u=n==null?void 0:n.controller)===null||u===void 0?void 0:u.backward)!==null&&c!==void 0?c:{}),x=rf((p=(f=n==null?void 0:n.controller)===null||f===void 0?void 0:f.forward)!==null&&p!==void 0?p:{});return Object.assign(Object.assign({},n),{direction:n.direction,interval:n.interval,visible:n.visible,orient:n.orient,slider:Object.assign(Object.assign({},n.slider),{trackStyle:g,railStyle:_,handlerStyle:m}),controller:Object.assign(Object.assign({},n.controller),{start:y,pause:b,backward:v,forward:x})})},Nie=(n,e)=>Object.assign(Object.assign({},II(n)),{data:e,type:"continuous"}),Uie=(n,e)=>Object.assign(Object.assign({},II(n)),{data:e,type:"discrete"}),Vh=n=>n==="left"||n==="right",Ly=n=>n==="top"||n==="bottom";class Wg extends an{constructor(){super(...arguments),this.layoutZIndex=rt.Player,this.layoutLevel=bs.Player,this.specKey="player",this.type=X.player,this._orient="bottom",this._getPlayerAttrs=()=>{var e,t;const i=this._spec.type,s={size:{width:this._width,height:this._height},dx:(e=this._spec.dx)!==null&&e!==void 0?e:0+this._dx,dy:(t=this._spec.dy)!==null&&t!==void 0?t:0+this._dy};return i==="discrete"?Object.assign(Object.assign(Object.assign({},Uie(this._spec,this._specs)),s),{disableTriggerEvent:this._option.disableTriggerEvent}):Object.assign(Object.assign(Object.assign({},Nie(this._spec,this._specs)),s),{disableTriggerEvent:this._option.disableTriggerEvent})},this._createOrUpdatePlayerComponent=()=>{const e=Object.assign({},this._getPlayerAttrs()),t=this.getContainer();this._playerComponent?ft(e,this._cacheAttrs)||(this._cacheAttrs=e,this._playerComponent.setAttributes(e),this._playerComponent._initAttributes(),this._playerComponent.render()):(e.type==="discrete"?this._playerComponent=new oY(e):this._playerComponent=new hY(e),this._cacheAttrs=e,this._playerComponent.name="player",t.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var e,t,i,s,r,a,o,l,h;return Math.max(...N((t=(e=this._spec.controller.start)===null||e===void 0?void 0:e.style)===null||t===void 0?void 0:t.size),...N((s=(i=this._spec.controller.pause)===null||i===void 0?void 0:i.style)===null||s===void 0?void 0:s.size),...N((a=(r=this._spec.controller.backward)===null||r===void 0?void 0:r.style)===null||a===void 0?void 0:a.size),...N((l=(o=this._spec.controller.forward)===null||o===void 0?void 0:o.style)===null||l===void 0?void 0:l.size),(h=Vh(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)!==null&&h!==void 0?h:10)},this._sliderExceededSize=()=>{var e,t,i,s,r,a,o,l,h;const d=(e=Vh(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)!==null&&e!==void 0?e:10,u=Math.max(...N((i=(t=this._spec.controller.start)===null||t===void 0?void 0:t.style)===null||i===void 0?void 0:i.size),...N((r=(s=this._spec.controller.pause)===null||s===void 0?void 0:s.style)===null||r===void 0?void 0:r.size),...N((o=(a=this._spec.controller.backward)===null||a===void 0?void 0:a.style)===null||o===void 0?void 0:o.size),...N((h=(l=this._spec.controller.forward)===null||l===void 0?void 0:l.style)===null||h===void 0?void 0:h.size));return d>=u?d-u:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(ye.rendered,()=>{var e;!((e=this._spec)===null||e===void 0)&&e.auto&&this._playerComponent.play()}),this._playerComponent.addEventListener(Pt.OnEnd,()=>{var e;this.event.emit(ye.playerEnd,{model:this}),this._alternate&&this._spec.type==="discrete"&&(this._direction=this._direction==="default"?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:this._direction==="reverse"?this._specs.length-2:1})),!((e=this._spec)===null||e===void 0)&&e.loop&&this._playerComponent.play()}),this._playerComponent.addEventListener(Pt.OnChange,e=>{const{index:t}=e.detail,i=this._specs[t];N(i.data).forEach(s=>{var r,a;(a=(r=this._option)===null||r===void 0?void 0:r.globalInstance)===null||a===void 0||a.updateData(s.id,s.values)}),this.event.emit(ye.playerChange,{model:this,value:{spec:i,index:t,specs:this._specs}})}),this._playerComponent.addEventListener(Pt.OnBackward,e=>{const{index:t}=e.detail,i=this._specs[t];this.event.emit(ye.playerBackward,{model:this,value:{spec:i,index:t,specs:this._specs}})}),this._playerComponent.addEventListener(Pt.OnForward,e=>{const{index:t}=e.detail,i=this._specs[t];this.event.emit(ye.playerForward,{model:this,value:{spec:i,index:t,specs:this._specs}})}),this._playerComponent.addEventListener(Pt.OnPlay,e=>{const{index:t}=e.detail,i=this._specs[t];this.event.emit(ye.playerPlay,{model:this,value:{spec:i,index:t,specs:this._specs}})}),this._playerComponent.addEventListener(Pt.OnPause,e=>{const{index:t}=e.detail,i=this._specs[t];this.event.emit(ye.playerPause,{model:this,value:{spec:i,index:t,specs:this._specs}})}))}}get orient(){return this._orient}set layoutOrient(e){this._orient=e}static getSpecInfo(e){const t=e[this.specKey];return C(t)||t.visible===!1?null:[{spec:t,specPath:[this.specKey],type:X.player}]}setAttrFromSpec(){var e,t,i,s,r,a,o;super.setAttrFromSpec(),this._orient=(e=this._spec.orient)!==null&&e!==void 0?e:"bottom",this._specs=(t=this._spec.specs)!==null&&t!==void 0?t:[],this._direction=(i=this._spec.direction)!==null&&i!==void 0?i:"default",this._alternate=(s=this._spec.alternate)!==null&&s!==void 0&&s,this._dx=(r=this._spec.dx)!==null&&r!==void 0?r:0,this._dy=(a=this._spec.dy)!==null&&a!==void 0?a:0,this._position=(o=this._spec.position)!==null&&o!==void 0?o:"middle"}afterSetLayoutStartPoint(e){if(super.afterSetLayoutStartPoint(e),j(e.x)){const t=Vh(this._orient)?e.x+this._sliderExceededSize()/2:e.x;this._playerComponent&&this._playerComponent.setAttribute("x",t)}if(j(e.y)){const t=Ly(this._orient)?e.y+this._sliderExceededSize()/2:e.y;this._playerComponent&&this._playerComponent.setAttribute("y",t)}}getBoundsInRect(e,t){this._width=this._computeWidth(e),this._height=this._computeHeight(e),this._dx=this._computeDx(t),this._dy=this._computeDy(t);const i=this._computeLayoutRect(e,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(e){}onRender(e){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(e,t,i){switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:t,y2:i};case"right":return{x1:e.width-t,y1:0,x2:e.width,y2:e.height};default:return{x1:0,y1:e.height-i,x2:e.width,y2:e.height}}}_computeWidth(e){return oe(this._spec.width)?Math.min(e.width,Number(this._spec.width)):Vh(this._orient)?this._maxSize():e.width}_computeHeight(e){return oe(this._spec.height)?(this._height=this._spec.height,Math.min(e.height,Number(this._spec.height))):Ly(this._orient)?this._maxSize():e.height}_computeDx(e){return Vh(this._orient)||this._position==="start"?0:this._position==="middle"?(e.width-this._width)/2:e.width-this._width}_computeDy(e){return Ly(this._orient)||this._position==="start"?0:this._position==="middle"?(e.height-this._height)/2:e.height-this._height}}Wg.specKey="player",Wg.type=X.player;const $ie=()=>{D.registerComponent(Wg.type,Wg)},QT={rect:eC,symbol:DI,arc:tC,point:Zie,"line-data":Xie,stackLabel:Jie,line:iC,area:iC,rect3d:eC,arc3d:tC,treemap:Qie};function Yie(n,e){var t;const{labelSpec:i}=e;return i.overlap&&!He(i.overlap)&&(i.overlap={}),((t=QT[n])!==null&&t!==void 0?t:QT.point)(e)}function Sm(n,e,t,i){var s;const{labelMark:r,series:a}=n,o={text:e[a.getMeasureField()[0]],data:e,textType:(s=n.labelSpec.textType)!==null&&s!==void 0?s:"text"},l=Object.keys(r.stateStyle.normal);for(const h of l){const d=r.getAttribute(h,e);o[h]=d}return t&&(o.text=t(o.text,e,{series:a})),i&&(a.type==="pie"?e._percent_=(100*e[aR]).toFixed(2)+"%":e[ka]&&(e._percent_=(100*e[ka]).toFixed(2)+"%"),o.text=_D(i,e)),o}function mS(n){return Y(n)?e=>n(e.data):n}function DI(n){var e,t,i;const{series:s,labelSpec:r}=n,a=s.direction==="horizontal"?"right":"top",o=(e=mS(r.position))!==null&&e!==void 0?e:a;let l;return l=r.overlap!==!1&&{strategy:(i=(t=r.overlap)===null||t===void 0?void 0:t.strategy)!==null&&i!==void 0?i:Kie(),avoidBaseMark:o!=="center"},{position:o,overlap:l}}function Xie(n){const e=DI(n);return ht(e.overlap)||(e.overlap.avoidBaseMark=!1),e}function Kie(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function eC(n){var e,t,i,s,r,a;const{series:o,labelSpec:l={}}=n,h=(e=mS(l.position))!==null&&e!==void 0?e:"outside",d=(t=o.direction)!==null&&t!==void 0?t:"vertical",u=o.direction==="horizontal"?(i=o.getXAxisHelper())===null||i===void 0?void 0:i.isInverse():(s=o.getYAxisHelper())===null||s===void 0?void 0:s.isInverse();let c,f=h;ae(h)&&f!=="inside"&&(f=g=>{const{data:_}=g,m=o.getMeasureField()[0];if(h==="outside"){const y={vertical:["top","bottom"],horizontal:["right","left"]},b=(_==null?void 0:_[m])>=0&&u||(_==null?void 0:_[m])<0&&!u?1:0;return y[d][b]}return h==="inside-bottom"?o.direction==="horizontal"?"inside-left":"inside-bottom":h==="inside-top"?o.direction==="horizontal"?"inside-right":"inside-top":h}),c=l.overlap!==!1&&{strategy:(a=(r=l.overlap)===null||r===void 0?void 0:r.strategy)!==null&&a!==void 0?a:qie(o)};let p=!1;return ae(h)&&h.includes("inside")&&(p=!0),{position:f,overlap:c,smartInvert:p}}function qie(n){return[{type:"position",position:e=>{var t,i;const{data:s}=e,r=n.getMeasureField()[0];return(n.direction==="horizontal"?!((t=n.getXAxisHelper())===null||t===void 0)&&t.isInverse():!((i=n.getYAxisHelper())===null||i===void 0)&&i.isInverse())?(s==null?void 0:s[r])>=0?n.direction==="horizontal"?["left","inside-left"]:["bottom","inside-bottom"]:n.direction==="horizontal"?["right","inside-right"]:["top","inside-top"]:(s==null?void 0:s[r])>=0?n.direction==="horizontal"?["right","inside-right"]:["top","inside-top"]:n.direction==="horizontal"?["left","inside-left"]:["bottom","inside-bottom"]}}]}function Zie(n){const{labelSpec:e}=n;let t;return t=e.overlap!==!1&&{avoidBaseMark:!1},{position:"center",overlap:t}}function tC(n){var e;const{labelSpec:t}=n,i=(e=mS(t.position))!==null&&e!==void 0?e:"outside",s=i;let r;return r=t.smartInvert?t.smartInvert:ae(i)&&i.includes("inside"),{position:s,smartInvert:r}}function Jie(n){const e=n.series,t=n.labelSpec||{},i=e.getTotalData();return{customLayoutFunc:s=>s.map(r=>{const a=t.position||"withChange",o=t.offset||0,l=r.data,h=Sm(n,l,t.formatMethod);return h.x=(d=>e.direction==="vertical"?e.totalPositionX(d,"index",.5):a==="middle"?.5*(e.totalPositionX(d,"end")+e.totalPositionY(d,"start")):a==="max"?e.totalPositionX(d,d.end>=d.start?"end":"start")+o:a==="min"?e.totalPositionX(d,d.end>=d.start?"start":"end")-o:e.totalPositionX(d,"end")+(d.end>=d.start?o:-o))(l),h.y=(d=>e.direction==="vertical"?a==="middle"?.5*(e.totalPositionY(d,"end")+e.totalPositionY(d,"start")):a==="max"?e.totalPositionY(d,d.end>=d.start?"end":"start")-o:a==="min"?e.totalPositionY(d,d.end>=d.start?"start":"end")+o:e.totalPositionY(d,"end")+(d.end>=d.start?-o:o):e.totalPositionY(d,"index",.5))(l),e.direction==="vertical"?h.textBaseline=a==="middle"?a:a==="withChange"&&l.end-l.start>=0||a==="max"?"bottom":"top":h.textAlign=a==="middle"?"center":a==="withChange"&&l.end-l.start>=0||a==="max"?"left":"right",no(Object.assign(Object.assign({},h),{id:r.id}))}),dataFilter:s=>{const r=[];return i.forEach(a=>{const o=s.find(l=>{var h;return a.index===((h=l.data)===null||h===void 0?void 0:h[e.getDimensionField()[0]])});o&&(o.data=a,r.push(o))}),r},overlap:{strategy:[]}}}function Qie(n){const e=n.labelSpec;return{customLayoutFunc:t=>t.map(i=>{const s=i.data,r=Sm(n,s,e.formatMethod);return no(Object.assign(Object.assign({},r),{id:i.id,pickable:!1}))}),overlap:!1}}function iC(n){var e,t,i,s;const{labelSpec:r,series:a}=n,o=(i=(t=(e=a.getViewDataStatistics)===null||e===void 0?void 0:e.call(a).latestData)===null||t===void 0?void 0:t[a.getSeriesField()])===null||i===void 0?void 0:i.values,l=o?o.map((h,d)=>({[a.getSeriesField()]:h,index:d})):[];return{position:(s=r.position)!==null&&s!==void 0?s:"end",data:l}}class yS extends an{constructor(e,t){super(e,t),this.type=X.label,this.name=X.label,this.layoutType="none",this.layoutZIndex=rt.Label,this._regions=t.getRegionsInIndex([t.specIndex])}_interactiveConfig(e){const{interactive:t}=e;if(t!==!0)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:e.state},{hover:s,select:r}=this._option.getChart().getSpec();return s===!1&&s.enable===!1||(i.hover=!0),r===!1&&r.enable===!1||(i.select=!0),i}_compareSpec(e,t){const i=super._compareSpec(e,t);return i.reRender=!0,ft(t,e)||(i.reMake=!0),i}onRender(e){}changeRegions(e){}_getNeedClearVRenderComponents(){return[]}}yS.type=X.label;class Vg extends dh{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(e){this._rule=e}getTarget(){return this._target}setTarget(e){this._target=e,this._rule||this.setRule(e.type)}getComponent(){return this._component}setComponent(e){this._component=e}}Vg.type="text",Vg.constructorType="label";const FI=()=>{D.registerMark(Vg.constructorType,Vg),_O()};class zI extends sc{_initTheme(e,t){return{spec:e,theme:this._theme}}}class Id extends yS{constructor(e,t){super(e,t),this.type=X.label,this.name=X.label,this.specKey="label",this.transformerConstructor=zI,this.layoutZIndex=rt.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(e,t){const i=[];return((t==null?void 0:t.region)||[]).forEach((r,a)=>{const o=(r.seriesIndexes||[]).some(l=>{const h=t.series[l],{markLabelSpec:d={}}=h;return Object.values(d).some(u=>Array.isArray(u)&&(c=>c.some(f=>f.visible))(u))});(e.labelLayout!=="region"||o)&&i.push({spec:e,type:X.label,specInfoPath:["region",a,"markLabel"],specIndex:a})}),i}init(e){super.init(e),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(e){super.reInit(e),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(ye.dataZoomChange,()=>{this._labelComponentMap.forEach((t,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&s.disableAnimation()}),this.event.on(de.AFTER_MARK_RENDER_END,e)});const e=()=>{this._labelComponentMap.forEach((t,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&s.enableAnimation()}),this.event.off(de.AFTER_MARK_RENDER_END,e)};this.event.on("afterElementEncode",t=>{var i;const s=t.item;this._option.getChart().getLayoutTag()===!1&&((i=s.getContext())===null||i===void 0?void 0:i.model)===this&&this._delegateLabelEvent(s.getGroupGraphicItem())})}_delegateLabelEvent(e){const t=e==null?void 0:e.findAll(i=>i.type==="text",!0).filter(i=>!i.__vchart_event);t&&t.length>0&&t.forEach(i=>{i.__vchart_event=!0,i.addEventListener("*",(s,r)=>this._delegateEvent(e,s,r,i,i.attribute.data))})}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),xt(this._regions,e=>{const{markLabelSpec:t={}}=e.getSpecInfo(),i=Object.keys(t),s=e.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let r=0;r<i.length;r++){const a=i[r],o=e.getMarkInName(a);o&&t[a].forEach((l,h)=>{if(l.visible){const d=this._labelInfoMap.get(s),u=this._createMark({type:"label",name:`${a}-label-${h}`},{noSeparateStyle:!0,attributeContext:e.getMarkAttributeContext()});u.setTarget(o),d.push({labelMark:u,baseMark:o,series:e,labelSpec:l})}})}})}_initLabelComponent(){this._labelInfoMap.forEach((e,t)=>{if(this._layoutRule==="region"){const i=this._createMark({type:"component",name:`${t.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});i&&(i.setSkipBeforeLayouted(!0),this._marks.addMark(i),this._labelComponentMap.set(i,()=>this._labelInfoMap.get(t)))}else e.forEach((i,s)=>{const r=this._createMark({type:"component",name:`${i.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0,support3d:i.baseMark.getSupport3d()});r&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),this._labelComponentMap.set(r,()=>this._labelInfoMap.get(t)[s]),i.labelMark.setComponent(r))})})}_initTextMarkStyle(){this._labelInfoMap.forEach(e=>{e.forEach(t=>{var i,s;const{labelMark:r,labelSpec:a,series:o}=t;if(this.initMarkStyleWithSpec(r,a,void 0),Y(a==null?void 0:a.getStyleHandler)){const l=a.getStyleHandler(o);l==null||l.call(o,r)}!((s=(i=r.stateStyle)===null||i===void 0?void 0:i.normal)===null||s===void 0)&&s.lineWidth&&r.setAttribute("stroke",o.getColorAttribute(),"normal",J.Base_Series)})})}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((e,t)=>{const i=e();W(i)?this._updateMultiLabelAttribute(i,t):this._updateSingleLabelAttribute(i,t)})}_updateMultiLabelAttribute(e,t){this._updateLabelComponentAttribute(t.getProduct(),e.map(({baseMark:i})=>i.getProduct()),e)}_updateSingleLabelAttribute(e,t){const{baseMark:i}=e;this._updateLabelComponentAttribute(t.getProduct(),i.getProduct(),[e])}_updateLabelComponentAttribute(e,t,i){const s=this._option.getAllComponents().filter(r=>r.type==="totalLabel");e.target(t).configure({interactive:!1}).depend(s.map(r=>r.getMarks()[0].getProduct())).labelStyle((r,a)=>{var o,l;const h=i[a.labelIndex];if(h){const{labelSpec:d,labelMark:u}=h,c=u.getRule(),f=this._interactiveConfig(d),p=(l=(o=this._spec)===null||o===void 0?void 0:o.centerOffset)!==null&&l!==void 0?l:0,g=pe({textStyle:Object.assign({pickable:d.interactive===!0},d.style),overlap:{avoidMarks:this._option.getAllComponents().filter(_=>_.type==="totalLabel").map(_=>_.getMarks()[0].getProductId())},x:0,y:0},Yie(c,h),Object.assign(Object.assign(Object.assign({},Nl(d,["position","style","state","type"])),f),{centerOffset:p}));return c!=="line"&&c!=="area"||(g.type=c),g}}).encode((r,a,o)=>{if(i[o.labelIndex]){const{labelSpec:l,labelMark:h}=i[o.labelIndex];return h.skipEncode?{data:r}:Sm(i[o.labelIndex],r,l.formatMethod,l.formatter)}}).size(()=>i[0].series.getRegion().getLayoutRect())}compileMarks(){this.getMarks().forEach(e=>{var t;const i=this._labelComponentMap.get(e)();let s;s=W(i)?i[0].series.getRegion().getGroupMark().getProduct():i.series.getRegion().getGroupMark().getProduct(),e.compile({group:s}),(t=e.getProduct())===null||t===void 0||t.configure({context:{model:this,labelInfo:i}})})}getVRenderComponents(){const e=[];return this._labelComponentMap.forEach((t,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&e.push(s)}),e}}Id.type=X.label,Id.specKey="label",Id.transformerConstructor=zI;const ene=()=>{wO(),FI(),rS(),D.registerComponent(Id.type,Id,!0)};class Ng extends yS{constructor(){super(...arguments),this.type=X.totalLabel,this.name=X.totalLabel,this.specKey="totalLabel",this.layoutZIndex=rt.Label}static getSpecInfo(e,t){var i;const s=[];return(i=t==null?void 0:t.region)===null||i===void 0||i.forEach((r,a)=>{var o;(o=r.seriesIndexes)===null||o===void 0||o.forEach(l=>{const{spec:h}=t.series[l],d=h[this.specKey];d!=null&&d.visible&&s.push({spec:d,type:X.totalLabel,specPath:["series",l,this.specKey],specIndex:a})})}),s}init(e){super.init(e),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var e;const t=this._getSeries();if(!((e=t.getSpec().totalLabel)===null||e===void 0)&&e.visible){const i=t.getMarksInType(["rect","symbol"])[0],s=this._createMark({type:"label",name:`${i.name}-total-label`});this._baseMark=i,this._textMark=s,this._initTextMarkStyle()}}_initTextMarkStyle(){super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:e=>e[FO]},"normal",J.Default)}_initLabelComponent(){const e=this._getSeries(),t=this._createMark({type:"component",name:`${e.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});t&&this._marks.addMark(t)}updateLayoutAttribute(){super.updateLayoutAttribute();const e=this._getSeries();this._marks.forEach((t,i)=>{t.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle(()=>{if(this._baseMark){const{offset:s,animation:r,overlap:a}=this._spec,o=this._interactiveConfig(this._spec);return pe({textStyle:{pickable:this._spec.interactive===!0},position:tne(e,this._baseMark.type),x:0,y:0},Object.assign({offset:s,animation:r,overlap:a,dataFilter:l=>l.filter(h=>h.data[Wv])},o))}}).encode(s=>Sm({baseMark:this._baseMark,labelMark:this._textMark,series:e,labelSpec:e.getSpec().totalLabel},s,this._spec.formatMethod)).size(()=>this._regions[0].getLayoutRect())})}compileMarks(){this.getMarks().forEach(e=>{var t;const i=this._regions[0].getGroupMark().getProduct();e.compile({group:i}),(t=e.getProduct())===null||t===void 0||t.configure({context:{model:this}})})}getVRenderComponents(){const e=[];return this.getMarks().forEach(t=>{const i=t.getProduct().getGroupGraphicItem();i&&e.push(i)}),e}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}Ng.type=X.totalLabel,Ng.specKey="totalLabel";function tne(n,e){let t;return e==="rect"?t=n.direction==="horizontal"?"right":"top":t="top",t}const ine=()=>{wO(),FI(),rS(),D.registerComponent(Ng.type,Ng,!0)};var nC=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};class Ug extends gS{constructor(){super(...arguments),this.type=X.markPoint,this.name=X.markPoint,this.specKey="markPoint",this.layoutZIndex=rt.MarkPoint}static getSpecInfo(e){const t=e[this.specKey];if(fe(t))return;if(!W(t)&&t.visible!==!1)return[{spec:t,specPath:[this.specKey],type:X.markPoint}];const i=[];return t.forEach((s,r)=>{s.visible!==!1&&i.push({spec:s,specIndex:r,specPath:[this.specKey,r],type:X.markPoint})}),i}_createMarkerComponent(){var e,t;const{itemContent:i={},itemLine:s={}}=this._spec,{text:r={},symbol:a,image:o,richText:l}=i,h=nC(i,["text","symbol","image","richText"]),d={zIndex:this.layoutZIndex,interactive:(e=this._spec.interactive)!==null&&e!==void 0&&e,position:{x:0,y:0},clipInRange:(t=this._spec.clip)!==null&&t!==void 0&&t,itemContent:Object.assign({symbolStyle:ve(a==null?void 0:a.style),imageStyle:o==null?void 0:o.style,textStyle:pS(r),richTextStyle:l==null?void 0:l.style},h)},{visible:u,line:c={}}=s,f=nC(s,["visible","line"]);return d.itemLine=u!==!1?Object.assign(Object.assign({},f),{visible:!0,lineStyle:ve(c.style)}):{visible:!1},new y0(d)}_markerLayout(){var e,t,i,s,r,a;const o=this._spec,l=this._markerData,h=this._relativeSeries,d="x"in o&&"y"in o,u="coordinate"in o,c="position"in o,f=(e=o==null?void 0:o.autoRange)!==null&&e!==void 0&&e;let p;d?p=zg(l,h,h,h,f)[0][0]:u?p=uS(l,h,f,o.coordinatesOffset)[0]:c&&(p=cS([o.position],h,o.regionRelative)[0]);const g=this._relativeSeries.getViewData().latestData,_=l?l.latestData[0]&&l.latestData[0].latestData?l.latestData[0].latestData:l.latestData:g;let m;if(o.clip||!((t=o.itemContent)===null||t===void 0)&&t.confine){const{minX:y,maxX:b,minY:v,maxY:x}=fS([h.getRegion()]);m={x:y,y:v,width:b-y,height:x-v}}if(this._markerComponent){const y=(i=this._markerComponent.attribute)!==null&&i!==void 0?i:{},b=(r=(s=y.itemContent)===null||s===void 0?void 0:s.textStyle)!==null&&r!==void 0?r:{};this._markerComponent.setAttributes({position:p,itemContent:Object.assign(Object.assign({},y.itemContent),{textStyle:Object.assign(Object.assign({},b),{text:!((a=this._spec.itemContent.text)===null||a===void 0)&&a.formatMethod?this._spec.itemContent.text.formatMethod(_,g):b.text})}),limitRect:m,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const e=this._spec,t=this._relativeSeries,i=P(e.x)&&P(e.y),s=P(e.coordinate);if(!s&&!i)return;let r;Ae(this._option.dataSet,"markerAggregation",dS),Ae(this._option.dataSet,"markerFilter",_S),i?r=[this._processSpecXY(e.x,e.y)]:s&&(r=this._processSpecCoo(e));const a=new Ye(this._option.dataSet,{name:`${this.type}_${this.id}_data`});a.parse([t.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),r&&a.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),a.target.on("change",()=>{this._markerLayout()}),this._markerData=a}}Ug.type=X.markPoint,Ug.specKey="markPoint";const nne=()=>{D.registerComponent(Ug.type,Ug)};class $g extends an{constructor(){super(...arguments),this.layoutType="none",this.type=X.brush,this.name=X.brush,this.specKey="brush",this.layoutZIndex=rt.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),t=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach(i=>{i.getActiveMarks().forEach(s=>{s&&(i.setMarkStyle(s,Object.assign({},e),"inBrush",J.Series),i.setMarkStyle(s,Object.assign({},t),"outOfBrush",J.Series))})})}static getSpecInfo(e){const t=e[this.specKey];if(!C(t)&&t.visible!==!1)return[{spec:t,specPath:[this.specKey],type:X.brush}]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(e){const t=[];for(const i in e)for(const s in e[i])t.push(e[i][s].data[0]);return t}_extendDatumOutOfBrush(e){const t=[];for(const i in e)t.push(e[i].data[0]);return t}_getBrushInteractiveAttr(e){const t=e.getLayoutStartPoint(),i=e.getLayoutRect(),s=t.x,r=s+i.width,a=t.y,o=a+i.height;return{interactiveRange:{minY:a,maxY:o,minX:s,maxX:r},xRange:[s,r],yRange:[a,o]}}_updateBrushComponent(e,t){const i=this._getBrushInteractiveAttr(e),s=this._brushComponents[t];s.setAttributes(i),this._initMarkBrushState(t,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(e,t){var i,s;const r=this._getBrushInteractiveAttr(e),a=new iO(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:ve((i=this._spec)===null||i===void 0?void 0:i.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=(s=this._spec.id)!==null&&s!==void 0?s:`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single"}=this._spec;this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(zi.drawStart,l=>{this._emitEvent(ye.brushStart,e)}),a.addEventListener(zi.moveStart,l=>{this._emitEvent(ye.brushStart,e)}),a.addEventListener(zi.drawing,l=>{this._needInitOutState&&o==="single"&&this._initMarkBrushState(t,"outOfBrush"),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(ye.brushChange,e,l)}),a.addEventListener(zi.moving,l=>{this._handleBrushChange(ye.brushChange,e,l)}),a.addEventListener(zi.brushClear,l=>{this._initMarkBrushState(t,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(ye.brushChange,e,l),this._handleBrushChange(ye.brushClear,e,l)}),a.addEventListener(zi.drawEnd,l=>{this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(ye.brushEnd,e,l)}),a.addEventListener(zi.moveEnd,l=>{this._handleBrushChange(ye.brushEnd,e,l)})}_handleBrushChange(e,t,i){const{operateMask:s}=i.detail;this._reconfigItem(s,t),this._reconfigLinkedItem(s,t),this._emitEvent(e,t)}_emitEvent(e,t){this.event.emit(e,{model:this,value:{operateType:e,operateRegion:t,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap}})}_transformBrushedMarkAttr(e){const t={};return e!=null&&e.symbol&&(t.symbolType=e.symbol),e!=null&&e.symbolSize&&(t.size=e.symbolSize),e!=null&&e.color&&(t.fill=e.color),e!=null&&e.colorAlpha&&(t.fillOpacity=e.colorAlpha),Object.assign(Object.assign({},ve(e)),t)}_reconfigItem(e,t){this._itemMap[t.id].forEach(i=>{const s=i.getProduct();!s||!s.elements||!s.elements.length||s.elements.forEach(r=>{var a,o,l;const h=r.getGraphicItem(),d=i.id+"_"+r.key;!((a=this._outOfBrushElementsMap)===null||a===void 0)&&a[d]&&this._isBrushContainItem(e,h)?(r.addState("inBrush"),this._inBrushElementsMap[e==null?void 0:e.name]||(this._inBrushElementsMap[e==null?void 0:e.name]={}),this._inBrushElementsMap[e==null?void 0:e.name][d]=r,delete this._outOfBrushElementsMap[d]):!((l=(o=this._inBrushElementsMap)===null||o===void 0?void 0:o[e==null?void 0:e.name])===null||l===void 0)&&l[d]&&!this._isBrushContainItem(e,h)&&(r.removeState("inBrush"),r.addState("outOfBrush"),this._outOfBrushElementsMap[d]=r,delete this._inBrushElementsMap[e.name][d]),h.setAttribute("pickable",!this._needDisablePickable)})})}_reconfigLinkedItem(e,t){const i=t.getLayoutStartPoint(),s=t.getSeries().map(r=>r.id);this._linkedSeries.forEach(r=>{if(!s.includes(r.id)){const a=r.getRegion().getLayoutStartPoint(),o=a.x-i.x,l=a.y-i.y;this._linkedItemMap[r.id].forEach(h=>{const d=h.getProduct();!d||!d.elements||!d.elements.length||d.elements.forEach(u=>{var c,f,p;const g=u.getGraphicItem(),_=h.id+"_"+u.key;!((c=this._linkedOutOfBrushElementsMap)===null||c===void 0)&&c[_]&&this._isBrushContainItem(e,g,{dx:o,dy:l})?(u.addState("inBrush"),this._linkedInBrushElementsMap[e==null?void 0:e.name]||(this._linkedInBrushElementsMap[e==null?void 0:e.name]={}),this._linkedInBrushElementsMap[e==null?void 0:e.name][_]=u,delete this._linkedOutOfBrushElementsMap[_]):!((p=(f=this._linkedInBrushElementsMap)===null||f===void 0?void 0:f[e==null?void 0:e.name])===null||p===void 0)&&p[_]&&!this._isBrushContainItem(e,g,{dx:o,dy:l})&&(u.removeState("inBrush"),u.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[_]=u),g.setAttribute("pickable",!this._needDisablePickable)})})}})}_isBrushContainItem(e,t,i){var s,r,a;if(!(e!=null&&e.globalTransMatrix)||!(!((s=e==null?void 0:e.attribute)===null||s===void 0)&&s.points))return!1;const o=(a=(r=e==null?void 0:e.attribute)===null||r===void 0?void 0:r.points)!==null&&a!==void 0?a:[],{a:l,b:h,c:d,d:u,e:c,f}=e.globalTransMatrix,p=(i==null?void 0:i.dx)||0,g=(i==null?void 0:i.dy)||0,_=o.map(v=>({x:l*v.x+d*v.y+c+p,y:h*v.x+u*v.y+f+g}));e.globalAABBBounds.clone().set(e.globalAABBBounds.x1+p,e.globalAABBBounds.y1+g,e.globalAABBBounds.x2+p,e.globalAABBBounds.y2+g);const m=t.globalTransMatrix.e,y=t.globalTransMatrix.f;let b=[];if(t.type==="symbol"){const{size:v=0}=t==null?void 0:t.attribute,x=N(v)[0]/2;return b=[{x:m-x,y:y-x},{x:m+x,y:y-x},{x:m+x,y:y+x},{x:m-x,y:y+x}],ES(_,b)}if(t.type==="rect"){const{x1:v,x2:x,y1:S,y2:A}=t==null?void 0:t.AABBBounds,k=Math.abs(v-x),w=Math.abs(S-A);return b=[{x:m,y},{x:m+k,y},{x:m+k,y:y+w},{x:m,y:y+w}],ES(_,b)}return e.globalAABBBounds.intersects(t.globalAABBBounds)}_bindRegions(){P(this._spec.regionId)&&P(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}_bindLinkedSeries(){P(this._spec.brushLinkSeriesId)&&P(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(N(this._spec.brushLinkSeriesId),N(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const e=this._spec.seriesId,t=this._spec.seriesIndex;this._relativeRegions.forEach(i=>{const s=[];i.getSeries().forEach(r=>{(e&&N(e).includes(r.userId.toString())||t&&N(t).includes(r.getSpecIndex())||!t&&!e)&&s.push(...r.getMarksWithoutRoot()),this._itemMap[i.id]=s})}),this._linkedSeries.forEach(i=>{this._linkedItemMap[i.id]=i.getMarksWithoutRoot()})}_initMarkBrushState(e,t){this._brushComponents.forEach((i,s)=>{s!==e&&i.children[0].removeAllChild()}),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach(i=>{i.getMarksWithoutRoot().forEach(s=>{const r=s.getProduct();!r||!r.elements||!r.elements.length||r.elements.forEach(a=>{const o=s.id+"_"+a.key;a.removeState("inBrush"),a.removeState("outOfBrush"),a.addState(t),this._outOfBrushElementsMap[o]=a,this._linkedOutOfBrushElementsMap[o]=a})})})}initEvent(){}onRender(e){}changeRegions(e){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(e,t){this._brushComponents&&this._relativeRegions.forEach((s,r)=>{this._updateBrushComponent(s,r)});const i=super._compareSpec(e,t);return ft(t,e)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(e){var t;super.onLayoutEnd(e),!this._option.disableTriggerEvent&&((t=this._spec.visible)===null||t===void 0||t)&&(this._brushComponents?this._relativeRegions.forEach((i,s)=>{this._updateBrushComponent(i,s)}):(this._brushComponents=[],this._relativeRegions.forEach((i,s)=>{this._createBrushComponent(i,s)})))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach(e=>{e._container.incrementalClearChild()})}clear(){var e;this._brushComponents&&((e=this.getContainer())===null||e===void 0||e.removeChild(this._brushComponents),this._brushComponents.forEach(t=>{t.removeAllChild(),t.releaseBrushEvents()}),this._brushComponents=null),super.clear()}}$g.type=X.brush,$g.specKey="brush";const sne=()=>{D.registerComponent($g.type,$g)};class Iu extends Ti{constructor(){super(...arguments),this.type=Iu.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}Iu.type="image";const rne=()=>{D.registerMark(Iu.type,Iu),$8()};class Yg extends an{constructor(){super(...arguments),this.type=X.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=rt.CustomMark,this.layoutLevel=bs.CustomMark}static getSpecInfo(e){const t=e[this.specKey];return t?[{spec:t,specIndex:0,specPath:[this.specKey],type:X.customMark}]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach((e,t)=>{this._createExtensionMark(e,null,`${be}_series_${this.id}_extensionMark`,t)})}_createExtensionMark(e,t,i,s){var r;const a=this._createMark({type:e.type,name:`${be}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext()});if(a&&(C(t)?this._marks.addMark(a):t&&t.addMark(a),this.initMarkStyleWithSpec(a,e),e.type==="group"&&(i=`${i}_${s}`,(r=e.children)===null||r===void 0||r.forEach((o,l)=>{this._createExtensionMark(o,a,i,l)})),P(e.dataId)||j(e.dataIndex))){const o=this.getChart().getSeriesData(e.dataId,e.dataIndex);o&&(o.target.addListener("change",()=>{a.getData().updateData()}),a.setDataView(o))}}initEvent(){}_compareSpec(e,t){const i=super._compareSpec(e,t);return ft(t,e)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(e){}_getNeedClearVRenderComponents(){return[]}onRender(e){}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,globalScale:(e,t)=>{var i;return(i=this._option.globalScale.getScale(e))===null||i===void 0?void 0:i.scale(t)}}}}Yg.type=X.customMark,Yg.specKey="customMark";const ane=()=>{rne(),D.registerComponent(Yg.type,Yg)};function sC(n,e,t=0){return t>Math.max(e.x1-n.x2,n.x1-e.x2,e.y1-n.y2,n.y1-e.y2)}function one(n){return{x1:n.x,x2:n.x+n.width,y1:n.y,y2:n.y+n.height}}function lne(n){return{x:n.x1,y:n.y1,width:n.x2-n.x1,height:n.y2-n.y1}}function jI(n){var e;if(!n||n.length===0)return[];if(n.length===1)return[n[0].rect];const t=n.map(s=>{var r;return Object.assign(Object.assign({},s),{bound:one(s.rect),anchorCandidates:une((r=s.anchors)!==null&&r!==void 0?r:[],s.point,s.rect,s.offset)})}),i=[];i.push(t[0].bound);for(let s=1;s<=t.length-1;s++){const r=t[s],a=r.bound;let o=i.some(l=>sC(l,a));if(r.anchorCandidates)if(o&&((e=r.anchorCandidates)===null||e===void 0?void 0:e.length)>0){for(let l=0;l<r.anchorCandidates.length;l++){const h=r.anchorCandidates[l],d={x1:h.x,y1:h.y,x2:h.x+a.x2-a.x1,y2:h.y+a.y2-a.y1,anchor:h};if(!i.some(u=>sC(u,d))){i.push(d),o=!1;break}}o&&i.push(r.bound)}else i.push(r.bound)}return i.map(s=>lne(s))}function hne(n,e,t){const i=n.map(h=>h.pointCoord),{x1:s,x2:r,y1:a,y2:o}=PD(i),l=t([(s+r)/2,(a+o)/2]);return l?jI(n.map(h=>{const d=h.rect,u=HI(e,h.pointCoord)?t(dne(e,[h.pointCoord.x,h.pointCoord.y],rC(aC(h.point,l)))):h.point;u&&(d.x=u.x,d.y=u.y);const c=rC(aC(h.point,l));let f;const p=[];return c>=-45&&c<45?(f="top",p.push("left","right")):c>=45&&c<135?f="right":c>=-135&&c<-45?(f="left",p.push("left")):(f="bottom",p.push("left","right")),h.anchors=p,h.offset=20,h.rect=bS(h.rect,f,0),h})):[]}function rC(n){return n>180?n-360:n}function aC(n,e){return 180*Math.atan2(n.y-e.y,n.x-e.x)/Math.PI+90}function dne(n,e,t,i=200){const s=5621/i;let r=e;for(let a=1;a<=s;a++){const o=GD(r,i,t);if(!HI(n,o))return[o.x,o.y];r=[o.x,o.y]}return e}function HI(n,e){for(let t=0;t<n.length;t++)if(HD(e,n[t]))return!0;return!1}function bS(n,e,t=0){const i=Object.assign({},n);return e==="top"?(i.x-=n.width/2,i.y-=t+n.height/2):e==="bottom"?(i.x-=n.width/2,i.y+=t-n.height/2):e==="left"?(i.x-=t+n.width,i.y-=n.height/2):e==="right"&&(i.x+=t,i.y-=n.height/2),i}function une(n,e,t,i=0){const s=[];return n.forEach(r=>{const{x:a,y:o}=bS(Object.assign(Object.assign({},e),{width:t.width,height:t.height}),r,i);s.push({x:a,y:o})}),s}class Xg extends an{constructor(){super(...arguments),this.type=X.mapLabel,this.name=X.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=rt.MarkPoint,this._activeDatum=[]}static getSpecInfo(e){const t=e[this.specKey];return t&&t.visible&&!P(t.series)?[{spec:t,specPath:[this.specKey],type:X.mapLabel}]:null}setAttrFromSpec(){var e,t,i,s;this.nameField=(e=this._spec.nameField)!==null&&e!==void 0?e:(t=this._series)===null||t===void 0?void 0:t.getDimensionField()[0],this.valueField=(i=this._spec.valueField)!==null&&i!==void 0?i:(s=this._series)===null||s===void 0?void 0:s.getMeasureField()[0]}created(){super.created(),this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var e,t,i,s,r,a,o,l;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],this._spec.position==="outer"&&(this._map=(t=(e=this._regions[0].getSeriesInType("map")[0])===null||e===void 0?void 0:e.getMapViewData())===null||t===void 0?void 0:t.latestData,this._longitudeField=(r=(s=(i=this._regions[0]).getSpec)===null||s===void 0?void 0:s.call(i))===null||r===void 0?void 0:r.longitudeField,this._latitudeField=(l=(o=(a=this._regions[0]).getSpec)===null||o===void 0?void 0:o.call(a))===null||l===void 0?void 0:l.latitudeField)}initData(){const e=this._series;if(!e)return;const t=e.getViewData();if(t){const i=new Ye(this._option.dataSet,{name:`${this.name}_data`});i.parse([t],{type:"dataview"}),i.transform({type:"copyDataView",level:An.copyDataView},!1),this._data=new wr(this._option,i),i.target.addListener("change",()=>{this._spec.trigger!=="hover"&&this._spec.trigger!=="click"&&(this._activeDatum=this._data.getLatestData())})}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},t=>(this.handleZoom(t),!0)),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},t=>(this.handlePan(t),!0));const e=this._spec.trigger;e!=="none"&&(e==="hover"?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},t=>{this._updateDatum(t.value)}),this.event.on("unhovered",()=>{this._updateDatum([])})):e==="click"&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},t=>{this._updateDatum(t.value)}),this.event.on("unselected",()=>{this._updateDatum([])})))}handlePan(e){const{delta:t}=e;this._markerComponents.forEach(i=>{i.translate(t[0],t[1])})}handleZoom(e){this._updateMarkerLayoutAttribute()}_updateDatum(e){this._activeDatum=e,this._markerComponents.forEach((t,i)=>{var s;const r=(s=this._data)===null||s===void 0?void 0:s.getLatestData()[i];this._activeDatum.includes(r)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)})}dataToPosition(e){return this._series.dataToPosition(e)}updateLayoutAttribute(){var e;const t=(e=this._data)===null||e===void 0?void 0:e.getLatestData();t&&t.length!==0&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var e;const t=[],i=[];this._markerComponents||(this._markerComponents=(e=this._data)===null||e===void 0?void 0:e.getLatestData().map((r,a)=>{var o;const l=new y0({position:void 0});return l&&(l.name=`${this.name}_marker_${a}`,l.id=(o=this._spec.id)!==null&&o!==void 0?o:`${this.name}_marker_${this.id}`,l.setAttribute("zIndex",this.layoutZIndex)),l})),this._markerComponents.forEach((r,a)=>{r.removeAllChild();const{pairInfo:o,contentMarks:l}=this._evaluateMarker(this._data.getLatestData()[a],a);o&&t.push(o),l&&i.push(l)});const s=this._layoutLabels(t);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(e,t){var i,s,r,a,o,l,h,d,u,c,f,p;let g=0,_=0,m=0,y=0,b=0;const v=this._spec.position||"top",x=this._spec.offset,S=vr((i=this._spec.background)===null||i===void 0?void 0:i.padding),A=this._spec.space||0;_+=((S==null?void 0:S.left)||0)+((S==null?void 0:S.right)||0),m+=((S==null?void 0:S.top)||0)+((S==null?void 0:S.bottom)||0);const k={},w=this.dataToPosition(e),M=Fx({});if(M.name=`${this.name}_marker_itemContainer_${t}`,k.container=M,(s=this._spec.background)===null||s===void 0?void 0:s.visible){const R=eh(ve(Object.assign({},this._spec.background.style)));R.setAttributes(w),k.labelBackground=R,M.appendChild(R)}if(!((r=this._spec.icon)===null||r===void 0)&&r.visible){const R=M_(ve(Object.assign({},this._spec.icon.style)));R.setAttributes(w),R.setAttribute("symbolType",(a=this._spec.icon.style)===null||a===void 0?void 0:a.shape);const L=R.AABBBounds,I=(o=(L==null?void 0:L.y2)-(L==null?void 0:L.y1))!==null&&o!==void 0?o:0,F=(l=(L==null?void 0:L.x2)-(L==null?void 0:L.x1))!==null&&l!==void 0?l:0;k.icon=R,M.appendChild(R),b=I,y+=F,g++}if(!((h=this._spec.nameLabel)===null||h===void 0)&&h.visible){const R=no(ve(Object.assign({},this._spec.nameLabel.style)));R.setAttributes(w),R.setAttribute("text",e[this.nameField]);const L=R.AABBBounds,I=(d=(L==null?void 0:L.y2)-(L==null?void 0:L.y1))!==null&&d!==void 0?d:0,F=(u=(L==null?void 0:L.x2)-(L==null?void 0:L.x1))!==null&&u!==void 0?u:0;k.nameLabel=R,M.appendChild(R),b=Math.max(b,I),y+=F,g++}if(!((c=this._spec.valueLabel)===null||c===void 0)&&c.visible&&P(e[this.valueField])){const R=no(ve(Object.assign({},this._spec.valueLabel.style)));R.setAttributes(w),R.setAttribute("text",e[this.valueField]);const L=R.AABBBounds,I=(f=(L==null?void 0:L.y2)-(L==null?void 0:L.y1))!==null&&f!==void 0?f:0,F=(p=(L==null?void 0:L.x2)-(L==null?void 0:L.x1))!==null&&p!==void 0?p:0;k.valueLabel=R,M.appendChild(R),b=Math.max(b,I),y+=F,g++}const T=Object.values(k).find(R=>!!R&&R.type!=="group"),E={x:T==null?void 0:T.getComputedAttribute("x"),y:T==null?void 0:T.getComputedAttribute("y")},O={x:E.x,y:E.y,width:0,height:0};O.width=_+y+(g-1)*A,O.height=m+b;const B={rect:O,point:E,index:t};if(v!=="outer"){const R=["top","right","left","bottom"].filter(L=>L!==v);B.rect=bS(O,v,x),B.anchors=R,B.offset=x}else B.pointCoord={x:+(e==null?void 0:e[this._longitudeField]),y:+(e==null?void 0:e[this._latitudeField])};return{pairInfo:B,contentMarks:k}}_layoutMarkers(e,t){var i,s,r;for(let a=0;a<t.length;a++){if(!e[a]||!t[a])return;const{icon:o,nameLabel:l,valueLabel:h,labelBackground:d,container:u}=t[a],c=e[a],f=vr((i=this._spec.background)===null||i===void 0?void 0:i.padding),p=this._spec.space||0,g=c.height/2;let _=(f==null?void 0:f.left)||0;[o,l,h].forEach((x,S)=>{var A,k;if(x){const w=x.AABBBounds;let M=0;x.type==="symbol"&&(M+=((A=w.x2-w.x1)!==null&&A!==void 0?A:0)/2),x.setAttributes({x:_+M,y:g}),_+=(k=w.x2-w.x1)!==null&&k!==void 0?k:0,S!==2&&(_+=p)}}),d==null||d.setAttributes({x:0,y:0,width:c.width,height:c.height}),u==null||u.setAttributes({dx:-c.width/2,dy:-c.height/2});const m=this._data.getLatestData()[a],y=this.dataToPosition(m),b=this.getRegions()[0].getLayoutStartPoint(),v=!(!(!((s=this._spec.leader)===null||s===void 0)&&s.visible)||!(o||l||h));this._markerComponents[a].setAttributes({x:b.x,y:b.y,position:y,visible:this._activeDatum.includes(m),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>u,autoRotate:!1,offsetX:c.x+c.width/2-y.x,offsetY:c.y+c.height/2-y.y},itemLine:{visible:v,type:"type-po",lineStyle:ve(Object.assign({},(r=this._spec.leader)===null||r===void 0?void 0:r.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let e=0;e<this._markerComponents.length;e++)this.getContainer().add(this._markerComponents[e])}_layoutLabels(e){return this._spec.position==="outer"&&this._map?hne(e,this._map,t=>this._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]})):jI(e)}_isRelativeModel(e){var t,i,s;const r=(i=(t=this._series.getXAxisHelper())===null||t===void 0?void 0:t.getAxisId())!==null&&i!==void 0?i:(s=this._series.getCoordinateHelper())===null||s===void 0?void 0:s.getCoordinateId();return(e==null?void 0:e.id)===r}_isRelativeSeries(e){return(e==null?void 0:e.id)===this._series.id}onRender(e){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}Xg.type=X.mapLabel,Xg.specKey="mapLabel";const cne=()=>{D.registerComponent(Xg.type,Xg)};class ax{constructor(e,t){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(e),this._gridInfo=e,this._col=e.col,this._row=e.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=t==null?void 0:t.onError,this.initUserSetting()}standardizationSpec(e){var t,i,s;e.col=(t=e.col)!==null&&t!==void 0?t:1,e.row=(i=e.row)!==null&&i!==void 0?i:1,e.elements=(s=e.elements)!==null&&s!==void 0?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((e,t)=>{e||(this._colSize[t]={value:0,isUserSetting:!1,isLayoutSetting:!1})}),this._rowSize.forEach((e,t)=>{e||(this._rowSize[t]={value:0,isUserSetting:!1,isLayoutSetting:!1})})}setSizeFromUserSetting(e,t,i,s){e.forEach(r=>{r.index<0&&r.index>=i||(j(r.size)?t[r.index]={value:+r.size,isUserSetting:!0,isLayoutSetting:!1}:Y(r.size)&&(t[r.index]={value:r.size(s),isUserSetting:!0,isLayoutSetting:!1}))})}clearLayoutSize(){this._colSize.forEach(e=>{e.isLayoutSetting=!1,e.isUserSetting||(e.value=0)}),this._rowSize.forEach(e=>{e.isLayoutSetting=!1,e.isUserSetting||(e.value=0)})}getItemGridInfo(e){var t;const i=this._elementMap.get(e);if(i)return i;let s;return s=(t=this._gridInfo.elements)===null||t===void 0?void 0:t.find(r=>{var a;if("modelId"in r&&P(r.modelId)){if(P(e.model.userId)&&e.model.userId===r.modelId)return!0}else if("modelKey"in r&&P(r.modelKey)&&"modelIndex"in r&&P(r.modelIndex)&&((a=e.model.specKey)!==null&&a!==void 0?a:e.model.type)===r.modelKey&&e.model.getSpecIndex()===r.modelIndex)return!0;return!1}),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(e,s),s}getSizeFromGird(e,t){var i;const s=t==="col"?this._colSize:this._rowSize;let r=0;for(let a=e[t];a<e[t]+((i=e[`${t}Span`])!==null&&i!==void 0?i:1);a++)r+=s[a].value;return r}getSizeFromUser(e,t){var i,s;const r=t==="col"?this._colSize:this._rowSize;if(!(!((i=r[e[t]])===null||i===void 0)&&i.isUserSetting))return;let a=0;for(let o=e[t];o<e[t]+((s=e[`${t}Span`])!==null&&s!==void 0?s:1);o++){if(!r[o].isUserSetting)return;a+=r[o].value}return a}setItemLayoutSizeToGrid(e,t){if(Nh(e)){if(t.colSpan&&t.colSpan>1||this._colSize[t.col].isUserSetting)return;this._colSize[t.col].value=Math.max(this._colSize[t.col].value,e.getLayoutRect().width+e.layoutPaddingLeft+e.layoutPaddingRight),this._colSize[t.col].isLayoutSetting=!0}else{if(t.rowSpan&&t.rowSpan>1||this._rowSize[t.row].isUserSetting)return;this._rowSize[t.row].value=Math.max(this._rowSize[t.row].value,e.getLayoutRect().height+e.layoutPaddingTop+e.layoutPaddingBottom),this._rowSize[t.row].isLayoutSetting=!0}}layoutGrid(e){const t=e==="col"?this._colSize:this._rowSize;let i=e==="col"?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];t.forEach(r=>{r.isUserSetting||r.isLayoutSetting?i-=r.value:s.push(r)}),i<0&&console.warn(`layout content ${e} size bigger than chart`),s.forEach(r=>r.value=i/s.length)}getItemPosition(e){const t=this.getItemGridInfo(e),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let s=0;s<t.col;s++)i.x+=this._colSize[s].value;for(let s=0;s<t.row;s++)i.y+=this._rowSize[s].value;return i.x+=e.layoutPaddingLeft+e.layoutOffsetX,i.y+=e.layoutPaddingTop+e.layoutOffsetY,i}getItemLayoutRect(e){var t,i;const s=this.getItemGridInfo(e);return{width:((t=this.getSizeFromGird(s,"col"))!==null&&t!==void 0?t:this._chartLayoutRect.width)-e.layoutPaddingLeft-e.layoutPaddingRight,height:((i=this.getSizeFromGird(s,"row"))!==null&&i!==void 0?i:this._chartLayoutRect.height)-e.layoutPaddingTop-e.layoutPaddingBottom}}layoutItems(e,t,i,s){this._chartLayoutRect=i,this._chartViewBox=s,this.clearLayoutSize(),t.sort((u,c)=>c.layoutLevel-u.layoutLevel);const r=t.filter(u=>u.layoutType==="normal"&&u.getModelVisible()!==!1),a=r.filter(u=>Nh(u)),o=r.filter(u=>!Nh(u));r.forEach(u=>{this.layoutOneItem(u,"user",!1)});const l=t.filter(u=>u.layoutType==="region-relative"),h=l.filter(u=>Nh(u)),d=l.filter(u=>!Nh(u));h.forEach(u=>this.layoutOneItem(u,"user",!1)),this.layoutGrid("col"),o.forEach(u=>this.layoutOneItem(u,"colGrid",!1)),d.forEach(u=>{this.layoutOneItem(u,"colGrid",!1)}),this.layoutGrid("row"),d.forEach(u=>{this.layoutOneItem(u,"grid",!1)}),a.forEach(u=>this.layoutOneItem(u,"grid",!1)),h.forEach(u=>{this.layoutOneItem(u,"grid",!0)}),this.layoutGrid("col"),t.filter(u=>u.layoutType==="region").forEach(u=>this.layoutOneItem(u,"grid",!1)),this.layoutAbsoluteItems(t.filter(u=>u.layoutType==="absolute")),t.filter(u=>u.layoutType!=="absolute").forEach(u=>{u.setLayoutStartPosition(this.getItemPosition(u))})}layoutAbsoluteItems(e){e.forEach(t=>{t.absoluteLayoutInRect(this._chartLayoutRect)})}layoutOneItem(e,t,i){var s,r;const a=t==="rowGrid"||t==="grid"?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),o=t==="colGrid"||t==="grid"?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),l=this.getItemGridInfo(e),h={width:((s=o(l,"col"))!==null&&s!==void 0?s:this._chartLayoutRect.width)-e.layoutPaddingLeft-e.layoutPaddingRight,height:((r=a(l,"row"))!==null&&r!==void 0?r:this._chartLayoutRect.height)-e.layoutPaddingTop-e.layoutPaddingBottom},d=e.computeBoundsInRect(h);j(d.width)||(d.width=h.width),j(d.height)||(d.height=h.height),e.setLayoutRect(t!=="grid"?d:h),this.setItemLayoutSizeToGrid(e,l)}}function Nh(n){return n.layoutOrient==="left"||n.layoutOrient==="right"}ax.type="grid";const fne=()=>{D.registerLayout(ax.type,ax)};class ox extends z0{layoutItems(e,t,i,s){this._layoutInit(e,t,i,s),this._layoutNormalItems(t);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},a=t.filter(m=>m.layoutType==="absolute"),o=a.filter(m=>m.layoutOrient==="z");let l={width:0,height:0};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:d,relativeOverlapItems:u,allRelatives:c,overlapItems:f}=this._groupItems(t);this.layoutRegionItems(h,d,u,f),this._processAutoIndent(h,d,u,f,c,r);const p=a.filter(m=>m.layoutOrient!=="z");this.layoutAbsoluteItems(p);const g=d.filter(m=>m.model.specKey==="axes"&&At(m.layoutOrient))[0],_=d.filter(m=>m.model.specKey==="axes"&&or(m.layoutOrient))[0];if(g&&o.length){const m=g.getLayoutStartPoint(),y=g.getLayoutRect(),b={x:_.layoutOrient==="left"?m.x+y.width:m.x,y:m.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};o[0].model.directionStr=_.layoutOrient==="left"?"r2l":"l2r";const v=g.getLayoutRect(),x=_.getLayoutRect(),S={length:o[0].getLayoutRect().width,width:v.width,height:x.height};g.model.setLayout3dBox&&g.model.setLayout3dBox(S),_.model.setLayout3dBox&&_.model.setLayout3dBox(S),o[0].model.setLayout3dBox&&o[0].model.setLayout3dBox(S),this.layoutZAxisItems(o,b)}}layoutZAxisItems(e,t){e.forEach(i=>{i.absoluteLayoutInRect(t)})}getItemComputeLayoutRect(e,t){return t||(t={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),{width:this.rightCurrent-this.leftCurrent-e.layoutPaddingLeft-e.layoutPaddingRight-(t.offsetLeft+t.offsetRight),height:this.bottomCurrent-this.topCurrent-e.layoutPaddingTop-e.layoutPaddingBottom-(t.offsetTop+t.offsetBottom)}}_checkAutoIndent(e){const t={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 e.forEach(r=>{if(!r.getModelVisible()||!r.autoIndent)return;const a=r.layoutOrient==="left"||r.layoutOrient==="right",o=r.getLastComputeOutBounds();a?(t.top=Math.max(t.top,o.y1-this.topCurrent),t.bottom=Math.max(t.bottom,o.y2-s)):(t.left=Math.max(t.left,o.x1-this.leftCurrent),t.right=Math.max(t.right,o.x2-i))}),t}}ox.type="layout3d";const pne=()=>{D.registerLayout(ox.type,ox)},gne=()=>{w4()};Un.useRegisters([ZK,rq,dq,bq,Dee,zee,jee,Vee,Iee,$ee,Yee,Xee,Zee,rte,ate,Uee,Qee,ete,lte,ite,nte,ste,ote,hte,Wee,dte,Hee,uq,Fee,Nee,Jee,tte,Kee,qee,bte,vte,xte,Ste,Ate,wte,kte,Ete,zte,yie,xie,Sie,Aie,kie,Mie,gL,nne,Hie,Wie,Gie,$ie,ene,ine,sne,ane,cne,gne,fne,pne]);var _ne=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(n);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(n,i[s])&&(t[i[s]]=n[i[s]])}return t};function mne(n,e="ChartContainer",t){const i=Ki.forwardRef((s,r)=>{const a=ss.useRef(),[o,l]=ss.useState(!1),{className:h,style:d,width:u}=s,c=_ne(s,["className","style","width"]);return ss.useLayoutEffect(()=>{l(!0)},[]),Ki.createElement("div",{ref:a,className:h,style:Object.assign({position:"relative",height:s.height||"100%",width:s.width||"100%"},d)},o?Ki.createElement(n,Object.assign({ref:r,container:a.current},t(c))):Ki.createElement(Ki.Fragment,null))});return i.displayName=e||n.name,i}const GI=Ki.createContext(null);GI.displayName="ChartContext";const WI=Ki.createContext(null);WI.displayName="ViewContext";const VI=n=>{let e=[];return Ki.Children.forEach(n,t=>{C(t)||($I.isFragment(t)?e=e.concat(VI(t.props.children)):e.push(t))}),e},yne=["children","hooks","ref"],Du={onPointerDown:"pointerdown",onPointerUp:"pointerup",onPointerUpOutside:"pointerupoutside",onPointerTap:"pointertap",onPointerOver:"pointerover",onPointerMove:"pointermove",onPointerEnter:"pointerenter",onPointerLeave:"pointerleave",onPointerOut:"pointerout",onMouseDown:"mousedown",onMouseUp:"mouseup",onMouseUpOutside:"mouseupoutside",onMouseMove:"mousemove",onMouseOver:"mouseover",onMouseOut:"mouseout",onMouseEnter:"mouseenter",onMouseLeave:"mouseleave",onPinch:"pinch",onPinchStart:"pinchstart",onPinchEnd:"pinchend",onPan:"pan",onPanStart:"panstart",onPanEnd:"panend",onDrag:"drag",onDragStart:"dragstart",onDragEnter:"dragenter",onDragLeave:"dragleave",onDragOver:"dragover",onDragEnd:"dragend",onRightDown:"rightdown",onRightUp:"rightup",onRightUpOutside:"rightupoutside",onTouchStart:"touchstart",onTouchEnd:"touchend",onTouchEndOutside:"touchendoutside",onTouchMove:"touchmove",onTouchCancel:"touchcancel",onPress:"press",onPressUp:"pressup",onPressEnd:"pressend",onSwipe:"swipe",onDrop:"drop",onWeel:"wheel",onClick:"click",onDblClick:"dblclick"},bne={onLegendItemHover:"legendItemHover",onLegendItemUnHover:"legendItemUnHover",onLegendItemClick:"legendItemClick",onLegendFilter:"legendFilter",onLegendSelectedDataChange:"legendSelectedDataChange"},vne={onBrushStart:"brushStart",onBrushChange:"brushChange",onBrushEnd:"brushEnd",onBrushClear:"brushClear"},xne={onDataZoomChange:"dataZoomChange"},Sne={onPlayerPlay:"playerPlay",onPlayerPause:"playerPause",onPlayerEnd:"playerEnd",onPlayerChange:"playerChange",onPlayerForward:"playerForward",onPlayerBackward:"playerBackward"},Ane={onScrollBarChange:"scrollBarChange"},kne={onDimensionHover:"dimensionHover",onDimensionClick:"dimensionClick"},wne={onDrill:"drill"},Mne={onInitialized:"initialized",onRendered:"rendered",onRenderFinished:"renderFinished",onAnimationFinished:"animationFinished",onLayoutStart:"layoutStart",onLayoutEnd:"layoutEnd"},lx=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},bne),vne),Sne),xne),Ane),kne),Mne),wne),Du),Tne=Object.keys(lx);Object.keys(Du).reduce((n,e)=>(n[Du[e]]=e,n),{});const oC=(n,e=Du)=>{const t={};return Object.keys(n).forEach(i=>{e[i]&&(t[i]=n[i])}),t},lC=(n,e,t,i=Du)=>{if(!e&&!t||!n)return!1;const s=t?oC(t,i):null,r=e?oC(e,i):null;return s&&Object.keys(s).forEach(a=>{(!r||!r[a]||r[a]!==s[a])&&n.off(i[a],t[a])}),r&&Object.keys(r).forEach(a=>{s&&s[a]&&s[a]===r[a]||n.on(i[a],r[a])}),!0},hC=[...yne,...Tne,"skipFunctionDiff","onError","onReady","spec","container","options"],Cne=Ki.forwardRef((n,e)=>{const[t,i]=ss.useState(0),s=ss.useRef({specFromChildren:{}});ss.useImperativeHandle(e,()=>{var g;return(g=s.current)===null||g===void 0?void 0:g.chart});const r=!!n.spec,[a,o]=ss.useState(null),l=ss.useRef(!1),h=ss.useRef(Nl(n,hC)),d=Ki.useRef(null),u=!!n.skipFunctionDiff,c=!!n.useSyncRender,f=g=>{var _;return r&&g.spec?g.spec:Object.assign(Object.assign({},h.current),(_=s.current)===null||_===void 0?void 0:_.specFromChildren)},p=()=>{if(!l.current){if(!s.current||!s.current.chart)return;lC(s.current.chart,n,d.current,lx);const g=s.current.chart.getCompiler().getVGrammarView();i(t+1),n.onReady&&n.onReady(s.current.chart,t===0),o(g)}};return ss.useEffect(()=>{var g;if(!(!((g=s.current)===null||g===void 0)&&g.chart))return(m=>{const y=new m.vchartConstrouctor(f(m),Object.assign(Object.assign({},m.options),{onError:m.onError,autoFit:!0,dom:m.container}));s.current=Object.assign(Object.assign({},s.current),{chart:y})})(n),s.current.chart&&(c?(s.current.chart.renderSync(),p()):s.current.chart.renderAsync().then(p)),lC(s.current.chart,n,null,lx),s.current=Object.assign(Object.assign({},s.current),{isChildrenUpdated:!1}),void(d.current=n);if(r)return void(ft(d.current.spec,n.spec,{skipFunction:u})||(d.current=n,c?(s.current.chart.updateSpecSync(f(n),void 0,{morph:!1,enableExitAnimation:!1}),p()):s.current.chart.updateSpec(f(n),void 0,{morph:!1,enableExitAnimation:!1}).then(p)));const _=Nl(n,hC);ft(_,h.current,{skipFunction:u})&&!s.current.isChildrenUpdated||(h.current=_,c?(s.current.chart.updateSpecSync(f(n),void 0,{morph:!1,enableExitAnimation:!1}),p()):s.current.chart.updateSpec(f(n),void 0,{morph:!1,enableExitAnimation:!1}).then(p)),s.current=Object.assign(Object.assign({},s.current),{isChildrenUpdated:!1})},[n]),ss.useEffect(()=>()=>{s&&(s.current.chart&&s.current.chart.release(),s.current=null),l.current=!0},[]),Ki.createElement(GI.Provider,{value:s.current},Ki.createElement(WI.Provider,{value:a},VI(n.children).map((g,_)=>{var m,y,b;return Ki.createElement(Ki.Fragment,{key:(b=(y=(m=g==null?void 0:g.props)===null||m===void 0?void 0:m.id)!==null&&y!==void 0?y:g==null?void 0:g.id)!==null&&b!==void 0?b:`child-${_}`},Ki.cloneElement(g,{updateId:t}))})))}),Pne=(n,e,t)=>{const i=mne(Cne,n,s=>Object.assign(s,e));return i.displayName=n,i},jne=Pne("VChart",{vchartConstrouctor:Un});export{Un as V,jne as a,Yv as l};